summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-04-14 03:56:25 +0100
committerCarl Hetherington <cth@carlh.net>2016-05-18 11:50:29 +0100
commitd7e14062764e1bbe81a7a85e69d0233f371cbd59 (patch)
tree72f9cea4055badd267a3e44faf6cba8fbb952027 /src
parent150f708d27b25d5b5d4e486d03c5bc4078027997 (diff)
Fiddle with some subtitle methods.
Diffstat (limited to 'src')
-rw-r--r--src/lib/dcp_content.cc16
-rw-r--r--src/lib/dcp_content.h10
-rw-r--r--src/lib/dcp_subtitle_content.h11
-rw-r--r--src/lib/ffmpeg_content.cc24
-rw-r--r--src/lib/ffmpeg_content.h3
-rw-r--r--src/lib/ffmpeg_subtitle_stream.h7
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<const Film> 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<const Film> 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<const Film> 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<int> ("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> 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<DCPTime> 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 <class T> bool can_reference (std::string overlapping, std::list<std::string>& why_not) const;
std::string _name;
- bool _has_subtitles;
/** true if our DCP is encrypted */
bool _encrypted;
boost::optional<dcp::EncryptedKDM> _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<const Film>, boost::filesystem::path);
DCPSubtitleContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
- /* Content */
void examine (boost::shared_ptr<Job>);
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<FFmpegSubtitleStream> i, subtitle_streams()) {
- if (i->has_image_subtitles()) {
- return true;
- }
- }
-
- return false;
-}
-
-bool
-FFmpegContent::has_text_subtitles () const
-{
- BOOST_FOREACH (shared_ptr<FFmpegSubtitleStream> 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<Filter const *> 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<RGBA, RGBA> colours () const;
private: