+/* -*- c-basic-offset: 8; default-tab-width: 8; -*- */
+
/*
Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
*/
+/** @file src/subtitle.h
+ * @brief Representations of subtitles.
+ */
+
#include <list>
#include <boost/shared_ptr.hpp>
-#include "util.h"
+#include "types.h"
struct AVSubtitle;
-class SubtitleImage;
class Image;
-class FilmState;
+/** A subtitle, consisting of an image and a position */
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;
}
+ dvdomatic::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<boost::shared_ptr<SubtitleImage> > _images;
+ Position _position;
+ boost::shared_ptr<Image> _image;
};
-extern Rectangle transformed_subtitle_area (
+dvdomatic::Rect
+subtitle_transformed_area (
float target_x_scale, float target_y_scale,
- Rectangle sub_area, int subtitle_offset, float subtitle_scale
+ dvdomatic::Rect sub_area, int subtitle_offset, float subtitle_scale
);
-class SubtitleImage
+/** A Subtitle class with details of the time over which it should be shown */
+class TimedSubtitle
{
public:
- SubtitleImage (AVSubtitleRect const *);
+ TimedSubtitle (AVSubtitle const &);
- void set_position (Position p) {
- _position = p;
- }
-
- Position position () const {
- return _position;
- }
+ bool displayed_at (Time) const;
- boost::shared_ptr<Image> image () const {
- return _image;
+ boost::shared_ptr<Subtitle> subtitle () const {
+ return _subtitle;
}
- Rectangle area () const;
-
private:
- Position _position;
- boost::shared_ptr<Image> _image;
+ /** the subtitle */
+ boost::shared_ptr<Subtitle> _subtitle;
+ /** display from time from the start of the content */
+ Time _from;
+ /** display to time from the start of the content */
+ Time _to;
};