summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-01-28 14:52:32 +0000
committerCarl Hetherington <cth@carlh.net>2014-01-28 14:52:32 +0000
commit4126980a15f4f6bb981d0793bd37483456c5bc79 (patch)
treefbc22b199fc7c747aa74e03ef22e65d0d61b2d1c /src
parentd88c2244d4f90d54164fcc856c3ba73809756381 (diff)
Misc fixes.
Diffstat (limited to 'src')
-rw-r--r--src/cpl.cc13
-rw-r--r--src/cpl.h8
-rw-r--r--src/reel.cc4
-rw-r--r--src/reel_asset.cc7
-rw-r--r--src/reel_stereo_picture_asset.cc12
-rw-r--r--src/reel_stereo_picture_asset.h4
6 files changed, 43 insertions, 5 deletions
diff --git a/src/cpl.cc b/src/cpl.cc
index 99c14d40..fc1b878c 100644
--- a/src/cpl.cc
+++ b/src/cpl.cc
@@ -47,9 +47,18 @@ using namespace dcp;
CPL::CPL (string annotation_text, ContentKind content_kind)
: _annotation_text (annotation_text)
+ /* default _content_title_text to _annotation_text */
+ , _content_title_text (annotation_text)
, _content_kind (content_kind)
+ , _content_version_id ("urn:uuid:" + make_uuid ())
{
-
+ /* default _content_version_id to and _content_version_label to
+ a random ID and the current time.
+ */
+ time_t now = time (0);
+ struct tm* tm = localtime (&now);
+ _content_version_id = "urn:uuid:" + make_uuid() + tm_to_string (tm);
+ _content_version_label_text = _content_version_id;
}
/** Construct a CPL object from a XML file */
@@ -114,7 +123,7 @@ CPL::write_xml (boost::filesystem::path file, Standard standard, XMLMetadata met
root->add_child("IssueDate")->add_child_text (metadata.issue_date);
root->add_child("Issuer")->add_child_text (metadata.issuer);
root->add_child("Creator")->add_child_text (metadata.creator);
- root->add_child("ContentTitleText")->add_child_text (_content_version_label_text);
+ 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");
diff --git a/src/cpl.h b/src/cpl.h
index 2066130e..f695e4e2 100644
--- a/src/cpl.h
+++ b/src/cpl.h
@@ -70,6 +70,14 @@ public:
std::string content_title_text () const {
return _content_title_text;
}
+
+ void set_content_version_id (std::string id) {
+ _content_version_id = id;
+ }
+
+ void set_content_version_label_text (std::string text) {
+ _content_version_label_text = text;
+ }
/** @return the type of the content, used by media servers
* to categorise things (e.g. feature, trailer, etc.)
diff --git a/src/reel.cc b/src/reel.cc
index 723a2db4..4bdbcb5f 100644
--- a/src/reel.cc
+++ b/src/reel.cc
@@ -74,7 +74,7 @@ Reel::write_to_cpl (xmlpp::Element* node, Standard standard) const
reel->add_child("Id")->add_child_text ("urn:uuid:" + make_uuid());
xmlpp::Element* asset_list = reel->add_child ("AssetList");
- if (_main_picture && dynamic_pointer_cast<MonoPictureMXF> (_main_picture)) {
+ if (_main_picture && dynamic_pointer_cast<ReelMonoPictureAsset> (_main_picture)) {
/* Mono pictures come before other stuff... */
_main_picture->write_to_cpl (asset_list, standard);
}
@@ -87,7 +87,7 @@ Reel::write_to_cpl (xmlpp::Element* node, Standard standard) const
_main_subtitle->write_to_cpl (asset_list, standard);
}
- if (_main_picture && dynamic_pointer_cast<StereoPictureMXF> (_main_picture)) {
+ if (_main_picture && dynamic_pointer_cast<ReelStereoPictureAsset> (_main_picture)) {
/* ... but stereo pictures must come after */
_main_picture->write_to_cpl (asset_list, standard);
}
diff --git a/src/reel_asset.cc b/src/reel_asset.cc
index b25aeb15..fa0068c5 100644
--- a/src/reel_asset.cc
+++ b/src/reel_asset.cc
@@ -40,6 +40,10 @@ ReelAsset::ReelAsset ()
}
+/** Construct a ReelAsset.
+ * @param content Content that this asset refers to.
+ * @param entry_point Entry point to use in that content.
+ */
ReelAsset::ReelAsset (boost::shared_ptr<Content> content, int64_t entry_point)
: Object (content->id ())
, _content (content)
@@ -49,7 +53,8 @@ ReelAsset::ReelAsset (boost::shared_ptr<Content> content, int64_t entry_point)
, _duration (_intrinsic_duration - _entry_point)
, _hash (make_digest (content->file (), 0))
{
-
+ /* default _annotation_text to the leaf name of our file */
+ _annotation_text = content->file().leaf().string ();
}
ReelAsset::ReelAsset (boost::shared_ptr<const cxml::Node> node)
diff --git a/src/reel_stereo_picture_asset.cc b/src/reel_stereo_picture_asset.cc
index a9cdab71..0df61175 100644
--- a/src/reel_stereo_picture_asset.cc
+++ b/src/reel_stereo_picture_asset.cc
@@ -18,6 +18,7 @@
*/
#include "reel_stereo_picture_asset.h"
+#include "stereo_picture_mxf.h"
#include <libcxml/cxml.h>
using std::string;
@@ -26,6 +27,17 @@ using std::make_pair;
using boost::shared_ptr;
using namespace dcp;
+ReelStereoPictureAsset::ReelStereoPictureAsset ()
+{
+
+}
+
+ReelStereoPictureAsset::ReelStereoPictureAsset (boost::shared_ptr<StereoPictureMXF> mxf, int64_t entry_point)
+ : ReelPictureAsset (mxf, entry_point)
+{
+
+}
+
ReelStereoPictureAsset::ReelStereoPictureAsset (boost::shared_ptr<const cxml::Node> node)
: ReelPictureAsset (node)
{
diff --git a/src/reel_stereo_picture_asset.h b/src/reel_stereo_picture_asset.h
index 6ae67217..56e357be 100644
--- a/src/reel_stereo_picture_asset.h
+++ b/src/reel_stereo_picture_asset.h
@@ -21,9 +21,13 @@
namespace dcp {
+class StereoPictureMXF;
+
class ReelStereoPictureAsset : public ReelPictureAsset
{
public:
+ ReelStereoPictureAsset ();
+ ReelStereoPictureAsset (boost::shared_ptr<StereoPictureMXF> content, int64_t entry_point);
ReelStereoPictureAsset (boost::shared_ptr<const cxml::Node>);
private: