Merge commit 'fa14804c83a7108a50c63d1f2180e30c75909529'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 1 Aug 2014 19:34:31 +0000 (21:34 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 1 Aug 2014 19:34:31 +0000 (21:34 +0200)
* commit 'fa14804c83a7108a50c63d1f2180e30c75909529':
  flv: Index the audio stream

Conflicts:
libavformat/flvdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/flvdec.c

@@@ -853,19 -814,20 +853,24 @@@ skip
                      break;
              }
          }
 -        if (i == s->nb_streams)
 -            st = create_stream(s, is_audio ? AVMEDIA_TYPE_AUDIO
 -                                           : AVMEDIA_TYPE_VIDEO);
 -        av_dlog(s, "%d %X %d \n", is_audio, flags, st->discard);
 +        if (i == s->nb_streams) {
 +            static const enum AVMediaType stream_types[] = {AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO, AVMEDIA_TYPE_DATA};
 +            av_log(s, AV_LOG_WARNING, "Stream discovered after head already parsed\n");
 +            st = create_stream(s, stream_types[stream_type]);
 +            if (!st)
 +                return AVERROR(ENOMEM);
 +
 +        }
 +        av_dlog(s, "%d %X %d \n", stream_type, flags, st->discard);
+         if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY ||
 -            is_audio)
++            stream_type == FLV_STREAM_TYPE_AUDIO)
+             av_add_index_entry(st, pos, dts, size, 0, AVINDEX_KEYFRAME);
 -        if ((st->discard >= AVDISCARD_NONKEY &&
 -             !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || is_audio)) ||
 -            (st->discard >= AVDISCARD_BIDIR &&
 -             ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio)) ||
 -            st->discard >= AVDISCARD_ALL) {
 +        if (  (st->discard >= AVDISCARD_NONKEY && !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || (stream_type == FLV_STREAM_TYPE_AUDIO)))
 +            ||(st->discard >= AVDISCARD_BIDIR  &&  ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && (stream_type == FLV_STREAM_TYPE_VIDEO)))
 +            || st->discard >= AVDISCARD_ALL
 +        ) {
              avio_seek(s->pb, next, SEEK_SET);
              continue;
          }