Disable parsing for ogg streams where no ogg header was found,
authorReinhard Tartler <siretart@tauware.de>
Tue, 9 Feb 2010 18:24:30 +0000 (18:24 +0000)
committerReinhard Tartler <siretart@tauware.de>
Tue, 9 Feb 2010 18:24:30 +0000 (18:24 +0000)
if no header was found the parser was not initialized and thus will
crash when trying to use it.

Originally committed as revision 21708 to svn://svn.ffmpeg.org/ffmpeg/branches/0.5

libavformat/oggdec.c

index 28dc56e..54406f5 100644 (file)
@@ -477,12 +477,17 @@ static int
 ogg_read_header (AVFormatContext * s, AVFormatParameters * ap)
 {
     struct ogg *ogg = s->priv_data;
+    int i;
     ogg->curidx = -1;
     //linear headers seek from start
     if (ogg_get_headers (s) < 0){
         return -1;
     }
 
+    for (i = 0; i < ogg->nstreams; i++)
+        if (ogg->streams[i].header < 0)
+            ogg->streams[i].codec = NULL;
+
     //linear granulepos seek from end
     ogg_get_length (s);