Commit 37a5e7db authored by Laurent Aimar's avatar Laurent Aimar

Added nsv stream record mode support.

parent 5924aed6
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment