]> git.sesse.net Git - ffmpeg/commitdiff
avformat/flvdec: add flv_full_metadata option into flvdec
authorSteven Liu <lq@chinaffmpeg.org>
Tue, 7 Aug 2018 07:51:36 +0000 (15:51 +0800)
committerSteven Liu <lq@chinaffmpeg.org>
Tue, 7 Aug 2018 07:51:36 +0000 (15:51 +0800)
output all the metadata context when use this option.

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
doc/demuxers.texi
libavformat/flvdec.c

index 5007e6339f14801463493dfe5812332be27b04ef..aad94eb50e6e3411448a536938486f8877e309dc 100644 (file)
@@ -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.
+
+@item -flv_full_metadata @var{bool}
+Output all context of the onMetadata.
 @end table
 
 @section gif
index ce3cac04ab54cb9b7b140d73a12b28d938ae9608..93c7f852379cc8c6f58c15b342431e0d80c54851 100644 (file)
@@ -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;
@@ -1280,6 +1281,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 }