History

Merge commit 'a0fa6d06b848f26b16ba12f0a9a4a85b93ab8022'

* commit 'a0fa6d06b848f26b16ba12f0a9a4a85b93ab8022': matroska: Warn when metadata references a non-existent element

Hendrik Leppkes committed 10 years ago

Commit 0ecec742 parents 255f896 a0fa6d01 file · +37 −6Browse files

Unified · Split

libavformat/matroskadec.c+37−6
@@ -1405,24 +1405,55 @@ static void matroska_convert_tags(AVFormatContext *s) · 1404 unmodified lines
14051405 for (i = 0; i < matroska->tags.nb_elem; i++) {
14061406 if (tags[i].target.attachuid) {
14071407 MatroskaAttachment *attachment = matroska->attachments.elem;
1408− for (j = 0; j < matroska->attachments.nb_elem; j++)
1408+ int found = 0;
1409+ for (j = 0; j < matroska->attachments.nb_elem; j++) {
14091410 if (attachment[j].uid == tags[i].target.attachuid &&
1410− attachment[j].stream)
1411+ attachment[j].stream) {
14111412 matroska_convert_tag(s, &tags[i].tag,
14121413 &attachment[j].stream->metadata, NULL);
1414+ found = 1;
1415+ }
1416+ }
1417+ if (!found) {
1418+ av_log(NULL, AV_LOG_WARNING,
1419+ "The tags at index %d refer to a "
1420+ "non-existent attachment %"PRId64".\n",
1421+ i, tags[i].target.attachuid);
1422+ }
14131423 } else if (tags[i].target.chapteruid) {
14141424 MatroskaChapter *chapter = matroska->chapters.elem;
1415− for (j = 0; j < matroska->chapters.nb_elem; j++)
1425+ int found = 0;
1426+ for (j = 0; j < matroska->chapters.nb_elem; j++) {
14161427 if (chapter[j].uid == tags[i].target.chapteruid &&
1417− chapter[j].chapter)
1428+ chapter[j].chapter) {
14181429 matroska_convert_tag(s, &tags[i].tag,
14191430 &chapter[j].chapter->metadata, NULL);
1431+ found = 1;
1432+ }
1433+ }
1434+ if (!found) {
1435+ av_log(NULL, AV_LOG_WARNING,
1436+ "The tags at index %d refer to a non-existent chapter "
1437+ "%"PRId64".\n",
1438+ i, tags[i].target.chapteruid);
1439+ }
14201440 } else if (tags[i].target.trackuid) {
14211441 MatroskaTrack *track = matroska->tracks.elem;
1422− for (j = 0; j < matroska->tracks.nb_elem; j++)
1423− if (track[j].uid == tags[i].target.trackuid && track[j].stream)
1442+ int found = 0;
1443+ for (j = 0; j < matroska->tracks.nb_elem; j++) {
1444+ if (track[j].uid == tags[i].target.trackuid &&
1445+ track[j].stream) {
14241446 matroska_convert_tag(s, &tags[i].tag,
14251447 &track[j].stream->metadata, NULL);
1448+ found = 1;
1449+ }
1450+ }
1451+ if (!found) {
1452+ av_log(NULL, AV_LOG_WARNING,
1453+ "The tags at index %d refer to a non-existent track "
1454+ "%"PRId64".\n",
1455+ i, tags[i].target.trackuid);
1456+ }
14261457 } else {
14271458 matroska_convert_tag(s, &tags[i].tag, &s->metadata,
14281459 tags[i].target.type);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t