#define DCPOMATIC_CONTENT_PART_H
#include <boost/weak_ptr.hpp>
+#include <boost/thread/mutex.hpp>
class Content;
class Film;
property == ContentProperty::PATH ||
property == VideoContentProperty::VIDEO_FRAME_TYPE ||
property == DCPContentProperty::CAN_BE_PLAYED ||
- property == TextSubtitleContentProperty::TEXT_SUBTITLE_COLOUR ||
- property == TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE ||
- property == TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE_COLOUR ||
+ property == SubtitleContentProperty::SUBTITLE_COLOUR ||
+ property == SubtitleContentProperty::SUBTITLE_OUTLINE ||
+ property == SubtitleContentProperty::SUBTITLE_OUTLINE_COLOUR ||
property == FFmpegContentProperty::SUBTITLE_STREAM
) {
DCPTime next;
BOOST_FOREACH (shared_ptr<Content> i, _content) {
- if (!i->subtitle || !i->subtitle->has_subtitles() || find (placed.begin(), placed.end(), i) != placed.end()) {
+ if (!i->subtitle || find (placed.begin(), placed.end(), i) != placed.end()) {
continue;
}
#include "safe_stringstream.h"
#include "font.h"
#include "raw_convert.h"
+#include "content.h"
#include <libcxml/cxml.h>
#include <libxml++/libxml++.h>
#include <boost/foreach.hpp>
int const SubtitleContentProperty::SUBTITLE_LANGUAGE = 506;
int const SubtitleContentProperty::FONTS = 507;
int const SubtitleContentProperty::SUBTITLE_VIDEO_FRAME_RATE = 508;
+int const SubtitleContentProperty::SUBTITLE_COLOUR = 509;
+int const SubtitleContentProperty::SUBTITLE_OUTLINE = 510;
+int const SubtitleContentProperty::SUBTITLE_OUTLINE_COLOUR = 511;
SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film)
: ContentPart (parent, film)
, _subtitle_y_offset (0)
, _subtitle_x_scale (1)
, _subtitle_y_scale (1)
+ , _colour (255, 255, 255)
+ , _outline (false)
+ , _outline_colour (0, 0, 0)
{
}
SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
- : ContentParet (parent, film)
+ : ContentPart (parent, film)
, _use_subtitles (false)
, _burn_subtitles (false)
, _subtitle_x_offset (0)
, _subtitle_y_offset (0)
, _subtitle_x_scale (1)
, _subtitle_y_scale (1)
+ , _colour (
+ node->optional_number_child<int>("Red").get_value_or(255),
+ node->optional_number_child<int>("Green").get_value_or(255),
+ node->optional_number_child<int>("Blue").get_value_or(255)
+ )
+ , _outline (node->optional_bool_child("Outline").get_value_or(false))
+ , _outline_colour (
+ node->optional_number_child<int>("OutlineRed").get_value_or(255),
+ node->optional_number_child<int>("OutlineGreen").get_value_or(255),
+ node->optional_number_child<int>("OutlineBlue").get_value_or(255)
+ )
{
if (version >= 32) {
_use_subtitles = node->bool_child ("UseSubtitles");
root->add_child("SubtitleXScale")->add_child_text (raw_convert<string> (_subtitle_x_scale));
root->add_child("SubtitleYScale")->add_child_text (raw_convert<string> (_subtitle_y_scale));
root->add_child("SubtitleLanguage")->add_child_text (_subtitle_language);
+ root->add_child("Red")->add_child_text (raw_convert<string> (_colour.r));
+ root->add_child("Green")->add_child_text (raw_convert<string> (_colour.g));
+ root->add_child("Blue")->add_child_text (raw_convert<string> (_colour.b));
+ root->add_child("Outline")->add_child_text (raw_convert<string> (_outline));
+ root->add_child("OutlineRed")->add_child_text (raw_convert<string> (_outline_colour.r));
+ root->add_child("OutlineGreen")->add_child_text (raw_convert<string> (_outline_colour.g));
+ root->add_child("OutlineBlue")->add_child_text (raw_convert<string> (_outline_colour.b));
for (list<shared_ptr<Font> >::const_iterator i = _fonts.begin(); i != _fonts.end(); ++i) {
(*i)->as_xml (root->add_child("Font"));
boost::mutex::scoped_lock lm (_mutex);
_use_subtitles = u;
}
- signal_changed (SubtitleContentProperty::USE_SUBTITLES);
+ _parent->signal_changed (SubtitleContentProperty::USE_SUBTITLES);
}
void
boost::mutex::scoped_lock lm (_mutex);
_burn_subtitles = b;
}
- signal_changed (SubtitleContentProperty::BURN_SUBTITLES);
+ _parent->signal_changed (SubtitleContentProperty::BURN_SUBTITLES);
}
void
boost::mutex::scoped_lock lm (_mutex);
_subtitle_x_offset = o;
}
- signal_changed (SubtitleContentProperty::SUBTITLE_X_OFFSET);
+ _parent->signal_changed (SubtitleContentProperty::SUBTITLE_X_OFFSET);
}
void
boost::mutex::scoped_lock lm (_mutex);
_subtitle_y_offset = o;
}
- signal_changed (SubtitleContentProperty::SUBTITLE_Y_OFFSET);
+ _parent->signal_changed (SubtitleContentProperty::SUBTITLE_Y_OFFSET);
}
void
boost::mutex::scoped_lock lm (_mutex);
_subtitle_x_scale = s;
}
- signal_changed (SubtitleContentProperty::SUBTITLE_X_SCALE);
+ _parent->signal_changed (SubtitleContentProperty::SUBTITLE_X_SCALE);
}
void
boost::mutex::scoped_lock lm (_mutex);
_subtitle_y_scale = s;
}
- signal_changed (SubtitleContentProperty::SUBTITLE_Y_SCALE);
+ _parent->signal_changed (SubtitleContentProperty::SUBTITLE_Y_SCALE);
}
void
boost::mutex::scoped_lock lm (_mutex);
_subtitle_language = language;
}
- signal_changed (SubtitleContentProperty::SUBTITLE_LANGUAGE);
+ _parent->signal_changed (SubtitleContentProperty::SUBTITLE_LANGUAGE);
}
string
SubtitleContent::identifier () const
{
SafeStringStream s;
- s << Content::identifier()
- << "_" << raw_convert<string> (subtitle_x_scale())
+ s << raw_convert<string> (subtitle_x_scale())
<< "_" << raw_convert<string> (subtitle_y_scale())
<< "_" << raw_convert<string> (subtitle_x_offset())
<< "_" << raw_convert<string> (subtitle_y_offset());
void
SubtitleContent::font_changed ()
{
- signal_changed (SubtitleContentProperty::FONTS);
+ _parent->signal_changed (SubtitleContentProperty::FONTS);
+}
+
+void
+SubtitleContent::set_colour (dcp::Colour colour)
+{
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ if (_colour == colour) {
+ return;
+ }
+
+ _colour = colour;
+ }
+
+ _parent->signal_changed (SubtitleContentProperty::SUBTITLE_COLOUR);
+}
+
+void
+SubtitleContent::set_outline (bool o)
+{
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ if (_outline == o) {
+ return;
+ }
+
+ _outline = o;
+ }
+
+ _parent->signal_changed (SubtitleContentProperty::SUBTITLE_OUTLINE);
}
-bool
-SubtitleContent::has_subtitles () const
+void
+SubtitleContent::set_outline_colour (dcp::Colour colour)
{
- return has_text_subtitles() || has_image_subtitles();
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ if (_outline_colour == colour) {
+ return;
+ }
+
+ _outline_colour = colour;
+ }
+
+ _parent->signal_changed (SubtitleContentProperty::SUBTITLE_OUTLINE_COLOUR);
}
#include "content_part.h"
#include <libcxml/cxml.h>
+#include <dcp/types.h>
#include <boost/signals2.hpp>
class Font;
static int const SUBTITLE_LANGUAGE;
static int const FONTS;
static int const SUBTITLE_VIDEO_FRAME_RATE;
+ static int const SUBTITLE_COLOUR;
+ static int const SUBTITLE_OUTLINE;
+ static int const SUBTITLE_OUTLINE_COLOUR;
};
class SubtitleContent : public ContentPart
void as_xml (xmlpp::Node *) const;
std::string identifier () const;
- bool has_subtitles () const;
+ bool has_image_subtitles () const {
+ /* XXX */
+ return true;
+ }
void add_font (boost::shared_ptr<Font> font);
return _subtitle_language;
}
+ void set_colour (dcp::Colour);
+
+ dcp::Colour colour () const {
+ boost::mutex::scoped_lock lm (_mutex);
+ return _colour;
+ }
+
+ void set_outline (bool);
+
+ bool outline () const {
+ boost::mutex::scoped_lock lm (_mutex);
+ return _outline;
+ }
+
+ void set_outline_colour (dcp::Colour);
+
+ dcp::Colour outline_colour () const {
+ boost::mutex::scoped_lock lm (_mutex);
+ return _outline_colour;
+ }
+
protected:
/** subtitle language (e.g. "German") or empty if it is not known */
std::string _subtitle_language;
/** y scale factor to apply to subtitles */
double _subtitle_y_scale;
std::list<boost::shared_ptr<Font> > _fonts;
+ dcp::Colour _colour;
+ bool _outline;
+ dcp::Colour _outline_colour;
std::list<boost::signals2::connection> _font_connections;
};
std::string const TextSubtitleContent::font_id = "font";
-int const TextSubtitleContentProperty::TEXT_SUBTITLE_COLOUR = 300;
-int const TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE = 301;
-int const TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE_COLOUR = 302;
-
TextSubtitleContent::TextSubtitleContent (shared_ptr<const Film> film, boost::filesystem::path path)
: Content (film, path)
- , _colour (255, 255, 255)
- , _outline (false)
- , _outline_colour (0, 0, 0)
{
- subtitle.reset (new SubtitleContent (this, film, path));
+ subtitle.reset (new SubtitleContent (this, film));
}
TextSubtitleContent::TextSubtitleContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
: Content (film, node)
, _length (node->number_child<ContentTime::Type> ("Length"))
- , _frame_rate (node->optional_number_child<double>("SubtitleVideoFrameRate"))
- , _colour (
- node->optional_number_child<int>("Red").get_value_or(255),
- node->optional_number_child<int>("Green").get_value_or(255),
- node->optional_number_child<int>("Blue").get_value_or(255)
- )
- , _outline (node->optional_bool_child("Outline").get_value_or(false))
- , _outline_colour (
- node->optional_number_child<int>("OutlineRed").get_value_or(255),
- node->optional_number_child<int>("OutlineGreen").get_value_or(255),
- node->optional_number_child<int>("OutlineBlue").get_value_or(255)
- )
{
subtitle.reset (new SubtitleContent (this, film, node, version));
}
TextSubtitle s (shared_from_this ());
/* Default to turning these subtitles on */
- set_use_subtitles (true);
+ subtitle->set_use_subtitles (true);
boost::mutex::scoped_lock lm (_mutex);
_length = s.length ();
- add_font (shared_ptr<Font> (new Font (font_id)));
+ subtitle->add_font (shared_ptr<Font> (new Font (font_id)));
}
string
Content::as_xml (node);
subtitle->as_xml (node);
node->add_child("Length")->add_child_text (raw_convert<string> (_length.get ()));
- if (_frame_rate) {
- node->add_child("SubtitleVideoFrameRate")->add_child_text (raw_convert<string> (_frame_rate.get()));
- }
- node->add_child("Red")->add_child_text (raw_convert<string> (_colour.r));
- node->add_child("Green")->add_child_text (raw_convert<string> (_colour.g));
- node->add_child("Blue")->add_child_text (raw_convert<string> (_colour.b));
- node->add_child("Outline")->add_child_text (raw_convert<string> (_outline));
- node->add_child("OutlineRed")->add_child_text (raw_convert<string> (_outline_colour.r));
- node->add_child("OutlineGreen")->add_child_text (raw_convert<string> (_outline_colour.g));
- node->add_child("OutlineBlue")->add_child_text (raw_convert<string> (_outline_colour.b));
}
DCPTime
*/
return film()->active_frame_rate_change(position()).source;
}
-
-void
-TextSubtitleContent::set_colour (dcp::Colour colour)
-{
- {
- boost::mutex::scoped_lock lm (_mutex);
- if (_colour == colour) {
- return;
- }
-
- _colour = colour;
- }
-
- signal_changed (TextSubtitleContentProperty::TEXT_SUBTITLE_COLOUR);
-}
-
-void
-TextSubtitleContent::set_outline (bool o)
-{
- {
- boost::mutex::scoped_lock lm (_mutex);
- if (_outline == o) {
- return;
- }
-
- _outline = o;
- }
-
- signal_changed (TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE);
-}
-
-void
-TextSubtitleContent::set_outline_colour (dcp::Colour colour)
-{
- {
- boost::mutex::scoped_lock lm (_mutex);
- if (_outline_colour == colour) {
- return;
- }
-
- _outline_colour = colour;
- }
-
- signal_changed (TextSubtitleContentProperty::TEXT_SUBTITLE_OUTLINE_COLOUR);
-}
class Job;
-class TextSubtitleContentProperty
-{
-public:
- static int const TEXT_SUBTITLE_COLOUR;
- static int const TEXT_SUBTITLE_OUTLINE;
- static int const TEXT_SUBTITLE_OUTLINE_COLOUR;
-};
-
/** @class TextSubtitleContent
* @brief SubRip or SSA subtitles.
*/
return boost::dynamic_pointer_cast<TextSubtitleContent> (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_text_subtitles () const {
- return true;
- }
-
- bool has_image_subtitles () const {
- return false;
- }
-
double subtitle_video_frame_rate () const;
void set_subtitle_video_frame_rate (double r);
- void set_colour (dcp::Colour);
-
- dcp::Colour colour () const {
- boost::mutex::scoped_lock lm (_mutex);
- return _colour;
- }
-
- void set_outline (bool);
-
- bool outline () const {
- boost::mutex::scoped_lock lm (_mutex);
- return _outline;
- }
-
- void set_outline_colour (dcp::Colour);
-
- dcp::Colour outline_colour () const {
- boost::mutex::scoped_lock lm (_mutex);
- return _outline_colour;
- }
-
static std::string const font_id;
private:
ContentTime _length;
/** Video frame rate that this content has been prepared for, if known */
boost::optional<double> _frame_rate;
- dcp::Colour _colour;
- bool _outline;
- dcp::Colour _outline_colour;
};
#include "text_subtitle_decoder.h"
#include "text_subtitle_content.h"
+#include "subtitle_content.h"
#include <dcp/subtitle_string.h>
#include <boost/foreach.hpp>
#include <iostream>
/* XXX: we are ignoring positioning specified in the file */
- shared_ptr<const TextSubtitleContent> content = dynamic_pointer_cast<const TextSubtitleContent> (_subtitle_content);
- DCPOMATIC_ASSERT (content);
-
list<dcp::SubtitleString> out;
/* Highest line index in this subtitle */
j.italic,
j.bold,
/* force the colour to whatever is configured */
- content->colour(),
+ _subtitle_content->colour(),
j.font_size.points (72 * 11),
1.0,
dcp::Time (_subtitles[_next].from.all_as_seconds(), 1000),
dcp::VALIGN_TOP,
dcp::DIRECTION_LTR,
j.text,
- content->outline() ? dcp::BORDER : dcp::NONE,
- content->outline_colour(),
+ _subtitle_content->outline() ? dcp::BORDER : dcp::NONE,
+ _subtitle_content->outline_colour(),
dcp::Time (0, 1000),
dcp::Time (0, 1000)
)
typedef std::vector<boost::shared_ptr<Content> > ContentList;
typedef std::vector<boost::shared_ptr<AudioContent> > AudioContentList;
-typedef std::vector<boost::shared_ptr<SubtitleContent> > SubtitleContentList;
typedef std::vector<boost::shared_ptr<FFmpegContent> > FFmpegContentList;
typedef int64_t Frame;
return ac;
}
-SubtitleContentList
+ContentList
ContentPanel::selected_subtitle ()
{
- SubtitleContentList sc;
+ ContentList sc;
BOOST_FOREACH (shared_ptr<Content> i, selected ()) {
- shared_ptr<SubtitleContent> t = dynamic_pointer_cast<SubtitleContent> (i);
- if (t) {
- sc.push_back (t);
+ if (i->subtitle) {
+ sc.push_back (i);
}
}
ContentList selected ();
ContentList selected_video ();
AudioContentList selected_audio ();
- SubtitleContentList selected_subtitle ();
+ ContentList selected_subtitle ();
FFmpegContentList selected_ffmpeg ();
void add_file_clicked ();
#include "lib/ffmpeg_content.h"
#include "lib/audio_processor.h"
#include "lib/video_content.h"
+#include "lib/subtitle_content.h"
#include "lib/dcp_content.h"
#include <dcp/key.h>
#include <dcp/raw_convert.h>
/*
- Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "system_font_dialog.h"
#include "font_files_dialog.h"
#include "lib/font.h"
+#include "lib/content.h"
#include "lib/subtitle_content.h"
#include <wx/wx.h>
#include <boost/foreach.hpp>
using std::cout;
using boost::shared_ptr;
-FontsDialog::FontsDialog (wxWindow* parent, shared_ptr<SubtitleContent> content)
+FontsDialog::FontsDialog (wxWindow* parent, shared_ptr<Content> content)
: wxDialog (parent, wxID_ANY, _("Fonts"))
, _content (content)
{
void
FontsDialog::setup ()
{
- shared_ptr<SubtitleContent> content = _content.lock ();
+ shared_ptr<Content> content = _content.lock ();
if (!content) {
return;
}
_fonts->DeleteAllItems ();
size_t n = 0;
- BOOST_FOREACH (shared_ptr<Font> i, content->fonts ()) {
+ BOOST_FOREACH (shared_ptr<Font> i, content->subtitle->fonts ()) {
wxListItem item;
item.SetId (n);
_fonts->InsertItem (item);
void
FontsDialog::edit_clicked ()
{
- shared_ptr<SubtitleContent> content = _content.lock ();
+ shared_ptr<Content> content = _content.lock ();
if (!content) {
return;
}
int const item = _fonts->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
string const id = wx_to_std (_fonts->GetItemText (item, 0));
shared_ptr<Font> font;
- BOOST_FOREACH (shared_ptr<Font> i, content->fonts()) {
+ BOOST_FOREACH (shared_ptr<Font> i, content->subtitle->fonts()) {
if (i->id() == id) {
font = i;
}
/*
- Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <boost/weak_ptr.hpp>
#include <boost/filesystem.hpp>
-class SubtitleContent;
+class Content;
class FontsDialog : public wxDialog
{
public:
- FontsDialog (wxWindow* parent, boost::shared_ptr<SubtitleContent>);
+ FontsDialog (wxWindow* parent, boost::shared_ptr<Content>);
private:
void setup ();
void selection_changed ();
void edit_clicked ();
- boost::weak_ptr<SubtitleContent> _content;
+ boost::weak_ptr<Content> _content;
wxListCtrl* _fonts;
wxButton* _edit;
};
/*
- Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*/
+#include "hints_dialog.h"
#include "lib/film.h"
#include "lib/ratio.h"
#include "lib/video_content.h"
#include "lib/subtitle_content.h"
#include "lib/font.h"
-#include "hints_dialog.h"
+#include "lib/content.h"
#include <wx/richtext/richtextctrl.h>
#include <boost/algorithm/string.hpp>
#include <boost/foreach.hpp>
*/
-#include <boost/weak_ptr.hpp>
#include <wx/wx.h>
+#include <boost/weak_ptr.hpp>
+#include <boost/signals2.hpp>
class wxRichTextCtrl;
class Film;
/*
- Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "lib/text_subtitle_decoder.h"
#include "lib/dcp_subtitle_decoder.h"
#include "lib/dcp_content.h"
+#include "lib/subtitle_content.h"
#include <wx/spinctrl.h>
#include <boost/foreach.hpp>
SubtitlePanel::film_content_changed (int property)
{
FFmpegContentList fc = _parent->selected_ffmpeg ();
- SubtitleContentList sc = _parent->selected_subtitle ();
+ ContentList sc = _parent->selected_subtitle ();
shared_ptr<FFmpegContent> fcs;
if (fc.size() == 1) {
fcs = fc.front ();
}
- shared_ptr<SubtitleContent> scs;
+ shared_ptr<Content> scs;
if (sc.size() == 1) {
scs = sc.front ();
}
}
setup_sensitivity ();
} else if (property == SubtitleContentProperty::USE_SUBTITLES) {
- checked_set (_use, scs ? scs->use_subtitles() : false);
+ checked_set (_use, scs ? scs->subtitle->use_subtitles() : false);
setup_sensitivity ();
} else if (property == SubtitleContentProperty::BURN_SUBTITLES) {
- checked_set (_burn, scs ? scs->burn_subtitles() : false);
+ checked_set (_burn, scs ? scs->subtitle->burn_subtitles() : false);
} else if (property == SubtitleContentProperty::SUBTITLE_X_OFFSET) {
- checked_set (_x_offset, scs ? lrint (scs->subtitle_x_offset() * 100) : 0);
+ checked_set (_x_offset, scs ? lrint (scs->subtitle->subtitle_x_offset() * 100) : 0);
} else if (property == SubtitleContentProperty::SUBTITLE_Y_OFFSET) {
- checked_set (_y_offset, scs ? lrint (scs->subtitle_y_offset() * 100) : 0);
+ checked_set (_y_offset, scs ? lrint (scs->subtitle->subtitle_y_offset() * 100) : 0);
} else if (property == SubtitleContentProperty::SUBTITLE_X_SCALE) {
- checked_set (_x_scale, scs ? lrint (scs->subtitle_x_scale() * 100) : 100);
+ checked_set (_x_scale, scs ? lrint (scs->subtitle->subtitle_x_scale() * 100) : 100);
} else if (property == SubtitleContentProperty::SUBTITLE_Y_SCALE) {
- checked_set (_y_scale, scs ? lrint (scs->subtitle_y_scale() * 100) : 100);
+ checked_set (_y_scale, scs ? lrint (scs->subtitle->subtitle_y_scale() * 100) : 100);
} else if (property == SubtitleContentProperty::SUBTITLE_LANGUAGE) {
- checked_set (_language, scs ? scs->subtitle_language() : "");
+ checked_set (_language, scs ? scs->subtitle->subtitle_language() : "");
} else if (property == DCPContentProperty::REFERENCE_SUBTITLE) {
if (scs) {
shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent> (scs);
void
SubtitlePanel::use_toggled ()
{
- BOOST_FOREACH (shared_ptr<SubtitleContent> i, _parent->selected_subtitle ()) {
- i->set_use_subtitles (_use->GetValue());
+ BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_subtitle ()) {
+ i->subtitle->set_use_subtitles (_use->GetValue());
}
}
void
SubtitlePanel::burn_toggled ()
{
- BOOST_FOREACH (shared_ptr<SubtitleContent> i, _parent->selected_subtitle ()) {
- i->set_burn_subtitles (_burn->GetValue());
+ BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_subtitle ()) {
+ i->subtitle->set_burn_subtitles (_burn->GetValue());
}
}
int text_subs = 0;
int dcp_subs = 0;
int image_subs = 0;
- SubtitleContentList sel = _parent->selected_subtitle ();
- BOOST_FOREACH (shared_ptr<SubtitleContent> i, sel) {
+ ContentList sel = _parent->selected_subtitle ();
+ BOOST_FOREACH (shared_ptr<Content> i, sel) {
shared_ptr<const FFmpegContent> fc = boost::dynamic_pointer_cast<const FFmpegContent> (i);
shared_ptr<const TextSubtitleContent> sc = boost::dynamic_pointer_cast<const TextSubtitleContent> (i);
shared_ptr<const DCPSubtitleContent> dsc = boost::dynamic_pointer_cast<const DCPSubtitleContent> (i);
if (fc) {
- if (fc->has_subtitles ()) {
+ if (fc->subtitle) {
++ffmpeg_subs;
++any_subs;
}
++any_subs;
}
- if (i->has_image_subtitles ()) {
+ if (i->subtitle->has_image_subtitles ()) {
++image_subs;
/* We must burn image subtitles at the moment */
- i->set_burn_subtitles (true);
+ i->subtitle->set_burn_subtitles (true);
}
}
void
SubtitlePanel::x_offset_changed ()
{
- BOOST_FOREACH (shared_ptr<SubtitleContent> i, _parent->selected_subtitle ()) {
- i->set_subtitle_x_offset (_x_offset->GetValue() / 100.0);
+ BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_subtitle ()) {
+ i->subtitle->set_subtitle_x_offset (_x_offset->GetValue() / 100.0);
}
}
void
SubtitlePanel::y_offset_changed ()
{
- BOOST_FOREACH (shared_ptr<SubtitleContent> i, _parent->selected_subtitle ()) {
- i->set_subtitle_y_offset (_y_offset->GetValue() / 100.0);
+ BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_subtitle ()) {
+ i->subtitle->set_subtitle_y_offset (_y_offset->GetValue() / 100.0);
}
}
void
SubtitlePanel::x_scale_changed ()
{
- SubtitleContentList c = _parent->selected_subtitle ();
+ ContentList c = _parent->selected_subtitle ();
if (c.size() == 1) {
- c.front()->set_subtitle_x_scale (_x_scale->GetValue() / 100.0);
+ c.front()->subtitle->set_subtitle_x_scale (_x_scale->GetValue() / 100.0);
}
}
void
SubtitlePanel::y_scale_changed ()
{
- BOOST_FOREACH (shared_ptr<SubtitleContent> i, _parent->selected_subtitle ()) {
- i->set_subtitle_y_scale (_y_scale->GetValue() / 100.0);
+ BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_subtitle ()) {
+ i->subtitle->set_subtitle_y_scale (_y_scale->GetValue() / 100.0);
}
}
void
SubtitlePanel::language_changed ()
{
- BOOST_FOREACH (shared_ptr<SubtitleContent> i, _parent->selected_subtitle ()) {
- i->set_subtitle_language (wx_to_std (_language->GetValue()));
+ BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_subtitle ()) {
+ i->subtitle->set_subtitle_language (wx_to_std (_language->GetValue()));
}
}
_subtitle_view = 0;
}
- SubtitleContentList c = _parent->selected_subtitle ();
+ ContentList c = _parent->selected_subtitle ();
DCPOMATIC_ASSERT (c.size() == 1);
shared_ptr<SubtitleDecoder> decoder;
_fonts_dialog = 0;
}
- SubtitleContentList c = _parent->selected_subtitle ();
+ ContentList c = _parent->selected_subtitle ();
DCPOMATIC_ASSERT (c.size() == 1);
_fonts_dialog = new FontsDialog (this, c.front ());
void
SubtitlePanel::appearance_dialog_clicked ()
{
- SubtitleContentList c = _parent->selected_subtitle ();
+ ContentList c = _parent->selected_subtitle ();
DCPOMATIC_ASSERT (c.size() == 1);
shared_ptr<TextSubtitleContent> sr = dynamic_pointer_cast<TextSubtitleContent> (c.front ());
/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "text_subtitle_appearance_dialog.h"
#include "lib/text_subtitle_content.h"
+#include "lib/subtitle_content.h"
#include <wx/wx.h>
#include <wx/clrpicker.h>
layout ();
- _colour->SetColour (wxColour (_content->colour().r, _content->colour().g, _content->colour().b));
- _outline->SetValue (_content->outline ());
- _outline_colour->SetColour (wxColour (_content->outline_colour().r, _content->outline_colour().g, _content->outline_colour().b));
+ _colour->SetColour (wxColour (_content->subtitle->colour().r, _content->subtitle->colour().g, _content->subtitle->colour().b));
+ _outline->SetValue (_content->subtitle->outline ());
+ _outline_colour->SetColour (
+ wxColour (_content->subtitle->outline_colour().r, _content->subtitle->outline_colour().g, _content->subtitle->outline_colour().b)
+ );
}
void
TextSubtitleAppearanceDialog::apply ()
{
wxColour const c = _colour->GetColour ();
- _content->set_colour (dcp::Colour (c.Red(), c.Green(), c.Blue()));
- _content->set_outline (_outline->GetValue ());
+ _content->subtitle->set_colour (dcp::Colour (c.Red(), c.Green(), c.Blue()));
+ _content->subtitle->set_outline (_outline->GetValue ());
wxColour const oc = _outline_colour->GetColour ();
- _content->set_outline_colour (dcp::Colour (oc.Red(), oc.Green(), oc.Blue()));
+ _content->subtitle->set_outline_colour (dcp::Colour (oc.Red(), oc.Green(), oc.Blue()));
}
_views.push_back (shared_ptr<TimelineView> (new TimelineAudioContentView (*this, i)));
}
- shared_ptr<SubtitleContent> sc = dynamic_pointer_cast<SubtitleContent> (i);
- if (sc && sc->has_subtitles ()) {
- _views.push_back (shared_ptr<TimelineView> (new TimelineSubtitleContentView (*this, sc)));
+ if (i->subtitle) {
+ _views.push_back (shared_ptr<TimelineView> (new TimelineSubtitleContentView (*this, i)));
}
}
virtual wxColour background_colour () const = 0;
virtual wxColour foreground_colour () const = 0;
+protected:
+
+ boost::weak_ptr<Content> _content;
+
private:
void do_paint (wxGraphicsContext* gc, std::list<dcpomatic::Rect<int> > overlaps);
int y_pos (int t) const;
void content_changed (int p);
- boost::weak_ptr<Content> _content;
boost::optional<int> _track;
bool _selected;
/*
- Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "timeline_subtitle_content_view.h"
#include "lib/subtitle_content.h"
+#include "lib/content.h"
using boost::shared_ptr;
-TimelineSubtitleContentView::TimelineSubtitleContentView (Timeline& tl, shared_ptr<SubtitleContent> c)
+TimelineSubtitleContentView::TimelineSubtitleContentView (Timeline& tl, shared_ptr<Content> c)
: TimelineContentView (tl, c)
- , _subtitle_content (c)
{
}
wxColour
TimelineSubtitleContentView::background_colour () const
{
- shared_ptr<SubtitleContent> sc = _subtitle_content.lock ();
if (!active ()) {
return wxColour (210, 210, 210, 128);
}
wxColour
TimelineSubtitleContentView::foreground_colour () const
{
- shared_ptr<SubtitleContent> sc = _subtitle_content.lock ();
if (!active ()) {
return wxColour (180, 180, 180, 128);
}
bool
TimelineSubtitleContentView::active () const
{
- shared_ptr<SubtitleContent> sc = _subtitle_content.lock ();
- return sc && sc->use_subtitles();
+ shared_ptr<Content> c = _content.lock ();
+ DCPOMATIC_ASSERT (c);
+ return c->subtitle && c->subtitle->use_subtitles();
}
/*
- Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
class TimelineSubtitleContentView : public TimelineContentView
{
public:
- TimelineSubtitleContentView (Timeline& tl, boost::shared_ptr<SubtitleContent> c);
+ TimelineSubtitleContentView (Timeline& tl, boost::shared_ptr<Content> c);
private:
bool active () const;
wxColour background_colour () const;
wxColour foreground_colour () const;
-
- boost::weak_ptr<SubtitleContent> _subtitle_content;
};
-
int count_ac = 0;
shared_ptr<const Content> ac;
int count_sc = 0;
- shared_ptr<const SubtitleContent> sc;
+ shared_ptr<const Content> sc;
BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
if (i->video) {
check_vc.insert (i->video->video_frame_rate ());
vc = i;
}
shared_ptr<const AudioContent> at = dynamic_pointer_cast<const AudioContent> (i);
- if (at) {
+ if (i->audio) {
++count_ac;
ac = at;
}
- shared_ptr<const SubtitleContent> st = dynamic_pointer_cast<const SubtitleContent> (i);
- if (st) {
+ if (i->subtitle) {
++count_sc;
- sc = st;
+ sc = i;
}
}
return;
}
- ContentColourConversionDialog* d = new ContentColourConversionDialog (this, vc.front()->yuv ());
+ ContentColourConversionDialog* d = new ContentColourConversionDialog (this, vc.front()->video->yuv ());
d->set (vc.front()->video->colour_conversion().get_value_or (PresetColourConversion::all().front ().conversion));
d->ShowModal ();
vc.front()->video->set_colour_conversion (d->get ());