diff mbox series

[FFmpeg-devel,v1] libavformat/mov: ffmpeg can't read mp4 track title metadata

Message ID 20211020023820.9772-1-xutopiaf@gmail.com
State New
Headers show
Series [FFmpeg-devel,v1] libavformat/mov: ffmpeg can't read mp4 track title metadata
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

xutopiaf@gmail.com Oct. 20, 2021, 2:38 a.m. UTC
From: xutopia <xutopiaf@gmail.com>

Signed-off-by: xutopia <xutopiaf@gmail.com>
---
 libavformat/mov.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 57c67e3aac..9673234734 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -521,7 +521,17 @@  retry:
             str[str_size] = 0;
         }
         c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
-        av_dict_set(&c->fc->metadata, key, str, 0);
+
+        if (c->trak_index >= 0) {
+            if (c->trak_index < c->fc->nb_streams) {
+                av_dict_set(&c->fc->streams[c->trak_index]->metadata, key, str, 0);
+            } else {
+                av_log(c->fc, AV_LOG_ERROR, "current trck idx=%d > streams=%d\n", c->trak_index, c->fc->nb_streams);
+            }
+        } else {
+            av_dict_set(&c->fc->metadata, key, str, 0);
+        }
+        
         if (*language && strcmp(language, "und")) {
             snprintf(key2, sizeof(key2), "%s-%s", key, language);
             av_dict_set(&c->fc->metadata, key2, str, 0);