summaryrefslogtreecommitdiff
path: root/libavformat/matroskaenc.c
diff options
context:
space:
mode:
authorRodger Combs <rodger.combs@gmail.com>2016-09-05 22:26:16 -0500
committerRodger Combs <rodger.combs@gmail.com>2016-09-06 17:25:37 -0500
commit843e72ea5542845a0a9fed743517c14a92279885 (patch)
tree9521c3b4a6f29a828599b600878a6904cbd4bac4 /libavformat/matroskaenc.c
parent3829a02738c16cfc84f41fd4b55a34c03386a65b (diff)
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.
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r--libavformat/matroskaenc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 7deccaaa74..3eeb09bab2 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -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);