[FFmpeg-devel] [PATCH] avformat/flvdec: add flv_full_metadata option into flvdec

Steven Liu lq at chinaffmpeg.org
Thu May 31 07:41:10 EEST 2018


output all the metadata context when use this option.

Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
 doc/demuxers.texi    | 3 +++
 libavformat/flvdec.c | 6 ++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 5007e6339f..aad94eb50e 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -272,6 +272,9 @@ Allocate the streams according to the onMetaData array content.
 
 @item -flv_ignore_prevtag @var{bool}
 Ignore the size of previous tag value.
+
+ at item -flv_full_metadata @var{bool}
+Output all context of the onMetadata.
 @end table
 
 @section gif
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index f65542711e..52280c2e3d 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -45,6 +45,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 dump_full_metadata;   ///< Dump full metadata of the onMetadata
     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];
@@ -612,7 +613,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream,
             (!vpar && !strcmp(key, "videocodecid"))))
                 s->ctx_flags &= ~AVFMTCTX_NOHEADER; //If there is either audio/video missing, codecid will be an empty object
 
-        if (!strcmp(key, "duration")        ||
+        if ((!strcmp(key, "duration")        ||
             !strcmp(key, "filesize")        ||
             !strcmp(key, "width")           ||
             !strcmp(key, "height")          ||
@@ -624,7 +625,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream,
             !strcmp(key, "audiosamplesize") ||
             !strcmp(key, "stereo")          ||
             !strcmp(key, "audiocodecid")    ||
-            !strcmp(key, "datastream"))
+            !strcmp(key, "datastream")) && !flv->dump_full_metadata)
             return 0;
 
         s->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
@@ -1282,6 +1283,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_full_metadata", "Dump full metadata of the onMetadata", OFFSET(dump_full_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 }
-- 
2.15.1





More information about the ffmpeg-devel mailing list