: _intrinsic_duration (0)
, _edit_rate (24, 1)
, _time_code_rate (24)
+ , _xml_id (make_uuid ())
{
}
xml.reset (new cxml::Document ("SubtitleReel"));
xml->read_file (file);
parse_xml (xml);
- _id = remove_urn_uuid (xml->string_child ("Id"));
+ _id = _xml_id = remove_urn_uuid (xml->string_child ("Id"));
} catch (cxml::Error& e) {
boost::throw_exception (
DCPReadError (
void
SMPTESubtitleAsset::parse_xml (shared_ptr<cxml::Document> xml)
{
+ _xml_id = remove_urn_uuid(xml->string_child("Id"));
_load_font_nodes = type_children<dcp::SMPTELoadFontNode> (xml, "LoadFont");
_content_title_text = xml->string_child ("ContentTitleText");
root->set_namespace_declaration ("http://www.smpte-ra.org/schemas/428-7/2010/DCST", "dcst");
root->set_namespace_declaration ("http://www.w3.org/2001/XMLSchema", "xs");
- root->add_child("Id", "dcst")->add_child_text ("urn:uuid:" + _id);
+ root->add_child("Id", "dcst")->add_child_text ("urn:uuid:" + _xml_id);
root->add_child("ContentTitleText", "dcst")->add_child_text (_content_title_text);
if (_annotation_text) {
root->add_child("AnnotationText", "dcst")->add_child_text (_annotation_text.get ());
return _start_time;
}
+ std::string xml_id () const {
+ return _xml_id;
+ }
+
static bool valid_mxf (boost::filesystem::path);
protected:
}
private:
+ friend struct ::write_smpte_subtitle_test;
+ friend struct ::write_smpte_subtitle_test2;
+
void read_fonts (boost::shared_ptr<ASDCP::TimedText::MXFReader>);
void parse_xml (boost::shared_ptr<cxml::Document> xml);
void read_mxf_descriptor (boost::shared_ptr<ASDCP::TimedText::MXFReader> reader, boost::shared_ptr<DecryptionContext> dec);
boost::optional<Time> _start_time;
std::list<boost::shared_ptr<SMPTELoadFontNode> > _load_font_nodes;
+ /** UUID for the XML inside the MXF, which should be different to the ID of the MXF according to
+ * Doremi's 2.8.18 release notes.
+ */
+ std::string _xml_id;
};
}
--- /dev/null
+/*
+ Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+
+ This file is part of libdcp.
+
+ libdcp is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ libdcp is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with libdcp. If not, see <http://www.gnu.org/licenses/>.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of portions of this program with the
+ OpenSSL library under certain conditions as described in each
+ individual source file, and distribute linked combinations
+ including the two.
+
+ You must obey the GNU General Public License in all respects
+ for all of the code used other than OpenSSL. If you modify
+ file(s) with this exception, you may extend this exception to your
+ version of the file(s), but you are not obligated to do so. If you
+ do not wish to do so, delete this exception statement from your
+ version. If you delete this exception statement from all source
+ files in the program, then also delete it here.
+*/
+
+#include <boost/test/unit_test.hpp>
+#include "smpte_subtitle_asset.h"
+
+using std::string;
+using boost::optional;
+
+BOOST_AUTO_TEST_CASE (smpte_subtitle_id_test)
+{
+ dcp::SMPTESubtitleAsset subs;
+ subs.add(dcp::SubtitleString(
+ optional<string>(),
+ false, false, false,
+ dcp::Colour(),
+ 64,
+ 1,
+ dcp::Time(0, 1, 2, 3, 24),
+ dcp::Time(0, 2, 2, 3, 24),
+ 0.5,
+ dcp::HALIGN_CENTER,
+ 0.5,
+ dcp::VALIGN_CENTER,
+ dcp::DIRECTION_LTR,
+ "Hello",
+ dcp::NONE,
+ dcp::Colour(),
+ dcp::Time(0, 0, 0, 0, 24),
+ dcp::Time(0, 0, 0, 0, 24)
+ ));
+ subs.write("build/test/smpte_subtitle_id_test.mxf");
+
+ dcp::SMPTESubtitleAsset check("build/test/smpte_subtitle_id_test.mxf");
+ BOOST_CHECK(check.id() != check.xml_id());
+}