lavf/matroskaenc: use mkv_check_tag_name consistently

Previously, we used a different list of checks when deciding whether to
write a set of tags at all than we did when deciding whether to write an
individual tag in the set. This resulted in sometimes writing an empty
tag master and seekhead. Now we use mkv_check_tag_name everywhere, so
if a dictionary is entirely composed of tags we skip, we don't write a
tag master at all.

This affected the test file, since "language" was on one list but not
the other, so we were writing an empty tag master there. The test hash
is updated to reflect that change.
This commit is contained in:
Rodger Combs 2016-09-05 22:26:16 -05:00
parent 3829a02738
commit 843e72ea55
No known key found for this signature in database
GPG Key ID: E3E54DCDCD3CB843
2 changed files with 6 additions and 6 deletions

View File

@ -1342,12 +1342,12 @@ static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int eleme
return 0;
}
static int mkv_check_tag(AVDictionary *m)
static int mkv_check_tag(AVDictionary *m, unsigned int elementid)
{
AVDictionaryEntry *t = NULL;
while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX)))
if (av_strcasecmp(t->key, "title") && av_strcasecmp(t->key, "stereo_mode"))
if (mkv_check_tag_name(t->key, elementid))
return 1;
return 0;
@ -1361,7 +1361,7 @@ static int mkv_write_tags(AVFormatContext *s)
ff_metadata_conv_ctx(s, ff_mkv_metadata_conv, NULL);
if (mkv_check_tag(s->metadata)) {
if (mkv_check_tag(s->metadata, 0)) {
ret = mkv_write_tag(s, s->metadata, 0, 0, &tags);
if (ret < 0) return ret;
}
@ -1369,7 +1369,7 @@ static int mkv_write_tags(AVFormatContext *s)
for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
if (!mkv_check_tag(st->metadata))
if (!mkv_check_tag(st->metadata, MATROSKA_ID_TAGTARGETS_TRACKUID))
continue;
ret = mkv_write_tag(s, st->metadata, MATROSKA_ID_TAGTARGETS_TRACKUID, i + 1, &tags);
@ -1398,7 +1398,7 @@ static int mkv_write_tags(AVFormatContext *s)
for (i = 0; i < s->nb_chapters; i++) {
AVChapter *ch = s->chapters[i];
if (!mkv_check_tag(ch->metadata))
if (!mkv_check_tag(ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID))
continue;
ret = mkv_write_tag(s, ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID, ch->id + mkv->chapter_id_offset, &tags);

View File

@ -4,6 +4,6 @@
FATE_MATROSKA-$(call DEMMUX, MATROSKA, MATROSKA) += fate-matroska-remux
fate-matroska-remux: CMD = md5 -i $(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-2pass-akiyo.webm -color_trc 4 -c:v copy -fflags +bitexact -strict -2 -f matroska
fate-matroska-remux: CMP = oneline
fate-matroska-remux: REF = 5ebcfaa8e3d534f8a800a58fd2b0aca6
fate-matroska-remux: REF = f08b20b90f158a4de5a02a52c25596b9
FATE_SAMPLES_AVCONV += $(FATE_MATROSKA-yes)