[vlc-devel] commit: Added nsv stream record mode support. (Laurent Aimar )
git version control
git at videolan.org
Wed Aug 27 00:21:02 CEST 2008
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Aug 26 14:11:52 2008 +0200| [37a5e7dbe5af4a4af03309a2834182e212a8ef15] | committer: Laurent Aimar
Added nsv stream record mode support.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=37a5e7dbe5af4a4af03309a2834182e212a8ef15
---
modules/demux/nsv.c | 32 ++++++++++++++++++++++++++------
1 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/modules/demux/nsv.c b/modules/demux/nsv.c
index 19f1120..c50579f 100644
--- a/modules/demux/nsv.c
+++ b/modules/demux/nsv.c
@@ -72,6 +72,8 @@ struct demux_sys_t
int64_t i_pcr;
int64_t i_time;
int64_t i_pcr_inc;
+
+ bool b_start_record;
};
static int Demux ( demux_t *p_demux );
@@ -120,6 +122,8 @@ static int Open( vlc_object_t *p_this )
p_sys->i_time = 0;
p_sys->i_pcr_inc = 0;
+ p_sys->b_start_record = false;
+
return VLC_SUCCESS;
}
@@ -159,16 +163,19 @@ static int Demux( demux_t *p_demux )
if( !memcmp( p_peek, "NSVf", 4 ) )
{
if( ReadNSVf( p_demux ) )
- {
return -1;
- }
}
else if( !memcmp( p_peek, "NSVs", 4 ) )
{
- if( ReadNSVs( p_demux ) )
+ if( p_sys->b_start_record )
{
- return -1;
+ /* Enable recording once synchronized */
+ stream_Control( p_demux->s, STREAM_SET_RECORD_STATE, true, "nsv" );
+ p_sys->b_start_record = false;
}
+
+ if( ReadNSVs( p_demux ) )
+ return -1;
break;
}
else if( GetWLE( p_peek ) == 0xbeef )
@@ -185,9 +192,7 @@ static int Demux( demux_t *p_demux )
{
msg_Err( p_demux, "invalid signature 0x%x (%4.4s)", GetDWLE( p_peek ), (const char*)p_peek );
if( ReSynch( p_demux ) )
- {
return -1;
- }
}
}
@@ -316,6 +321,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
{
demux_sys_t *p_sys = p_demux->p_sys;
double f, *pf;
+ bool b_bool, *pb_bool;
int64_t i64, *pi64;
switch( i_query )
@@ -372,6 +378,20 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
*pf = (double)1000000.0 / (double)p_sys->i_pcr_inc;
return VLC_SUCCESS;
+ case DEMUX_CAN_RECORD:
+ pb_bool = (bool*)va_arg( args, bool * );
+ *pb_bool = true;
+ return VLC_SUCCESS;
+
+ case DEMUX_SET_RECORD_STATE:
+ b_bool = (bool)va_arg( args, int );
+
+ if( !b_bool )
+ stream_Control( p_demux->s, STREAM_SET_RECORD_STATE, false );
+ p_sys->b_start_record = b_bool;
+ return VLC_SUCCESS;
+
+
case DEMUX_SET_TIME:
default:
return VLC_EGENERIC;
More information about the vlc-devel
mailing list