, VideoContent (f)
, SingleStreamAudioContent (f)
, SubtitleContent (f)
+ , _has_subtitles (false)
, _directory (p)
{
read_directory (p);
, SubtitleContent (f, node, version)
{
_name = node->string_child ("Name");
+ _has_subtitles = node->bool_child ("HasSubtitles");
_directory = node->string_child ("Directory");
}
{
job->set_progress_unknown ();
Content::examine (job);
+
shared_ptr<DCPExaminer> 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
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 ());
}
{
return SubtitleContent::identifier ();
}
+
+bool
+DCPContent::has_subtitles () const
+{
+ boost::mutex::scoped_lock lm (_mutex);
+ return _has_subtitles;
+}
void as_xml (xmlpp::Node *) const;
std::string identifier () const;
+ /* SubtitleContent */
+ bool has_subtitles () const;
+
boost::filesystem::path directory () const {
boost::mutex::scoped_lock lm (_mutex);
return _directory;
void read_directory (boost::filesystem::path);
std::string _name;
+ bool _has_subtitles;
boost::filesystem::path _directory;
};
_audio_length += ContentTime::from_frames ((*i)->main_sound()->duration(), _video_frame_rate.get ());
}
+
+ if ((*i)->main_subtitle ()) {
+ _has_subtitles = true;
+ }
}
}
return _name;
}
+ bool has_subtitles () const {
+ return _has_subtitles;
+ }
+
int audio_channels () const {
return _audio_channels.get_value_or (0);
}
boost::optional<int> _audio_frame_rate;
ContentTime _audio_length;
std::string _name;
+ bool _has_subtitles;
};
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_subtitles () const {
+ return true;
+ }
+
private:
DCPTime _length;
};
return d;
}
+
+bool
+FFmpegContent::has_subtitles () const
+{
+ return !subtitle_streams().empty ();
+}
void set_audio_mapping (AudioMapping);
boost::filesystem::path audio_analysis_path () const;
+ /* SubtitleContent */
+ bool has_subtitles () const;
+
void set_filters (std::vector<Filter const *> const &);
std::vector<boost::shared_ptr<FFmpegSubtitleStream> > subtitle_streams () const {
return boost::dynamic_pointer_cast<SubRipContent> (Content::shared_from_this ());
}
+ /* 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_subtitles () const {
+ return true;
+ }
+
private:
DCPTime _length;
};
static int const SUBTITLE_USE;
};
+/** @class SubtitleContent
+ * @brief Parent for content which has the potential to include subtitles.
+ *
+ * Although inheriting from this class indicates that the content could
+ * have subtitles, it may not. ::has_subtitles() will tell you.
+ */
class SubtitleContent : public virtual Content
{
public:
void as_xml (xmlpp::Node *) const;
std::string identifier () const;
+ virtual bool has_subtitles () const = 0;
+
void set_subtitle_use (bool);
void set_subtitle_x_offset (double);
void set_subtitle_y_offset (double);
shared_ptr<const SubRipContent> sc = boost::dynamic_pointer_cast<const SubRipContent> (*i);
shared_ptr<const DCPSubtitleContent> dsc = boost::dynamic_pointer_cast<const DCPSubtitleContent> (*i);
if (fc) {
- if (!fc->subtitle_streams().empty ()) {
+ if (!fc->has_subtitles ()) {
++ffmpeg_subs;
++any_subs;
}
#include <boost/weak_ptr.hpp>
#include "lib/film.h"
#include "lib/playlist.h"
+#include "lib/image_content.h"
#include "film_editor.h"
#include "timeline.h"
#include "wx_util.h"
gc->StrokePath (path);
gc->FillPath (path);
- wxString name = wxString::Format (wxT ("%s [%s]"), std_to_wx (cont->path_summary()).data(), type().data());
+ wxString name = wxString::Format (wxT ("%s [%s]"), std_to_wx (cont->summary()).data(), type().data());
wxDouble name_width;
wxDouble name_height;
wxDouble name_descent;
wxString type () const
{
- if (dynamic_pointer_cast<FFmpegContent> (content ())) {
- return _("video");
- } else {
+ if (dynamic_pointer_cast<ImageContent> (content ()) && content()->number_of_paths() == 1) {
return _("still");
+ } else {
+ return _("video");
}
}
if (dynamic_pointer_cast<AudioContent> (*i)) {
_views.push_back (shared_ptr<View> (new AudioContentView (*this, *i)));
}
- if (dynamic_pointer_cast<SubtitleContent> (*i)) {
+
+ shared_ptr<SubtitleContent> sc = dynamic_pointer_cast<SubtitleContent> (*i);
+ if (sc && sc->has_subtitles ()) {
_views.push_back (shared_ptr<View> (new SubtitleContentView (*this, *i)));
}
}