if (decoder->subtitle) {
decoder->subtitle->BitmapStart.connect (bind (&Player::bitmap_text_start, this, weak_ptr<Piece> (piece), _1));
decoder->subtitle->PlainStart.connect (bind (&Player::plain_text_start, this, weak_ptr<Piece> (piece), _1));
- decoder->subtitle->Stop.connect (bind (&Player::subtitle_stop, this, weak_ptr<Piece> (piece), _1));
+ decoder->subtitle->Stop.connect (bind (&Player::subtitle_stop, this, weak_ptr<Piece> (piece), _1, _2));
}
}
int const vfr = _film->video_frame_rate();
- BOOST_FOREACH (PlayerText i, _active_subtitles.get_burnt (DCPTimePeriod(time, time + DCPTime::from_frames(1, vfr)), _always_burn_subtitles)) {
+ BOOST_FOREACH (PlayerCaption i, _active_text[TEXT_SUBTITLE].get_burnt (DCPTimePeriod(time, time + DCPTime::from_frames(1, vfr)), _always_burn_subtitles)) {
/* Image subtitles */
list<PositionImage> c = transform_bitmap_texts (i.image);
}
void
-Player::bitmap_text_start (weak_ptr<Piece> wp, ContentBitmapText subtitle)
+Player::bitmap_text_start (weak_ptr<Piece> wp, ContentBitmapCaption subtitle)
{
shared_ptr<Piece> piece = wp.lock ();
if (!piece) {
subtitle.sub.rectangle.width *= piece->content->subtitle->x_scale ();
subtitle.sub.rectangle.height *= piece->content->subtitle->y_scale ();
- PlayerText ps;
+ PlayerCaption ps;
ps.image.push_back (subtitle.sub);
DCPTime from (content_time_to_dcp (piece, subtitle.from()));
- _active_subtitles.add_from (wp, ps, from);
+ _active_text[subtitle.type()].add_from (wp, ps, from);
}
void
-Player::plain_text_start (weak_ptr<Piece> wp, ContentPlainText subtitle)
+Player::plain_text_start (weak_ptr<Piece> wp, ContentTextCaption subtitle)
{
shared_ptr<Piece> piece = wp.lock ();
if (!piece) {
return;
}
- PlayerText ps;
+ PlayerCaption ps;
DCPTime const from (content_time_to_dcp (piece, subtitle.from()));
if (from > piece->content->end()) {
}
s.set_in (dcp::Time(from.seconds(), 1000));
- ps.text.push_back (PlainText (s, piece->content->subtitle->outline_width()));
+ ps.text.push_back (TextCaption (s, piece->content->subtitle->outline_width()));
ps.add_fonts (piece->content->subtitle->fonts ());
}
- _active_subtitles.add_from (wp, ps, from);
+ _active_text[subtitle.type()].add_from (wp, ps, from);
}
void
-Player::subtitle_stop (weak_ptr<Piece> wp, ContentTime to)
+Player::subtitle_stop (weak_ptr<Piece> wp, ContentTime to, TextType type)
{
- if (!_active_subtitles.have (wp)) {
+ if (!_active_text[type].have (wp)) {
return;
}
return;
}
- pair<PlayerText, DCPTime> from = _active_subtitles.add_to (wp, dcp_to);
+ pair<PlayerCaption, DCPTime> from = _active_text[type].add_to (wp, dcp_to);
if (piece->content->subtitle->use() && !_always_burn_subtitles && !piece->content->subtitle->burn()) {
- Subtitle (from.first, DCPTimePeriod (from.second, dcp_to));
+ Text (from.first, type, DCPTimePeriod (from.second, dcp_to));
}
}
}
_audio_merger.clear ();
- _active_subtitles.clear ();
+ for (int i = 0; i < TEXT_COUNT; ++i) {
+ _active_text[i].clear ();
+ }
BOOST_FOREACH (shared_ptr<Piece> i, _pieces) {
if (time < i->content->position()) {
Player::do_emit_video (shared_ptr<PlayerVideo> pv, DCPTime time)
{
if (pv->eyes() == EYES_BOTH || pv->eyes() == EYES_RIGHT) {
- _active_subtitles.clear_before (time);
+ for (int i = 0; i < TEXT_COUNT; ++i) {
+ _active_text[i].clear_before (time);
+ }
}
optional<PositionImage> subtitles = subtitles_for_frame (time);