diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-01-14 10:39:07 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-01-14 10:39:07 +0000 |
| commit | 057400eb1718e8769592e34e07d90405eb95605f (patch) | |
| tree | 282a856feca494b1571d0ee67e22763a2db122e6 /src/lib/player.cc | |
| parent | ee4362c939b5fe6bab598b59916478513b9d6779 (diff) | |
Scale subtitle times with frame rate change if they are part of a piece of video content.
Diffstat (limited to 'src/lib/player.cc')
| -rw-r--r-- | src/lib/player.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc index 9f8599693..56145f5bd 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -292,6 +292,7 @@ Player::process_video (weak_ptr<Piece> weak_piece, shared_ptr<const Image> image pi->set_subtitle (_out_subtitle.image, _out_subtitle.position + container_offset); } + #ifdef DCPOMATIC_DEBUG _last_video = piece->content; @@ -683,8 +684,18 @@ Player::update_subtitle () _in_subtitle.image->pixel_format (), true ); - _out_subtitle.from = _in_subtitle.from + piece->content->position (); - _out_subtitle.to = _in_subtitle.to + piece->content->position (); + + /* XXX: hack */ + Time from = _in_subtitle.from; + Time to = _in_subtitle.to; + shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (piece->content); + if (vc) { + from = rint (from * vc->video_frame_rate() / _film->video_frame_rate()); + to = rint (to * vc->video_frame_rate() / _film->video_frame_rate()); + } + + _out_subtitle.from = from * piece->content->position (); + _out_subtitle.to = to + piece->content->position (); } /** Re-emit the last frame that was emitted, using current settings for crop, ratio, scaler and subtitles. |
