Merge branch 'master' of /home/carl/git/libdcp
[libdcp.git] / src / picture_asset.h
index 9df85bade20424df1f9a7c5253bcf562262c106d..c9226b1f72f05628e81296fec190233009d45ed3 100644 (file)
@@ -63,7 +63,7 @@ public:
         */
        void write_to_cpl (std::ostream& s) const;
 
-       bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, std::list<std::string>& notes) const;
+       bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> note) const;
 
        Size size () const {
                return _size;
@@ -72,7 +72,7 @@ public:
 protected:     
 
        bool frame_buffer_equals (
-               int frame, EqualityOptions opt, std::list<std::string>& notes,
+               int frame, EqualityOptions opt, boost::function<void (NoteType, std::string)> note,
                uint8_t const * data_A, unsigned int size_A, uint8_t const * data_B, unsigned int size_B
                ) const;
 
@@ -84,9 +84,9 @@ class MonoPictureAsset;
 
 struct FrameInfo
 {
-       FrameInfo (uint64_t o, uint64_t l, std::string h)
+       FrameInfo (uint64_t o, uint64_t s, std::string h)
                : offset (o)
-               , length (l)
+               , size (s)
                , hash (h)
        {}
 
@@ -95,7 +95,7 @@ struct FrameInfo
        void write (std::ostream& s);
        
        uint64_t offset;
-       uint64_t length;
+       uint64_t size;
        std::string hash;
 };
 
@@ -122,6 +122,7 @@ private:
        friend class MonoPictureAsset;
 
        MonoPictureAssetWriter (MonoPictureAsset *, bool);
+       void start (uint8_t *, int);
 
        /* no copy construction */
        MonoPictureAssetWriter (MonoPictureAssetWriter const &);
@@ -137,8 +138,10 @@ private:
        MonoPictureAsset* _asset;
        /** Number of picture frames written to the asset so far */
        int _frames_written;
+       bool _started;
        /** true if finalize() has been called */
        bool _finalized;
+       bool _overwrite;
 };
 
 /** A 2D (monoscopic) picture asset */
@@ -204,12 +207,10 @@ 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 ();
-
-       boost::shared_ptr<MonoPictureAssetWriter> start_overwrite ();
+       boost::shared_ptr<MonoPictureAssetWriter> start_write (bool);
 
        boost::shared_ptr<const MonoPictureFrame> get_frame (int n) const;
-       bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, std::list<std::string>& notes) 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;
@@ -223,7 +224,7 @@ public:
        StereoPictureAsset (std::string directory, std::string mxf_name, int fps, int intrinsic_duration);
        
        boost::shared_ptr<const StereoPictureFrame> get_frame (int n) const;
-       bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, std::list<std::string>& notes) const;
+       bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> note) const;
 };