This is an attempt to fix DoM bug #2205.
subtitles_as_xml (root, 250, Standard::INTEROP);
- return doc.write_to_string ("UTF-8");
+ return format_xml(doc, {});
}
{
xmlpp::Document doc;
auto root = doc.create_root_node ("SubtitleReel");
- root->set_namespace_declaration (subtitle_smpte_ns);
- root->set_namespace_declaration ("http://www.w3.org/2001/XMLSchema", "xs");
DCP_ASSERT (_xml_id);
root->add_child("Id")->add_child_text("urn:uuid:" + *_xml_id);
subtitles_as_xml (root->add_child("SubtitleList"), _time_code_rate, Standard::SMPTE);
- return doc.write_to_string ("UTF-8");
+ return format_xml(doc, { {"", subtitle_smpte_ns}, {"xs", "http://www.w3.org/2001/XMLSchema"} });
}
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/shared_array.hpp>
+#include <algorithm>
-using std::dynamic_pointer_cast;
-using std::string;
-using std::cout;
using std::cerr;
+using std::cout;
+using std::dynamic_pointer_cast;
+using std::make_shared;
using std::map;
+using std::pair;
using std::shared_ptr;
+using std::string;
using std::vector;
-using std::make_shared;
-using boost::optional;
using boost::lexical_cast;
+using boost::optional;
using namespace dcp;
}
}
}
+
+
+namespace {
+
+struct State
+{
+ int indent;
+ string xml;
+ int disable_formatting;
+};
+
+}
+
+
+static
+void
+format_xml_node (xmlpp::Node const* node, State& state)
+{
+ if (auto text_node = dynamic_cast<const xmlpp::TextNode*>(node)) {
+ string content = text_node->get_content();
+ boost::replace_all(content, "&", "&");
+ boost::replace_all(content, "<", "<");
+ boost::replace_all(content, ">", ">");
+ state.xml += content;
+ } else if (auto element = dynamic_cast<const xmlpp::Element*>(node)) {
+ ++state.indent;
+
+ auto children = element->get_children();
+ auto const should_disable_formatting =
+ std::any_of(
+ children.begin(), children.end(),
+ [](xmlpp::Node const* node) { return static_cast<bool>(dynamic_cast<const xmlpp::ContentNode*>(node)); }
+ ) || element->get_name() == "Text";
+
+ if (!state.disable_formatting) {
+ state.xml += "\n" + string(state.indent * 2, ' ');
+ }
+
+ state.xml += "<" + element->get_name();
+
+ for (auto attribute: element->get_attributes()) {
+ state.xml += String::compose(" %1=\"%2\"", attribute->get_name().raw(), attribute->get_value().raw());
+ }
+
+ if (children.empty()) {
+ state.xml += "/>";
+ } else {
+ state.xml += ">";
+
+ if (should_disable_formatting) {
+ ++state.disable_formatting;
+ }
+
+ for (auto child: children) {
+ format_xml_node(child, state);
+ }
+
+ if (!state.disable_formatting) {
+ state.xml += "\n" + string(state.indent * 2, ' ');
+ }
+
+ state.xml += String::compose("</%1>", element->get_name().raw());
+
+ if (should_disable_formatting) {
+ --state.disable_formatting;
+ }
+ }
+
+ --state.indent;
+ }
+}
+
+
+/** Format XML much as write_to_string_formatted() would do, except without adding any white space
+ * to <Text> nodes. This is an attempt to avoid changing what is actually displayed as subtitles
+ * while also formatting the XML in such a way as to avoid DoM bug 2205.
+ *
+ * namespace is a list of namespaces for the root node; it would be nicer to set these up with
+ * set_namespace_declaration in the caller and then to extract them here but I couldn't find a way
+ * to get all namespaces with the libxml++ API.
+ */
+string
+SubtitleAsset::format_xml (xmlpp::Document const& document, vector<pair<string, string>> const& namespaces)
+{
+ auto root = document.get_root_node();
+
+ State state = {};
+ state.xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<" + root->get_name();
+
+ for (auto const& ns: namespaces) {
+ if (ns.first.empty()) {
+ state.xml += String::compose(" xmlns=\"%1\"", ns.second);
+ } else {
+ state.xml += String::compose(" xmlns:%1=\"%2\"", ns.first, ns.second);
+ }
+ }
+
+ for (auto attribute: root->get_attributes()) {
+ state.xml += String::compose(" %1=\"%2\"", attribute->get_name().raw(), attribute->get_value().raw());
+ }
+
+ state.xml += ">";
+
+ for (auto child: document.get_root_node()->get_children()) {
+ format_xml_node(child, state);
+ }
+
+ state.xml += String::compose("\n</%1>\n", root->get_name().raw());
+
+ return state.xml;
+}
+
#include <libcxml/cxml.h>
#include <boost/shared_array.hpp>
#include <map>
+#include <string>
+#include <utility>
+#include <vector>
namespace xmlpp {
+ class Document;
class Element;
}
return _raw_xml;
}
+ static std::string format_xml (xmlpp::Document const& document, std::vector<std::pair<std::string, std::string>> const& namespaces);
+
protected:
friend struct ::interop_dcp_font_test;
friend struct ::smpte_dcp_font_test;
c._id = "a6c58cff-3e1e-4b38-acec-a42224475ef6";
check_xml (
- "<DCSubtitle Version=\"1.0\">"
- "<SubtitleID>a6c58cff-3e1e-4b38-acec-a42224475ef6</SubtitleID>"
- "<MovieTitle>Test</MovieTitle>"
- "<ReelNumber>1</ReelNumber>"
- "<Language>EN</Language>"
- "<Font AspectAdjust=\"1.0\" Color=\"FFFFFFFF\" Effect=\"none\" EffectColor=\"FF000000\" Id=\"Frutiger\" Italic=\"no\" Script=\"normal\" Size=\"48\" Underlined=\"no\" Weight=\"normal\">"
- "<Subtitle SpotNumber=\"1\" TimeIn=\"00:04:09:229\" TimeOut=\"00:04:11:229\" FadeUpTime=\"0\" FadeDownTime=\"0\">"
- "<Text VAlign=\"top\" VPosition=\"80\">Hello world</Text>"
- "</Subtitle>"
- "</Font>"
- "<Font AspectAdjust=\"1.0\" Color=\"FF800040\" Effect=\"border\" EffectColor=\"FF010203\" Italic=\"yes\" Script=\"normal\" Size=\"91\" Underlined=\"yes\" Weight=\"bold\">"
- "<Subtitle SpotNumber=\"2\" TimeIn=\"05:41:00:219\" TimeOut=\"06:12:15:219\" FadeUpTime=\"930792\" FadeDownTime=\"4591834\">"
- "<Text VAlign=\"bottom\" VPosition=\"40\">What's going <Space Size=\"9em\"/>on</Text>"
- "</Subtitle>"
- "</Font>"
+ "<DCSubtitle Version=\"1.0\">\n"
+ " <SubtitleID>a6c58cff-3e1e-4b38-acec-a42224475ef6</SubtitleID>\n"
+ " <MovieTitle>Test</MovieTitle>\n"
+ " <ReelNumber>1</ReelNumber>\n"
+ " <Language>EN</Language>\n"
+ " <Font AspectAdjust=\"1.0\" Color=\"FFFFFFFF\" Effect=\"none\" EffectColor=\"FF000000\" Id=\"Frutiger\" Italic=\"no\" Script=\"normal\" Size=\"48\" Underlined=\"no\" Weight=\"normal\">\n"
+ " <Subtitle SpotNumber=\"1\" TimeIn=\"00:04:09:229\" TimeOut=\"00:04:11:229\" FadeUpTime=\"0\" FadeDownTime=\"0\">\n"
+ " <Text VAlign=\"top\" VPosition=\"80\">Hello world</Text>\n"
+ " </Subtitle>\n"
+ " </Font>\n"
+ " <Font AspectAdjust=\"1.0\" Color=\"FF800040\" Effect=\"border\" EffectColor=\"FF010203\" Italic=\"yes\" Script=\"normal\" Size=\"91\" Underlined=\"yes\" Weight=\"bold\">\n"
+ " <Subtitle SpotNumber=\"2\" TimeIn=\"05:41:00:219\" TimeOut=\"06:12:15:219\" FadeUpTime=\"930792\" FadeDownTime=\"4591834\">\n"
+ " <Text VAlign=\"bottom\" VPosition=\"40\">What's going <Space Size=\"9em\"/>on</Text>\n"
+ " </Subtitle>\n"
+ " </Font>\n"
"</DCSubtitle>",
c.xml_as_string (),
vector<string>()
c._id = "a6c58cff-3e1e-4b38-acec-a42224475ef6";
check_xml (
- "<DCSubtitle Version=\"1.0\">"
- "<SubtitleID>a6c58cff-3e1e-4b38-acec-a42224475ef6</SubtitleID>"
- "<MovieTitle>Test</MovieTitle>"
- "<ReelNumber>1</ReelNumber>"
- "<Language>EN</Language>"
- "<Font AspectAdjust=\"1.0\" Color=\"FFFFFFFF\" Effect=\"none\" EffectColor=\"FF000000\" Id=\"Frutiger\" Italic=\"no\" Script=\"normal\" Size=\"48\" Underlined=\"no\" Weight=\"normal\">"
- "<Subtitle SpotNumber=\"1\" TimeIn=\"00:04:09:229\" TimeOut=\"00:04:11:229\" FadeUpTime=\"0\" FadeDownTime=\"0\">"
- "<Text HPosition=\"-20\" VAlign=\"top\" VPosition=\"80\">Hello world</Text>"
- "</Subtitle>"
- "</Font>"
- "<Font AspectAdjust=\"1.0\" Color=\"FF800040\" Effect=\"border\" EffectColor=\"FF010203\" Italic=\"yes\" Script=\"normal\" Size=\"91\" Underlined=\"yes\" Weight=\"bold\">"
- "<Subtitle SpotNumber=\"2\" TimeIn=\"05:41:00:219\" TimeOut=\"06:12:15:219\" FadeUpTime=\"930792\" FadeDownTime=\"4591834\">"
- "<Text HPosition=\"-20\" VAlign=\"bottom\" VPosition=\"40\">What's going on</Text>"
- "</Subtitle>"
- "</Font>"
+ "<DCSubtitle Version=\"1.0\">\n"
+ " <SubtitleID>a6c58cff-3e1e-4b38-acec-a42224475ef6</SubtitleID>\n"
+ " <MovieTitle>Test</MovieTitle>\n"
+ " <ReelNumber>1</ReelNumber>\n"
+ " <Language>EN</Language>\n"
+ " <Font AspectAdjust=\"1.0\" Color=\"FFFFFFFF\" Effect=\"none\" EffectColor=\"FF000000\" Id=\"Frutiger\" Italic=\"no\" Script=\"normal\" Size=\"48\" Underlined=\"no\" Weight=\"normal\">\n"
+ " <Subtitle SpotNumber=\"1\" TimeIn=\"00:04:09:229\" TimeOut=\"00:04:11:229\" FadeUpTime=\"0\" FadeDownTime=\"0\">\n"
+ " <Text HPosition=\"-20\" VAlign=\"top\" VPosition=\"80\">Hello world</Text>\n"
+ " </Subtitle>\n"
+ " </Font>\n"
+ " <Font AspectAdjust=\"1.0\" Color=\"FF800040\" Effect=\"border\" EffectColor=\"FF010203\" Italic=\"yes\" Script=\"normal\" Size=\"91\" Underlined=\"yes\" Weight=\"bold\">\n"
+ " <Subtitle SpotNumber=\"2\" TimeIn=\"05:41:00:219\" TimeOut=\"06:12:15:219\" FadeUpTime=\"930792\" FadeDownTime=\"4591834\">\n"
+ " <Text HPosition=\"-20\" VAlign=\"bottom\" VPosition=\"40\">What's going on</Text>\n"
+ " </Subtitle>\n"
+ " </Font>\n"
"</DCSubtitle>",
c.xml_as_string (),
vector<string>()
<Path>subs.xml</Path>
<VolumeIndex>1</VolumeIndex>
<Offset>0</Offset>
- <Length>414</Length>
+ <Length>438</Length>
</Chunk>
</ChunkList>
</Asset>
<Asset>
<Id>urn:uuid:46c3eb45-15e5-47d6-8684-d8641e4dc516</Id>
<AnnotationText>46c3eb45-15e5-47d6-8684-d8641e4dc516</AnnotationText>
- <Hash>614bJ4VLsNZ6mLbdXbZXjGuoSsY=</Hash>
+ <Hash>Y8rZTMi93JjmkgwFK7Fu3W5rz/Y=</Hash>
<Size>1061</Size>
<Type>text/xml;asdcpKind=CPL</Type>
</Asset>
<Asset>
<Id>urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6</Id>
<AnnotationText>a6c58cff-3e1e-4b38-acec-a42224475ef6</AnnotationText>
- <Hash>cVnFjMLTQnSIAlIzJpNB/p7B230=</Hash>
- <Size>414</Size>
+ <Hash>ilLkOSjxgHZxkAdOPVJBoDFiUh8=</Hash>
+ <Size>438</Size>
<Type>text/xml;asdcpKind=Subtitle</Type>
</Asset>
<Asset>
<?xml version="1.0" encoding="UTF-8"?>
-<DCSubtitle Version="1.0"><SubtitleID>a6c58cff-3e1e-4b38-acec-a42224475ef6</SubtitleID><MovieTitle>Test</MovieTitle><ReelNumber>1</ReelNumber><Language>EN</Language><Subtitle SpotNumber="1" TimeIn="00:04:09:229" TimeOut="00:04:11:229" FadeUpTime="0" FadeDownTime="0"><Image VAlign="top" VPosition="80">d36f4bb3-c4fa-4a95-9915-6fec3110cd71.png</Image></Subtitle></DCSubtitle>
+<DCSubtitle Version="1.0">
+ <SubtitleID>a6c58cff-3e1e-4b38-acec-a42224475ef6</SubtitleID>
+ <MovieTitle>Test</MovieTitle>
+ <ReelNumber>1</ReelNumber>
+ <Language>EN</Language>
+ <Subtitle SpotNumber="1" TimeIn="00:04:09:229" TimeOut="00:04:11:229" FadeUpTime="0" FadeDownTime="0">
+ <Image VAlign="top" VPosition="80">d36f4bb3-c4fa-4a95-9915-6fec3110cd71.png</Image>
+ </Subtitle>
+</DCSubtitle>
BOOST_CHECK_EQUAL (sub1->font._values["size"], "42");
}
+
+/* Check that subtitle XML is prettily formatted without inserting any white space into
+ * <Text> node, which I think has the potential to alter appearance.
+ */
+BOOST_AUTO_TEST_CASE (format_xml_test1)
+{
+ xmlpp::Document doc;
+ auto root = doc.create_root_node("Foo");
+ root->add_child("Empty");
+ root->add_child("Text")->add_child_text("Hello world");
+ root->add_child("Font")->add_child("Text")->add_child_text("Say what");
+ auto fred = root->add_child("Text")->add_child("Font");
+ fred->set_attribute("bob", "job");
+ fred->add_child_text("Fred");
+ fred->add_child("Text")->add_child_text("Jim");
+ fred->add_child_text("Sheila");
+ BOOST_REQUIRE_EQUAL (dcp::SubtitleAsset::format_xml(doc, { {"", "fred"}, {"jim", "sheila"} }),
+"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+"<Foo xmlns=\"fred\" xmlns:jim=\"sheila\">\n"
+" <Empty/>\n"
+" <Text>Hello world</Text>\n"
+" <Font>\n"
+" <Text>Say what</Text>\n"
+" </Font>\n"
+" <Text><Font bob=\"job\">Fred<Text>Jim</Text>Sheila</Font></Text>\n"
+"</Foo>\n");
+}
+
+
+BOOST_AUTO_TEST_CASE (format_xml_test2)
+{
+ xmlpp::DomParser parser;
+ auto path = private_test / "DKH_UT_EN20160601def.xml";
+ parser.parse_file(path.string().c_str());
+ auto document = parser.get_document();
+ check_xml (dcp::file_to_string(private_test / "DKH_UT_EN20160601def.reformatted.xml"), dcp::SubtitleAsset::format_xml(*document, {}), {});
+}
+
+
+BOOST_AUTO_TEST_CASE (format_xml_entities_test)
+{
+ xmlpp::Document doc;
+ auto root = doc.create_root_node("Foo");
+ root->add_child("Bar")->add_child_text("Don't panic & xml \"is\" 'great' & < > —");
+ BOOST_REQUIRE_EQUAL(dcp::SubtitleAsset::format_xml(doc, {}),
+"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+"<Foo>\n"
+" <Bar>Don't panic &amp; xml \"is\" 'great' & < > —</Bar>\n"
+"</Foo>\n");
+}
c._xml_id = "a6c58cff-3e1e-4b38-acec-a42224475ef6";
check_xml (
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- "<SubtitleReel xmlns=\"http://www.smpte-ra.org/schemas/428-7/2010/DCST\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
- "<Id>urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6</Id>"
- "<ContentTitleText>Test</ContentTitleText>"
- "<IssueDate>2016-04-01T03:52:00.000+00:00</IssueDate>"
- "<ReelNumber>1</ReelNumber>"
- "<Language>en</Language>"
- "<EditRate>24 1</EditRate>"
- "<TimeCodeRate>24</TimeCodeRate>"
- "<SubtitleList>"
- "<Font AspectAdjust=\"1.0\" Color=\"FFFFFFFF\" Effect=\"none\" EffectColor=\"FF000000\" ID=\"Frutiger\" Italic=\"no\" Script=\"normal\" Size=\"48\" Underline=\"no\" Weight=\"normal\">"
- "<Subtitle SpotNumber=\"1\" TimeIn=\"00:04:09:22\" TimeOut=\"00:04:11:22\" FadeUpTime=\"00:00:00:00\" FadeDownTime=\"00:00:00:00\">"
- "<Text Valign=\"top\" Vposition=\"80\">Hello world</Text>"
- "</Subtitle>"
- "</Font>"
- "<Font AspectAdjust=\"1.0\" Color=\"FF800040\" Effect=\"border\" EffectColor=\"FF010203\" Italic=\"yes\" Script=\"normal\" Size=\"91\" Underline=\"yes\" Weight=\"bold\">"
- "<Subtitle SpotNumber=\"2\" TimeIn=\"05:41:00:21\" TimeOut=\"06:12:15:21\" FadeUpTime=\"01:02:03:04\" FadeDownTime=\"05:06:07:08\">"
- "<Text Valign=\"bottom\" Vposition=\"40\" Direction=\"rtl\">What's going <Space Size=\"4.2\"/>on</Text>"
- "</Subtitle>"
- "</Font>"
- "</SubtitleList>"
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<SubtitleReel xmlns=\"http://www.smpte-ra.org/schemas/428-7/2010/DCST\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n"
+ " <Id>urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6</Id>\n"
+ " <ContentTitleText>Test</ContentTitleText>\n"
+ " <IssueDate>2016-04-01T03:52:00.000+00:00</IssueDate>\n"
+ " <ReelNumber>1</ReelNumber>\n"
+ " <Language>en</Language>\n"
+ " <EditRate>24 1</EditRate>\n"
+ " <TimeCodeRate>24</TimeCodeRate>\n"
+ " <SubtitleList>\n"
+ " <Font AspectAdjust=\"1.0\" Color=\"FFFFFFFF\" Effect=\"none\" EffectColor=\"FF000000\" ID=\"Frutiger\" Italic=\"no\" Script=\"normal\" Size=\"48\" Underline=\"no\" Weight=\"normal\">\n"
+ " <Subtitle SpotNumber=\"1\" TimeIn=\"00:04:09:22\" TimeOut=\"00:04:11:22\" FadeUpTime=\"00:00:00:00\" FadeDownTime=\"00:00:00:00\">\n"
+ " <Text Valign=\"top\" Vposition=\"80\">Hello world</Text>\n"
+ " </Subtitle>\n"
+ " </Font>\n"
+ " <Font AspectAdjust=\"1.0\" Color=\"FF800040\" Effect=\"border\" EffectColor=\"FF010203\" Italic=\"yes\" Script=\"normal\" Size=\"91\" Underline=\"yes\" Weight=\"bold\">\n"
+ " <Subtitle SpotNumber=\"2\" TimeIn=\"05:41:00:21\" TimeOut=\"06:12:15:21\" FadeUpTime=\"01:02:03:04\" FadeDownTime=\"05:06:07:08\">\n"
+ " <Text Valign=\"bottom\" Vposition=\"40\" Direction=\"rtl\">What's going <Space Size=\"4.2\"/>on</Text>\n"
+ " </Subtitle>\n"
+ " </Font>\n"
+ " </SubtitleList>\n"
"</SubtitleReel>",
c.xml_as_string (),
vector<string>()
check_xml (
c.xml_as_string(),
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- "<SubtitleReel xmlns=\"http://www.smpte-ra.org/schemas/428-7/2010/DCST\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
- "<Id>urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6</Id>"
- "<ContentTitleText>Test</ContentTitleText>"
- "<IssueDate>2016-04-01T03:52:00.000+00:00</IssueDate>"
- "<ReelNumber>1</ReelNumber>"
- "<Language>en</Language>"
- "<EditRate>24 1</EditRate>"
- "<TimeCodeRate>24</TimeCodeRate>"
- "<SubtitleList>"
- "<Font AspectAdjust=\"1.0\" Color=\"FFFFFFFF\" Effect=\"none\" EffectColor=\"FF000000\" ID=\"Arial\" Script=\"normal\" Size=\"48\" Underline=\"no\" Weight=\"normal\">"
- "<Subtitle SpotNumber=\"1\" TimeIn=\"00:00:01:00\" TimeOut=\"00:00:09:00\" FadeUpTime=\"00:00:00:00\" FadeDownTime=\"00:00:00:00\">"
- "<Text Valign=\"top\" Vposition=\"80\">"
- "<Font Italic=\"no\">Testing is </Font>"
- "<Font Italic=\"yes\">really</Font>"
- "<Font Italic=\"no\"> fun</Font>"
- "</Text>"
- "<Text Valign=\"top\" Vposition=\"90\">"
- "<Font Italic=\"no\">This is the </Font>"
- "<Font Italic=\"yes\">second</Font>"
- "<Font Italic=\"no\"> line</Font>"
- "</Text>"
- "</Subtitle>"
- "</Font>"
- "</SubtitleList>"
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<SubtitleReel xmlns=\"http://www.smpte-ra.org/schemas/428-7/2010/DCST\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n"
+ " <Id>urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6</Id>\n"
+ " <ContentTitleText>Test</ContentTitleText>\n"
+ " <IssueDate>2016-04-01T03:52:00.000+00:00</IssueDate>\n"
+ " <ReelNumber>1</ReelNumber>\n"
+ " <Language>en</Language>\n"
+ " <EditRate>24 1</EditRate>\n"
+ " <TimeCodeRate>24</TimeCodeRate>\n"
+ " <SubtitleList>\n"
+ " <Font AspectAdjust=\"1.0\" Color=\"FFFFFFFF\" Effect=\"none\" EffectColor=\"FF000000\" ID=\"Arial\" Script=\"normal\" Size=\"48\" Underline=\"no\" Weight=\"normal\">\n"
+ " <Subtitle SpotNumber=\"1\" TimeIn=\"00:00:01:00\" TimeOut=\"00:00:09:00\" FadeUpTime=\"00:00:00:00\" FadeDownTime=\"00:00:00:00\">\n"
+ " <Text Valign=\"top\" Vposition=\"80\"><Font Italic=\"no\">Testing is </Font><Font Italic=\"yes\">really</Font><Font Italic=\"no\"> fun</Font></Text>\n"
+ " <Text Valign=\"top\" Vposition=\"90\"><Font Italic=\"no\">This is the </Font><Font Italic=\"yes\">second</Font><Font Italic=\"no\"> line</Font></Text>\n"
+ " </Subtitle>\n"
+ " </Font>\n"
+ " </SubtitleList>\n"
"</SubtitleReel>",
vector<string>()
);
check_xml (
c.xml_as_string(),
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- "<SubtitleReel xmlns=\"http://www.smpte-ra.org/schemas/428-7/2010/DCST\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
- "<Id>urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6</Id>"
- "<ContentTitleText>Test</ContentTitleText>"
- "<IssueDate>2016-04-01T03:52:00.000+00:00</IssueDate>"
- "<ReelNumber>1</ReelNumber>"
- "<Language>en</Language>"
- "<EditRate>24 1</EditRate>"
- "<TimeCodeRate>24</TimeCodeRate>"
- "<SubtitleList>"
- "<Font AspectAdjust=\"1.0\" Color=\"FFFFFFFF\" Effect=\"none\" EffectColor=\"FF000000\" ID=\"Arial\" Italic=\"no\" Script=\"normal\" Size=\"48\" Underline=\"no\" Weight=\"normal\">"
- "<Subtitle SpotNumber=\"1\" TimeIn=\"00:00:01:00\" TimeOut=\"00:00:09:00\" FadeUpTime=\"00:00:00:00\" FadeDownTime=\"00:00:00:00\">"
- "<Text Valign=\"top\" Vposition=\"80\">Top line</Text>"
- "<Text Valign=\"top\" Vposition=\"90\">Bottom line</Text>"
- "</Subtitle>"
- "</Font>"
- "</SubtitleList>"
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<SubtitleReel xmlns=\"http://www.smpte-ra.org/schemas/428-7/2010/DCST\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n"
+ " <Id>urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6</Id>\n"
+ " <ContentTitleText>Test</ContentTitleText>\n"
+ " <IssueDate>2016-04-01T03:52:00.000+00:00</IssueDate>\n"
+ " <ReelNumber>1</ReelNumber>\n"
+ " <Language>en</Language>\n"
+ " <EditRate>24 1</EditRate>\n"
+ " <TimeCodeRate>24</TimeCodeRate>\n"
+ " <SubtitleList>\n"
+ " <Font AspectAdjust=\"1.0\" Color=\"FFFFFFFF\" Effect=\"none\" EffectColor=\"FF000000\" ID=\"Arial\" Italic=\"no\" Script=\"normal\" Size=\"48\" Underline=\"no\" Weight=\"normal\">\n"
+ " <Subtitle SpotNumber=\"1\" TimeIn=\"00:00:01:00\" TimeOut=\"00:00:09:00\" FadeUpTime=\"00:00:00:00\" FadeDownTime=\"00:00:00:00\">\n"
+ " <Text Valign=\"top\" Vposition=\"80\">Top line</Text>\n"
+ " <Text Valign=\"top\" Vposition=\"90\">Bottom line</Text>\n"
+ " </Subtitle>\n"
+ " </Font>\n"
+ " </SubtitleList>\n"
"</SubtitleReel>",
{}
);
check_xml (
c.xml_as_string(),
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- "<SubtitleReel xmlns=\"http://www.smpte-ra.org/schemas/428-7/2010/DCST\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
- "<Id>urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6</Id>"
- "<ContentTitleText>Test</ContentTitleText>"
- "<IssueDate>2016-04-01T03:52:00.000+00:00</IssueDate>"
- "<ReelNumber>1</ReelNumber>"
- "<Language>en</Language>"
- "<EditRate>24 1</EditRate>"
- "<TimeCodeRate>24</TimeCodeRate>"
- "<SubtitleList>"
- "<Font AspectAdjust=\"1.0\" Color=\"FFFFFFFF\" Effect=\"none\" EffectColor=\"FF000000\" ID=\"Arial\" Italic=\"no\" Script=\"normal\" Size=\"48\" Underline=\"no\" Weight=\"normal\">"
- "<Subtitle SpotNumber=\"1\" TimeIn=\"00:00:01:00\" TimeOut=\"00:00:09:00\" FadeUpTime=\"00:00:00:00\" FadeDownTime=\"00:00:00:00\">"
- "<Text Valign=\"bottom\" Vposition=\"80\">Top line</Text>"
- "<Text Valign=\"bottom\" Vposition=\"70\">Bottom line</Text>"
- "</Subtitle>"
- "</Font>"
- "</SubtitleList>"
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<SubtitleReel xmlns=\"http://www.smpte-ra.org/schemas/428-7/2010/DCST\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n"
+ " <Id>urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6</Id>\n"
+ " <ContentTitleText>Test</ContentTitleText>\n"
+ " <IssueDate>2016-04-01T03:52:00.000+00:00</IssueDate>\n"
+ " <ReelNumber>1</ReelNumber>\n"
+ " <Language>en</Language>\n"
+ " <EditRate>24 1</EditRate>\n"
+ " <TimeCodeRate>24</TimeCodeRate>\n"
+ " <SubtitleList>\n"
+ " <Font AspectAdjust=\"1.0\" Color=\"FFFFFFFF\" Effect=\"none\" EffectColor=\"FF000000\" ID=\"Arial\" Italic=\"no\" Script=\"normal\" Size=\"48\" Underline=\"no\" Weight=\"normal\">\n"
+ " <Subtitle SpotNumber=\"1\" TimeIn=\"00:00:01:00\" TimeOut=\"00:00:09:00\" FadeUpTime=\"00:00:00:00\" FadeDownTime=\"00:00:00:00\">\n"
+ " <Text Valign=\"bottom\" Vposition=\"80\">Top line</Text>\n"
+ " <Text Valign=\"bottom\" Vposition=\"70\">Bottom line</Text>\n"
+ " </Subtitle>\n"
+ " </Font>\n"
+ " </SubtitleList>\n"
"</SubtitleReel>",
{}
);
{
dcp::VerificationNote::Type::BV21_ERROR,
dcp::VerificationNote::Code::INVALID_CLOSED_CAPTION_XML_SIZE_IN_BYTES,
- string("372207"),
+ string("419346"),
canonical(dir / "subs.mxf")
},
{ dcp::VerificationNote::Type::WARNING, dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME },
check_verify_result (
{ dir },
{
- { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::INVALID_TIMED_TEXT_SIZE_IN_BYTES, string("121695136"), canonical(dir / "subs.mxf") },
+ { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::INVALID_TIMED_TEXT_SIZE_IN_BYTES, string("121695542"), canonical(dir / "subs.mxf") },
{ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::INVALID_TIMED_TEXT_FONT_SIZE_IN_BYTES, string("121634816"), canonical(dir / "subs.mxf") },
{ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_SUBTITLE_START_TIME, canonical(dir / "subs.mxf") },
{ dcp::VerificationNote::Type::WARNING, dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME },