diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-06-03 22:54:17 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-06-03 22:54:17 +0100 |
| commit | 7affca9f7b210c3137eb084cd393b534051a2647 (patch) | |
| tree | a7258aaf447a83680ca459fcc856be4352c6f2d6 /src/lib/player.cc | |
| parent | 635e9a1f0de1a7a8ec573e04391ccc83ee457d72 (diff) | |
Various fixes to allow independent x and y scaling of text subs (#489).
Diffstat (limited to 'src/lib/player.cc')
| -rw-r--r-- | src/lib/player.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc index ac5a70570..f53bf68d2 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -63,6 +63,7 @@ using std::vector; using std::pair; using std::map; using std::make_pair; +using std::copy; using boost::shared_ptr; using boost::weak_ptr; using boost::dynamic_pointer_cast; @@ -385,7 +386,8 @@ Player::get_video (DCPTime time, bool accurate) /* Text subtitles (rendered to an image) */ if (!ps.text.empty ()) { - sub_images.push_back (render_subtitles (ps.text, _video_container_size)); + list<PositionImage> s = render_subtitles (ps.text, _video_container_size); + copy (s.begin (), s.end (), back_inserter (sub_images)); } if (!sub_images.empty ()) { @@ -585,7 +587,13 @@ Player::get_subtitles (DCPTime time, DCPTime length, bool starting) BOOST_FOREACH (ContentTextSubtitle& ts, text) { BOOST_FOREACH (dcp::SubtitleString& s, ts.subs) { s.set_v_position (s.v_position() + subtitle_content->subtitle_y_offset ()); - s.set_size (s.size() * max (subtitle_content->subtitle_x_scale(), subtitle_content->subtitle_y_scale())); + float const xs = subtitle_content->subtitle_x_scale(); + float const ys = subtitle_content->subtitle_y_scale(); + float const average = s.size() * (xs + ys) / 2; + s.set_size (average); + if (fabs (1.0 - xs / ys) > dcp::ASPECT_ADJUST_EPSILON) { + s.set_aspect_adjust (xs / ys); + } ps.text.push_back (s); } } |
