workaround for broken flvtoolized files
authorAlex Beregszaszi <alex@rtfs.hu>
Wed, 7 Mar 2007 01:52:08 +0000 (01:52 +0000)
committerAlex Beregszaszi <alex@rtfs.hu>
Wed, 7 Mar 2007 01:52:08 +0000 (01:52 +0000)
Originally committed as revision 8277 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/flvdec.c

index 6295f1a..bf91fbb 100644 (file)
@@ -230,6 +230,12 @@ static int flv_read_header(AVFormatContext *s,
 
     url_fskip(&s->pb, 4);
     flags = get_byte(&s->pb);
 
     url_fskip(&s->pb, 4);
     flags = get_byte(&s->pb);
+    /* old flvtool cleared this field */
+    /* FIXME: better fix needed */
+    if (!flags) {
+        flags = FLV_HEADER_FLAG_HASVIDEO | FLV_HEADER_FLAG_HASAUDIO;
+        av_log(s, AV_LOG_WARNING, "Broken FLV file, which says no streams present, this might fail\n");
+    }
 
     if(flags & FLV_HEADER_FLAG_HASVIDEO){
         st = av_new_stream(s, 0);
 
     if(flags & FLV_HEADER_FLAG_HASVIDEO){
         st = av_new_stream(s, 0);