mkvextract: don't write BOMs twice with --redirect-output

This commit is contained in:
Moritz Bunkus 2014-03-10 20:22:12 +01:00
parent ad45d0aa76
commit 441cded096
4 changed files with 30 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2014-03-10 Moritz Bunkus <moritz@bunkus.org>
* mkvextract: bug fix: during the extraction of chapters, tags or
segment info XML files with the --redirect-output parameter the
BOM (byte order mark) was written twice.
2014-03-05 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: MPEG TS: timestamp outliers are ignored if

View File

@ -162,8 +162,12 @@ ebml_chapters_converter_c::write_xml(KaxChapters &chapters,
ebml_chapters_converter_c converter;
converter.to_xml(chapters, doc);
auto flags = pugi::format_default;
if (!out.bom_written())
flags |= pugi::format_write_bom;
std::stringstream out_stream;
doc->save(out_stream, " ", pugi::format_default | pugi::format_write_bom);
doc->save(out_stream, " ", flags);
out.puts(out_stream.str());
}

View File

@ -271,3 +271,4 @@ T_422ac3_rederive_track_parameters_from_bitstream:7cf40379f451c604c8b6fce1f66b52
T_423deprecated_iso639_codes:9e7d8ab790007cf4f26ea31bb5de148f-good-6dd4fb24b0c76fb411a108102145eb71-good-2f580ffb94651b8782075a35b69258f3-good-4425838d0144c380ddbf59815cf83455-good:passed:20140222-185414:0.243526271
T_424avc_recover_point_sei_before_second_field:b66042e704ced1b55a5283d4b09876de:passed:20140304-190254:1.581374408
T_425mpeg_ts_timestamp_outlier:d9c6a4a1c7e815fed80a038128899586:passed:20140305-203603:2.509694471
T_426extract_write_bom_only_once:a9255d40de93e2731aaead0a746e582f-a9255d40de93e2731aaead0a746e582f:passed:20140310-195606:0.0

View File

@ -0,0 +1,18 @@
#!/usr/bin/ruby -w
# -*- coding: utf-8 -*-
# T_426extract_write_bom_only_once
file = "data/mkv/complex.mkv"
describe "mkvextract / write BOMs only once with --redirect-output"
test "extraction via shell redirection" do
extract(file, :mode => :chapters).
slice(0..-2).
join('').
md5
end
test "extraction via --redirect-output" do
sys "../src/mkvextract --engage no_variable_data chapters #{file} --redirect-output #{tmp} &> /dev/null"
hash_tmp
end