summaryrefslogtreecommitdiff
path: root/src/lib/subtitle.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-10-17 00:06:10 +0100
committerCarl Hetherington <cth@carlh.net>2012-10-17 00:06:10 +0100
commit7ef2ba523ca2ddc0470f5837bc88ad9c597361e2 (patch)
tree9aaa33632f2c41e8c3129543c8214c8c3d7274cb /src/lib/subtitle.cc
parent9e93c860759b8d04277596781706488f59a3cc12 (diff)
parentc37c744bbb236b1fd39f86e4f0ab36652d403d67 (diff)
Merge branch 'master' of /home/carl/git/dvdomatic
Diffstat (limited to 'src/lib/subtitle.cc')
-rw-r--r--src/lib/subtitle.cc25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/lib/subtitle.cc b/src/lib/subtitle.cc
index 01e8cac13..dcb747828 100644
--- a/src/lib/subtitle.cc
+++ b/src/lib/subtitle.cc
@@ -17,6 +17,10 @@
*/
+/** @file src/subtitle.cc
+ * @brief Representations of subtitles.
+ */
+
#include "subtitle.h"
#include "image.h"
#include "exceptions.h"
@@ -25,6 +29,10 @@
using namespace std;
using namespace boost;
+/** Construct a TimedSubtitle. This is a subtitle image, position,
+ * and a range of time over which it should be shown.
+ * @param sub AVSubtitle to read.
+ */
TimedSubtitle::TimedSubtitle (AVSubtitle const & sub)
{
/* subtitle PTS in seconds */
@@ -73,13 +81,27 @@ TimedSubtitle::displayed_at (double t) const
return t >= _from && t <= _to;
}
+/** Construct a subtitle, which is an image and a position.
+ * @param p Position within the (uncropped) source frame.
+ * @param i Image of the subtitle (should be RGBA).
+ */
Subtitle::Subtitle (Position p, shared_ptr<Image> i)
: _position (p)
, _image (i)
{
}
-
+
+/** Given the area of a subtitle, work out the area it should
+ * take up when its video frame is scaled up, and it is optionally
+ * itself scaled and offset.
+ * @param target_x_scale the x scaling of the video frame that the subtitle is in.
+ * @param target_y_scale the y scaling of the video frame that the subtitle is in.
+ * @param sub_area The area of the subtitle within the original source.
+ * @param subtitle_offset y offset to apply to the subtitle position (+ve is down)
+ * in the coordinate space of the source.
+ * @param subtitle_scale scaling factor to apply to the subtitle image.
+ */
Rectangle
subtitle_transformed_area (
float target_x_scale, float target_y_scale,
@@ -114,6 +136,7 @@ subtitle_transformed_area (
return tx;
}
+/** @return area that this subtitle take up, in the original uncropped source's coordinate space */
Rectangle
Subtitle::area () const
{