[vlc-commits] commit: avformat: check if stream can seek before setting is_stream to avformat ( Ilkka Ollakka )

git at videolan.org git at videolan.org
Thu May 20 16:41:51 CEST 2010


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Thu May 20 17:40:55 2010 +0300| [8115853d91657ef9c09317b77d38788b5a8b602d] | committer: Ilkka Ollakka 

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

based on feedback from fenrir, looks nicer too.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8115853d91657ef9c09317b77d38788b5a8b602d
---

 modules/demux/avformat/demux.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 1c6f159..3b5454b 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -116,6 +116,7 @@ int OpenDemux( vlc_object_t *p_this )
     AVInputFormat *fmt;
     unsigned int  i;
     int64_t       i_start_time = -1;
+    bool          b_can_seek;
 
     /* Init Probe data */
     pd.filename = p_demux->psz_path;
@@ -199,12 +200,17 @@ int OpenDemux( vlc_object_t *p_this )
     p_sys->url.prot->next = 0;
     init_put_byte( &p_sys->io, p_sys->io_buffer, p_sys->io_buffer_size,
                    0, &p_sys->url, IORead, NULL, IOSeek );
-    /* Tell avformat that input is stream, so it doesn't get stuck
+
+    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
        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
        */
-    p_sys->url.is_streamed = 1;
-    p_sys->io.is_streamed = 1;
+       p_sys->url.is_streamed = 1;
+       p_sys->io.is_streamed = 1;
+    }
 
 
     /* Open it */



More information about the vlc-commits mailing list