From 0dc52cd6e69890cd8a2c539e80389ea8bac5cc3c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 9 Jul 2014 10:17:49 +0100 Subject: [PATCH] Fix DCP name in editor; fix use of DCP entry points. --- src/lib/content.h | 3 +++ src/lib/dcp_content.cc | 8 ++++++-- src/lib/dcp_content.h | 1 + src/lib/dcp_decoder.cc | 7 ++++--- src/lib/dcp_examiner.cc | 2 ++ src/lib/dcp_examiner.h | 6 ++++++ 6 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/lib/content.h b/src/lib/content.h index 6bbf33b35..ab14dc6f5 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -65,6 +65,9 @@ public: virtual ~Content () {} virtual void examine (boost::shared_ptr); + /** @return Quick one-line summary of the content, as will be presented in the + * film editor. + */ virtual std::string summary () const = 0; /** @return Technical details of this content; these are written to logs to * help with debugging. diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 663846e26..3d4a48b89 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -56,14 +56,18 @@ DCPContent::examine (shared_ptr job) { job->set_progress_unknown (); Content::examine (job); - shared_ptr examiner (new DCPExaminer (shared_from_this ())); + shared_ptr examiner (new DCPExaminer (shared_from_this ())); take_from_video_examiner (examiner); + + boost::mutex::scoped_lock lm (_mutex); + _name = examiner->name (); } string DCPContent::summary () const { - return String::compose (_("%1 [DCP]"), path_summary ()); + boost::mutex::scoped_lock lm (_mutex); + return String::compose (_("%1 [DCP]"), _name); } string diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index 7f3ac956d..22b5fa08d 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -46,4 +46,5 @@ private: void read_directory (boost::filesystem::path); boost::filesystem::path _directory; + std::string _name; }; diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc index 14672a23b..1939fc1c9 100644 --- a/src/lib/dcp_decoder.cc +++ b/src/lib/dcp_decoder.cc @@ -62,20 +62,21 @@ DCPDecoder::pass () shared_ptr mxf = (*_reel)->main_picture()->mxf (); shared_ptr mono = dynamic_pointer_cast (mxf); shared_ptr stereo = dynamic_pointer_cast (mxf); + int64_t const ep = (*_reel)->main_picture()->entry_point (); if (mono) { shared_ptr image (new Image (PIX_FMT_RGB24, mxf->size(), false)); - mono->get_frame (_next.frames (vfr))->rgb_frame (image->data()[0]); + mono->get_frame (ep + _next.frames (vfr))->rgb_frame (image->data()[0]); shared_ptr aligned (new Image (image, true)); video (shared_ptr (new RawImageProxy (aligned, _log)), _next.frames (vfr)); } else { shared_ptr left (new Image (PIX_FMT_RGB24, mxf->size(), false)); - stereo->get_frame (_next.frames (vfr))->rgb_frame (dcp::EYE_LEFT, left->data()[0]); + stereo->get_frame (ep + _next.frames (vfr))->rgb_frame (dcp::EYE_LEFT, left->data()[0]); shared_ptr aligned_left (new Image (left, true)); video (shared_ptr (new RawImageProxy (aligned_left, _log)), _next.frames (vfr)); shared_ptr right (new Image (PIX_FMT_RGB24, mxf->size(), false)); - stereo->get_frame (_next.frames (vfr))->rgb_frame (dcp::EYE_RIGHT, right->data()[0]); + stereo->get_frame (ep + _next.frames (vfr))->rgb_frame (dcp::EYE_RIGHT, right->data()[0]); shared_ptr aligned_right (new Image (right, true)); video (shared_ptr (new RawImageProxy (aligned_right, _log)), _next.frames (vfr)); } diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index 7ce18c9f7..3051a4670 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -43,6 +43,8 @@ DCPExaminer::DCPExaminer (shared_ptr content) throw DCPError ("Multiple CPLs found in DCP"); } + _name = dcp.cpls().front()->content_title_text (); + list > reels = dcp.cpls().front()->reels (); for (list >::const_iterator i = reels.begin(); i != reels.end(); ++i) { diff --git a/src/lib/dcp_examiner.h b/src/lib/dcp_examiner.h index c8b0ef7da..a2793c788 100644 --- a/src/lib/dcp_examiner.h +++ b/src/lib/dcp_examiner.h @@ -38,10 +38,16 @@ public: return _video_length; } + std::string name () const { + return _name; + } + private: boost::optional _video_frame_rate; boost::optional _video_size; ContentTime _video_length; + /* XXX: used? */ boost::optional _audio_channels; boost::optional _audio_frame_rate; + std::string _name; }; -- 2.30.2