diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-12-07 14:51:23 +0100 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-12-07 14:51:23 +0100 |
commit | 0ecec7449c580dfb8b9f6f53dff413cec38e4982 (patch) | |
tree | c6d818beaa76434f3fb7c1850eee8f59b1334c4b /libavformat | |
parent | 255f8966b2b5e8befcfba1908339734a3ef06a67 (diff) | |
parent | a0fa6d06b848f26b16ba12f0a9a4a85b93ab8022 (diff) | |
download | ffmpeg-0ecec7449c580dfb8b9f6f53dff413cec38e4982.tar.gz |
Merge commit 'a0fa6d06b848f26b16ba12f0a9a4a85b93ab8022'
* commit 'a0fa6d06b848f26b16ba12f0a9a4a85b93ab8022':
matroska: Warn when metadata references a non-existent element
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/matroskadec.c | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 749e9a974b..aad567ac6e 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1405,24 +1405,55 @@ static void matroska_convert_tags(AVFormatContext *s) for (i = 0; i < matroska->tags.nb_elem; i++) { if (tags[i].target.attachuid) { MatroskaAttachment *attachment = matroska->attachments.elem; - for (j = 0; j < matroska->attachments.nb_elem; j++) + int found = 0; + for (j = 0; j < matroska->attachments.nb_elem; j++) { if (attachment[j].uid == tags[i].target.attachuid && - attachment[j].stream) + attachment[j].stream) { matroska_convert_tag(s, &tags[i].tag, &attachment[j].stream->metadata, NULL); + found = 1; + } + } + if (!found) { + av_log(NULL, AV_LOG_WARNING, + "The tags at index %d refer to a " + "non-existent attachment %"PRId64".\n", + i, tags[i].target.attachuid); + } } else if (tags[i].target.chapteruid) { MatroskaChapter *chapter = matroska->chapters.elem; - for (j = 0; j < matroska->chapters.nb_elem; j++) + int found = 0; + for (j = 0; j < matroska->chapters.nb_elem; j++) { if (chapter[j].uid == tags[i].target.chapteruid && - chapter[j].chapter) + chapter[j].chapter) { matroska_convert_tag(s, &tags[i].tag, &chapter[j].chapter->metadata, NULL); + found = 1; + } + } + if (!found) { + av_log(NULL, AV_LOG_WARNING, + "The tags at index %d refer to a non-existent chapter " + "%"PRId64".\n", + i, tags[i].target.chapteruid); + } } else if (tags[i].target.trackuid) { MatroskaTrack *track = matroska->tracks.elem; - for (j = 0; j < matroska->tracks.nb_elem; j++) - if (track[j].uid == tags[i].target.trackuid && track[j].stream) + int found = 0; + for (j = 0; j < matroska->tracks.nb_elem; j++) { + if (track[j].uid == tags[i].target.trackuid && + track[j].stream) { matroska_convert_tag(s, &tags[i].tag, &track[j].stream->metadata, NULL); + found = 1; + } + } + if (!found) { + av_log(NULL, AV_LOG_WARNING, + "The tags at index %d refer to a non-existent track " + "%"PRId64".\n", + i, tags[i].target.trackuid); + } } else { matroska_convert_tag(s, &tags[i].tag, &s->metadata, tags[i].target.type); |