* @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)
{
_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.
}
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
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.
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
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 ();
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
};
_film->video_frame_rate(),
_film->j2k_bandwidth(),
_film->resolution(),
+ _film->burn_subtitles(),
_film->log()
)
));
}
shared_ptr<Image>
-PlayerVideo::image () const
+PlayerVideo::image (bool burn_subtitle) const
{
shared_ptr<Image> im = _in->image ();
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);
}
}
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);
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));
}
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);
}
}
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;
void
process_video (shared_ptr<PlayerVideo> pvf)
{
- shared_ptr<DCPVideo> local (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_));
- shared_ptr<DCPVideo> remote (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_));
+ shared_ptr<DCPVideo> local (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, true, log_));
+ shared_ptr<DCPVideo> remote (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, true, log_));
cout << "Frame " << frame_count << ": ";
cout.flush ();
list<shared_ptr<PlayerVideo> > pvf = _player->get_video (p, accurate);
if (!pvf.empty ()) {
- _frame = pvf.front()->image ();
+ _frame = pvf.front()->image (true);
_frame = _frame->scale (_frame->size(), Scaler::from_id ("fastbilinear"), PIX_FMT_RGB24, false);
_position = pvf.front()->time ();
} else {
24,
200000000,
RESOLUTION_2K,
+ true,
log
)
);
24,
200000000,
RESOLUTION_2K,
+ true,
log
)
);