Commit 708fee3a authored by Francois Cartegnie's avatar Francois Cartegnie

demux: ts: don't try to seek on non seekable

parent 1ad96d63
...@@ -308,6 +308,7 @@ typedef struct ...@@ -308,6 +308,7 @@ typedef struct
struct demux_sys_t struct demux_sys_t
{ {
stream_t *stream; stream_t *stream;
bool b_canseek;
vlc_mutex_t csa_lock; vlc_mutex_t csa_lock;
/* TS packet size (188, 192, 204) */ /* TS packet size (188, 192, 204) */
...@@ -794,6 +795,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -794,6 +795,7 @@ static int Open( vlc_object_t *p_this )
p_sys->b_split_es = var_InheritBool( p_demux, "ts-split-es" ); p_sys->b_split_es = var_InheritBool( p_demux, "ts-split-es" );
p_sys->b_canseek = false;
p_sys->i_pid_ref_pcr = -1; p_sys->i_pid_ref_pcr = -1;
p_sys->i_first_pcr = -1; p_sys->i_first_pcr = -1;
p_sys->i_current_pcr = -1; p_sys->i_current_pcr = -1;
...@@ -811,18 +813,23 @@ static int Open( vlc_object_t *p_this ) ...@@ -811,18 +813,23 @@ static int Open( vlc_object_t *p_this )
return VLC_ENOMEM; return VLC_ENOMEM;
} }
bool can_seek = false; bool b_can_fastseek = false;
stream_Control( p_sys->stream, STREAM_CAN_FASTSEEK, &can_seek ); stream_Control( p_sys->stream, STREAM_CAN_SEEK, &p_sys->b_canseek );
if( can_seek ) stream_Control( p_sys->stream, STREAM_CAN_FASTSEEK, &b_can_fastseek );
if ( p_sys->b_canseek )
{ {
GetFirstPCR( p_demux ); if( b_can_fastseek )
CheckPCR( p_demux ); {
GetLastPCR( p_demux ); GetFirstPCR( p_demux );
} CheckPCR( p_demux );
if( p_sys->i_first_pcr < 0 || p_sys->i_last_pcr < 0 ) GetLastPCR( p_demux );
{ }
msg_Dbg( p_demux, "Force Seek Per Percent: PCR's not found,");
p_sys->b_force_seek_per_percent = true; if( p_sys->i_first_pcr < 0 || p_sys->i_last_pcr < 0 )
{
msg_Dbg( p_demux, "Force Seek Per Percent: PCR's not found,");
p_sys->b_force_seek_per_percent = true;
}
} }
while( p_sys->i_pmt_es <= 0 && vlc_object_alive( p_demux ) ) while( p_sys->i_pmt_es <= 0 && vlc_object_alive( p_demux ) )
...@@ -1088,6 +1095,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -1088,6 +1095,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_SET_POSITION: case DEMUX_SET_POSITION:
f = (double) va_arg( args, double ); f = (double) va_arg( args, double );
if(!p_sys->b_canseek)
return VLC_EGENERIC;
if( p_sys->b_force_seek_per_percent || if( p_sys->b_force_seek_per_percent ||
(p_sys->b_dvb_meta && p_sys->b_access_control) || (p_sys->b_dvb_meta && p_sys->b_access_control) ||
p_sys->i_last_pcr - p_sys->i_first_pcr <= 0 ) p_sys->i_last_pcr - p_sys->i_first_pcr <= 0 )
......
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