Header guards.
[libdcp.git] / src / picture_asset.h
index c9226b1f72f05628e81296fec190233009d45ed3..cc99ddbcbe0ea592d89000fee51a7958c44114c5 100644 (file)
@@ -27,6 +27,7 @@
 #include <openjpeg.h>
 #include "mxf_asset.h"
 #include "util.h"
+#include "metadata.h"
 
 namespace libdcp
 {
@@ -56,19 +57,16 @@ public:
         *  @param intrinsic_duration Duration of all the frames in the asset.
         *  @param size Size of video frame images in pixels.
         */
-       PictureAsset (std::string directory, std::string mxf_name, boost::signals2::signal<void (float)>* progress, int fps, int intrinsic_duration, Size size);
+       PictureAsset (std::string directory, std::string mxf_name, boost::signals2::signal<void (float)>* progress, int fps, int intrinsic_duration, bool encrypted, Size);
        
-       /** Write details of this asset to a CPL stream.
-        *  @param s Stream.
-        */
-       void write_to_cpl (std::ostream& s) const;
-
        bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> note) const;
 
        Size size () const {
                return _size;
        }
 
+       void write_to_cpl (xmlpp::Node *) const;
+
 protected:     
 
        bool frame_buffer_equals (
@@ -78,6 +76,10 @@ protected:
 
        /** picture size in pixels */
        Size _size;
+
+private:
+       std::string key_type () const;
+       std::string cpl_node_name () const;
 };
 
 class MonoPictureAsset;
@@ -112,8 +114,6 @@ struct FrameInfo
 class MonoPictureAssetWriter
 {
 public:
-       ~MonoPictureAssetWriter ();
-
        FrameInfo write (uint8_t* data, int size);
        void fake_write (int size);
        void finalize ();
@@ -121,7 +121,7 @@ public:
 private:
        friend class MonoPictureAsset;
 
-       MonoPictureAssetWriter (MonoPictureAsset *, bool);
+       MonoPictureAssetWriter (MonoPictureAsset *, bool, MXFMetadata const &);
        void start (uint8_t *, int);
 
        /* no copy construction */
@@ -142,6 +142,7 @@ private:
        /** true if finalize() has been called */
        bool _finalized;
        bool _overwrite;
+       MXFMetadata _metadata;
 };
 
 /** A 2D (monoscopic) picture asset */
@@ -158,6 +159,7 @@ public:
         *  @param fps Video frames per second.
         *  @param intrinsic_duration Length of the whole asset in frames.
         *  @param size Size of images in pixels.
+        *  @param encrypted true if asset should be encrypted.
         */
        MonoPictureAsset (
                std::vector<std::string> const & files,
@@ -166,7 +168,9 @@ public:
                boost::signals2::signal<void (float)>* progress,
                int fps,
                int intrinsic_duration,
-               Size size
+               bool encrypted,
+               Size size,
+               MXFMetadata const & metadata = MXFMetadata ()
                );
 
        /** Construct a MonoPictureAsset, generating the MXF from the JPEG2000 files.
@@ -179,6 +183,7 @@ public:
         *  @param fps Video frames per second.
         *  @param intrinsic_duration Length of the whole asset in frames.
         *  @param size Size of images in pixels.
+        *  @param encrypted true if asset should be encrypted.
         */
        MonoPictureAsset (
                boost::function<std::string (int)> get_path,
@@ -187,7 +192,9 @@ public:
                boost::signals2::signal<void (float)>* progress,
                int fps,
                int intrinsic_duration,
-               Size size
+               bool encrypted,
+               Size size,
+               MXFMetadata const & metadata = MXFMetadata ()
                );
 
        /** Construct a MonoPictureAsset, reading the MXF from disk.
@@ -207,14 +214,14 @@ public:
        MonoPictureAsset (std::string directory, std::string mxf_name, int fps, Size size);
 
        /** Start a progressive write to a MonoPictureAsset */
-       boost::shared_ptr<MonoPictureAssetWriter> start_write (bool);
+       boost::shared_ptr<MonoPictureAssetWriter> start_write (bool, MXFMetadata const & metadata = MXFMetadata ());
 
        boost::shared_ptr<const MonoPictureFrame> get_frame (int n) const;
        bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> note) const;
 
 private:
        std::string path_from_list (int f, std::vector<std::string> const & files) const;
-       void construct (boost::function<std::string (int)>);
+       void construct (boost::function<std::string (int)>, MXFMetadata const &);
 };
 
 /** A 3D (stereoscopic) picture asset */