Commit Graph

11928 Commits

Author SHA1 Message Date
Moritz Bunkus
5b431c02ea
SSA/ASS textsubs: emit warning for invalid 8-bit characters in UTF-8 sequences
Part of the implementation of #2246.
2018-06-20 22:18:41 +02:00
Moritz Bunkus
7a9a245f40
SRT textsubs: emit warning for invalid 8-bit characters in UTF-8 sequences
Part of the implementation of #2246.
2018-06-20 22:18:41 +02:00
Moritz Bunkus
de603b7402
SSA/ASS textsubs: try UTF-8 if no encoding was specified with fallback to system's encoding
Part of the implementation of #2246.
2018-06-20 22:18:41 +02:00
Moritz Bunkus
1bb63b08bd
SRT textsubs: try UTF-8 if no encoding was specified with fallback to system's encoding
Part of the implementation of #2246.
2018-06-20 22:14:09 +02:00
Moritz Bunkus
5ff7aed0b9
UTF-8: move functions to mtx::utf8 namespace; add is_valid function 2018-06-20 22:14:07 +02:00
Moritz Bunkus
291e98423c
textsubs packetizer: simplify constructor arguments 2018-06-20 20:49:20 +02:00
Moritz Bunkus
1762d4dc2e
Ogg Opus reader: calculate packet timestamps from granulepos
The prior algorithm summed up all Opus frame's number of samples and
calculated the expected timestamp from there. That expected timestamp
was compared to the Ogg page's granule position, and the discard
padding was calculated from that.

This lead to problems in several cases:

1. When the first packet's granule position was bigger than the number
   of samples in the Opus frame, the specs say that the first sample's
   timestamp is positive in that case. mkvmerge was wrongfully using 0
   as the timestamp and thought discard padding was needed in such a
   case.

2. When the first packet's granule position was smaller than the
   number of samples in the Opus frame (meaning the first sample's
   timestamp was negative), a technically invalid bitstream, mkvmerge
   was wrongfully forcing the first packet's timestamp up to 0 and
   inserting discard padding elements all over the place as its
   internal calculations got confused.

The new algorithm bases the calculation on the last known granule
position special-casing for certain Ogg packet numbers:

1. For the first Ogg page the timestamps of all packets is calculated
   by subtracting each packet's number of samples from the page's
   granule position in reverse order. This may result in the first
   packet's timestamp being positive, which mkvmerge now preserves.

   mkvmerge won't calculate a discard padding for this page.

2. For all other pages each packet's timestamp is calculated by adding
   each packet's number of samples to the previous Ogg page's end
   timestamp as given by its granule position.

   mkvmerge then calculates the discard padding for the last packet of
   the page by comparing the calculated end timestamp of that packet
   with the Ogg page's end timestamp as given by the granule
   position.

   As a workaround for certain rounding errors encountered in the
   wild, a discard padding of one sample will be treated as if no
   discard padding was present for all but the very last packet as
   indicated by the "end of stream" bit.

Fixes #2280.
2018-06-20 19:27:47 +02:00
Moritz Bunkus
10f030a504
Ogg Opus reader: enable debugging for opus_reader & ogm_opus_reader 2018-06-20 18:58:36 +02:00
Moritz Bunkus
e718c896be
Opus packetizer: improve debug messages 2018-06-20 18:58:23 +02:00
Moritz Bunkus
46164c0070
audio packetizers: keep discard padding if present on source packet
Only applies to the packetizers for the following formats: AAC, AC-3,
DTS, MP3 and TrueHD. The other packetizers were already keeping the
value.

Fixes #2296.
2018-06-19 21:58:02 +02:00
Moritz Bunkus
c9e95d272b
translations on macOS: use path relative to executable for finding .po files
Together with the additions of building `libiconv` and a complete
`gettext` in `build.sh` in revision
e17cbecb16, this enables the use of all
available interface translations on macOS.

