write (temp);
boost::filesystem::rename (temp, final);
}
+
+bool
+dcp::operator== (Data const & a, Data const & b)
+{
+ return (a.size() == b.size() && memcmp (a.data().get(), b.data().get(), a.size() == 0));
+}
int _size;
};
+bool operator==(Data const & a, Data const & b);
+
}
#endif
}
void
-SMPTESubtitleAsset::add (dcp::SubtitleString s)
+SMPTESubtitleAsset::add (shared_ptr<Subtitle> s)
{
SubtitleAsset::add (s);
_intrinsic_duration = latest_subtitle_out().as_editable_units (_edit_rate.numerator / _edit_rate.denominator);
std::string xml_as_string () const;
void write (boost::filesystem::path path) const;
- void add (SubtitleString);
+ void add (boost::shared_ptr<Subtitle>);
void add_font (std::string id, boost::filesystem::path file);
void set_key (Key key);
files in the program, then also delete it here.
*/
+#ifndef LIBDCP_SUBTITLE_H
+#define LIBDCP_SUBTITLE_H
+
/** @file src/subtitle.h
* @brief Subtitle class.
*/
Time fade_down_time
);
+ virtual ~Subtitle () {}
+
Time in () const {
return _in;
}
return _out;
}
-
float h_position () const {
return _h_position;
}
};
}
+
+#endif
/*
- Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
#include "util.h"
#include "xml.h"
#include "subtitle_string.h"
+#include "subtitle_image.h"
#include "dcp_assert.h"
#include <asdcp/AS_DCP.h>
#include <asdcp/KM_util.h>
}
_subtitles.push_back (
- SubtitleString (
- ps.font_id,
- ps.italic.get_value_or (false),
- ps.bold.get_value_or (false),
- ps.underline.get_value_or (false),
- ps.colour.get_value_or (dcp::Colour (255, 255, 255)),
- ps.size.get_value_or (42),
- ps.aspect_adjust.get_value_or (1.0),
- ps.in.get(),
- ps.out.get(),
- ps.h_position.get_value_or(0),
- ps.h_align.get_value_or(HALIGN_CENTER),
- ps.v_position.get_value_or(0),
- ps.v_align.get_value_or(VALIGN_CENTER),
- ps.direction.get_value_or (DIRECTION_LTR),
- text,
- ps.effect.get_value_or (NONE),
- ps.effect_colour.get_value_or (dcp::Colour (0, 0, 0)),
- ps.fade_up_time.get_value_or(Time()),
- ps.fade_down_time.get_value_or(Time())
+ shared_ptr<Subtitle> (
+ new SubtitleString (
+ ps.font_id,
+ ps.italic.get_value_or (false),
+ ps.bold.get_value_or (false),
+ ps.underline.get_value_or (false),
+ ps.colour.get_value_or (dcp::Colour (255, 255, 255)),
+ ps.size.get_value_or (42),
+ ps.aspect_adjust.get_value_or (1.0),
+ ps.in.get(),
+ ps.out.get(),
+ ps.h_position.get_value_or(0),
+ ps.h_align.get_value_or(HALIGN_CENTER),
+ ps.v_position.get_value_or(0),
+ ps.v_align.get_value_or(VALIGN_CENTER),
+ ps.direction.get_value_or (DIRECTION_LTR),
+ text,
+ ps.effect.get_value_or (NONE),
+ ps.effect_colour.get_value_or (dcp::Colour (0, 0, 0)),
+ ps.fade_up_time.get_value_or(Time()),
+ ps.fade_down_time.get_value_or(Time())
+ )
)
);
}
-list<SubtitleString>
+list<shared_ptr<Subtitle> >
SubtitleAsset::subtitles_during (Time from, Time to, bool starting) const
{
- list<SubtitleString> s;
- BOOST_FOREACH (SubtitleString const & i, _subtitles) {
- if ((starting && from <= i.in() && i.in() < to) || (!starting && i.out() >= from && i.in() <= to)) {
+ list<shared_ptr<Subtitle> > s;
+ BOOST_FOREACH (shared_ptr<Subtitle> i, _subtitles) {
+ if ((starting && from <= i->in() && i->in() < to) || (!starting && i->out() >= from && i->in() <= to)) {
s.push_back (i);
}
}
}
void
-SubtitleAsset::add (SubtitleString s)
+SubtitleAsset::add (shared_ptr<Subtitle> s)
{
_subtitles.push_back (s);
}
SubtitleAsset::latest_subtitle_out () const
{
Time t;
- BOOST_FOREACH (SubtitleString const & i, _subtitles) {
- if (i.out() > t) {
- t = i.out ();
+ BOOST_FOREACH (shared_ptr<Subtitle> i, _subtitles) {
+ if (i->out() > t) {
+ t = i->out ();
}
}
return false;
}
- if (_subtitles != other->_subtitles) {
+ if (_subtitles.size() != other->_subtitles.size()) {
note (DCP_ERROR, "subtitles differ");
return false;
}
+ list<shared_ptr<Subtitle> >::const_iterator i = _subtitles.begin ();
+ list<shared_ptr<Subtitle> >::const_iterator j = other->_subtitles.begin ();
+
+ while (i != _subtitles.end()) {
+ shared_ptr<SubtitleString> string_i = dynamic_pointer_cast<SubtitleString> (*i);
+ shared_ptr<SubtitleString> string_j = dynamic_pointer_cast<SubtitleString> (*j);
+ shared_ptr<SubtitleImage> image_i = dynamic_pointer_cast<SubtitleImage> (*i);
+ shared_ptr<SubtitleImage> image_j = dynamic_pointer_cast<SubtitleImage> (*j);
+
+ if ((string_i && !string_j) || (image_i && !image_j)) {
+ note (DCP_ERROR, "subtitles differ");
+ return false;
+ }
+
+ if (string_i && *string_i != *string_j) {
+ note (DCP_ERROR, "subtitles differ");
+ return false;
+ }
+
+ if (image_i && *image_i != *image_j) {
+ note (DCP_ERROR, "subtitles differ");
+ return false;
+ }
+ }
+
return true;
}
struct SubtitleSorter
{
- bool operator() (SubtitleString const & a, SubtitleString const & b) {
- if (a.in() != b.in()) {
- return a.in() < b.in();
+ bool operator() (shared_ptr<Subtitle> a, shared_ptr<Subtitle> b) {
+ if (a->in() != b->in()) {
+ return a->in() < b->in();
}
- return a.v_position() < b.v_position();
+ return a->v_position() < b->v_position();
}
};
void
SubtitleAsset::subtitles_as_xml (xmlpp::Element* xml_root, int time_code_rate, Standard standard) const
{
- list<SubtitleString> sorted = _subtitles;
+ list<shared_ptr<Subtitle> > sorted = _subtitles;
sorted.sort (SubtitleSorter ());
/* Gather our subtitles into a hierarchy of Subtitle/Text/String objects, writing
float last_v_position;
Direction last_direction;
- BOOST_FOREACH (SubtitleString const & i, sorted) {
+ BOOST_FOREACH (shared_ptr<Subtitle> i, sorted) {
if (!subtitle ||
- (last_in != i.in() ||
- last_out != i.out() ||
- last_fade_up_time != i.fade_up_time() ||
- last_fade_down_time != i.fade_down_time())
+ (last_in != i->in() ||
+ last_out != i->out() ||
+ last_fade_up_time != i->fade_up_time() ||
+ last_fade_down_time != i->fade_down_time())
) {
- subtitle.reset (new order::Subtitle (root, i.in(), i.out(), i.fade_up_time(), i.fade_down_time()));
+ subtitle.reset (new order::Subtitle (root, i->in(), i->out(), i->fade_up_time(), i->fade_down_time()));
root->children.push_back (subtitle);
- last_in = i.in ();
- last_out = i.out ();
- last_fade_up_time = i.fade_up_time ();
- last_fade_down_time = i.fade_down_time ();
+ last_in = i->in ();
+ last_out = i->out ();
+ last_fade_up_time = i->fade_up_time ();
+ last_fade_down_time = i->fade_down_time ();
text.reset ();
}
- if (!text ||
- last_h_align != i.h_align() ||
- fabs(last_h_position - i.h_position()) > ALIGN_EPSILON ||
- last_v_align != i.v_align() ||
- fabs(last_v_position - i.v_position()) > ALIGN_EPSILON ||
- last_direction != i.direction()
- ) {
-
- text.reset (new order::Text (subtitle, i.h_align(), i.h_position(), i.v_align(), i.v_position(), i.direction()));
- subtitle->children.push_back (text);
+ shared_ptr<SubtitleString> is = dynamic_pointer_cast<SubtitleString>(i);
+
+ if (is) {
+ if (!text ||
+ last_h_align != is->h_align() ||
+ fabs(last_h_position - is->h_position()) > ALIGN_EPSILON ||
+ last_v_align != is->v_align() ||
+ fabs(last_v_position - is->v_position()) > ALIGN_EPSILON ||
+ last_direction != is->direction()
+ ) {
+ text.reset (new order::Text (subtitle, is->h_align(), is->h_position(), is->v_align(), is->v_position(), is->direction()));
+ subtitle->children.push_back (text);
+
+ last_h_align = is->h_align ();
+ last_h_position = is->h_position ();
+ last_v_align = is->v_align ();
+ last_v_position = is->v_position ();
+ last_direction = is->direction ();
+ }
- last_h_align = i.h_align ();
- last_h_position = i.h_position ();
- last_v_align = i.v_align ();
- last_v_position = i.v_position ();
- last_direction = i.direction ();
+ text->children.push_back (shared_ptr<order::String> (new order::String (text, order::Font (is, standard), is->text())));
}
- text->children.push_back (shared_ptr<order::String> (new order::String (text, order::Font (i, standard), i.text())));
+ /* XXX: image */
}
/* Pull font changes as high up the hierarchy as we can */
/** @class SubtitleAsset
* @brief A parent for classes representing a file containing subtitles.
*
- * This class holds a list of SubtitleString objects which it can extract
+ * This class holds a list of Subtitle objects which it can extract
* from the appropriate part of either an Interop or SMPTE XML file.
* Its subclasses InteropSubtitleAsset and SMPTESubtitleAsset handle the
* differences between the two types.
NoteHandler note
) const;
- std::list<SubtitleString> subtitles_during (Time from, Time to, bool starting) const;
- std::list<SubtitleString> const & subtitles () const {
+ std::list<boost::shared_ptr<Subtitle> > subtitles_during (Time from, Time to, bool starting) const;
+ std::list<boost::shared_ptr<Subtitle> > const & subtitles () const {
return _subtitles;
}
- virtual void add (SubtitleString);
+ virtual void add (boost::shared_ptr<Subtitle>);
virtual void add_font (std::string id, boost::filesystem::path file) = 0;
std::map<std::string, Data> fonts_with_load_ids () const;
void subtitles_as_xml (xmlpp::Element* root, int time_code_rate, Standard standard) const;
/** All our subtitles, in no particular order */
- std::list<SubtitleString> _subtitles;
+ std::list<boost::shared_ptr<Subtitle> > _subtitles;
class Font
{
using std::string;
using std::map;
+using boost::shared_ptr;
using namespace dcp;
string
return standard == SMPTE ? "dcst" : "";
}
-order::Font::Font (SubtitleString const & s, Standard standard)
+order::Font::Font (shared_ptr<SubtitleString> s, Standard standard)
{
- if (s.font()) {
+ if (s->font()) {
if (standard == SMPTE) {
- _values["ID"] = s.font().get ();
+ _values["ID"] = s->font().get ();
} else {
- _values["Id"] = s.font().get ();
+ _values["Id"] = s->font().get ();
}
}
- _values["Italic"] = s.italic() ? "yes" : "no";
- _values["Color"] = s.colour().to_argb_string();
- _values["Size"] = raw_convert<string> (s.size());
- _values["AspectAdjust"] = raw_convert<string>(s.aspect_adjust(), 1, true);
- _values["Effect"] = effect_to_string (s.effect());
- _values["EffectColor"] = s.effect_colour().to_argb_string();
+ _values["Italic"] = s->italic() ? "yes" : "no";
+ _values["Color"] = s->colour().to_argb_string();
+ _values["Size"] = raw_convert<string> (s->size());
+ _values["AspectAdjust"] = raw_convert<string>(s->aspect_adjust(), 1, true);
+ _values["Effect"] = effect_to_string (s->effect());
+ _values["EffectColor"] = s->effect_colour().to_argb_string();
_values["Script"] = "normal";
if (standard == SMPTE) {
- _values["Underline"] = s.underline() ? "yes" : "no";
+ _values["Underline"] = s->underline() ? "yes" : "no";
} else {
- _values["Underlined"] = s.underline() ? "yes" : "no";
+ _values["Underlined"] = s->underline() ? "yes" : "no";
}
- _values["Weight"] = s.bold() ? "bold" : "normal";
+ _values["Weight"] = s->bold() ? "bold" : "normal";
}
xmlpp::Element*
public:
Font () {}
- Font (SubtitleString const & s, Standard standard);
+ Font (boost::shared_ptr<SubtitleString> s, Standard standard);
xmlpp::Element* as_xml (xmlpp::Element* parent, Context& context) const;
#include "subtitle_image.h"
+using std::ostream;
using namespace dcp;
SubtitleImage::SubtitleImage (
{
}
+
+bool
+dcp::operator== (SubtitleImage const & a, SubtitleImage const & b)
+{
+ return (
+ a.png_image() == b.png_image(),
+ a.in() == b.in() &&
+ a.out() == b.out() &&
+ a.h_position() == b.h_position() &&
+ a.h_align() == b.h_align() &&
+ a.v_position() == b.v_position() &&
+ a.v_align() == b.v_align() &&
+ a.fade_up_time() == b.fade_up_time() &&
+ a.fade_down_time() == b.fade_down_time()
+ );
+}
+
+bool
+dcp::operator!= (SubtitleImage const & a, SubtitleImage const & b)
+{
+ return !(a == b);
+}
+
+ostream&
+dcp::operator<< (ostream& s, SubtitleImage const & sub)
+{
+ s << "\n[IMAGE] from " << sub.in() << " to " << sub.out() << ";\n"
+ << "fade up " << sub.fade_up_time() << ", fade down " << sub.fade_down_time() << ";\n"
+ << "v pos " << sub.v_position() << ", valign " << ((int) sub.v_align())
+ << ", hpos " << sub.h_position() << ", halign " << ((int) sub.h_align()) << "\n";
+
+ return s;
+}
Time fade_down_time
);
+ Data png_image () const {
+ return _png_image;
+ }
+
private:
Data _png_image;
};
+bool operator== (SubtitleImage const & a, SubtitleImage const & b);
+bool operator!= (SubtitleImage const & a, SubtitleImage const & b);
+std::ostream& operator<< (std::ostream& s, SubtitleImage const & sub);
+
}
#endif
);
}
+bool
+dcp::operator!= (SubtitleString const & a, SubtitleString const & b)
+{
+ return !(a == b);
+}
+
ostream&
dcp::operator<< (ostream& s, SubtitleString const & sub)
{
};
bool operator== (SubtitleString const & a, SubtitleString const & b);
+bool operator!= (SubtitleString const & a, SubtitleString const & b);
std::ostream& operator<< (std::ostream& s, SubtitleString const & sub);
}
/*
- Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
BOOST_CHECK_EQUAL (interop_lfn->id, "theFontId");
BOOST_CHECK_EQUAL (interop_lfn->uri, "arial.ttf");
- list<dcp::SubtitleString> s = subs.subtitles_during (dcp::Time (0, 0, 6, 1, 250), dcp::Time (0, 0, 6, 2, 250), false);
+ list<shared_ptr<dcp::Subtitle> > s = subs.subtitles_during (dcp::Time (0, 0, 6, 1, 250), dcp::Time (0, 0, 6, 2, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 1);
- BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.front()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.front()), dcp::SubtitleString (
string ("theFontId"),
false,
false,
s = subs.subtitles_during (dcp::Time (0, 0, 7, 190, 250), dcp::Time (0, 0, 7, 191, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 2);
- BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.front()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.front()), dcp::SubtitleString (
string ("theFontId"),
true,
false,
dcp::Time (0, 0, 0, 1, 250),
dcp::Time (0, 0, 0, 1, 250)
));
- BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.back()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.back()), dcp::SubtitleString (
string ("theFontId"),
false,
false,
s = subs.subtitles_during (dcp::Time (0, 0, 11, 95, 250), dcp::Time (0, 0, 11, 96, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 1);
- BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.back()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.back()), dcp::SubtitleString (
string ("theFontId"),
false,
false,
s = subs.subtitles_during (dcp::Time (0, 0, 14, 42, 250), dcp::Time (0, 0, 14, 43, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 1);
- BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.back()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.back()), dcp::SubtitleString (
string ("theFontId"),
false,
true,
{
dcp::InteropSubtitleAsset subs ("test/data/subs2.xml");
- list<dcp::SubtitleString> s = subs.subtitles_during (dcp::Time (0, 0, 42, 100, 250), dcp::Time (0, 0, 42, 101, 250), false);
+ list<shared_ptr<dcp::Subtitle> > s = subs.subtitles_during (dcp::Time (0, 0, 42, 100, 250), dcp::Time (0, 0, 42, 101, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 2);
- BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.front()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.front()), dcp::SubtitleString (
string ("theFont"),
true,
false,
dcp::Time (0, 0, 0, 0, 250),
dcp::Time (0, 0, 0, 0, 250)
));
- BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.back()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.back()), dcp::SubtitleString (
string ("theFont"),
true,
false,
s = subs.subtitles_during (dcp::Time (0, 0, 50, 50, 250), dcp::Time (0, 0, 50, 51, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 2);
- BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.front()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.front()), dcp::SubtitleString (
string ("theFont"),
true,
false,
dcp::Time (0, 0, 0, 0, 250),
dcp::Time (0, 0, 0, 0, 250)
));
- BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.back()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.back()), dcp::SubtitleString (
string ("theFont"),
true,
false,
s = subs.subtitles_during (dcp::Time (0, 1, 2, 300, 250), dcp::Time (0, 1, 2, 301, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 2);
- BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.front()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.front()), dcp::SubtitleString (
string ("theFont"),
true,
false,
dcp::Time (0, 0, 0, 0, 250),
dcp::Time (0, 0, 0, 0, 250)
));
- BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.back()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.back()), dcp::SubtitleString (
string ("theFont"),
true,
false,
s = subs.subtitles_during (dcp::Time (0, 1, 15, 50, 250), dcp::Time (0, 1, 15, 51, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 2);
- BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.front()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.front()), dcp::SubtitleString (
string ("theFont"),
true,
false,
dcp::Time (0, 0, 0, 0, 250),
dcp::Time (0, 0, 0, 0, 250)
));
- BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.back()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.back()), dcp::SubtitleString (
string ("theFont"),
true,
false,
s = subs.subtitles_during (dcp::Time (0, 1, 27, 200, 250), dcp::Time (0, 1, 27, 201, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 2);
- BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.front()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.front()), dcp::SubtitleString (
string ("theFont"),
true,
false,
dcp::Time (0, 0, 0, 0, 250),
dcp::Time (0, 0, 0, 0, 250)
));
- BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.back()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.back()), dcp::SubtitleString (
string ("theFont"),
true,
false,
s = subs.subtitles_during (dcp::Time (0, 1, 42, 300, 250), dcp::Time (0, 1, 42, 301, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 2);
- BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.front()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.front()), dcp::SubtitleString (
string ("theFont"),
false,
false,
dcp::Time (0, 0, 0, 0, 250),
dcp::Time (0, 0, 0, 0, 250)
));
- BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.back()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.back()), dcp::SubtitleString (
string ("theFont"),
false,
false,
s = subs.subtitles_during (dcp::Time (0, 1, 45, 200, 250), dcp::Time (0, 1, 45, 201, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 2);
- BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.front()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.front()), dcp::SubtitleString (
string ("theFont"),
false,
false,
dcp::Time (0, 0, 0, 0, 250),
dcp::Time (0, 0, 0, 0, 250)
));
- BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.back()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.back()), dcp::SubtitleString (
string ("theFont"),
false,
false,
s = subs.subtitles_during (dcp::Time (0, 1, 47, 249, 250), dcp::Time (0, 1, 47, 250, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 2);
- BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.front()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.front()), dcp::SubtitleString (
string ("theFont"),
false,
false,
dcp::Time (0, 0, 0, 0, 250),
dcp::Time (0, 0, 0, 0, 250)
));
- BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.back()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.back()), dcp::SubtitleString (
string ("theFont"),
false,
false,
s = subs.subtitles_during (dcp::Time (0, 2, 6, 210, 250), dcp::Time (0, 2, 6, 211, 250), false);
BOOST_REQUIRE_EQUAL (s.size(), 2);
- BOOST_CHECK_EQUAL (s.front(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.front()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.front()), dcp::SubtitleString (
string ("theFont"),
true,
false,
dcp::Time (0, 0, 0, 0, 250),
dcp::Time (0, 0, 0, 0, 250)
));
- BOOST_CHECK_EQUAL (s.back(), dcp::SubtitleString (
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(s.back()));
+ BOOST_CHECK_EQUAL (*dynamic_pointer_cast<dcp::SubtitleString>(s.back()), dcp::SubtitleString (
string ("theFont"),
true,
false,
BOOST_CHECK_EQUAL (smpte_lfn->id, "theFontId");
BOOST_CHECK_EQUAL (smpte_lfn->urn, "9118bbce-4105-4a05-b37c-a5a6f75e1fea");
BOOST_REQUIRE_EQUAL (sc.subtitles().size(), 63);
- BOOST_CHECK_EQUAL (sc.subtitles().front().text(), "Noch mal.");
- BOOST_CHECK_EQUAL (sc.subtitles().front().in(), dcp::Time (0, 0, 25, 12, 25));
- BOOST_CHECK_EQUAL (sc.subtitles().front().out(), dcp::Time (0, 0, 26, 4, 25));
- BOOST_CHECK_EQUAL (sc.subtitles().back().text(), "Prochainement");
- BOOST_CHECK_EQUAL (sc.subtitles().back().in(), dcp::Time (0, 1, 57, 17, 25));
- BOOST_CHECK_EQUAL (sc.subtitles().back().out(), dcp::Time (0, 1, 58, 12, 25));
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(sc.subtitles().front()));
+ BOOST_CHECK_EQUAL (dynamic_pointer_cast<dcp::SubtitleString>(sc.subtitles().front())->text(), "Noch mal.");
+ BOOST_CHECK_EQUAL (sc.subtitles().front()->in(), dcp::Time (0, 0, 25, 12, 25));
+ BOOST_CHECK_EQUAL (sc.subtitles().front()->out(), dcp::Time (0, 0, 26, 4, 25));
+ BOOST_REQUIRE (dynamic_pointer_cast<dcp::SubtitleString>(sc.subtitles().back()));
+ BOOST_CHECK_EQUAL (dynamic_pointer_cast<dcp::SubtitleString>(sc.subtitles().back())->text(), "Prochainement");
+ BOOST_CHECK_EQUAL (sc.subtitles().back()->in(), dcp::Time (0, 1, 57, 17, 25));
+ BOOST_CHECK_EQUAL (sc.subtitles().back()->out(), dcp::Time (0, 1, 58, 12, 25));
}
/** And another one featuring <Font> within <Text> */
dcp::SMPTESubtitleAsset sc (private_test / "olsson.xml");
BOOST_REQUIRE_EQUAL (sc.subtitles().size(), 6);
- list<dcp::SubtitleString>::const_iterator i = sc.subtitles().begin();
- BOOST_CHECK_EQUAL (i->text(), "Testing is ");
- BOOST_CHECK (!i->italic());
+ list<shared_ptr<dcp::Subtitle> >::const_iterator i = sc.subtitles().begin();
+ shared_ptr<dcp::SubtitleString> is = dynamic_pointer_cast<dcp::SubtitleString>(*i);
+ BOOST_REQUIRE (is);
+ BOOST_CHECK_EQUAL (is->text(), "Testing is ");
+ BOOST_CHECK (!is->italic());
++i;
- BOOST_CHECK_EQUAL (i->text(), "really");
- BOOST_CHECK (i->italic());
+ is = dynamic_pointer_cast<dcp::SubtitleString>(*i);
+ BOOST_REQUIRE (is);
+ BOOST_CHECK_EQUAL (is->text(), "really");
+ BOOST_CHECK (is->italic());
++i;
- BOOST_CHECK_EQUAL (i->text(), " fun!");
- BOOST_CHECK (!i->italic());
+ is = dynamic_pointer_cast<dcp::SubtitleString>(*i);
+ BOOST_REQUIRE (is);
+ BOOST_CHECK_EQUAL (is->text(), " fun!");
+ BOOST_CHECK (!is->italic());
++i;
- BOOST_CHECK_EQUAL (i->text(), "This is the ");
- BOOST_CHECK (!i->italic());
+ is = dynamic_pointer_cast<dcp::SubtitleString>(*i);
+ BOOST_REQUIRE (is);
+ BOOST_CHECK_EQUAL (is->text(), "This is the ");
+ BOOST_CHECK (!is->italic());
++i;
- BOOST_CHECK_EQUAL (i->text(), "second");
- BOOST_CHECK (i->italic());
+ is = dynamic_pointer_cast<dcp::SubtitleString>(*i);
+ BOOST_REQUIRE (is);
+ BOOST_CHECK_EQUAL (is->text(), "second");
+ BOOST_CHECK (is->italic());
++i;
- BOOST_CHECK_EQUAL (i->text(), " line!");
- BOOST_CHECK (!i->italic());
+ is = dynamic_pointer_cast<dcp::SubtitleString>(*i);
+ BOOST_REQUIRE (is);
+ BOOST_CHECK_EQUAL (is->text(), " line!");
+ BOOST_CHECK (!is->italic());
}
using std::string;
using boost::optional;
+using boost::shared_ptr;
BOOST_AUTO_TEST_CASE (smpte_subtitle_id_test)
{
dcp::SMPTESubtitleAsset subs;
- subs.add(dcp::SubtitleString(
- optional<string>(),
- false, false, false,
- dcp::Colour(),
- 64,
- 1,
- dcp::Time(0, 1, 2, 3, 24),
- dcp::Time(0, 2, 2, 3, 24),
- 0.5,
- dcp::HALIGN_CENTER,
- 0.5,
- dcp::VALIGN_CENTER,
- dcp::DIRECTION_LTR,
- "Hello",
- dcp::NONE,
- dcp::Colour(),
- dcp::Time(0, 0, 0, 0, 24),
- dcp::Time(0, 0, 0, 0, 24)
- ));
+ subs.add(
+ shared_ptr<dcp::Subtitle> (
+ new dcp::SubtitleString(
+ optional<string>(),
+ false, false, false,
+ dcp::Colour(),
+ 64,
+ 1,
+ dcp::Time(0, 1, 2, 3, 24),
+ dcp::Time(0, 2, 2, 3, 24),
+ 0.5,
+ dcp::HALIGN_CENTER,
+ 0.5,
+ dcp::VALIGN_CENTER,
+ dcp::DIRECTION_LTR,
+ "Hello",
+ dcp::NONE,
+ dcp::Colour(),
+ dcp::Time(0, 0, 0, 0, 24),
+ dcp::Time(0, 0, 0, 0, 24)
+ )
+ )
+ );
subs.write("build/test/smpte_subtitle_id_test.mxf");
dcp::SMPTESubtitleAsset check("build/test/smpte_subtitle_id_test.mxf");
c.set_movie_title ("Test");
c.add (
- dcp::SubtitleString (
- string ("Frutiger"),
- false,
- false,
- false,
- dcp::Colour (255, 255, 255),
- 48,
- 1.0,
- dcp::Time (0, 4, 9, 22, 24),
- dcp::Time (0, 4, 11, 22, 24),
- 0,
- dcp::HALIGN_CENTER,
- 0.8,
- dcp::VALIGN_TOP,
- dcp::DIRECTION_LTR,
- "Hello world",
- dcp::NONE,
- dcp::Colour (0, 0, 0),
- dcp::Time (0, 0, 0, 0, 24),
- dcp::Time (0, 0, 0, 0, 24)
+ shared_ptr<dcp::Subtitle> (
+ new dcp::SubtitleString (
+ string ("Frutiger"),
+ false,
+ false,
+ false,
+ dcp::Colour (255, 255, 255),
+ 48,
+ 1.0,
+ dcp::Time (0, 4, 9, 22, 24),
+ dcp::Time (0, 4, 11, 22, 24),
+ 0,
+ dcp::HALIGN_CENTER,
+ 0.8,
+ dcp::VALIGN_TOP,
+ dcp::DIRECTION_LTR,
+ "Hello world",
+ dcp::NONE,
+ dcp::Colour (0, 0, 0),
+ dcp::Time (0, 0, 0, 0, 24),
+ dcp::Time (0, 0, 0, 0, 24)
+ )
)
);
c.add (
- dcp::SubtitleString (
- boost::optional<string> (),
- true,
- true,
- true,
- dcp::Colour (128, 0, 64),
- 91,
- 1.0,
- dcp::Time (5, 41, 0, 21, 24),
- dcp::Time (6, 12, 15, 21, 24),
- 0,
- dcp::HALIGN_CENTER,
- 0.4,
- dcp::VALIGN_BOTTOM,
- dcp::DIRECTION_LTR,
- "What's going on",
- dcp::BORDER,
- dcp::Colour (1, 2, 3),
- dcp::Time (1, 2, 3, 4, 24),
- dcp::Time (5, 6, 7, 8, 24)
+ shared_ptr<dcp::Subtitle> (
+ new dcp::SubtitleString (
+ boost::optional<string> (),
+ true,
+ true,
+ true,
+ dcp::Colour (128, 0, 64),
+ 91,
+ 1.0,
+ dcp::Time (5, 41, 0, 21, 24),
+ dcp::Time (6, 12, 15, 21, 24),
+ 0,
+ dcp::HALIGN_CENTER,
+ 0.4,
+ dcp::VALIGN_BOTTOM,
+ dcp::DIRECTION_LTR,
+ "What's going on",
+ dcp::BORDER,
+ dcp::Colour (1, 2, 3),
+ dcp::Time (1, 2, 3, 4, 24),
+ dcp::Time (5, 6, 7, 8, 24)
+ )
)
);
c.set_movie_title ("Test");
c.add (
- dcp::SubtitleString (
- string ("Frutiger"),
- false,
- false,
- false,
- dcp::Colour (255, 255, 255),
- 48,
- 1.0,
- dcp::Time (0, 4, 9, 22, 24),
- dcp::Time (0, 4, 11, 22, 24),
- -0.2,
- dcp::HALIGN_CENTER,
- 0.8,
- dcp::VALIGN_TOP,
- dcp::DIRECTION_LTR,
- "Hello world",
- dcp::NONE,
- dcp::Colour (0, 0, 0),
- dcp::Time (0, 0, 0, 0, 24),
- dcp::Time (0, 0, 0, 0, 24)
+ shared_ptr<dcp::Subtitle> (
+ new dcp::SubtitleString (
+ string ("Frutiger"),
+ false,
+ false,
+ false,
+ dcp::Colour (255, 255, 255),
+ 48,
+ 1.0,
+ dcp::Time (0, 4, 9, 22, 24),
+ dcp::Time (0, 4, 11, 22, 24),
+ -0.2,
+ dcp::HALIGN_CENTER,
+ 0.8,
+ dcp::VALIGN_TOP,
+ dcp::DIRECTION_LTR,
+ "Hello world",
+ dcp::NONE,
+ dcp::Colour (0, 0, 0),
+ dcp::Time (0, 0, 0, 0, 24),
+ dcp::Time (0, 0, 0, 0, 24)
+ )
)
);
c.add (
- dcp::SubtitleString (
- boost::optional<string> (),
- true,
- true,
- true,
- dcp::Colour (128, 0, 64),
- 91,
- 1.0,
- dcp::Time (5, 41, 0, 21, 24),
- dcp::Time (6, 12, 15, 21, 24),
- -0.2,
- dcp::HALIGN_CENTER,
- 0.4,
- dcp::VALIGN_BOTTOM,
- dcp::DIRECTION_LTR,
- "What's going on",
- dcp::BORDER,
- dcp::Colour (1, 2, 3),
- dcp::Time (1, 2, 3, 4, 24),
- dcp::Time (5, 6, 7, 8, 24)
+ shared_ptr<dcp::Subtitle> (
+ new dcp::SubtitleString (
+ boost::optional<string> (),
+ true,
+ true,
+ true,
+ dcp::Colour (128, 0, 64),
+ 91,
+ 1.0,
+ dcp::Time (5, 41, 0, 21, 24),
+ dcp::Time (6, 12, 15, 21, 24),
+ -0.2,
+ dcp::HALIGN_CENTER,
+ 0.4,
+ dcp::VALIGN_BOTTOM,
+ dcp::DIRECTION_LTR,
+ "What's going on",
+ dcp::BORDER,
+ dcp::Colour (1, 2, 3),
+ dcp::Time (1, 2, 3, 4, 24),
+ dcp::Time (5, 6, 7, 8, 24)
+ )
)
);
c.set_issue_date (dcp::LocalTime ("2016-04-01T03:52:00+00:00"));
c.add (
- dcp::SubtitleString (
- string ("Frutiger"),
- false,
- false,
- false,
- dcp::Colour (255, 255, 255),
- 48,
- 1.0,
- dcp::Time (0, 4, 9, 22, 24),
- dcp::Time (0, 4, 11, 22, 24),
- 0,
- dcp::HALIGN_CENTER,
- 0.8,
- dcp::VALIGN_TOP,
- dcp::DIRECTION_LTR,
- "Hello world",
- dcp::NONE,
- dcp::Colour (0, 0, 0),
- dcp::Time (0, 0, 0, 0, 24),
- dcp::Time (0, 0, 0, 0, 24)
+ shared_ptr<dcp::Subtitle> (
+ new dcp::SubtitleString (
+ string ("Frutiger"),
+ false,
+ false,
+ false,
+ dcp::Colour (255, 255, 255),
+ 48,
+ 1.0,
+ dcp::Time (0, 4, 9, 22, 24),
+ dcp::Time (0, 4, 11, 22, 24),
+ 0,
+ dcp::HALIGN_CENTER,
+ 0.8,
+ dcp::VALIGN_TOP,
+ dcp::DIRECTION_LTR,
+ "Hello world",
+ dcp::NONE,
+ dcp::Colour (0, 0, 0),
+ dcp::Time (0, 0, 0, 0, 24),
+ dcp::Time (0, 0, 0, 0, 24)
+ )
)
);
c.add (
- dcp::SubtitleString (
- boost::optional<string> (),
- true,
- true,
- true,
- dcp::Colour (128, 0, 64),
- 91,
- 1.0,
- dcp::Time (5, 41, 0, 21, 24),
- dcp::Time (6, 12, 15, 21, 24),
- 0,
- dcp::HALIGN_CENTER,
- 0.4,
- dcp::VALIGN_BOTTOM,
- dcp::DIRECTION_RTL,
- "What's going on",
- dcp::BORDER,
- dcp::Colour (1, 2, 3),
- dcp::Time (1, 2, 3, 4, 24),
- dcp::Time (5, 6, 7, 8, 24)
+ shared_ptr<dcp::Subtitle> (
+ new dcp::SubtitleString (
+ boost::optional<string> (),
+ true,
+ true,
+ true,
+ dcp::Colour (128, 0, 64),
+ 91,
+ 1.0,
+ dcp::Time (5, 41, 0, 21, 24),
+ dcp::Time (6, 12, 15, 21, 24),
+ 0,
+ dcp::HALIGN_CENTER,
+ 0.4,
+ dcp::VALIGN_BOTTOM,
+ dcp::DIRECTION_RTL,
+ "What's going on",
+ dcp::BORDER,
+ dcp::Colour (1, 2, 3),
+ dcp::Time (1, 2, 3, 4, 24),
+ dcp::Time (5, 6, 7, 8, 24)
+ )
)
);
c.set_issue_date (dcp::LocalTime ("2016-04-01T03:52:00+00:00"));
c.add (
- dcp::SubtitleString (
- string ("Arial"),
- false,
- false,
- false,
- dcp::Colour (255, 255, 255),
- 48,
- 1.0,
- dcp::Time (0, 0, 1, 0, 24),
- dcp::Time (0, 0, 9, 0, 24),
- 0,
- dcp::HALIGN_CENTER,
- 0.8,
- dcp::VALIGN_TOP,
- dcp::DIRECTION_LTR,
- "Testing is ",
- dcp::NONE,
- dcp::Colour (0, 0, 0),
- dcp::Time (0, 0, 0, 0, 24),
- dcp::Time (0, 0, 0, 0, 24)
+ shared_ptr<dcp::Subtitle> (
+ new dcp::SubtitleString (
+ string ("Arial"),
+ false,
+ false,
+ false,
+ dcp::Colour (255, 255, 255),
+ 48,
+ 1.0,
+ dcp::Time (0, 0, 1, 0, 24),
+ dcp::Time (0, 0, 9, 0, 24),
+ 0,
+ dcp::HALIGN_CENTER,
+ 0.8,
+ dcp::VALIGN_TOP,
+ dcp::DIRECTION_LTR,
+ "Testing is ",
+ dcp::NONE,
+ dcp::Colour (0, 0, 0),
+ dcp::Time (0, 0, 0, 0, 24),
+ dcp::Time (0, 0, 0, 0, 24)
+ )
)
);
c.add (
- dcp::SubtitleString (
- string ("Arial"),
- true,
- false,
- false,
- dcp::Colour (255, 255, 255),
- 48,
- 1.0,
- dcp::Time (0, 0, 1, 0, 24),
- dcp::Time (0, 0, 9, 0, 24),
- 0,
- dcp::HALIGN_CENTER,
- 0.8,
- dcp::VALIGN_TOP,
- dcp::DIRECTION_LTR,
- "really",
- dcp::NONE,
- dcp::Colour (0, 0, 0),
- dcp::Time (0, 0, 0, 0, 24),
- dcp::Time (0, 0, 0, 0, 24)
+ shared_ptr<dcp::Subtitle> (
+ new dcp::SubtitleString (
+ string ("Arial"),
+ true,
+ false,
+ false,
+ dcp::Colour (255, 255, 255),
+ 48,
+ 1.0,
+ dcp::Time (0, 0, 1, 0, 24),
+ dcp::Time (0, 0, 9, 0, 24),
+ 0,
+ dcp::HALIGN_CENTER,
+ 0.8,
+ dcp::VALIGN_TOP,
+ dcp::DIRECTION_LTR,
+ "really",
+ dcp::NONE,
+ dcp::Colour (0, 0, 0),
+ dcp::Time (0, 0, 0, 0, 24),
+ dcp::Time (0, 0, 0, 0, 24)
+ )
)
);
c.add (
- dcp::SubtitleString (
- string ("Arial"),
- false,
- false,
- false,
- dcp::Colour (255, 255, 255),
- 48,
- 1.0,
- dcp::Time (0, 0, 1, 0, 24),
- dcp::Time (0, 0, 9, 0, 24),
- 0,
- dcp::HALIGN_CENTER,
- 0.8,
- dcp::VALIGN_TOP,
- dcp::DIRECTION_LTR,
- " fun",
- dcp::NONE,
- dcp::Colour (0, 0, 0),
- dcp::Time (0, 0, 0, 0, 24),
- dcp::Time (0, 0, 0, 0, 24)
+ shared_ptr<dcp::Subtitle> (
+ new dcp::SubtitleString (
+ string ("Arial"),
+ false,
+ false,
+ false,
+ dcp::Colour (255, 255, 255),
+ 48,
+ 1.0,
+ dcp::Time (0, 0, 1, 0, 24),
+ dcp::Time (0, 0, 9, 0, 24),
+ 0,
+ dcp::HALIGN_CENTER,
+ 0.8,
+ dcp::VALIGN_TOP,
+ dcp::DIRECTION_LTR,
+ " fun",
+ dcp::NONE,
+ dcp::Colour (0, 0, 0),
+ dcp::Time (0, 0, 0, 0, 24),
+ dcp::Time (0, 0, 0, 0, 24)
+ )
)
);
c.add (
- dcp::SubtitleString (
- string ("Arial"),
- false,
- false,
- false,
- dcp::Colour (255, 255, 255),
- 48,
- 1.0,
- dcp::Time (0, 0, 1, 0, 24),
- dcp::Time (0, 0, 9, 0, 24),
- 0,
- dcp::HALIGN_CENTER,
- 0.9,
- dcp::VALIGN_TOP,
- dcp::DIRECTION_LTR,
- "This is the ",
- dcp::NONE,
- dcp::Colour (0, 0, 0),
- dcp::Time (0, 0, 0, 0, 24),
- dcp::Time (0, 0, 0, 0, 24)
+ shared_ptr<dcp::Subtitle> (
+ new dcp::SubtitleString (
+ string ("Arial"),
+ false,
+ false,
+ false,
+ dcp::Colour (255, 255, 255),
+ 48,
+ 1.0,
+ dcp::Time (0, 0, 1, 0, 24),
+ dcp::Time (0, 0, 9, 0, 24),
+ 0,
+ dcp::HALIGN_CENTER,
+ 0.9,
+ dcp::VALIGN_TOP,
+ dcp::DIRECTION_LTR,
+ "This is the ",
+ dcp::NONE,
+ dcp::Colour (0, 0, 0),
+ dcp::Time (0, 0, 0, 0, 24),
+ dcp::Time (0, 0, 0, 0, 24)
+ )
)
);
c.add (
- dcp::SubtitleString (
- string ("Arial"),
- true,
- false,
- false,
- dcp::Colour (255, 255, 255),
- 48,
- 1.0,
- dcp::Time (0, 0, 1, 0, 24),
- dcp::Time (0, 0, 9, 0, 24),
- 0,
- dcp::HALIGN_CENTER,
- 0.9,
- dcp::VALIGN_TOP,
- dcp::DIRECTION_LTR,
- "second",
- dcp::NONE,
- dcp::Colour (0, 0, 0),
- dcp::Time (0, 0, 0, 0, 24),
- dcp::Time (0, 0, 0, 0, 24)
+ shared_ptr<dcp::Subtitle> (
+ new dcp::SubtitleString (
+ string ("Arial"),
+ true,
+ false,
+ false,
+ dcp::Colour (255, 255, 255),
+ 48,
+ 1.0,
+ dcp::Time (0, 0, 1, 0, 24),
+ dcp::Time (0, 0, 9, 0, 24),
+ 0,
+ dcp::HALIGN_CENTER,
+ 0.9,
+ dcp::VALIGN_TOP,
+ dcp::DIRECTION_LTR,
+ "second",
+ dcp::NONE,
+ dcp::Colour (0, 0, 0),
+ dcp::Time (0, 0, 0, 0, 24),
+ dcp::Time (0, 0, 0, 0, 24)
+ )
)
);
c.add (
- dcp::SubtitleString (
- string ("Arial"),
- false,
- false,
- false,
- dcp::Colour (255, 255, 255),
- 48,
- 1.0,
- dcp::Time (0, 0, 1, 0, 24),
- dcp::Time (0, 0, 9, 0, 24),
- 0,
- dcp::HALIGN_CENTER,
- 0.9,
- dcp::VALIGN_TOP,
- dcp::DIRECTION_LTR,
- " line",
- dcp::NONE,
- dcp::Colour (0, 0, 0),
- dcp::Time (0, 0, 0, 0, 24),
- dcp::Time (0, 0, 0, 0, 24)
+ shared_ptr<dcp::Subtitle> (
+ new dcp::SubtitleString (
+ string ("Arial"),
+ false,
+ false,
+ false,
+ dcp::Colour (255, 255, 255),
+ 48,
+ 1.0,
+ dcp::Time (0, 0, 1, 0, 24),
+ dcp::Time (0, 0, 9, 0, 24),
+ 0,
+ dcp::HALIGN_CENTER,
+ 0.9,
+ dcp::VALIGN_TOP,
+ dcp::DIRECTION_LTR,
+ " line",
+ dcp::NONE,
+ dcp::Colour (0, 0, 0),
+ dcp::Time (0, 0, 0, 0, 24),
+ dcp::Time (0, 0, 0, 0, 24)
+ )
)
);
#include "reel_sound_asset.h"
#include "reel_subtitle_asset.h"
#include "subtitle_string.h"
+#include "subtitle_image.h"
#include "interop_subtitle_asset.h"
#include "smpte_subtitle_asset.h"
#include "mono_picture_asset.h"
cout << " Subtitle ID: " << reel->main_subtitle()->id();
if (reel->main_subtitle()->asset_ref().resolved()) {
- list<SubtitleString> subs = reel->main_subtitle()->asset()->subtitles ();
+ list<shared_ptr<Subtitle> > subs = reel->main_subtitle()->asset()->subtitles ();
cout << "\n Subtitle: " << subs.size() << " subtitles";
shared_ptr<InteropSubtitleAsset> iop = dynamic_pointer_cast<InteropSubtitleAsset> (reel->main_subtitle()->asset());
if (iop) {
cout << " in " << smpte->language().get() << "\n";
}
if (list_subtitles) {
- BOOST_FOREACH (SubtitleString const& k, subs) {
- cout << k << "\n";
+ BOOST_FOREACH (shared_ptr<Subtitle> k, subs) {
+ shared_ptr<SubtitleString> ks = dynamic_pointer_cast<SubtitleString> (k);
+ if (ks) {
+ cout << *ks << "\n";
+ }
+ shared_ptr<SubtitleImage> is = dynamic_pointer_cast<SubtitleImage> (k);
+ if (is) {
+ cout << *is << "\n";
+ }
}
}
} else {
def write_compilation_database(ctx):
"Write the clang compilation database as JSON"
database_file = ctx.bldnode.make_node('compile_commands.json')
- Logs.info('Build commands will be stored in %s', database_file.path_from(ctx.path))
+ Logs.info('Build commands will be stored in %s' % database_file.path_from(ctx.path))
try:
root = json.load(database_file)
except IOError: