return _state.dcp_name ();
}
+ /** @return true to use a DCI-spec name for the DCP */
bool use_dci_name () const {
return _state.use_dci_name;
}
return _state.dcp_frames;
}
+ /** @return what to do with the end of an encode when trimming */
TrimAction dcp_trim_action () const {
return _state.dcp_trim_action;
}
return _state.dcp_ab;
}
+ /** @return gain that should be applied to the audio when making a DCP
+ (in dB).
+ */
float audio_gain () const {
return _state.audio_gain;
}
+ /** @return delay to apply to audio (positive moves audio later) in milliseconds */
int audio_delay () const {
return _state.audio_delay;
}
+ /** @return duration to make still-sourced films (in seconds) */
int still_duration () const {
return _state.still_duration;
}
+ /** @return true to encode DCP with subtitles, if they are available */
bool with_subtitles () const {
return _state.with_subtitles;
}
+ /** @return offset to move subtitles by, in source pixels; +ve moves
+ them down the image, -ve moves them up.
+ */
int subtitle_offset () const {
return _state.subtitle_offset;
}
+ /** @return scaling factor to apply to subtitle images */
float subtitle_scale () const {
return _state.subtitle_scale;
}
return length;
}
+/** @return a DCI-compliant name for a DCP of this film */
string
FilmState::dci_name () const
{
}
}
+ /* Spec is that the name part should be maximum 14 characters, as I understand it */
if (fixed_name.length() > 14) {
fixed_name = fixed_name.substr (0, 14);
}
std::string directory;
/** Name for DVD-o-matic */
std::string name;
+ /** True if a auto-generated DCI-compliant name should be used for our DCP */
bool use_dci_name;
/** File or directory containing content; may be relative to our directory
* or an absolute path.
int audio_delay;
/** Duration to make still-sourced films (in seconds) */
int still_duration;
+ /** True if subtitles should be shown for this film */
bool with_subtitles;
/** y offset for placing subtitles, in source pixels; +ve is further down
the frame, -ve is further up.
*/
int subtitle_offset;
+ /** scale factor to apply to subtitles */
float subtitle_scale;
/* DCI naming stuff */
*/
+/** @file src/subtitle.cc
+ * @brief Representations of subtitles.
+ */
+
#include "subtitle.h"
#include "image.h"
#include "exceptions.h"
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 */
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,
return tx;
}
+/** @return area that this subtitle take up, in the original uncropped source's coordinate space */
Rectangle
Subtitle::area () const
{
*/
+/** @file src/subtitle.h
+ * @brief Representations of subtitles.
+ */
+
#include <list>
#include <boost/shared_ptr.hpp>
#include "util.h"
struct AVSubtitle;
class Image;
+/** A subtitle, consisting of an image and a position */
class Subtitle
{
public:
float target_x_scale, float target_y_scale,
Rectangle 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:
}
private:
+ /** the subtitle */
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 */
);
}
+/** Round a number up to the nearest multiple of another number.
+ * @param a Number to round.
+ * @param t Multiple to round to.
+ * @return Rounded number.
+ */
+
int
round_up (int a, int t)
{
return a - (a % t);
}
+/** Read a sequence of key / value pairs from a text stream;
+ * the keys are the first words on the line, and the values are
+ * the remainder of the line following the key. Lines beginning
+ * with # are ignored.
+ * @param s Stream to read.
+ * @return key/value pairs.
+ */
multimap<string, string>
read_key_value (istream &s)
{