Fix horrid memory corruptions.
[dcpomatic.git] / src / lib / subtitle.h
index 18d2590ebf62c6617f377e43bff36ee2e6133baa..de8f025964fc468683573813f8948ad6715d81c7 100644 (file)
 #include "util.h"
 
 struct AVSubtitle;
-class SubtitleImage;
-class SimpleImage;
+class Image;
 
 class Subtitle
 {
 public:
-       Subtitle (AVSubtitle const &);
+       Subtitle (Position p, boost::shared_ptr<Image> i);
 
-       bool displayed_at (double t);
+       void set_position (Position p) {
+               _position = p;
+       }
 
-       std::list<boost::shared_ptr<SubtitleImage> > images () const {
-               return _images;
+       Position position () const {
+               return _position;
+       }
+       
+       boost::shared_ptr<Image> image () const {
+               return _image;
        }
 
+       Rectangle 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<boost::shared_ptr<SubtitleImage> > _images;
+       Position _position;
+       boost::shared_ptr<Image> _image;
 };
 
-class SubtitleImage
+Rectangle
+subtitle_transformed_area (
+       float target_x_scale, float target_y_scale,
+       Rectangle sub_area, int subtitle_offset, float subtitle_scale
+       );
+       
+class TimedSubtitle
 {
 public:
-       SubtitleImage (AVSubtitleRect const *);
+       TimedSubtitle (AVSubtitle const &);
 
-       Position position () const {
-               return _position;
-       }
+       bool displayed_at (double t) const;
        
-       boost::shared_ptr<SimpleImage> image () const {
-               return _image;
+       boost::shared_ptr<Subtitle> subtitle () const {
+               return _subtitle;
        }
 
 private:
-       Position _position;
-       boost::shared_ptr<SimpleImage> _image;
+       boost::shared_ptr<Subtitle> _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;
 };