summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-07-01 17:03:16 +0100
committerCarl Hetherington <cth@carlh.net>2014-07-01 17:03:16 +0100
commit096660d2cc3e65ae5e13a69e7ace19ff0d48b39a (patch)
treefa1c32fd182c7cd19ab5565cdd411445d06dbe8d /src/lib
parent7632d0d3da495443b80334363399172e54ebfd7c (diff)
Only burn subtitles if it is turned on.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dcp_video.cc11
-rw-r--r--src/lib/dcp_video.h3
-rw-r--r--src/lib/encoder.cc1
-rw-r--r--src/lib/player_video.cc12
-rw-r--r--src/lib/player_video.h6
5 files changed, 19 insertions, 14 deletions
diff --git a/src/lib/dcp_video.cc b/src/lib/dcp_video.cc
index 8d4a5925f..b6b7ab296 100644
--- a/src/lib/dcp_video.cc
+++ b/src/lib/dcp_video.cc
@@ -82,13 +82,14 @@ using dcp::raw_convert;
* @param l Log to write to.
*/
DCPVideo::DCPVideo (
- shared_ptr<const PlayerVideo> frame, int index, int dcp_fps, int bw, Resolution r, shared_ptr<Log> l
+ shared_ptr<const PlayerVideo> frame, int index, int dcp_fps, int bw, Resolution r, bool b, shared_ptr<Log> l
)
: _frame (frame)
, _index (index)
, _frames_per_second (dcp_fps)
, _j2k_bandwidth (bw)
, _resolution (r)
+ , _burn_subtitles (b)
, _log (l)
{
@@ -102,6 +103,7 @@ DCPVideo::DCPVideo (shared_ptr<const PlayerVideo> frame, shared_ptr<const cxml::
_frames_per_second = node->number_child<int> ("FramesPerSecond");
_j2k_bandwidth = node->number_child<int> ("J2KBandwidth");
_resolution = Resolution (node->optional_number_child<int>("Resolution").get_value_or (RESOLUTION_2K));
+ _burn_subtitles = node->bool_child ("BurnSubtitles");
}
/** J2K-encode this frame on the local host.
@@ -124,7 +126,7 @@ DCPVideo::encode_locally ()
}
shared_ptr<dcp::XYZFrame> xyz = dcp::rgb_to_xyz (
- _frame->image(),
+ _frame->image (_burn_subtitles),
in_lut,
dcp::GammaLUT::cache.get (16, 1 / _frame->colour_conversion().output_gamma, false),
matrix
@@ -285,7 +287,7 @@ DCPVideo::encode_remotely (ServerDescription serv)
socket->write ((uint8_t *) xml.str().c_str(), xml.str().length() + 1);
/* Send binary data */
- _frame->send_binary (socket);
+ _frame->send_binary (socket, _burn_subtitles);
/* Read the response (JPEG2000-encoded data); this blocks until the data
is ready and sent back.
@@ -305,7 +307,8 @@ DCPVideo::add_metadata (xmlpp::Element* el) const
el->add_child("FramesPerSecond")->add_child_text (raw_convert<string> (_frames_per_second));
el->add_child("J2KBandwidth")->add_child_text (raw_convert<string> (_j2k_bandwidth));
el->add_child("Resolution")->add_child_text (raw_convert<string> (int (_resolution)));
- _frame->add_metadata (el);
+ el->add_child("BurnSubtitles")->add_child_text (_burn_subtitles ? "1" : "0");
+ _frame->add_metadata (el, _burn_subtitles);
}
Eyes
diff --git a/src/lib/dcp_video.h b/src/lib/dcp_video.h
index 7b01966bd..05a0b4ce3 100644
--- a/src/lib/dcp_video.h
+++ b/src/lib/dcp_video.h
@@ -101,7 +101,7 @@ public:
class DCPVideo : public boost::noncopyable
{
public:
- DCPVideo (boost::shared_ptr<const PlayerVideo>, int, int, int, Resolution, boost::shared_ptr<Log>);
+ DCPVideo (boost::shared_ptr<const PlayerVideo>, int, int, int, Resolution, bool b, boost::shared_ptr<Log>);
DCPVideo (boost::shared_ptr<const PlayerVideo>, cxml::ConstNodePtr, boost::shared_ptr<Log>);
boost::shared_ptr<EncodedData> encode_locally ();
@@ -122,6 +122,7 @@ private:
int _frames_per_second; ///< Frames per second that we will use for the DCP
int _j2k_bandwidth; ///< J2K bandwidth to use
Resolution _resolution; ///< Resolution (2K or 4K)
+ bool _burn_subtitles; ///< true to burn subtitles into the image
boost::shared_ptr<Log> _log; ///< log
};
diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc
index 2b1f1d9b3..591523570 100644
--- a/src/lib/encoder.cc
+++ b/src/lib/encoder.cc
@@ -220,6 +220,7 @@ Encoder::process_video (shared_ptr<PlayerVideo> pvf)
_film->video_frame_rate(),
_film->j2k_bandwidth(),
_film->resolution(),
+ _film->burn_subtitles(),
_film->log()
)
));
diff --git a/src/lib/player_video.cc b/src/lib/player_video.cc
index 3c513848a..d1b394933 100644
--- a/src/lib/player_video.cc
+++ b/src/lib/player_video.cc
@@ -85,7 +85,7 @@ PlayerVideo::set_subtitle (PositionImage image)
}
shared_ptr<Image>
-PlayerVideo::image () const
+PlayerVideo::image (bool burn_subtitle) const
{
shared_ptr<Image> im = _in->image ();
@@ -111,7 +111,7 @@ PlayerVideo::image () const
Position<int> const container_offset ((_out_size.width - _inter_size.width) / 2, (_out_size.height - _inter_size.width) / 2);
- if (_subtitle.image) {
+ if (burn_subtitle && _subtitle.image) {
out->alpha_blend (_subtitle.image, _subtitle.position);
}
@@ -119,7 +119,7 @@ PlayerVideo::image () const
}
void
-PlayerVideo::add_metadata (xmlpp::Node* node) const
+PlayerVideo::add_metadata (xmlpp::Node* node, bool send_subtitles) const
{
node->add_child("Time")->add_child_text (raw_convert<string> (_time.get ()));
_crop.as_xml (node);
@@ -132,7 +132,7 @@ PlayerVideo::add_metadata (xmlpp::Node* node) const
node->add_child("Eyes")->add_child_text (raw_convert<string> (_eyes));
node->add_child("Part")->add_child_text (raw_convert<string> (_part));
_colour_conversion.as_xml (node);
- if (_subtitle.image) {
+ if (send_subtitles && _subtitle.image) {
node->add_child ("SubtitleWidth")->add_child_text (raw_convert<string> (_subtitle.image->size().width));
node->add_child ("SubtitleHeight")->add_child_text (raw_convert<string> (_subtitle.image->size().height));
node->add_child ("SubtitleX")->add_child_text (raw_convert<string> (_subtitle.position.x));
@@ -141,10 +141,10 @@ PlayerVideo::add_metadata (xmlpp::Node* node) const
}
void
-PlayerVideo::send_binary (shared_ptr<Socket> socket) const
+PlayerVideo::send_binary (shared_ptr<Socket> socket, bool send_subtitles) const
{
_in->send_binary (socket);
- if (_subtitle.image) {
+ if (send_subtitles && _subtitle.image) {
_subtitle.image->write_to_socket (socket);
}
}
diff --git a/src/lib/player_video.h b/src/lib/player_video.h
index 7d2787783..e06e5f45e 100644
--- a/src/lib/player_video.h
+++ b/src/lib/player_video.h
@@ -41,10 +41,10 @@ public:
void set_subtitle (PositionImage);
- boost::shared_ptr<Image> image () const;
+ boost::shared_ptr<Image> image (bool burn_subtitle) const;
- void add_metadata (xmlpp::Node* node) const;
- void send_binary (boost::shared_ptr<Socket> socket) const;
+ void add_metadata (xmlpp::Node* node, bool send_subtitles) const;
+ void send_binary (boost::shared_ptr<Socket> socket, bool send_subtitles) const;
DCPTime time () const {
return _time;