Commit Graph

1383 Commits

Author SHA1 Message Date
Moritz Bunkus
f617989a31
chapter parser: re-write checking & normalizing IETF & legacy language elements
The old code assumed that there's at most one IETF & one legacy
language element within the same "chapter display" element. This
doesn't have to be the case as the specs lists both language elements
as multiple.

Part of the fix of #3120.
2021-05-29 17:52:43 +02:00
Moritz Bunkus
607ba88c74
OGM-style chapters: handle any number of decimal places up to 9, not just 3
Fixes #3121.
2021-05-28 21:12:15 +02:00
Moritz Bunkus
b26c23c61e
mkmverge, mkvpropedit: only remove default-value mandatory elements if not multi
There are elements in Matroska that are mandatory, have a default
value and may occur multiple times within the same master, mainly the
"chapter language" element. The semantics in such a case are that the
default value must only be used if NO OTHER element of the same type
is present within the same master element.

If a "chapter display" contains, let's say, a string for the languages
German & English, two "chapter language" elements must be
used. Checking with the specs reveals that English is the default
value for "chapter languages". Therefore one might think we can omit
writing the instance for "chapter language" with value "English". But
that would leave one "chapter language" element present with "German"
as the value, and semantically that would be the value a reader must
use.

This patch changes how default elements are removed before writing a
master element. It now iterates over all elements keeping track of how
many elements of each type there are within the same master. Mandatory
elements set to their default value will now only then be removed if
there is only that one instance of the mandatory element.

Part of the fix of #3120.
2021-05-27 19:26:28 +02:00
Moritz Bunkus
d00038f225
tests: intentional update due to bf987929c 2021-05-24 08:43:13 +02:00
Moritz Bunkus
229e3c9e5e
mkvmerge: overhaul "default track" flag handling
The Matroska specs have recently clarified regarding the intended
interpretation of the "default track" flag. If it is set, it is
supposed to signal to the player that this track is eligible for being
played by default, potentially taking other factors such as user
preferences regarding languages into account.

This implies that more than one track of each type can have this flag
set. For example, a Blu-ray disc with three audio tracks might have
the main audio in both English and Japanese, whereas the third audio
track contains the director's comments. In such a case the first two
tracks should have the "default track" flag set, the third one
shouldn't.

Earlier mkvmerge was enforcing that only one track of each type could
have the flag set. This restriction has been removed.

Part of the implementation of #3092.
2021-05-23 17:45:05 +02:00
Moritz Bunkus
bdabd08891
tests: intentional update due to 7f4e47cc0 2021-05-23 13:33:23 +02:00
Moritz Bunkus
a44a201a51
HEVC packetizer: calculate precise frame duration
When the timestamps & the default duration comes from a container with
low timestamp resolution (= from Matroska), calculating the actual
default duration and frame duration to use requires using the HEVC
stream's frame duration if the delta between it and the source's
imprecise duration is less than the source's timestamp resolution.

Otherwise the cluster helper will often come to the conclusion that a
frame's duration doesn't match the track's default duration. The
result in such cases is that `BlockGroup` elements with
`BlockDuration` elements have to be used to signal the frame's (wrong
because imprecise) duration.

With precisely calculated frame duration the cluster helper will
always see that the frame's duration matches the track's default
duration. It can therefore always use `SimpleBlock` elements and save
on space that way.

Fixes #3114.
2021-05-21 20:53:20 +02:00
Moritz Bunkus
849491f024
mkvmerge, mkvextract: HEVC: don't discard access unit delimiter NALUs 2021-05-21 19:06:40 +02:00
Moritz Bunkus
e7ffc2032d
HEVC parser: fix location, ordering & duplication of certain NALUs
1. Parameter set & prefix SEI NALUs are no longer duplicated in front
   of key frames.

2. Parameter set & prefix SEI NALUs will now be output in the same
   order they're found if they already exist in the bitstream in front
   of key frames.

