avformat/matroskaenc: Don't waste bytes on BlockGroup length fields

This commit uses the new EbmlWriter API to write the length fields
of the BlockGroup and its descendants that are themselves Master
elements (namely BlockAdditions and BlockMore) on the least amount of
bytes.

This fixes regressions introduced when the special code for writing
general subtitles was removed. Accordingly, the binsub-mksenc and
matroska-zero-length-block FATE-tests have now been reverted back
to their old state again; the advantages of this approach are evident
with the matroska-vp8-alpha-remux test which up until now wrote
all the length fields of all BlockGroups, BlockAdditions and BlockMore
on eight bytes.

Using the EbmlWriter API also allowed to improve locality in
mkv_write_block(): E.g. both DiscardPadding as well as the
BlockAdditional side-data are now directly used to add elements
to the writer whereas the earlier code had to first check
for whether a BlockGroup should be used and then check again
(after the place where a BlockGroup would be opened if one were
used) for whether there is DiscardPadding or BlockAdditional
side-data to write.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2022-01-16 14:01:28 +01:00
parent abbc111067
commit 9f7e0b37ff
5 changed files with 129 additions and 91 deletions

View File

@@ -1 +1 @@
9dd2ff92a3da9fb50405db3d05e41042
490b1b4beb4a614c06004609039ce779

View File

@@ -1,5 +1,5 @@
89c4f6136f151f45c217ec363fe9db2b *tests/data/fate/matroska-vp8-alpha-remux.matroska
237178 tests/data/fate/matroska-vp8-alpha-remux.matroska
58147987d42f32d105d96b24b0755257 *tests/data/fate/matroska-vp8-alpha-remux.matroska
235018 tests/data/fate/matroska-vp8-alpha-remux.matroska
#tb 0: 1/1000
#media_type 0: video
#codec_id 0: vp8

View File

@@ -1,5 +1,5 @@
c09d3b89ed0795817d671deb041fca1b *tests/data/fate/matroska-zero-length-block.matroska
650 tests/data/fate/matroska-zero-length-block.matroska
f37ba7e8a30eaa33c1fd0ef77447fb41 *tests/data/fate/matroska-zero-length-block.matroska
636 tests/data/fate/matroska-zero-length-block.matroska
#tb 0: 1/1000
#media_type 0: subtitle
#codec_id 0: subrip

View File

@@ -1,5 +1,5 @@
01732642a0750de3959fd348092929a5 *tests/data/fate/webm-dash-chapters.webm
111162 tests/data/fate/webm-dash-chapters.webm
f97445ba73e182c888fa077348384083 *tests/data/fate/webm-dash-chapters.webm
111156 tests/data/fate/webm-dash-chapters.webm
#extradata 0: 3469, 0xc6769ddc
#tb 0: 1/1000
#media_type 0: audio