Commit Graph

1227 Commits

Author SHA1 Message Date
Moritz Bunkus
190827ee5a
text I/O: always treat newlines as EOL regardless of detected EOL style
Problematic were files for which DOS-style EOLs were
detected (carriage return followed by newline, \r\n) but which had
some lines terminated solely by a newline (\n). In such a case the
EOL was only detected upon seeing the next \r\n, and the value
returned from the `getline()` function would return something that
everyone would judge to be multiple lines of text.

Fixes #2594.
2019-08-10 16:05:57 +02:00
Moritz Bunkus
f383f8c78c
all: use H.265 instead of h.265
Second part of the fix of #2600.
2019-08-10 14:34:54 +02:00
Moritz Bunkus
b56918d388
all: use H.264 instead of h.264
Part of the fix of #2600.
2019-08-10 14:29:54 +02:00
Moritz Bunkus
ba03b34352
tests: intentional update due to translation updates 2019-08-06 21:03:50 +02:00
Moritz Bunkus
7dee3ae004
tests: update due to translation update 2019-06-18 19:14:35 +02:00
Chun-Kai Mao
1fb763752d
translations: update Chinese Traditional 2019-06-17 21:14:22 +02:00
Moritz Bunkus
39557e80a0
Matroska reader: add "codec_name" track property in JSON identification 2019-06-17 19:53:27 +02:00
Moritz Bunkus
970193a36e
tests: update due to translation update 2019-05-18 12:36:40 +02:00
Moritz Bunkus
dc163cc4d5
AV1: use container timing info if no bitstream timing info present
Fixes #2553.
2019-05-18 10:40:35 +02:00
Rafael Fontenelle
89cf6dcdcd
translations: update Brazilian Portuguese 2019-05-08 20:05:13 +02:00
Moritz Bunkus
002daadc0a
mkvmerge: clarify description of several MPEG audio & video format names
Fixes #1275.
2019-04-22 15:51:29 +02:00
Moritz Bunkus
d9c9b2498f
subtitles: treat all frames as key frames
Fixes #2541.
2019-04-17 15:54:46 +02:00
Moritz Bunkus
09ad48cb8f
tests: intentional update due to a2e7d242c 2019-04-10 21:35:52 +02:00
Moritz Bunkus
66a2cebc82
tests: add test case for Emojis 2019-03-12 20:28:47 +01:00
Moritz Bunkus
5a36d0e95e
libEBML: update to latest upstream version
This pulls the fixes for handling Unicode code points >
U+FFFF. Also update the one test case with invalid data which is now
handled slightly differently than before.

Part of the fix of #2516.
2019-03-06 22:39:54 +01:00
Moritz Bunkus
11067b213b
mkvinfo: show element's data size when --size is used 2019-03-06 19:31:20 +01:00
Moritz Bunkus
47058a6da2
HEVC: use height of full frame for dimensions for interlaced streams
Fixes #2446.
2019-01-26 13:48:52 +01:00
Moritz Bunkus
9e1a1f3de6
subtitles: allow duration = 0ms
Various places needed to differentiate better between "no duration is
known or set for this packet" and "this packet has a duration of
0ms". The former means that no duration element should be written to
the file, and the use of `SimpleBlock` instead of `BlockGroup` is
OK. The latter on the other hand means that a `BlockGroup` must be
used and a duration element must be added.

This core change uncovered a couple of subtle bugs in other places
where subtitles were handled:

• The Matroska reader passed 0 as the duration even if no duration
  element was present making it impossible for other code to
  differentiate between "no duration present" and "duration present
  but set to 0".
• The DVB subtitle packetizer always enforced writing the duration
  even if the duration wasn't known.
• The Kate packetizer used a wrong dummy value of 1us for the duration
  for the "end of stream" packet as the core would not write a
  duration of 0.
• The text subtitle packetizer was using the difference between the
  current packet and the following one for packets were the duration
  was 0 or unknown. The correct behavior is to do this only if the
  duration is unknown, not if it is 0.

Fixes #2490.
2019-01-24 16:01:22 +01:00
Moritz Bunkus
78a46ac215
bit_reader_c: add function for reading bits into a std::string 2019-01-22 18:01:09 +01:00
Moritz Bunkus
37e2da5502
MP4 reader: ignore edit lists consisting solely of unsupported elements
Unsupported edits such as dwells were simply ignored. If all of them
were ignored, then the new timeline was empty resulting in no data
being copied for that track. Instead simply ignore edit lists whose
new timeline ends up empty after the entries have been processed.

