Skip to content

Commit d62fd6e

Browse files
rbernonmstorsjo
authored andcommitted
avformat/mov: Store trak > udta metadata on each stream
Some files keep extra metadata such as 'name' fields within udta, and it is useful for Wine to access them with the "export_all" option so they can then be exposed to Windows applications. Signed-off-by: Rémi Bernon <[email protected]> Signed-off-by: Martin Storsjö <[email protected]>
1 parent 78ff378 commit d62fd6e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

libavformat/mov.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,12 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
354354
int (*parse)(MOVContext*, AVIOContext*, unsigned, const char*) = NULL;
355355
int raw = 0;
356356
int num = 0;
357+
AVDictionary **metadata;
358+
359+
if (c->trak_index >= 0 && c->trak_index < c->fc->nb_streams)
360+
metadata = &c->fc->streams[c->trak_index]->metadata;
361+
else
362+
metadata = &c->fc->metadata;
357363

358364
switch (atom.type) {
359365
case MKTAG( '@','P','R','M'): key = "premiere_version"; raw = 1; break;
@@ -572,10 +578,10 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
572578
str[str_size] = 0;
573579
}
574580
c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
575-
av_dict_set(&c->fc->metadata, key, str, 0);
581+
av_dict_set(metadata, key, str, 0);
576582
if (*language && strcmp(language, "und")) {
577583
snprintf(key2, sizeof(key2), "%s-%s", key, language);
578-
av_dict_set(&c->fc->metadata, key2, str, 0);
584+
av_dict_set(metadata, key2, str, 0);
579585
}
580586
if (!strcmp(key, "encoder")) {
581587
int major, minor, micro;

0 commit comments

Comments
 (0)