diff --git a/NEWS.md b/NEWS.md index 85a5004a0..a069160e5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,14 @@ +# Version ? + +## Bug fixes + +* mkvmerge: Matroska reader: when reading tracks (e.g. a subtitle track) from + Matroska files with their `default track` flag set to `yes`, and when + overwriting those via the command line to `no`, `mkvmerge` would not promote + additional tracks of the same type from other files (e.g. another subtitle + track from an SRT file). Fixes #2863. + + # Version 48.0.0 "Sick Of Losing Soulmates" 2020-06-27 ## New features and enhancements diff --git a/src/input/r_matroska.cpp b/src/input/r_matroska.cpp index 010c37e3e..ea52668a7 100644 --- a/src/input/r_matroska.cpp +++ b/src/input/r_matroska.cpp @@ -1649,11 +1649,12 @@ kax_reader_c::set_packetizer_headers(kax_track_t *t) { if (m_appending) return; - if (t->default_track) - PTZR(t->ptzr)->set_as_default_track(t->type == 'v' ? DEFTRACK_TYPE_VIDEO : t->type == 'a' ? DEFTRACK_TYPE_AUDIO : DEFTRACK_TYPE_SUBS, DEFAULT_TRACK_PRIORITY_FROM_SOURCE); - - else if (!PTZR(t->ptzr)->m_ti.m_default_track.has_value()) - PTZR(t->ptzr)->m_ti.m_default_track = false; + if (!PTZR(t->ptzr)->m_ti.m_default_track.has_value()) { + if (t->default_track) + PTZR(t->ptzr)->set_as_default_track(t->type == 'v' ? DEFTRACK_TYPE_VIDEO : t->type == 'a' ? DEFTRACK_TYPE_AUDIO : DEFTRACK_TYPE_SUBS, DEFAULT_TRACK_PRIORITY_FROM_SOURCE); + else + PTZR(t->ptzr)->m_ti.m_default_track = false; + } if (t->forced_track && !PTZR(t->ptzr)->m_ti.m_forced_track.has_value()) PTZR(t->ptzr)->set_track_forced_flag(true); diff --git a/tests/results.txt b/tests/results.txt index 640d850c0..0e0b814c3 100644 --- a/tests/results.txt +++ b/tests/results.txt @@ -544,3 +544,4 @@ T_695mpeg_ts_single_h264_frame_with_unbounded_pes_size:a97c491d719a6228d593e6d67 T_696wavpack5:167606e4e11fef79a9cb859a371d4d8a-009b8b5a53f51ddf0f8fd3be3bf808cb-167606e4e11fef79a9cb859a371d4d8a:passed:20200617-144644:0.079896556 T_697dts_es_xch:true:passed:20200622-160456:0.0 T_698ac3_dolby_surround_ex:true-true-true:passed:20200622-173931:0.051167592 +T_699default_track_forced_off_vs_default_by_type:59aea3a8b7c10b1e64e6e241f2dc979c-true-59aea3a8b7c10b1e64e6e241f2dc979c-true-c4e85aed908bbe688fe6949c442cdbba-true:passed:20200629-201706:0.073934952 diff --git a/tests/test-699default_track_forced_off_vs_default_by_type.rb b/tests/test-699default_track_forced_off_vs_default_by_type.rb new file mode 100755 index 000000000..72e83997e --- /dev/null +++ b/tests/test-699default_track_forced_off_vs_default_by_type.rb @@ -0,0 +1,16 @@ +#!/usr/bin/ruby -w + +# T_699default_track_forced_off_vs_default_by_type +describe "mkvmerge / Matroska file with 'default track' set, overwritten on command line, track from additional SRT file should become default" + +file_names = "data/mkv/sub-is-default.mks data/subtitles/srt/ven.srt" +specs = [ [ "", true, false ], [ "--default-track 0:yes", true, false ], [ "--default-track 0:no", false, true ] ] + +specs.each do |spec| + test_merge file_names, :args => spec[0], :keep_tmp => true + + test "#{spec}" do + json = identify_json(tmp) + (json["tracks"][0]["properties"]["default_track"] == spec[1]) && (json["tracks"][1]["properties"]["default_track"] == spec[2]) + end +end