[FFmpeg-devel] [PATCH 2/2] avformat/flvdec: re enable flv_data_packet() and use AVMEDIA_TYPE_SUBTITLE
Michael Niedermayer
michaelni at gmx.at
Wed Jan 21 00:10:12 CET 2015
Found-by: kurosu
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
libavformat/flvdec.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 572268f..f98cb97 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -482,7 +482,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream,
0 <= (int)(num_val * 1024.0))
acodec->bit_rate = num_val * 1024.0;
else if (!strcmp(key, "datastream")) {
- AVStream *st = create_stream(s, AVMEDIA_TYPE_DATA);
+ AVStream *st = create_stream(s, AVMEDIA_TYPE_SUBTITLE);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_id = AV_CODEC_ID_TEXT;
@@ -749,12 +749,12 @@ static int flv_data_packet(AVFormatContext *s, AVPacket *pkt,
for (i = 0; i < s->nb_streams; i++) {
st = s->streams[i];
- if (st->codec->codec_type == AVMEDIA_TYPE_DATA)
+ if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE)
break;
}
if (i == s->nb_streams) {
- st = create_stream(s, AVMEDIA_TYPE_DATA);
+ st = create_stream(s, AVMEDIA_TYPE_SUBTITLE);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_id = AV_CODEC_ID_TEXT;
@@ -830,11 +830,14 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
goto skip;
} else if (type == FLV_TAG_TYPE_META) {
stream_type=FLV_STREAM_TYPE_DATA;
- if (size > 13 + 1 + 4 && dts == 0) { // Header-type metadata stuff
+ if (size > 13 + 1 + 4) { // Header-type metadata stuff
+ int type;
meta_pos = avio_tell(s->pb);
- if (flv_read_metabody(s, next) <= 0) {
+ type = flv_read_metabody(s, next);
+ if (type == 0 && dts == 0 || type < 0) {
goto skip;
- }
+ } else if (type == TYPE_ONTEXTDATA)
+ return flv_data_packet(s, pkt, dts, next);
avio_seek(s->pb, meta_pos, SEEK_SET);
}
} else {
--
1.7.9.5
More information about the ffmpeg-devel
mailing list