Fixes #2487.
2019-01-19 11:12:26 +01:00
Moritz Bunkus
901e49b049
mm_file_io_c: don't flush on close by default
When closing files that were opened for writing, cached data will not
be flushed to storage automatically anymore. This reverts the
workaround implemented for #2469. A new option was added to both
programs (`--flush-on-close`) that re-enables flushing for people who
are affected by data loss such as described in #2469.

The reason is that automatic flushing causes long delays in processing
queues when the output by mkvmerge/mkvextract isn't the final product but
just an intermediate result to be processed further.

Implements #2480.
2019-01-10 22:05:34 +01:00
Moritz Bunkus
4e7fe6c790
extract: WAV: convert to W64 if extension is .w64 or file size is > 4 GB
Implements #2458.
2018-12-19 18:34:30 +01:00
Moritz Bunkus
0011711f19
fix compilation with newer zapcc
This makes sure `operator<<(std::ostream, basic_timestamp_c<long>)` is
visible in the compilation unit and code will be generated for it.
2018-12-15 19:20:38 +01:00
Moritz Bunkus
383b910fe2
mkvmerge, GUI's chapter editor: use name template for nameless Ogg chapters
Fixes #2441.
2018-11-25 22:27:33 +01:00
Moritz Bunkus
4b87f049e7
kax_analyzer_c: adjust cues when a cluster was moved
Writing level 1 elements can lead to the situation that a one-byte gap
must be covered. In that case `kax_analyzer_c` can move the head of
the following element by shrinking or enlarging its size field.

If that following element happens to be a cluster, there may be cues
that refer to that cluster. They must be updated in order to reflect
the cluster's new position.

Fixes #2408.
2018-11-24 15:04:24 +01:00
Moritz Bunkus
0683d30a19
mkvextract: AAC: write program config element if present in AudioSpecificConfig
The `CodecPrivate` Matroska element contains AAC's
`AudioSpecificConfig` structure. That structure can contain a
`GASpecificConfig` structure which in turn can contain a
`program_config_element` (short: PCE).

The PCE carries vital information about number of
channels in certain situations and must be present in the first raw
AAC packet if it is present in the `AudioSpecificConfig`. Otherwise
the number of channels cannot be determined.

mkvextract will now check whether the first packet contains the PCE
already. If it doesn't and if there's a PCE in the
`AudioSpecificConfig`, mkvextract will now prepend the first audio
packet with that PCE (right behind the ADTS headers).

Fixes #2205 and #2433.
2018-11-21 17:05:48 +01:00
Moritz Bunkus
cb51487445
tests: update due to translation update in 2f11d815d 2018-11-20 21:30:28 +01:00
Moritz Bunkus
659e25dc36
fmt conversion: convert the unit test files 2018-11-20 21:30:26 +01:00
Moritz Bunkus
29cdba5f29
chapters: take smallest timestamp in first file into account
When generating chapters mkvmerge has to take into account things such
as splitting and file linking. This requires shifting chapter
timestamps to match file timestamps. However, for files which don't
start at 0 generated chapters would be wrongfully shifted down to
below 0 causing invalid timestamps.

Fixes #2432.
2018-11-16 09:54:52 +01:00
Moritz Bunkus
d672c35354
tests: switch to mkvextract's new syntax 2018-11-16 09:51:30 +01:00
Moritz Bunkus
88ef93984f
MP4 reader: don't read atom data beyond parent atom's size
Fixes #2431.
2018-11-15 20:03:07 +01:00
Moritz Bunkus
7e496e696d
tests: don't run mkvinfo on TALOS 2018-0694 test file
Older libEBML or libMatroska versions don't validate the parent/child
sizes properly. This means that tests running on those older versions
cause mkvinfo to fail (with an exception = harmlessly).
2018-10-26 10:21:36 +02:00
Moritz Bunkus
43021d16c7
kax_file_c, ElementReader: only delete returned upper-level element if found
The `EbmlElement::Read` function returns two values via reference
parameters. They're called `UpperEltFound` (an integer) and
`FoundElt` (a pointer to an EBML element). They're used for passing
back the first element found (if any) that is not a child of the
element currently being read so that the calling code can continue
parsing the file using the upper-level element.

If the calling code doesn't need that element, it has to delete it
itself. However, the code must not simply rely on the `FoundElt`
pointer being not null as the `Read` function assigns temporary
results to that variable. Depending on the file content, that
temporary element may have already been deleted by the `Read`
function. When the calling code then simply deletes `FoundElt` itself,
this leads to a typical case of use-after-free.

