diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-08-22 17:33:43 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-08-22 17:33:43 +0100 |
| commit | 78979cc6ad60c03bfc2e3757722d8e18d670a4c3 (patch) | |
| tree | 662e7bb91ad3cd7b06b4c7260dd449e7d151a8ef /src | |
| parent | b4a004619216df74aaac99a67ccc25d5547926ee (diff) | |
Very slightly less verbose subs checking.
Diffstat (limited to 'src')
| -rw-r--r-- | src/subtitle_asset.cc | 39 | ||||
| -rw-r--r-- | src/subtitle_asset.h | 10 |
2 files changed, 49 insertions, 0 deletions
diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc index ee74e5eb..2446c137 100644 --- a/src/subtitle_asset.cc +++ b/src/subtitle_asset.cc @@ -287,3 +287,42 @@ Subtitle::size_in_pixels (int screen_height) const return _size * screen_height / (11 * 72); } + +bool +libdcp::operator== (Subtitle const & a, Subtitle const & b) +{ + return ( + a.font() == b.font() && + a.italic() == b.italic() && + a.color() == b.color() && + a.size() == b.size() && + a.in() == b.in() && + a.out() == b.out() && + a.v_position() == b.v_position() && + a.v_align() == b.v_align() && + a.text() == b.text() && + a.effect() == b.effect() && + a.effect_color() == b.effect_color() && + a.fade_up_time() == b.fade_up_time() && + a.fade_down_time() == b.fade_down_time() + ); +} + +ostream& +libdcp::operator<< (ostream& s, Subtitle const & sub) +{ + s << "\n`" << sub.text() << "' from " << sub.in() << " to " << sub.out() << ";\n" + << "fade up " << sub.fade_up_time() << ", fade down " << sub.fade_down_time() << ";\n" + << "font " << sub.font() << ", "; + + if (sub.italic()) { + s << "italic"; + } else { + s << "non-italic"; + } + + s << ", size " << sub.size() << ", color " << sub.color() << ", vpos " << sub.v_position() << ", valign " << ((int) sub.v_align()) << ";\n" + << "effect " << ((int) sub.effect()) << ", effect color " << sub.effect_color(); + + return s; +} diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h index 662f85f1..72563470 100644 --- a/src/subtitle_asset.h +++ b/src/subtitle_asset.h @@ -151,6 +151,10 @@ public: return _fade_down_time; } + int size () const { + return _size; + } + int size_in_pixels (int screen_height) const; private: @@ -169,6 +173,9 @@ private: Time _fade_down_time; }; +bool operator== (Subtitle const & a, Subtitle const & b); +std::ostream& operator<< (std::ostream& s, Subtitle const & sub); + class SubtitleAsset : public Asset, public XMLFile { public: @@ -185,6 +192,9 @@ public: } std::list<boost::shared_ptr<Subtitle> > subtitles_at (Time t) const; + std::list<boost::shared_ptr<Subtitle> > const & subtitles () const { + return _subtitles; + } private: std::string font_id_to_name (std::string id) const; |