3. Several NALU types, notably Dolby Vision-specific NALUs ("unspecified
   62" and "unspecified 63") and suffix SEI NALUs, must be placed in
   the same Matroska block but behind the slice NALUs they belong
   to. They are now. Earlier they were stored in the following
   Matroska block, before the slice NALUs.

Part of fixing & implementing #2784, #2818, #3093 and #3113.
2021-05-21 19:06:40 +02:00
Moritz Bunkus
04744ce691
SRT: recognize empty text files with .srt file name extension as SRT subtitles
Implements #3089.
2021-05-17 23:05:11 +02:00
Moritz Bunkus
f0b88d1ba7
mkvinfo: block group summary: calculate frame positions correctly
The end position used for subtracting the frame sizes must be the end
position of the `Block` element, not of the containing `BlockGroup`
element as that can contain other elements such as the `BlockDuration`
element.
2021-05-17 21:53:36 +02:00
Moritz Bunkus
14d85a6970
tests: skip certain tests when address sanitizers are used 2021-04-09 18:08:14 +02:00
Moritz Bunkus
0a2cb7d1bd
tests: support skipping tests for certain build configurations 2021-04-09 18:06:57 +02:00
Moritz Bunkus
686cc15da4
tests: add options for excluding certain tests 2021-04-08 00:06:03 +02:00
Moritz Bunkus
43fdadb3a5
AAC: add support for channel configuration according to Rec. ITU-R BS.1196-7
These include channel configuration codes ≥ 8 for 6.1, 7.1 & 22.2
channels.

Fixes #3081.
2021-04-05 21:04:06 +02:00
Moritz Bunkus
e75e9c503e
mkvmerge: HEVC: normalize parameter set NALUs
Normalization means that each key frame is prefixed with exactly one
set of the currently active picture, sequence & video parameter sets.

Fixes #3034 and prevents the same class of issues where the parameter
sets required to decode do not match the ones in CodecPrivate but
aren't present in front of the key frames. This often happens when
appending files.
2021-03-23 19:48:53 +01:00
Moritz Bunkus
12284bf662
tests: prevent updating results if results contain 'failed' 2021-03-20 13:15:22 +01:00
Moritz Bunkus
889d3910ef
tests: fix chapter languages test due to dcfe41269 2021-03-20 13:13:50 +01:00
Moritz Bunkus
5f42b31006
extract: chapters: don't add ChapterLanguage elements if not present in file 2021-03-15 17:46:48 +01:00
Moritz Bunkus
cfe40fd261
propedit: chapters: don't write mandatory elements set to their default value 2021-03-15 17:27:30 +01:00
Moritz Bunkus
299808387f
propedit: tags: don't write mandatory elements set to their default value
See #3071.
2021-03-15 17:27:30 +01:00
Moritz Bunkus
7b00448ba3
tags: don't set "target type" for track statistics tags 2021-03-15 17:27:30 +01:00
Moritz Bunkus
5bdebfd9e6
chapters: don't write mandatory elements set to their default value 2021-03-15 17:27:30 +01:00
Moritz Bunkus
0ab096dcbe
tags: don't write mandatory elements set to their default value
See #3071.
2021-03-15 17:27:30 +01:00
Moritz Bunkus
49a3f71595
merge: tags: use spec-compliant "und" as default language simple tags
Part of the fix of #3071.
2021-03-14 21:08:27 +01:00
Moritz Bunkus
6b4d524291
merge: tags: don't use "eng" as default language for simple tags
The effect is that track statistics tags will no longer have a
language set. This turns the effective language of track statistics
tags into "undetermiend" due to the default value of the legacy tag
language element.

Fixes #3073.
2021-03-14 20:45:18 +01:00
Moritz Bunkus
dd6d72f232
merge: tags: extend --disable-language-ietf to work on tags
Fixes #3070.
2021-03-14 20:16:58 +01:00
Moritz Bunkus
35825236ec
merge: don't write existing ChapLanguageIETF element with --disable-language-ietf
Existing elements read from Matroska or XML chapter files will no
longer be written if `--disable-language-ietf` is used.

Part of the fix of #3069.
2021-03-14 20:01:41 +01:00
Moritz Bunkus
c0cc43a541
merge: parse --disable-language-ietf before other chapter-handling code
Part of the fix of #3069.
2021-03-14 19:47:35 +01:00
Moritz Bunkus
ed191adb2f
tests: option :post_args for adding args at the end of the command line 2021-03-14 19:19:44 +01:00
Moritz Bunkus
0237579c88
info: normalize formatting of all floating point values
…even those using the default formatter.
2021-03-10 23:24:53 +01:00
Moritz Bunkus
20b2092a5c
tests: add cases for mtx::regex::replace 2021-03-10 23:02:44 +01:00
Moritz Bunkus
499e41e065
unit tests: fix due to code name normalization 2021-03-05 23:22:08 +01:00
Moritz Bunkus
df30cdb305
tests: update for the AVC & HEVC codec name normalization 2021-03-05 22:27:35 +01:00
Moritz Bunkus
c847b83fad
remove "change length of NALU 'size' field" functionality 2021-03-02 21:01:55 +01:00
Moritz Bunkus
f0243659d2
ID result: use constexpr instead of #defines 2021-02-21 14:04:54 +01:00
Moritz Bunkus
47ffd40bc2
MP4: move constants to namespace mtx::m4p; use constexpr instead of #define 2021-02-20 23:04:40 +01:00
Moritz Bunkus
efe74a6cea
tests: make 717 independent of where the test files reside in the file system 2021-02-19 23:00:43 +01:00
Moritz Bunkus
d2652415ac
tests: add test for non-ASCII characters in file names 2021-02-19 16:15:58 +01:00
Moritz Bunkus
7cd36322e7
tests: add Blu-ray file/directory structure recognition test 2021-02-19 16:15:53 +01:00
Moritz Bunkus
35e6172aa7
extract: HEVC: use parameter from first frame instead of CodecPrivate
Fixes #3031.
2021-02-18 19:52:22 +01:00
Moritz Bunkus
6a5b4b97db
BCP 47: add ISO 639-3 languages (only those of type "living")
Part of the implementation of #3007.
2021-02-17 22:19:10 +01:00
Moritz Bunkus
44e74d7d1b
tests: update due to 659a83e542 2021-02-14 14:54:53 +01:00
Moritz Bunkus
ee73b2f54c
AC-3 parser: add support for byte-swapped data
Implements #3022.
2021-02-07 11:51:39 +01:00
Moritz Bunkus
7121cac5c8
tests: intentional update due to Blu-ray PCM channel layout fixes 2021-02-06 15:47:02 +01:00
Moritz Bunkus
d356a8efd4
tests, NEWS, AUTHORS: add for 7.1 channel aac fix in 6cc7b55 2021-02-04 22:46:09 +01:00
Moritz Bunkus
1c30de8586
tests: update due to change in how mkvinfo displays flag names 2021-02-03 20:28:16 +01:00
Moritz Bunkus
b8e66fd6b3
mkvmerge: identification schema v14: add new track header elements
Part of #3011.
2021-02-03 18:33:48 +01:00
Moritz Bunkus
a88452c538
mkvinfo: use '…' in flag names for clarity 2021-02-02 16:08:13 +01:00
Moritz Bunkus
47d6ae5fcc
Matroska reader: keep audio bit depth header if present
Implements #3009.
2021-01-30 22:52:57 +01:00