Commit 91a3e5cd authored by Ilkka Ollakka's avatar Ilkka Ollakka Committed by Ilkka Ollakka

avformat: check if stream can seek before setting is_stream to avformat

based on feedback from fenrir, looks nicer too.
(cherry picked from commit 8115853d)
Signed-off-by: default avatarIlkka Ollakka <ileoo@iki.fi>
parent 48935a8a
...@@ -116,6 +116,7 @@ int OpenDemux( vlc_object_t *p_this ) ...@@ -116,6 +116,7 @@ int OpenDemux( vlc_object_t *p_this )
AVInputFormat *fmt; AVInputFormat *fmt;
unsigned int i; unsigned int i;
int64_t i_start_time = -1; int64_t i_start_time = -1;
bool b_can_seek;
/* Init Probe data */ /* Init Probe data */
pd.filename = p_demux->psz_path; pd.filename = p_demux->psz_path;
...@@ -199,12 +200,17 @@ int OpenDemux( vlc_object_t *p_this ) ...@@ -199,12 +200,17 @@ int OpenDemux( vlc_object_t *p_this )
p_sys->url.prot->next = 0; p_sys->url.prot->next = 0;
init_put_byte( &p_sys->io, p_sys->io_buffer, p_sys->io_buffer_size, init_put_byte( &p_sys->io, p_sys->io_buffer, p_sys->io_buffer_size,
0, &p_sys->url, IORead, NULL, IOSeek ); 0, &p_sys->url, IORead, NULL, IOSeek );
stream_Control( p_demux->s, STREAM_CAN_SEEK, &b_can_seek );
if( !b_can_seek )
{
/* Tell avformat that input is stream, so it doesn't get stuck /* Tell avformat that input is stream, so it doesn't get stuck
when trying av_find_stream_info() trying to seek all the wrong places when trying av_find_stream_info() trying to seek all the wrong places
init_put_byte defaults io.is_streamed=0, so thats why we set them after it init_put_byte defaults io.is_streamed=0, so thats why we set them after it
*/ */
p_sys->url.is_streamed = 1; p_sys->url.is_streamed = 1;
p_sys->io.is_streamed = 1; p_sys->io.is_streamed = 1;
}
/* Open it */ /* Open it */
......
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