Instead the calling code must only work with the returned `FoundElt`
pointer if the other returned value, `UpperEltFound`, trueish in the
C++ sense (if it isn't 0). Then and only then may the calling code
attempt to delete the object `FoundElt` points to.

This vulnerability allows arbitrary code execution via specially
crafted Matroska files. It was reported by Cisco TALOS on 2018-10-25
and is known as TALOS 2018-0694.
2018-10-25 22:22:31 +02:00
Moritz Bunkus
1a3adffb4c
Matroska reader: AV1: recreate av1C when reading files by mkvmerge v28.0.0
Last part of the fix for #2410.
2018-10-21 22:51:02 +02:00
Moritz Bunkus
a346aadfae
AV1 parser: include OBU common data in av1C
Part of the fix of #2410.
2018-10-21 22:29:43 +02:00
Moritz Bunkus
1a6286e778
AV1 parser: fix bug in sequence header parser
The two header fields `delta_frame_id_length_minus2` and
`additional_frame_id_length_minus1` are only present if
`reduced_still_picture_header` is not set but
`frame_id_numbers_present_flag` is.

Part of the fix for #2410.
2018-10-21 22:14:16 +02:00
Moritz Bunkus
fe5e19753f
kax_analyzer_c: fix one-byte gap handling
When surrounding elements have been written using eight-byte size
length fields, the analyzer cannot enlarge the element
anymore. Instead, it can shrink them by one byte and move the head
up. That way the former one-byte gap will become a two-byte gap
instead. A new, empty EBML void element can then be placed in the gap
instead.

libavformat from ffmpeg/libav writes most level 1 elements with
eight-byte size length fields. Files created by it are therefore the
prime candidate for hitting this but.

Fixes #2406.
2018-10-20 16:21:35 +02:00
Moritz Bunkus
2f5b9149a0
VP9 packetizer: build codec private according to VP9 codec mapping
Implements #2379.
2018-10-13 18:48:33 +02:00
Moritz Bunkus
9916700f8c
IVF extractor: default to 25 FPS if no default duration given 2018-10-11 16:34:48 +02:00
Moritz Bunkus
66effd98c2
math: add function for clamping parts of a rational to max value 2018-10-11 16:34:43 +02:00
Moritz Bunkus
a80c3bd09e
extract: IVF: use precise frame rates if possible
Part of #2261.
2018-10-11 14:33:57 +02:00
Moritz Bunkus
88dfeae3f5
memory_c: new function for prepending memory; add test cases 2018-10-08 10:53:59 +02:00
Moritz Bunkus
236765a800
AV1 packetizer: set default duration from bitstream's timing info as fallback
Part of the implementation of #2261.
2018-10-07 23:55:50 +02:00
Moritz Bunkus
3571f4ab4c
extract: add support for extracting AV1 to IVF
Part of the implementation of #2261.
2018-10-07 23:06:47 +02:00
Moritz Bunkus
dca6f040a9
MP4 reader: add support for AV1 2018-10-07 23:06:47 +02:00
Moritz Bunkus
967c66e764
tests: intentional update due to AV1 changes 2018-10-07 23:01:26 +02:00
Moritz Bunkus
13821a724f
JSON identification: catch "out of space" exception in bad UTF-8 removal
This is the only exception that `::utf8::remove_invalid()` throws. If
it is encountered, simply stop processing the string further.

Fixes #2398.
2018-10-06 12:29:32 +02:00
Moritz Bunkus
b242ed2fa1
MPEG TS: allow 50 MB to be buffered
With a low buffer limit, it's possible that mkvmerge hits the limit
while looking for the "end of display" conditions for teletext
subtitles. In such a case mkvmerge starts writing out buffered audio &
video packets even though there's no packet available for the subtitle
track.

Once mkvmerge does find the "end of display" conditions, the formerly
incomplete subtitle packet will be written. However, at that point the
timestamps of audio & video packets are higher already, causing the
subtitle packet to be interlaved wrongly.

The higher the limit, the less likely it is mkvmerge will run into
such a situation. With 50 MB the problem disappears for the provided
test file.

Workaround for #2393.
2018-10-05 21:29:34 +02:00
Moritz Bunkus
b7b3721a42
mkvmerge: simple text subtitles: handle blocks without a duration
If there's no duration, the current entry will be buffered. As soon as
the following entry is found, the difference between the start
timestamps of the current and buffered blocks will be used as the
buffered block's duration.

Second part of the implementation of #2397.
2018-10-05 20:26:10 +02:00
Moritz Bunkus
237585d0d4
mkvextract: simple text subtitles: handle blocks without a duration
If there's no duration, the current entry will be buffered. As soon as
the following entry is found, the difference between the start
timestamps of the current and buffered blocks will be used as the
buffered block's duration.

Part of the implementation of #2397.
2018-10-05 19:06:51 +02:00