Fix (I think) AuthenticatedPublic signer.
[libdcp.git] / src / picture_asset.h
index 2031a9ed5bd052b72074e07a6bc52be3e5eb7226..2af1f69ad0a940c2f270256eb5805fb3b2312a7b 100644 (file)
@@ -21,7 +21,7 @@
 #define LIBDCP_PICTURE_ASSET_H
 
 /** @file  src/picture_asset.h
- *  @brief An asset made up of JPEG2000 files
+ *  @brief An asset made up of JPEG2000 data
  */
 
 #include <openjpeg.h>
@@ -34,10 +34,9 @@ namespace libdcp
 
 class MonoPictureFrame;        
 class StereoPictureFrame;
-class MonoPictureAssetWriter;
-class StereoPictureAssetWriter;
+class PictureAssetWriter;
 
-/** @brief An asset made up of JPEG2000 files */
+/** @brief An asset made up of JPEG2000 data */
 class PictureAsset : public MXFAsset
 {
 public:
@@ -55,11 +54,26 @@ public:
         *  @param directory Directory where MXF file is.
         *  @param mxf_name Name of MXF file.
         *  @param progress Signal to use to inform of progres, or 0.
-        *  @param fps Video Frames per second.
-        *  @param intrinsic_duration Duration of all the frames in the asset.
+        *  @param fps Video frames per second.
+        *  @param intrinsic_duration Total number of 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, bool encrypted, Size);
+       PictureAsset (
+               std::string directory,
+               std::string mxf_name,
+               boost::signals2::signal<void (float)>* progress,
+               int fps,
+               int intrinsic_duration,
+               bool encrypted,
+               Size
+               );
+
+       /** Start a progressive write to this asset.
+        *  @param overwrite true to overwrite an existing MXF file; in this mode, writing can be resumed to a partially-written MXF; false if the
+        *  MXF file does not exist.
+        *  @param metadata MXF metadata to use.
+        */
+       virtual boost::shared_ptr<PictureAssetWriter> start_write (bool overwrite, bool interop, MXFMetadata const & metadata = MXFMetadata ()) = 0;
        
        bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> note) const;
 
@@ -67,7 +81,7 @@ public:
                return _size;
        }
 
-       void write_to_cpl (xmlpp::Node *) const;
+       void write_to_cpl (xmlpp::Element *, bool) const;
 
 protected:     
 
@@ -81,12 +95,9 @@ protected:
 
 private:
        std::string key_type () const;
-       std::string cpl_node_name () const;
+       virtual int edit_rate_factor () const = 0;
 };
 
-class MonoPictureAsset;
-
-
 /** A 2D (monoscopic) picture asset */
 class MonoPictureAsset : public PictureAsset
 {
@@ -99,7 +110,7 @@ public:
         *  @param mxf_name Name of MXF file to create.
         *  @param progress Signal to inform of progress.
         *  @param fps Video frames per second.
-        *  @param intrinsic_duration Length of the whole asset in frames.
+        *  @param intrinsic_duration Total number of frames in the asset.
         *  @param size Size of images in pixels.
         *  @param encrypted true if asset should be encrypted.
         */
@@ -112,6 +123,7 @@ public:
                int intrinsic_duration,
                bool encrypted,
                Size size,
+               bool interop,
                MXFMetadata const & metadata = MXFMetadata ()
                );
 
@@ -123,7 +135,7 @@ public:
         *  @param mxf_name Name of MXF file to create.
         *  @param progress Signal to inform of progress.
         *  @param fps Video frames per second.
-        *  @param intrinsic_duration Length of the whole asset in frames.
+        *  @param intrinsic_duration Total number of frames in the asset.
         *  @param size Size of images in pixels.
         *  @param encrypted true if asset should be encrypted.
         */
@@ -136,6 +148,7 @@ public:
                int intrinsic_duration,
                bool encrypted,
                Size size,
+               bool interop,
                MXFMetadata const & metadata = MXFMetadata ()
                );
 
@@ -156,14 +169,16 @@ 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, MXFMetadata const & metadata = MXFMetadata ());
+       boost::shared_ptr<PictureAssetWriter> start_write (bool, 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)>, MXFMetadata const &);
+       void construct (boost::function<std::string (int)>, bool, MXFMetadata const &);
+       std::string cpl_node_name () const;
+       int edit_rate_factor () const;
 };
 
 /** A 3D (stereoscopic) picture asset */       
@@ -183,10 +198,15 @@ public:
        StereoPictureAsset (std::string directory, std::string mxf_name, int fps, Size size);
 
        /** Start a progressive write to a StereoPictureAsset */
-       boost::shared_ptr<StereoPictureAssetWriter> start_write (bool, MXFMetadata const & metadata = MXFMetadata ());
+       boost::shared_ptr<PictureAssetWriter> start_write (bool, bool, MXFMetadata const & metadata = MXFMetadata ());
 
        boost::shared_ptr<const StereoPictureFrame> 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 cpl_node_name () const;
+       std::pair<std::string, std::string> cpl_node_attribute (bool) const;
+       int edit_rate_factor () const;
 };