DCPContent::DCPContent (shared_ptr<const Film> film, boost::filesystem::path p)
: Content (film)
- , _has_subtitles (false)
, _encrypted (false)
, _kdm_valid (false)
, _reference_video (false)
{
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 ();
: 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"));
{
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 ();
}
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 ());
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;
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;
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;
};
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 ()
{
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: