Fix incorrect day-of-month in LocalTime.
[libdcp.git] / src / mono_picture_mxf.cc
index e33454dc0cdd5045d5caaca5a4ff6bfadc9e6fb0..09311a01fb0a9cf39e131ee4a051e646879c91b4 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 #include "AS_DCP.h"
 #include "KM_fileio.h"
 #include "exceptions.h"
+#include "dcp_assert.h"
 #include "mono_picture_frame.h"
+#include "compose.hpp"
 
 using std::string;
 using std::vector;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
-using boost::lexical_cast;
 using namespace dcp;
 
 MonoPictureMXF::MonoPictureMXF (boost::filesystem::path file)
@@ -46,6 +47,13 @@ MonoPictureMXF::MonoPictureMXF (boost::filesystem::path file)
        }
 
        read_picture_descriptor (desc);
+       
+       ASDCP::WriterInfo info;
+       if (ASDCP_FAILURE (reader.FillWriterInfo (info))) {
+               boost::throw_exception (DCPReadError ("could not read video MXF information"));
+       }
+
+       read_writer_info (info);
 }
 
 MonoPictureMXF::MonoPictureMXF (Fraction edit_rate)
@@ -61,8 +69,12 @@ MonoPictureMXF::get_frame (int n) const
 }
 
 bool
-MonoPictureMXF::equals (shared_ptr<const Content> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const
+MonoPictureMXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler note) const
 {
+       if (!dynamic_pointer_cast<const MonoPictureMXF> (other)) {
+               return false;
+       }
+       
        if (!MXF::equals (other, opt, note)) {
                return false;
        }
@@ -93,14 +105,14 @@ MonoPictureMXF::equals (shared_ptr<const Content> other, EqualityOptions opt, bo
        }
 
        shared_ptr<const MonoPictureMXF> other_picture = dynamic_pointer_cast<const MonoPictureMXF> (other);
-       assert (other_picture);
+       DCP_ASSERT (other_picture);
 
        for (int i = 0; i < _intrinsic_duration; ++i) {
                if (i >= other_picture->intrinsic_duration()) {
                        return false;
                }
                
-               note (PROGRESS, "Comparing video frame " + lexical_cast<string> (i) + " of " + lexical_cast<string> (_intrinsic_duration));
+               note (DCP_PROGRESS, String::compose ("Comparing video frame %1 of %2", i, _intrinsic_duration));
                shared_ptr<const MonoPictureFrame> frame_A = get_frame (i);
                shared_ptr<const MonoPictureFrame> frame_B = other_picture->get_frame (i);
                
@@ -128,9 +140,3 @@ MonoPictureMXF::cpl_node_name () const
 {
        return "MainPicture";
 }
-
-int
-MonoPictureMXF::edit_rate_factor () const
-{
-       return 1;
-}