X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fsubtitle.h;h=38ba4e70e0170fabd5e2a71ee2ad9eadceb5a2ee;hb=dea922bbc1fa2b643140a6b5275e58a1fb0225c9;hp=18d2590ebf62c6617f377e43bff36ee2e6133baa;hpb=b96ad1327c25d5de8d61ed73a1c0e207e67f1226;p=dcpomatic.git diff --git a/src/lib/subtitle.h b/src/lib/subtitle.h index 18d2590eb..38ba4e70e 100644 --- a/src/lib/subtitle.h +++ b/src/lib/subtitle.h @@ -17,47 +17,65 @@ */ +/** @file src/subtitle.h + * @brief Representations of subtitles. + */ + #include #include #include "util.h" struct AVSubtitle; -class SubtitleImage; -class SimpleImage; +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; + } - std::list > images () const { - return _images; + Position position () const { + return _position; + } + + boost::shared_ptr image () const { + return _image; } + 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; - std::list > _images; + Position _position; + boost::shared_ptr _image; }; -class SubtitleImage +Rect +subtitle_transformed_area ( + float target_x_scale, float target_y_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: - SubtitleImage (AVSubtitleRect const *); + TimedSubtitle (AVSubtitle const &); - Position position () const { - return _position; - } + bool displayed_at (double t) const; - boost::shared_ptr image () const { - return _image; + boost::shared_ptr subtitle () const { + return _subtitle; } private: - Position _position; - boost::shared_ptr _image; + /** 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; };