Fixes #2110, #2307, #2323.
2018-06-16 22:29:48 +02:00
Moritz Bunkus
e17cbecb16
macOS build: update all libraries, add iconv & full gettext build 2018-06-16 21:57:42 +02:00
Moritz Bunkus
d290e0dbf1
base64tool: fix compilation after removal of 'using namespcae' from headers 2018-06-15 18:39:25 +02:00
Moritz Bunkus
4eefc50110
JSON identification: replace invalid UTF-8 bytes with placeholder characters
nlohmann's JSON libraries in version 2.x used to strip bytes that
aren't valid UTF-8 from strings (e.g. service/station names in MPEG
transport streams) before outputting the JSON data structures. With
MKVToolNix v24 that bundled library was updated to v3 which now throws
an exception on such invalid data.

Therefore mkvmerge now takes care of replacing invalid bytes with
placeholder characters itself before passing the strings to nlohmann's
JSON library.

Fixes #2327.
2018-06-15 17:45:22 +02:00
Moritz Bunkus
1ca6c7f8d9
UTF-8 CPP: update to 2.3.5 revision 1537543999978d3a0464560a9a940d6140c6ba59 2018-06-15 17:45:22 +02:00
Moritz Bunkus
8bcc286dfc
refactoring: no 'using namespace …' in header files
It is dangerous insofar as it pollutes an immense number of source
files. For example, utf8cpp's stuff uses relative namespace
names (e.g. `utf8::some_type`). If `using namespace libebml` is in
effect, then this clashes with `libebml::utf8` which is a typedef for
`unsigned char`, causing compiler errors.
2018-06-15 17:45:22 +02:00
Moritz Bunkus
c8cb86b8fb
bit_reader_c: fix get_bit_position/get_remaining_bits for empty buffers
One side affect of the fixed bug was that trying to identify/mux an
empty file (file with a size of 0) resulted in the following error
message:

> Error: buffer_c: num > m_filled. Should not have happened. Please
> file a bug report.
2018-06-14 21:23:42 +02:00
Moritz Bunkus
1c7ad896a1
MPEG TS: compare MPLS start/end timestamps against PTS, not DTS
Otherwise the first video key frame was dropped whenever it wasn't the
first frame in presentation order.

Fixes #2321.
2018-06-14 20:48:28 +02:00
Moritz Bunkus
5030625bd9
MPEG TS reader: prefix all debug names with mpeg_ts_ 2018-06-14 20:19:15 +02:00
Moritz Bunkus
c0fb339e71
MPEG TS reader: add debug code for not zero-basing timestamps 2018-06-14 19:24:14 +02:00
Moritz Bunkus
9d26ac99ea
TrueHD/MLP packetizer: don't attempt dialog volume normalization removal for MLP 2018-06-13 22:06:07 +02:00
Moritz Bunkus
f265565c42
tests: update for MLP fix of #2326 2018-06-13 22:06:07 +02:00
Moritz Bunkus
01f4a8191e
TrueHD/AC-3 converter: handle MLP, too
Part of the fix of #2326.
2018-06-13 22:06:07 +02:00
Moritz Bunkus
347c230448
TrueHD/MLP parser: is_normal() must test if m_type is normal, not sync
Part of the fix for #2326.
2018-06-13 22:06:07 +02:00
Moritz Bunkus
b5340c61e2
TrueHD/MLP parser: set codec of non-sync frames based on last sync frame
Part of the fix for #2326.
2018-06-13 22:06:07 +02:00
Moritz Bunkus
832335ce30
TrueHD/MLP parser: use mxdebug_if instead of mxverb 2018-06-13 21:57:30 +02:00
Moritz Bunkus
93d02a0208
TrueHD packetizer: use boost::optional instead of magic value 2018-06-13 19:35:34 +02:00
Moritz Bunkus
07ab76f377
timestamp_calculator_c: add_timestamp overload with boost::optional<int64_t> 2018-06-13 19:35:06 +02:00
Moritz Bunkus
9afc43b209
HEVC/h.265 ES reader: clear parser's buffer after reading the headers
After reading the headers, the file is read again from the
start. Therefore no data must be left in the parser's internal
buffers. That was the intention behind calling `flush()` - but that
isn't actually what flush does. Instead it tries to use the remaining
data in the buffers as a frame.

This is not only wrong, it can also fail and cause an exception to be
thrown. That in turn causes a failure when reading the headers — both
identification and muxing abort at that point.

