mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-25 04:11:44 +00:00
Matroska reader: fix default track
flag handling
Let's take a Matroska file with a subtitle track with its `default track` set to `on`. When you remux that file, forcing that flag to off via `--default-track …:no`, the first other track of the same type (subtitles) that is read from a container which does not provide such `default track` information (e.g. an SRT file) should have its `default track` flag set. Before this change this wasn't the case; the track from the SRT would have its flag set to `no`. The Matroska reader was always signalling "default track = yes` at the container level to the packetizer, even if it was overridden via command line options. The flag would still be set to `no` in the output file, but the fact that there was a `yes` at the container level prevented `mkvmerge` from considering other tracks which only had a priority of `track type`. Fixes #2863.
This commit is contained in:
parent
4e2530afca
commit
a310e7d120
11
NEWS.md
11
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
|
# Version 48.0.0 "Sick Of Losing Soulmates" 2020-06-27
|
||||||
|
|
||||||
## New features and enhancements
|
## New features and enhancements
|
||||||
|
@ -1649,11 +1649,12 @@ kax_reader_c::set_packetizer_headers(kax_track_t *t) {
|
|||||||
if (m_appending)
|
if (m_appending)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (t->default_track)
|
if (!PTZR(t->ptzr)->m_ti.m_default_track.has_value()) {
|
||||||
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);
|
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())
|
else
|
||||||
PTZR(t->ptzr)->m_ti.m_default_track = false;
|
PTZR(t->ptzr)->m_ti.m_default_track = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (t->forced_track && !PTZR(t->ptzr)->m_ti.m_forced_track.has_value())
|
if (t->forced_track && !PTZR(t->ptzr)->m_ti.m_forced_track.has_value())
|
||||||
PTZR(t->ptzr)->set_track_forced_flag(true);
|
PTZR(t->ptzr)->set_track_forced_flag(true);
|
||||||
|
@ -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_696wavpack5:167606e4e11fef79a9cb859a371d4d8a-009b8b5a53f51ddf0f8fd3be3bf808cb-167606e4e11fef79a9cb859a371d4d8a:passed:20200617-144644:0.079896556
|
||||||
T_697dts_es_xch:true:passed:20200622-160456:0.0
|
T_697dts_es_xch:true:passed:20200622-160456:0.0
|
||||||
T_698ac3_dolby_surround_ex:true-true-true:passed:20200622-173931:0.051167592
|
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
|
||||||
|
16
tests/test-699default_track_forced_off_vs_default_by_type.rb
Executable file
16
tests/test-699default_track_forced_off_vs_default_by_type.rb
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user