Unpick MXF from the class hierarchy.
[libdcp.git] / src / sound_mxf.cc
index 05dac418e752613d80e01452c16823330fea62da..19a30bff9287eb7784fb55f2554ec2bbc3ac5796 100644 (file)
@@ -29,6 +29,7 @@
 #include "compose.hpp"
 #include "KM_fileio.h"
 #include "AS_DCP.h"
+#include "dcp_assert.h"
 #include <libxml++/nodes/element.h>
 #include <boost/filesystem.hpp>
 #include <iostream>
@@ -43,7 +44,8 @@ using boost::shared_ptr;
 using namespace dcp;
 
 SoundMXF::SoundMXF (boost::filesystem::path file)
-       : MXF (file)
+       : Asset (file)
+       , _intrinsic_duration (0)
        , _channels (0)
        , _sampling_rate (0)
 {
@@ -69,12 +71,12 @@ SoundMXF::SoundMXF (boost::filesystem::path file)
                boost::throw_exception (DCPReadError ("could not read audio MXF information"));
        }
 
-       read_writer_info (info);
-
+       _id = read_writer_info (info);
 }
 
 SoundMXF::SoundMXF (Fraction edit_rate, int sampling_rate, int channels)
-       : MXF (edit_rate)
+       : _edit_rate (edit_rate)
+       , _intrinsic_duration (0)
        , _channels (channels)
        , _sampling_rate (sampling_rate)
 {
@@ -82,12 +84,8 @@ SoundMXF::SoundMXF (Fraction edit_rate, int sampling_rate, int channels)
 }
 
 bool
-SoundMXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
+SoundMXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler note) const
 {
-       if (!MXF::equals (other, opt, note)) {
-               return false;
-       }
-                    
        ASDCP::PCM::MXFReader reader_A;
        Kumu::Result_t r = reader_A.OpenRead (file().string().c_str());
        if (ASDCP_FAILURE (r)) {
@@ -170,3 +168,16 @@ SoundMXF::start_write (boost::filesystem::path file, Standard standard)
        /* XXX: can't we use a shared_ptr here? */
        return shared_ptr<SoundMXFWriter> (new SoundMXFWriter (this, file, standard));
 }
+
+string
+SoundMXF::pkl_type (Standard standard) const
+{
+       switch (standard) {
+       case INTEROP:
+               return "application/x-smpte-mxf;asdcpKind=Sound";
+       case SMPTE:
+               return "application/mxf";
+       default:
+               DCP_ASSERT (false);
+       }
+}