And leverage the video index if the video is just disabled as wm4
did in an initial patch.
---
libavformat/flvdec.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 8e4cc5e..d74741d 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -57,6 +57,7 @@ typedef struct {
} validate_index[2];
int validate_next;
int validate_count;
+ int has_video;
} FLVContext;
static int flv_probe(AVProbeData *p)
@@ -76,11 +77,14 @@ static int flv_probe(AVProbeData *p)
static AVStream *create_stream(AVFormatContext *s, int codec_type)
{
+ FLVContext *flv = s->priv_data;
AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return NULL;
st->codec->codec_type = codec_type;
avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
+ if (codec_type == AVMEDIA_TYPE_VIDEO)
+ flv->has_video = 1;
return st;
}
@@ -818,6 +822,11 @@ skip:
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 ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY ||
+ !flv->has_video)
+ 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 &&
@@ -826,8 +835,6 @@ skip:
avio_seek(s->pb, next, SEEK_SET);
continue;
}
- if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY)
- av_add_index_entry(st, pos, dts, size, 0, AVINDEX_KEYFRAME);
break;
}
--
1.9.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel