X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fvideo_mxf_content.cc;h=bf8bb9f469b22fb772c9b547f8876e40284f4175;hp=f5fab485e023ac2103958fe5bf36ebc94b82f199;hb=386e25f3b9d3fa59cbdeed458d9b3e0d21e338b8;hpb=5a5324ed3a381a86dfe0a6e3932c1d58fdcd596f diff --git a/src/lib/video_mxf_content.cc b/src/lib/video_mxf_content.cc index f5fab485e..bf8bb9f46 100644 --- a/src/lib/video_mxf_content.cc +++ b/src/lib/video_mxf_content.cc @@ -24,27 +24,27 @@ #include "job.h" #include "film.h" #include "compose.hpp" +#include #include #include #include #include -#include #include "i18n.h" using std::list; using std::string; using boost::shared_ptr; -using boost::make_shared; +using namespace dcpomatic; -VideoMXFContent::VideoMXFContent (shared_ptr film, boost::filesystem::path path) - : Content (film, path) +VideoMXFContent::VideoMXFContent (boost::filesystem::path path) + : Content (path) { } -VideoMXFContent::VideoMXFContent (shared_ptr 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); } @@ -52,8 +52,10 @@ VideoMXFContent::VideoMXFContent (shared_ptr film, cxml::ConstNodePt bool VideoMXFContent::valid_mxf (boost::filesystem::path path) { + Kumu::DefaultLogSink().UnsetFilterFlag(Kumu::LOG_ALLOW_ALL); + try { - shared_ptr mp = make_shared (path); + shared_ptr mp (new dcp::MonoPictureAsset (path)); return true; } catch (dcp::MXFFileError& e) { @@ -62,7 +64,8 @@ VideoMXFContent::valid_mxf (boost::filesystem::path path) } try { - shared_ptr sp = make_shared (path); + Kumu::DefaultLogSink().SetFilterFlag(0); + shared_ptr sp (new dcp::StereoPictureAsset (path)); return true; } catch (dcp::MXFFileError& e) { @@ -70,19 +73,22 @@ VideoMXFContent::valid_mxf (boost::filesystem::path path) } + Kumu::DefaultLogSink().SetFilterFlag(Kumu::LOG_ALLOW_ALL); + return false; } void -VideoMXFContent::examine (shared_ptr job) +VideoMXFContent::examine (shared_ptr film, shared_ptr job) { job->set_progress_unknown (); - Content::examine (job); + Content::examine (film, job); video.reset (new VideoContent (this)); - shared_ptr examiner = make_shared (shared_from_this ()); + shared_ptr examiner (new VideoMXFExaminer (shared_from_this ())); video->take_from_examiner (examiner); + video->unset_colour_conversion (); } string @@ -104,28 +110,29 @@ VideoMXFContent::identifier () const } void -VideoMXFContent::as_xml (xmlpp::Node* node) const +VideoMXFContent::as_xml (xmlpp::Node* node, bool with_paths) const { node->add_child("Type")->add_child_text ("VideoMXF"); - Content::as_xml (node); + Content::as_xml (node, with_paths); video->as_xml (node); } DCPTime -VideoMXFContent::full_length () const +VideoMXFContent::full_length (shared_ptr film) 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()); + FrameRateChange const frc (film, shared_from_this()); + return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film->video_frame_rate()); } -void -VideoMXFContent::add_properties (list& p) const +DCPTime +VideoMXFContent::approximate_length () const { - video->add_properties (p); + return DCPTime::from_frames (video->length_after_3d_combine(), 24); } void -VideoMXFContent::set_default_colour_conversion () +VideoMXFContent::add_properties (shared_ptr film, list& p) const { - video->unset_colour_conversion (); + Content::add_properties (film, p); + video->add_properties (p); }