X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fsubtitle.h;h=38ba4e70e0170fabd5e2a71ee2ad9eadceb5a2ee;hb=eac941aed6e6eed7f0329e42c7a036ed620f8df0;hp=ef9571ad4f6a0f849b80ac61ce54858a77399b9e;hpb=e946a66554185459043af2a8bdae575e255c743d;p=dcpomatic.git diff --git a/src/lib/subtitle.h b/src/lib/subtitle.h index ef9571ad4..38ba4e70e 100644 --- a/src/lib/subtitle.h +++ b/src/lib/subtitle.h @@ -17,6 +17,10 @@ */ +/** @file src/subtitle.h + * @brief Representations of subtitles. + */ + #include #include #include "util.h" @@ -24,14 +28,12 @@ struct AVSubtitle; class Image; +/** A subtitle, consisting of an image and a position */ class Subtitle { public: - Subtitle (AVSubtitle const &); Subtitle (Position p, boost::shared_ptr i); - bool displayed_at (double t); - void set_position (Position p) { _position = p; } @@ -44,20 +46,36 @@ public: return _image; } - Rectangle area () const; + Rect area () const; private: - /** display from time in seconds from the start of the film */ - double _from; - /** display to time in seconds from the start of the film */ - double _to; Position _position; boost::shared_ptr _image; }; -Rectangle +Rect subtitle_transformed_area ( float target_x_scale, float target_y_scale, - Rectangle sub_area, int subtitle_offset, float subtitle_scale + Rect sub_area, int subtitle_offset, float subtitle_scale ); + +/** A Subtitle class with details of the time over which it should be shown */ +class TimedSubtitle +{ +public: + TimedSubtitle (AVSubtitle const &); + + bool displayed_at (double t) const; + boost::shared_ptr subtitle () const { + return _subtitle; + } + +private: + /** the subtitle */ + boost::shared_ptr _subtitle; + /** display from time in seconds from the start of the film */ + double _from; + /** display to time in seconds from the start of the film */ + double _to; +};