mkvextract: USF: format_timestamp expects timestamps in nanoseconds

Fixes #2875.
This commit is contained in:
Moritz Bunkus 2020-07-12 18:03:47 +02:00
parent 270cac5c6c
commit 7910f0e70c
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
4 changed files with 17 additions and 3 deletions

View File

@ -13,6 +13,8 @@
tree-like structure" mode, the GUI always stopped at the first cluster
regardless of the setting of the "verbosity" option.
* Windows installer: the images are shown again. Fixes #2868.
* mkvextract: USF subtitles: start & end timestamps were too high by a factor
of 1.000.000. Fixes #2875.
# Version 48.0.0 "Sick Of Losing Soulmates" 2020-06-27

View File

@ -366,13 +366,13 @@ xtr_usf_c::finish_track() {
std::stringstream text_in(text);
pugi::xml_document subtitle_doc;
if (!subtitle_doc.load(text_in, pugi::parse_default | pugi::parse_declaration | pugi::parse_doctype | pugi::parse_pi | pugi::parse_comments)) {
mxwarn(fmt::format(Y("Track {0}: An USF subtitle entry starting at timestamp {1} is not well-formed XML and will be skipped.\n"), m_tid, mtx::string::format_timestamp(entry.m_start * 1000000, 3)));
mxwarn(fmt::format(Y("Track {0}: An USF subtitle entry starting at timestamp {1} is not well-formed XML and will be skipped.\n"), m_tid, mtx::string::format_timestamp(entry.m_start, 3)));
continue;
}
auto subtitle = subtitles.append_child("subtitle");
subtitle.append_attribute("start").set_value(mtx::string::format_timestamp(entry.m_start * 1000000, 3).c_str());
subtitle.append_attribute("stop"). set_value(mtx::string::format_timestamp(entry.m_end * 1000000, 3).c_str());
subtitle.append_attribute("start").set_value(mtx::string::format_timestamp(entry.m_start, 3).c_str());
subtitle.append_attribute("stop"). set_value(mtx::string::format_timestamp(entry.m_end, 3).c_str());
for (auto child : subtitle_doc.document_element())
subtitle.append_copy(child);

View File

@ -545,3 +545,4 @@ T_696wavpack5:167606e4e11fef79a9cb859a371d4d8a-009b8b5a53f51ddf0f8fd3be3bf808cb-
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
T_700X_usf:c57150efb37908136e2c9a05944bc307-46001697d31d3a435ac65008cd37ea5a:passed:20200712-180338:0.023615368

11
tests/test-700X_usf.rb Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/ruby -w
# T_700X_usf
describe "mkextract / USF subtitles"
test_merge "data/subtitles/usf/u.usf", :keep_tmp => true
test "USF extraction" do
extract tmp, 0 => "#{tmp}-1"
hash_file "#{tmp}-1"
end