a random ID and the current time.
*/
string const uuid = make_uuid();
- _content_version_id = "urn:uuid:" + uuid;
- _content_version_label_text = uuid + LocalTime().as_string ();
+ _content_version.id = "urn:uuid:" + uuid;
+ _content_version.label_text = uuid + LocalTime().as_string ();
}
/** Construct a CPL object from a XML file */
_content_kind = content_kind_from_string (f.string_child ("ContentKind"));
shared_ptr<cxml::Node> content_version = f.optional_node_child ("ContentVersion");
if (content_version) {
- _content_version_id = content_version->optional_string_child ("Id").get_value_or ("");
- _content_version_label_text = content_version->string_child ("LabelText");
+ _content_version.id = content_version->optional_string_child("Id").get_value_or("");
+ _content_version.label_text = content_version->string_child("LabelText");
content_version->done ();
} else if (_standard == SMPTE) {
/* ContentVersion is required in SMPTE */
root->add_child("Creator")->add_child_text (_creator);
root->add_child("ContentTitleText")->add_child_text (_content_title_text);
root->add_child("ContentKind")->add_child_text (content_kind_to_string (_content_kind));
- {
- xmlpp::Node* cv = root->add_child ("ContentVersion");
- cv->add_child ("Id")->add_child_text (_content_version_id);
- cv->add_child ("LabelText")->add_child_text (_content_version_label_text);
- }
+ _content_version.as_xml (root);
+
xmlpp::Element* rating_list = root->add_child("RatingList");
BOOST_FOREACH (Rating i, _ratings) {
i.as_xml (rating_list->add_child("Rating"));
_content_title_text = ct;
}
- /** @return contents of the <Id> node within <ContentVersion> */
- void set_content_version_id (std::string id) {
- _content_version_id = id;
- }
-
- /** @return contents of the <LabelText> node within <ContentVersion> */
- void set_content_version_label_text (std::string text) {
- _content_version_label_text = text;
+ /** Set the contents of the ContentVersion tag */
+ void set_content_version (ContentVersion v) {
+ _content_version = v;
}
/** @return the type of the content, used by media servers
_ratings = r;
}
- std::string content_version_label_text () const {
- return _content_version_label_text;
+ ContentVersion content_version () const {
+ return _content_version;
}
static std::string static_pkl_type (Standard standard);
std::string _annotation_text;
std::string _content_title_text; ///< <ContentTitleText>
ContentKind _content_kind; ///< <ContentKind>
- std::string _content_version_id; ///< <Id> in <ContentVersion>
- std::string _content_version_label_text; ///< <LabelText> in <ContentVersion>
+ ContentVersion _content_version; ///< <ContentVersion>
std::list<boost::shared_ptr<Reel> > _reels;
std::list<Rating> _ratings;
s << r.agency << " " << r.label;
return s;
}
+
+
+void
+ContentVersion::as_xml (xmlpp::Element* parent) const
+{
+ xmlpp::Node* cv = parent->add_child("ContentVersion");
+ cv->add_child("Id")->add_child_text(id);
+ cv->add_child("LabelText")->add_child_text(label_text);
+}
+
extern bool operator== (Rating const & a, Rating const & b);
extern std::ostream& operator<< (std::ostream& s, Rating const & r);
+
+class ContentVersion
+{
+public:
+ ContentVersion () {}
+
+ ContentVersion (std::string id_, std::string label_text_)
+ : id (id_)
+ , label_text (label_text_)
+ {}
+
+ void as_xml (xmlpp::Element* parent) const;
+
+ std::string id;
+ std::string label_text;
+};
+
}
#endif
boost::filesystem::create_directories ("build/test/DCP/dcp_test2");
dcp::DCP d ("build/test/DCP/dcp_test2");
shared_ptr<dcp::CPL> cpl (new dcp::CPL ("A Test DCP", dcp::FEATURE));
- cpl->set_content_version_id ("urn:uri:81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00");
- cpl->set_content_version_label_text ("81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00");
+ cpl->set_content_version (
+ dcp::ContentVersion("urn:uri:81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00", "81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00")
+ );
cpl->set_issuer ("OpenDCP 0.0.25");
cpl->set_creator ("OpenDCP 0.0.25");
cpl->set_issue_date ("2012-07-17T04:45:18+00:00");
boost::filesystem::create_directories ("build/test/DCP/dcp_test5");
dcp::DCP d ("build/test/DCP/dcp_test5");
shared_ptr<dcp::CPL> cpl (new dcp::CPL ("A Test DCP", dcp::FEATURE));
- cpl->set_content_version_id ("urn:uri:81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00");
- cpl->set_content_version_label_text ("81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00");
+ cpl->set_content_version (
+ dcp::ContentVersion("urn:uri:81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00", "81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00")
+ );
cpl->set_issuer ("OpenDCP 0.0.25");
cpl->set_creator ("OpenDCP 0.0.25");
cpl->set_issue_date ("2012-07-17T04:45:18+00:00");
shared_ptr<dcp::ReelSoundAsset> (new dcp::ReelSoundAsset (ms, 0)),
shared_ptr<dcp::ReelSubtitleAsset> ()
)));
- cpl->set_content_version_id ("urn:uri:81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00");
- cpl->set_content_version_label_text ("81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00");
+ cpl->set_content_version (
+ dcp::ContentVersion("urn:uri:81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00", "81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00")
+ );
cpl->set_annotation_text ("A Test DCP");
cpl->set_issuer ("OpenDCP 0.0.25");
cpl->set_creator ("OpenDCP 0.0.25");
cpl->set_creator (creator);
cpl->set_issue_date (issue_date);
cpl->set_annotation_text (annotation_text);
- cpl->set_content_version_label_text ("foo");
+ dcp::ContentVersion cv = cpl->content_version ();
+ cv.label_text = "foo";
+ cpl->set_content_version (cv);
dcp::DCP dcp ("build/test/write_interop_subtitle_test3");
dcp.add (cpl);