X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcp_content.cc;h=0eef075d7c0b9eddcb58c7dfd544af212e90b21c;hb=a8af9a0b57b853b8a8cd8fa35adb3fc967d59ee7;hp=b1d0d9a378b855b97893e5635d6d11d3cf5b56b5;hpb=8d58a7c5f4320ad5c111e336c45e44d6b51ab509;p=dcpomatic.git diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index b1d0d9a37..0eef075d7 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -34,6 +34,7 @@ DCPContent::DCPContent (shared_ptr f, boost::filesystem::path p) , VideoContent (f) , SingleStreamAudioContent (f) , SubtitleContent (f) + , _has_subtitles (false) , _directory (p) { read_directory (p); @@ -46,6 +47,7 @@ DCPContent::DCPContent (shared_ptr f, cxml::ConstNodePtr node, int v , SubtitleContent (f, node, version) { _name = node->string_child ("Name"); + _has_subtitles = node->bool_child ("HasSubtitles"); _directory = node->string_child ("Directory"); } @@ -66,12 +68,14 @@ DCPContent::examine (shared_ptr job) { job->set_progress_unknown (); Content::examine (job); + shared_ptr examiner (new DCPExaminer (shared_from_this ())); take_from_video_examiner (examiner); take_from_audio_examiner (examiner); boost::mutex::scoped_lock lm (_mutex); _name = examiner->name (); + _has_subtitles = examiner->has_subtitles (); } string @@ -99,7 +103,9 @@ DCPContent::as_xml (xmlpp::Node* node) const SingleStreamAudioContent::as_xml (node); SubtitleContent::as_xml (node); + 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("Directory")->add_child_text (_directory.string ()); } @@ -116,3 +122,10 @@ DCPContent::identifier () const { return SubtitleContent::identifier (); } + +bool +DCPContent::has_subtitles () const +{ + boost::mutex::scoped_lock lm (_mutex); + return _has_subtitles; +}