aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorAndrew Stone <andrew@clovar.com>2014-07-31 19:56:37 -0400
committerAnton Khirnov <anton@khirnov.net>2014-08-13 16:10:49 +0000
commit019d3fccc4dcf5c8379112f697ce9eb08edee9b9 (patch)
tree88fcfca58eb5508a5ca4c77aa4a8596d13db7548 /libavformat
parent7e38903b5c86a759549e70647ae42bb22d353b14 (diff)
downloadffmpeg-019d3fccc4dcf5c8379112f697ce9eb08edee9b9.tar.gz
Set protocol-level metadata in AVFormatContext any time a packet is read.
If any option named "metadata" is set inside the context, it is pulled up to the context and then the option is cleared. Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 698fcfec01..973ab94d6f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -892,6 +892,7 @@ static int read_from_packet_buffer(AVPacketList **pkt_buffer,
static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
{
int ret = 0, i, got_packet = 0;
+ AVDictionary *metadata = NULL;
av_init_packet(pkt);
@@ -967,6 +968,14 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
if (!got_packet && s->parse_queue)
ret = read_from_packet_buffer(&s->parse_queue, &s->parse_queue_end, pkt);
+ av_opt_get_dict_val(s, "metadata", AV_OPT_SEARCH_CHILDREN, &metadata);
+ if (metadata) {
+ s->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
+ av_dict_copy(&s->metadata, metadata, 0);
+ av_dict_free(&metadata);
+ av_opt_set_dict_val(s, "metadata", NULL, AV_OPT_SEARCH_CHILDREN);
+ }
+
if (s->debug & FF_FDEBUG_TS)
av_log(s, AV_LOG_DEBUG,
"read_frame_internal stream=%d, pts=%"PRId64", dts=%"PRId64", "