If any option named "metadata" is set inside the context, it is pulled up to
the context and then the option is cleared.
Rather than maintaining a list of metadata changes and presenting them to
an application, the application must poll the metadata it's interested in
by using av_dict_version(). Typically, since this data is only used for
display, there's no need to track what actually changes as updating displayed
metadata with identical information should be acceptable.
---
As promised, here is the patch, stripped to the core and only updating metadata
it sees
set as an option.
libavformat/utils.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index de66c6b..ccd5d66 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1027,6 +1027,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);
@@ -1102,6 +1103,13 @@ 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) {
+ 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", "
--
2.0.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel