From 734db122e4285f955297c6082dcf84ecc4372d19 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 3 Sep 2024 22:09:18 +0200 Subject: [PATCH] MPEG TS reader: add hack for not combining Dolby Vision layers from separate tracks --- src/common/hacks.cpp | 1 + src/common/hacks.h | 3 ++- src/input/r_mpeg_ts.cpp | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/hacks.cpp b/src/common/hacks.cpp index 52795d2bd..cc0eec485 100644 --- a/src/common/hacks.cpp +++ b/src/common/hacks.cpp @@ -68,6 +68,7 @@ get_list() { hacks.emplace_back("keep_whitespaces_in_text_subtitles", svec{ Y("Normally spaces & tabs are removed from the beginning & the end of each line in text subtitles."), Y("If this hack is enabled, they won't be removed.") }); hacks.emplace_back("always_write_block_add_ids", svec{ Y("If enabled, the BlockAddID element will be written even if it's set to its default value of 1.") }); + hacks.emplace_back("keep_dolby_vision_layers_separate", svec{ Y("Prevents mkvmerge from looking for Dolby Vision Enhancement Layers stored in a separate track & combining them with the track containing the Dolby Vision Base Layer.") }); hacks.emplace_back("cow", svec{ Y("No help available.") }); return hacks; diff --git a/src/common/hacks.h b/src/common/hacks.h index 862cd0aeb..5592ef4b9 100644 --- a/src/common/hacks.h +++ b/src/common/hacks.h @@ -47,7 +47,8 @@ constexpr unsigned int APPEND_AND_SPLIT_FLAC = 22; constexpr unsigned int DONT_NORMALIZE_PARAMETER_SETS = 23; constexpr unsigned int KEEP_WHITESPACES_IN_TEXT_SUBTITLES = 24; constexpr unsigned int ALWAYS_WRITE_BLOCK_ADD_IDS = 25; -constexpr unsigned int MAX_IDX = 25; +constexpr unsigned int KEEP_DOLBY_VISION_LAYERS_SEPARATE = 26; +constexpr unsigned int MAX_IDX = 26; } struct hack_t { diff --git a/src/input/r_mpeg_ts.cpp b/src/input/r_mpeg_ts.cpp index b34fc3482..7e82f51aa 100644 --- a/src/input/r_mpeg_ts.cpp +++ b/src/input/r_mpeg_ts.cpp @@ -32,6 +32,7 @@ #include "common/checksums/base_fwd.h" #include "common/dovi_meta.h" #include "common/endian.h" +#include "common/hacks.h" #include "common/hdmv_textst.h" #include "common/mm_io_x.h" #include "common/mp3.h" @@ -1427,6 +1428,9 @@ reader_c::read_headers_for_file(std::size_t file_num) { void reader_c::pair_dovi_base_and_enhancement_layer_tracks() { + if (mtx::hacks::is_engaged(mtx::hacks::KEEP_DOLBY_VISION_LAYERS_SEPARATE)) + return; + for (std::size_t idx = 0, num_tracks = m_tracks.size(); idx < num_tracks; ++idx) { auto &track = *m_tracks[idx];