This is the HEVC analog for what was fixed for AVC in #2325.
2018-06-13 17:58:08 +02:00
Moritz Bunkus
ee46e1c7ab
AVC/h.264 ES reader: clear parser's buffer after reading the headers
After reading the headers, the file is read again from the
start. Therefore no data must be left in the parser's internal
buffers. That was the intention behind calling `flush()` - but that
isn't actually what flush does. Instead it tries to use the remaining
data in the buffers as a frame.

This is not only wrong, it can also fail and cause an exception to be
thrown. That in turn causes a failure when reading the headers — both
identification and muxing abort at that point.

Fixes #2325.
2018-06-13 17:52:29 +02:00
Jan Mazurczyk
92915be313
translations: update Polish 2018-06-11 20:04:08 +02:00
Moritz Bunkus
fca5c6fb9a
installer: convert translation files to UTF-8
Switching to NSIS 3 with Unicode support.
2018-06-11 19:44:20 +02:00
Moritz Bunkus
f34bc9a1f6
GUI: headers: allow removal of non-mandatory elements again
This was a regression from fixing #2320 in
0d7d5ca3dd.

Fixes #2322.
2018-06-11 16:14:54 +02:00
Moritz Bunkus
73620f83fa
translations: update list of translatable strings 2018-06-10 20:06:06 +02:00
Moritz Bunkus
c9e0637972
GUI: setToolTips: simplify interface if both tool tips are identical 2018-06-10 20:05:19 +02:00
Moritz Bunkus
fa8e0dff2e
translations: update list of translatable strings; update German translation 2018-06-10 20:01:13 +02:00
Moritz Bunkus
7da05d1dcc
GUI: change "track" to "item" in the preferences in certain cases
Whenever the word means all the possible elements in the "tracks,
chapters and tags" box, the word "item" is better as it includes
chapters & tags whereas "tracks" only means "audio/video/subtitle/
button tracks".
2018-06-10 19:58:52 +02:00
Moritz Bunkus
91482380e2
bump version number, set release code name 2018-06-10 11:39:12 +02:00
Antoni Bella Pérez
c6bebefd73
translations: update Catalan 2018-06-10 11:04:57 +02:00
Antoni Bella Pérez
3b7408d8b7
man page translations: update Catalan 2018-06-10 11:04:50 +02:00
Moritz Bunkus
4547cfa5ac
NEWS.md: reorder & reword elements for easier consumption 2018-06-10 09:01:31 +02:00
Moritz Bunkus
5dd2ea4433
man page translations: update list of translatable strings; update German translation 2018-06-09 20:51:09 +02:00
Moritz Bunkus
c4e4a42e51
E-AC-3 parser: parse & evaluate channel layout from dependent streams
In AC-3 streams you can have an AC-3 core with dependent E-AC-3
frames. The E-AC-3 frames can both replace channels from the AC-3 core
and add additional channels to them.

Fixes #2283.
2018-06-09 20:46:40 +02:00
Moritz Bunkus
45322bc7dd
Matroska reader: keep "display unit" video track property if present
Fixes #2317.
2018-06-09 12:35:32 +02:00
Moritz Bunkus
dbee007f5f
mkvmerge: identification: report display unit video track property 2018-06-09 12:35:32 +02:00
Moritz Bunkus
e1b74c6e6f
DVB subs: don't fix 4 byte CodecPrivate before identification
The identification should show what's actually there in the file, not
the fixed-up data.
2018-06-09 12:35:32 +02:00
Moritz Bunkus
cc75b794e4
packetizers: set video display dimensions properly
The packetizers should not call `set_video_display_width/height`
directly as that doesn't take parameter precedence into account:
command line parameters should override bitstream parameters.
2018-06-09 09:54:16 +02:00
Moritz Bunkus
4431545f5e
mkvmerge: facilities for copying/setting display unit header field 2018-06-09 09:50:48 +02:00
Moritz Bunkus
0d7d5ca3dd
GUI: headers: fix removal status text for mandatory elements with default values
Fixes #2320.
2018-06-09 08:59:22 +02:00
Moritz Bunkus
21d09d4bcd
nlohmann JSON: don't use std::snprintf
libintl.h defines a preprocessor define for `snprintf` with the
content of `libintl_snprintf` if the C library isn't GNU's
glibc. Therefore `std::snprintf` actually becomes
`std::libintl_snprintf` which doesn't exist. This affects e.g. mingw
and macOS.
2018-06-08 23:11:53 +02:00