Throw an exception on making a DCP with no reels.
[libdcp.git] / src / reel_asset.h
index 4092a97a5c8ab5cf1ce69664ff34c632a6cac03a..654b5a974f5e6ee4ebe7490432d675cdb978bccd 100644 (file)
@@ -41,7 +41,7 @@
 #include "object.h"
 #include "util.h"
 #include "ref.h"
-#include <boost/shared_ptr.hpp>
+#include <memory>
 
 namespace cxml {
        class Node;
@@ -66,7 +66,7 @@ class ReelAsset : public Object
 {
 public:
        ReelAsset (std::string id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
-       explicit ReelAsset (boost::shared_ptr<const cxml::Node>);
+       explicit ReelAsset (std::shared_ptr<const cxml::Node>);
 
        virtual xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const = 0;
 
@@ -82,7 +82,7 @@ public:
                _entry_point = e;
        }
 
-       int64_t entry_point () const {
+       boost::optional<int64_t> entry_point () const {
                return _entry_point;
        }
 
@@ -90,10 +90,12 @@ public:
                _duration = d;
        }
 
-       int64_t duration () const {
+       boost::optional<int64_t> duration () const {
                return _duration;
        }
 
+       int64_t actual_duration () const;
+
        std::string annotation_text () const {
                return _annotation_text;
        }
@@ -102,7 +104,7 @@ public:
                _annotation_text = at;
        }
 
-       bool asset_equals (boost::shared_ptr<const ReelAsset>, EqualityOptions, NoteHandler) const;
+       bool asset_equals (std::shared_ptr<const ReelAsset>, EqualityOptions, NoteHandler) const;
 
 protected:
 
@@ -117,15 +119,15 @@ protected:
        /** @return Any namespace that should be used on the asset's node in the CPL */
        virtual std::pair<std::string, std::string> cpl_node_namespace (Standard) const;
 
-       xmlpp::Node* write_to_cpl_base (xmlpp::Node* node, Standard standard, boost::optional<std::string> hash) const;
+       xmlpp::Node* write_to_cpl_asset (xmlpp::Node* node, Standard standard, boost::optional<std::string> hash) const;
 
-       int64_t _intrinsic_duration;  ///< The &lt;IntrinsicDuration&gt; from the reel's entry for this asset
-       int64_t _duration;            ///< The &lt;Duration&gt; from the reel's entry for this asset
+       int64_t _intrinsic_duration;           ///< The &lt;IntrinsicDuration&gt; from the reel's entry for this asset
+       boost::optional<int64_t> _duration;    ///< The &lt;Duration&gt; from the reel's entry for this asset, if present
 
 private:
-       std::string _annotation_text; ///< The &lt;AnnotationText&gt; from the reel's entry for this asset
-       Fraction _edit_rate;          ///< The &lt;EditRate&gt; from the reel's entry for this asset
-       int64_t _entry_point;         ///< The &lt;EntryPoint&gt; from the reel's entry for this asset
+       std::string _annotation_text;          ///< The &lt;AnnotationText&gt; from the reel's entry for this asset
+       Fraction _edit_rate;                   ///< The &lt;EditRate&gt; from the reel's entry for this asset
+       boost::optional<int64_t> _entry_point; ///< The &lt;EntryPoint&gt; from the reel's entry for this asset
 };
 
 }