From d7e14062764e1bbe81a7a85e69d0233f371cbd59 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 14 Apr 2016 03:56:25 +0100 Subject: [PATCH] Fiddle with some subtitle methods. --- src/lib/dcp_content.cc | 16 ++++++++++------ src/lib/dcp_content.h | 10 ---------- src/lib/dcp_subtitle_content.h | 11 ----------- src/lib/ffmpeg_content.cc | 24 ------------------------ src/lib/ffmpeg_content.h | 3 --- src/lib/ffmpeg_subtitle_stream.h | 7 ------- 6 files changed, 10 insertions(+), 61 deletions(-) diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index d47c52273..7a2d350de 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -56,7 +56,6 @@ int const DCPContentProperty::REFERENCE_SUBTITLE = 603; DCPContent::DCPContent (shared_ptr film, boost::filesystem::path p) : Content (film) - , _has_subtitles (false) , _encrypted (false) , _kdm_valid (false) , _reference_video (false) @@ -65,7 +64,6 @@ DCPContent::DCPContent (shared_ptr film, boost::filesystem::path p) { video.reset (new VideoContent (this, film)); audio.reset (new AudioContent (this, film)); - subtitle.reset (new SubtitleContent (this, film)); read_directory (p); set_default_colour_conversion (); @@ -75,16 +73,20 @@ DCPContent::DCPContent (shared_ptr film, cxml::ConstNodePtr node, in : Content (film, node) { video.reset (new VideoContent (this, film, node, version)); + audio.reset (new AudioContent (this, film, node)); audio->set_stream ( AudioStreamPtr ( new AudioStream (node->number_child ("AudioFrameRate"), AudioMapping (node->node_child ("AudioMapping"), version)) ) ); - subtitle.reset (new SubtitleContent (this, film, node, version)); _name = node->string_child ("Name"); - _has_subtitles = node->bool_child ("HasSubtitles"); + + if (node->bool_child ("HasSubtitles")) { + subtitle.reset (new SubtitleContent (this, film, node, version)); + } + _encrypted = node->bool_child ("Encrypted"); if (node->optional_node_child ("KDM")) { _kdm = dcp::EncryptedKDM (node->string_child ("KDM")); @@ -134,7 +136,9 @@ DCPContent::examine (shared_ptr job) { boost::mutex::scoped_lock lm (_mutex); _name = examiner->name (); - _has_subtitles = examiner->has_subtitles (); + if (examiner->has_subtitles ()) { + subtitle.reset (new SubtitleContent (this, film())); + } _encrypted = examiner->encrypted (); _kdm_valid = examiner->kdm_valid (); } @@ -173,7 +177,7 @@ DCPContent::as_xml (xmlpp::Node* node) const boost::mutex::scoped_lock lm (_mutex); node->add_child("Name")->add_child_text (_name); - node->add_child("HasSubtitles")->add_child_text (_has_subtitles ? "1" : "0"); + node->add_child("HasSubtitles")->add_child_text (subtitle ? "1" : "0"); node->add_child("Encrypted")->add_child_text (_encrypted ? "1" : "0"); if (_kdm) { node->add_child("KDM")->add_child_text (_kdm->as_xml ()); diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index b2bc90ebd..269a0373c 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -65,15 +65,6 @@ public: void set_default_colour_conversion (); std::list reel_split_points () const; - bool has_text_subtitles () const { - boost::mutex::scoped_lock lm (_mutex); - return _has_subtitles; - } - - bool has_image_subtitles () const { - return false; - } - void changed (int property); boost::filesystem::path directory () const; @@ -126,7 +117,6 @@ private: template bool can_reference (std::string overlapping, std::list& why_not) const; std::string _name; - bool _has_subtitles; /** true if our DCP is encrypted */ bool _encrypted; boost::optional _kdm; diff --git a/src/lib/dcp_subtitle_content.h b/src/lib/dcp_subtitle_content.h index 211765796..f454da907 100644 --- a/src/lib/dcp_subtitle_content.h +++ b/src/lib/dcp_subtitle_content.h @@ -26,23 +26,12 @@ public: DCPSubtitleContent (boost::shared_ptr, boost::filesystem::path); DCPSubtitleContent (boost::shared_ptr, cxml::ConstNodePtr, int); - /* Content */ void examine (boost::shared_ptr); std::string summary () const; std::string technical_summary () const; void as_xml (xmlpp::Node *) const; DCPTime full_length () const; - /* SubtitleContent */ - - bool has_text_subtitles () const { - return true; - } - - bool has_image_subtitles () const { - return false; - } - private: ContentTime _length; }; diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index dfeb2a0ad..463722778 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -355,30 +355,6 @@ FFmpegContent::text_subtitles_during (ContentTimePeriod period, bool starting) c return stream->text_subtitles_during (period, starting); } -bool -FFmpegContent::has_image_subtitles () const -{ - BOOST_FOREACH (shared_ptr i, subtitle_streams()) { - if (i->has_image_subtitles()) { - return true; - } - } - - return false; -} - -bool -FFmpegContent::has_text_subtitles () const -{ - BOOST_FOREACH (shared_ptr i, subtitle_streams()) { - if (i->has_text_subtitles()) { - return true; - } - } - - return false; -} - void FFmpegContent::set_default_colour_conversion () { diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index de222b0de..b11486bf1 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -63,9 +63,6 @@ public: void set_default_colour_conversion (); - bool has_text_subtitles () const; - bool has_image_subtitles () const; - void set_filters (std::vector const &); void changed (int property); diff --git a/src/lib/ffmpeg_subtitle_stream.h b/src/lib/ffmpeg_subtitle_stream.h index 175eeacef..ce4faa0e4 100644 --- a/src/lib/ffmpeg_subtitle_stream.h +++ b/src/lib/ffmpeg_subtitle_stream.h @@ -39,13 +39,6 @@ public: ContentTime find_subtitle_to (std::string id) const; void add_offset (ContentTime offset); void set_colour (RGBA from, RGBA to); - - bool has_image_subtitles () const { - return !_image_subtitles.empty (); - } - bool has_text_subtitles () const { - return !_text_subtitles.empty (); - } std::map colours () const; private: -- 2.30.2