diff options
author | James Almer <jamrial@gmail.com> | 2017-06-01 23:47:32 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2017-09-08 20:02:43 -0300 |
commit | 27b7800ba907ff4fbb8ecacc50e19a1386f1c643 (patch) | |
tree | c0ff024d904c44fabd4e4becb9c7939a8b3810e1 /libavformat/matroskaenc.c | |
parent | 260ea7a7b395891b12eeddbd9042e0a4d3c72db9 (diff) | |
download | ffmpeg-27b7800ba907ff4fbb8ecacc50e19a1386f1c643.tar.gz |
avformat/matroskaenc: also write tags when output is WebM
WebM supports a subset of elements from the Tags master.
See https://www.webmproject.org/docs/container/#tagging
Reviewed-by: Ivan Janatra <janatra@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r-- | libavformat/matroskaenc.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 9cc7be352e..17094f82b0 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1681,17 +1681,20 @@ static int mkv_write_tags(AVFormatContext *s) } } - for (i = 0; i < s->nb_chapters; i++) { - AVChapter *ch = s->chapters[i]; + if (mkv->mode != MODE_WEBM) { + for (i = 0; i < s->nb_chapters; i++) { + AVChapter *ch = s->chapters[i]; - if (!mkv_check_tag(ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID)) - continue; + 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, &mkv->tags); - if (ret < 0) return ret; + ret = mkv_write_tag(s, ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID, ch->id + mkv->chapter_id_offset, &mkv->tags); + if (ret < 0) + return ret; + } } - if (mkv->have_attachments) { + if (mkv->have_attachments && mkv->mode != MODE_WEBM) { for (i = 0; i < mkv->attachments->num_entries; i++) { mkv_attachment *attachment = &mkv->attachments->entries[i]; AVStream *st = s->streams[attachment->stream_idx]; @@ -1988,12 +1991,12 @@ static int mkv_write_header(AVFormatContext *s) ret = mkv_write_attachments(s); if (ret < 0) goto fail; - - ret = mkv_write_tags(s); - if (ret < 0) - goto fail; } + ret = mkv_write_tags(s); + if (ret < 0) + goto fail; + if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL) && !mkv->is_live) mkv_write_seekhead(pb, mkv); |