Merge branch '1.0' of git.carlh.net:git/libdcp into 1.0
[libdcp.git] / src / mxf.h
index f2c0fdf794cbf6952f0a434cb7bae77d8b822078..f0ad4bd837cf2671312a6194a9467f195ae271b7 100644 (file)
--- a/src/mxf.h
+++ b/src/mxf.h
@@ -30,6 +30,10 @@ namespace ASDCP {
        class AESDecContext;
 }
 
+/* Undefine some stuff that the OS X 10.5 SDK defines */
+#undef Key
+#undef set_key
+
 namespace dcp
 {
 
@@ -45,16 +49,10 @@ public:
        MXF (boost::filesystem::path file);
        ~MXF ();
 
-       virtual std::string key_type () const = 0;
-       
-       std::string pkl_type () const {
-               return "application/x-smpte-mxf";
-       }
-       
        bool equals (
-               boost::shared_ptr<const Content> other,
+               boost::shared_ptr<const Asset> other,
                EqualityOptions opt,
-               boost::function<void (NoteType, std::string)> note
+               NoteHandler note
                ) const;
 
        /** Fill in a ADSCP::WriteInfo struct.
@@ -63,46 +61,75 @@ public:
         */
        void fill_writer_info (ASDCP::WriterInfo* w, Standard standard);
 
-       void set_progress (boost::signals2::signal<void (float)>* progress) {
-               _progress = progress;
-       }
-
+       /** @return true if the data is encrypted */
        bool encrypted () const {
                return !_key_id.empty ();
        }
 
+       /** Set the ID of the key that is used for encryption/decryption.
+        *  @param i key ID.
+        */
        void set_key_id (std::string i) {
                _key_id = i;
        }
 
+       /** @return the ID of the key used for encryption/decryption, or an empty string */
        std::string key_id () const {
                return _key_id;
        }
-       
+
        void set_key (Key);
 
+       /** @return encryption/decryption key, if one has been set */
        boost::optional<Key> key () const {
                return _key;
        }
 
+       /** @return encryption context, set up with any key that has been passed to set_key() */
        ASDCP::AESEncContext* encryption_context () const {
                return _encryption_context;
        }
 
+       /** Set the metadata that is written to the MXF file.
+        *  @param m Metadata.
+        */
        void set_metadata (MXFMetadata m) {
                _metadata = m;
        }
 
+       /** @return metadata from the MXF file */
        MXFMetadata metadata () const {
                return _metadata;
        }
 
+       Fraction edit_rate () const {
+               return _edit_rate;
+       }
+
+       /** @return The total length of this content in video frames.
+        *  The amount of content presented may be less than this.
+        */
+       int64_t intrinsic_duration () const {
+               return _intrinsic_duration;
+       }
+       
 protected:
-       /** Signal to emit to report progress, or 0 */
-       boost::signals2::signal<void (float)>* _progress;
+       friend class MXFWriter;
+
+       std::string pkl_type (Standard standard) const;
+       void read_writer_info (ASDCP::WriterInfo const &);
+       
+       Fraction _edit_rate;
+       /** The total length of this content in video frames.  The amount of
+        *  content presented may be less than this.
+        */
+       int64_t _intrinsic_duration;
+       
        ASDCP::AESEncContext* _encryption_context;
        ASDCP::AESDecContext* _decryption_context;
+       /** ID of the key used for encryption/decryption, or an empty string */
        std::string _key_id;
+       /** Key used for encryption/decryption, if there is one */
        boost::optional<Key> _key;
        MXFMetadata _metadata;
 };