aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Liu <lq@chinaffmpeg.org>2018-08-07 15:48:23 +0800
committerSteven Liu <lq@chinaffmpeg.org>2018-08-07 15:48:23 +0800
commitd37125fb910e466ab3e505afd0a687486f4e7c93 (patch)
treed967ecd9e4367ac1807bc8535533685a420e6782
parentd54ae9b782c85e626a1e49a8ee204728746227d1 (diff)
downloadffmpeg-d37125fb910e466ab3e505afd0a687486f4e7c93.tar.gz
avformat/flvdec: add flv_ignore_prevtag option into flvdec
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
-rw-r--r--doc/demuxers.texi3
-rw-r--r--libavformat/flvdec.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 072918be28..5007e6339f 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -269,6 +269,9 @@ ffmpeg -f live_flv -i rtmp://<any.server>/anything/key ....
@table @option
@item -flv_metadata @var{bool}
Allocate the streams according to the onMetaData array content.
+
+@item -flv_ignore_prevtag @var{bool}
+Ignore the size of previous tag value.
@end table
@section gif
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 975641757a..ff91008371 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -44,6 +44,7 @@
typedef struct FLVContext {
const AVClass *class; ///< Class for private options.
int trust_metadata; ///< configure streams according onMetaData
+ int trust_datasize; ///< trust data size of FLVTag
int wrong_dts; ///< wrong dts due to negative cts
uint8_t *new_extradata[FLV_STREAM_TYPE_NB];
int new_extradata_size[FLV_STREAM_TYPE_NB];
@@ -1250,6 +1251,7 @@ retry_duration:
leave:
last = avio_rb32(s->pb);
+ if (!flv->trust_datasize) {
if (last != orig_size + 11 && last != orig_size + 10 &&
!avio_feof(s->pb) &&
(last != orig_size || !last) && last != flv->sum_flv_tag_size &&
@@ -1262,6 +1264,7 @@ leave:
goto retry;
}
}
+ }
return ret;
}
@@ -1277,6 +1280,7 @@ static int flv_read_seek(AVFormatContext *s, int stream_index,
#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
{ "flv_metadata", "Allocate streams according to the onMetaData array", OFFSET(trust_metadata), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD },
+ { "flv_ignore_prevtag", "Ignore the Size of previous tag", OFFSET(trust_datasize), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD },
{ "missing_streams", "", OFFSET(missing_streams), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 0xFF, VD | AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY },
{ NULL }
};