_name = examiner->name ();
for (int i = 0; i < TEXT_COUNT; ++i) {
if (examiner->has_text(static_cast<TextType>(i))) {
- text.push_back (shared_ptr<TextContent>(new TextContent(this, static_cast<TextType>(i))));
+ text.push_back (shared_ptr<TextContent>(new TextContent(this, static_cast<TextType>(i), static_cast<TextType>(i))));
}
}
texts = text.size ();
DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, boost::filesystem::path path)
: Content (film, path)
{
- text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE)));
+ text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE, TEXT_OPEN_SUBTITLE)));
}
DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
_subtitle_streams = examiner->subtitle_streams ();
if (!_subtitle_streams.empty ()) {
text.clear ();
- text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE)));
+ text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE, TEXT_UNKNOWN)));
_subtitle_stream = _subtitle_streams.front ();
}
using std::string;
using std::cout;
using boost::shared_ptr;
+using boost::optional;
using dcp::raw_convert;
StringTextFileContent::StringTextFileContent (shared_ptr<const Film> film, boost::filesystem::path path)
: Content (film, path)
{
- text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE)));
+ text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE, TEXT_UNKNOWN)));
}
StringTextFileContent::StringTextFileContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
int const TextContentProperty::OUTLINE_WIDTH = 514;
int const TextContentProperty::TYPE = 515;
-TextContent::TextContent (Content* parent, TextType original_type)
+TextContent::TextContent (Content* parent, TextType type, TextType original_type)
: ContentPart (parent)
, _use (false)
, _burn (false)
, _y_scale (1)
, _line_spacing (1)
, _outline_width (2)
- , _type (original_type)
+ , _type (type)
, _original_type (original_type)
{
, _line_spacing (node->optional_number_child<double>("LineSpacing").get_value_or (1))
, _outline_width (node->optional_number_child<int>("OutlineWidth").get_value_or (2))
, _type (TEXT_OPEN_SUBTITLE)
- , _original_type (TEXT_OPEN_SUBTITLE)
{
if (version >= 37) {
_use = node->bool_child ("Use");
connect_to_fonts ();
_type = string_to_text_type (node->optional_string_child("Type").get_value_or("open"));
- _original_type = string_to_text_type (node->optional_string_child("OriginalType").get_value_or("open"));
+ if (node->optional_string_child("OriginalType")) {
+ _original_type = string_to_text_type (node->optional_string_child("OriginalType").get());
+ }
}
TextContent::TextContent (Content* parent, vector<shared_ptr<Content> > c)
class TextContent : public ContentPart
{
public:
- TextContent (Content* parent, TextType original_type);
+ TextContent (Content* parent, TextType type, TextType original_type);
TextContent (Content* parent, std::vector<boost::shared_ptr<Content> >);
void as_xml (xmlpp::Node *) const;
TextType
string_to_text_type (string s)
{
- if (s == "open-subtitle") {
+ if (s == "unknown") {
+ return TEXT_UNKNOWN;
+ } else if (s == "open-subtitle") {
return TEXT_OPEN_SUBTITLE;
} else if (s == "closed") {
return TEXT_CLOSED_CAPTION;
text_type_to_string (TextType t)
{
switch (t) {
+ case TEXT_UNKNOWN:
+ return "unknown";
case TEXT_OPEN_SUBTITLE:
return "open-subtitle";
case TEXT_CLOSED_CAPTION:
text_type_to_name (TextType t)
{
switch (t) {
+ case TEXT_UNKNOWN:
+ return _("Timed text");
case TEXT_OPEN_SUBTITLE:
return _("Open subtitles");
case TEXT_CLOSED_CAPTION:
*/
enum TextType
{
+ TEXT_UNKNOWN,
TEXT_OPEN_SUBTITLE,
TEXT_CLOSED_CAPTION,
TEXT_COUNT
using std::list;
using std::cout;
using boost::shared_ptr;
+using boost::optional;
using boost::dynamic_pointer_cast;
+/** @param t Original text type of the content, if known */
TextPanel::TextPanel (ContentPanel* p, TextType t)
: ContentSubPanel (p, std_to_wx(text_type_to_name(t)))
, _text_view (0)
{
wxBoxSizer* reference_sizer = new wxBoxSizer (wxVERTICAL);
- _reference = new wxCheckBox (this, wxID_ANY, _("Use this DCP's subtitle as OV and make VF"));
+ wxString refer = _("Use this DCP's subtitle as OV and make VF");
+ if (t == TEXT_CLOSED_CAPTION) {
+ refer = _("Use this DCP's closed caption as OV and make VF");
+ }
+
+ _reference = new wxCheckBox (this, wxID_ANY, refer);
reference_sizer->Add (_reference, 0, wxLEFT | wxRIGHT | wxTOP, DCPOMATIC_SIZER_GAP);
_reference_note = new wxStaticText (this, wxID_ANY, _(""));