From bd7dea3f4f185a32966d7542837030d843c8518d Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sat, 4 Apr 2020 15:35:48 +0200 Subject: avformat/matroskaenc: Don't waste bytes writing durations Tags in the Matroska file format can be summarized as follows: There is a level 1-element called Tags containing one or many Tag elements each of which in turn contain a Targets element and one or many SimpleTags. Each SimpleTag roughly corresponds to a single key-value pair similar to an AVDictionaryEntry. The Targets meanwhile contains information to what the metadata contained in the SimpleTags contained in the containing Tag applies (i.e. to the file as a whole or to an individual track). The Matroska muxer writes such metadata. It puts the metadata of every stream into a Tag whose Targets makes it point to the corresponding track. And if the output is seekable, then it also adds another Tag for each track whose Targets corresponds to the track and where it reserves space in a SimpleTag to write the duration at the end of the muxing process into. Yet there is no reason to write two Tag elements for a track and a few bytes (typically 24 bytes per track) can be saved by adding the duration SimpleTag to the other Tag of the same track (if it exists). FATE has been updated because the output files changed. (Tests that write to unseekable output (pipes) needn't be updated (no duration tag has ever been written for them) and the same applies to tests without further metadata.) Signed-off-by: Andreas Rheinhardt --- tests/ref/fate/matroska-flac-extradata-update | 4 ++-- tests/ref/fate/rgb24-mkv | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/ref/fate') diff --git a/tests/ref/fate/matroska-flac-extradata-update b/tests/ref/fate/matroska-flac-extradata-update index 743486c974..f274e1a75d 100644 --- a/tests/ref/fate/matroska-flac-extradata-update +++ b/tests/ref/fate/matroska-flac-extradata-update @@ -1,5 +1,5 @@ -2b363aecd6422c3ce9964983f5d0f3ef *tests/data/fate/matroska-flac-extradata-update.matroska -2049 tests/data/fate/matroska-flac-extradata-update.matroska +5070c157123b54e218c7e0a45d5606c8 *tests/data/fate/matroska-flac-extradata-update.matroska +1977 tests/data/fate/matroska-flac-extradata-update.matroska #extradata 0: 34, 0x7acb09e7 #extradata 1: 34, 0x7acb09e7 #extradata 2: 34, 0x443402dd diff --git a/tests/ref/fate/rgb24-mkv b/tests/ref/fate/rgb24-mkv index 43b4ee2e19..686c45ebfb 100644 --- a/tests/ref/fate/rgb24-mkv +++ b/tests/ref/fate/rgb24-mkv @@ -1,5 +1,5 @@ -92861b36a8220a3dae10d91cba614892 *tests/data/fate/rgb24-mkv.matroska -58216 tests/data/fate/rgb24-mkv.matroska +f9feab2a7ed8f1049df1b70982291505 *tests/data/fate/rgb24-mkv.matroska +58192 tests/data/fate/rgb24-mkv.matroska #tb 0: 1/10 #media_type 0: video #codec_id 0: rawvideo -- cgit v1.2.3