Rename TYPE_DEBUG_PLAYER to TYPE_DEBUG_VIDEO_VIEW.
[dcpomatic.git] / src / lib / video_mxf_content.cc
index 325ea8e7214a460cc52e447c26e96e07cf5f4a56..0c905a624219eec3ce07527583ac0d6fd6065d4a 100644 (file)
@@ -24,6 +24,7 @@
 #include "job.h"
 #include "film.h"
 #include "compose.hpp"
+#include <asdcp/KM_log.h>
 #include <dcp/mono_picture_asset.h>
 #include <dcp/stereo_picture_asset.h>
 #include <dcp/exceptions.h>
 using std::list;
 using std::string;
 using boost::shared_ptr;
+using namespace dcpomatic;
 
-VideoMXFContent::VideoMXFContent (shared_ptr<const Film> film, boost::filesystem::path path)
-       : Content (film, path)
+VideoMXFContent::VideoMXFContent (boost::filesystem::path path)
+       : Content (path)
 {
 
 }
 
-VideoMXFContent::VideoMXFContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
-       : Content (film, node)
+VideoMXFContent::VideoMXFContent (cxml::ConstNodePtr node, int version)
+       : Content (node)
 {
        video = VideoContent::from_xml (this, node, version);
 }
@@ -50,33 +52,38 @@ VideoMXFContent::VideoMXFContent (shared_ptr<const Film> film, cxml::ConstNodePt
 bool
 VideoMXFContent::valid_mxf (boost::filesystem::path path)
 {
+       Kumu::DefaultLogSink().UnsetFilterFlag(Kumu::LOG_ALLOW_ALL);
+
        try {
                shared_ptr<dcp::MonoPictureAsset> mp (new dcp::MonoPictureAsset (path));
                return true;
        } catch (dcp::MXFFileError& e) {
 
-       } catch (dcp::DCPReadError& e) {
+       } catch (dcp::ReadError& e) {
 
        }
 
        try {
+               Kumu::DefaultLogSink().SetFilterFlag(0);
                shared_ptr<dcp::StereoPictureAsset> sp (new dcp::StereoPictureAsset (path));
                return true;
        } catch (dcp::MXFFileError& e) {
 
-       } catch (dcp::DCPReadError& e) {
+       } catch (dcp::ReadError& e) {
 
        }
 
+       Kumu::DefaultLogSink().SetFilterFlag(Kumu::LOG_ALLOW_ALL);
+
        return false;
 }
 
 void
-VideoMXFContent::examine (shared_ptr<Job> job)
+VideoMXFContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
 {
        job->set_progress_unknown ();
 
-       Content::examine (job);
+       Content::examine (film, job);
 
        video.reset (new VideoContent (this));
        shared_ptr<VideoMXFExaminer> examiner (new VideoMXFExaminer (shared_from_this ()));
@@ -111,14 +118,21 @@ VideoMXFContent::as_xml (xmlpp::Node* node, bool with_paths) const
 }
 
 DCPTime
-VideoMXFContent::full_length () const
+VideoMXFContent::full_length (shared_ptr<const Film> film) const
+{
+       FrameRateChange const frc (film, shared_from_this());
+       return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
+}
+
+DCPTime
+VideoMXFContent::approximate_length () const
 {
-       FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate());
-       return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film()->video_frame_rate());
+       return DCPTime::from_frames (video->length_after_3d_combine(), 24);
 }
 
 void
-VideoMXFContent::add_properties (list<UserProperty>& p) const
+VideoMXFContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p) const
 {
+       Content::add_properties (film, p);
        video->add_properties (p);
 }