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.
This commit is contained in:
Moritz Bunkus 2018-06-09 12:05:18 +02:00
parent cc75b794e4
commit e1b74c6e6f
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
4 changed files with 30 additions and 16 deletions

View File

@ -698,14 +698,6 @@ kax_reader_c::verify_dvb_subtitle_track(kax_track_t *t) {
return false;
}
if (t->private_data->get_size() == 4) {
// The subtitling type byte is missing. Add it. From ETSI EN 300 468 table 26:
// 0x10 = DVB subtitles (normal) with no monitor aspect ratio criticality
t->private_data->resize(5);
t->private_data->get_buffer()[4] = 0x10;
}
return true;
}
@ -1977,6 +1969,22 @@ kax_reader_c::create_audio_packetizer(kax_track_t *t,
t->handle_packetizer_codec_delay();
}
void
kax_reader_c::create_dvbsub_subtitle_packetizer(kax_track_t &t,
track_info_c &nti) {
if (t.private_data->get_size() == 4) {
// The subtitling type byte is missing. Add it. From ETSI EN 300 468 table 26:
// 0x10 = DVB subtitles (normal) with no monitor aspect ratio criticality
t.private_data->resize(5);
t.private_data->get_buffer()[4] = 0x10;
}
set_track_packetizer(&t, new dvbsub_packetizer_c(this, nti, t.private_data));
show_packetizer_info(t.tnum, t.ptzr_ptr);
t.sub_type = 'p';
}
void
kax_reader_c::create_subtitle_packetizer(kax_track_t *t,
track_info_c &nti) {
@ -1986,12 +1994,10 @@ kax_reader_c::create_subtitle_packetizer(kax_track_t *t,
t->sub_type = 'v';
} else if (t->codec.is(codec_c::type_e::S_DVBSUB)) {
set_track_packetizer(t, new dvbsub_packetizer_c(this, nti, t->private_data));
show_packetizer_info(t->tnum, t->ptzr_ptr);
t->sub_type = 'p';
} else if (t->codec.is(codec_c::type_e::S_DVBSUB))
create_dvbsub_subtitle_packetizer(*t, nti);
} else if (t->codec.is(codec_c::type_e::S_WEBVTT)) {
else if (t->codec.is(codec_c::type_e::S_WEBVTT)) {
set_track_packetizer(t, new webvtt_packetizer_c(this, nti));
show_packetizer_info(t->tnum, t->ptzr_ptr);

View File

@ -314,6 +314,8 @@ protected:
virtual void create_avc_video_packetizer(kax_track_t *t, track_info_c &nti);
virtual void create_avc_es_video_packetizer(kax_track_t *t, track_info_c &nti);
virtual void create_dvbsub_subtitle_packetizer(kax_track_t &t, track_info_c &nti);
virtual void read_headers_info(mm_io_c *io, EbmlElement *l0, int64_t position);
virtual void read_headers_info_writing_app(KaxWritingApp *&kwriting_app);
virtual void read_headers_track_audio(kax_track_t *track, KaxTrackAudio *ktaudio);

View File

@ -428,7 +428,7 @@ T_579vobsub_in_matroska_without_codecprivate:405065b599ed13549aed6f6a3a4d9a61-8b
T_580mp4_dash_moof_after_moov_and_mdat:f1fff7b1ebacc42779b81a28a8419e22:passed:20170127-203233:0.04411854
T_581mp4_multiple_moov_atoms:66936ba41652629cf1c65fc944016c19:passed:20170129-104017:0.104375064
T_582reading_mp4_with_and_without_track_order:fedfd2e0b9c21c282c6c94ecb6787999-fedfd2e0b9c21c282c6c94ecb6787999:passed:20170211-173020:0.065096784
T_583dvbsub_four_bytes_codecprivate:2eb500871b0eefccbf284c9a7b20fad9-60ea2bea10aedfc7b9e3281292bb63cb:passed:20170217-183748:0.078521662
T_583dvbsub_four_bytes_codecprivate:4+4+4-351d2991cf139bb1fe6db31652f9da6f:passed:20170217-183748:0.078521662
T_584ac_3_misdetected_as_mp3:true-8d0eb2c407a645f9925d3f0eca0f9e2a:passed:20170218-123152:0.369584022
T_585h264_wrong_mapping_of_timestamps_to_frames:b029b516547274fa059f9cb467a15072:passed:20170318-172210:0.580192044
T_586h265_invalid_default_display_window_in_sps_vui:d60a90e202c1fc45a8df995c9c3afc44:passed:20170319-185708:0.186032079

View File

@ -5,5 +5,11 @@ describe "mkvmerge / DVB subtitles in Matroska with CodecPrivate missing the sub
file = "data/subtitles/dvbsub/codecprivate_four_bytes.mkv"
test_identify file
test_merge file
test "codec private length" do
identify_json(file)["tracks"].
select { |t| t["codec"] == "DVBSUB" }.
map { |t| t["properties"]["codec_private_length"].to_s }.
join('+')
end
test_merge file, :args => "-A -D"