X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplayer.cc;h=a8ba7cc536b5012cedab2d6f065f972578894a4c;hb=c28b3d6f168607aca9995282b96647eb64a26dc9;hp=cb6d519842c5c6cfce1ac92d5f1fe83f74a04e0c;hpb=015fe447cfe25babc55cf8ed282bb909e4713aa0;p=dcpomatic.git diff --git a/src/lib/player.cc b/src/lib/player.cc index cb6d51984..a8ba7cc53 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -270,7 +270,7 @@ Player::emit_video (weak_ptr weak_piece, shared_ptr video) FrameRateChange frc (content->video_frame_rate(), _film->video_frame_rate()); float const ratio = content->ratio() ? content->ratio()->ratio() : content->video_size_after_crop().ratio(); - libdcp::Size image_size = fit_ratio_within (ratio, _video_container_size); + dcp::Size image_size = fit_ratio_within (ratio, _video_container_size); if (_approximate_size) { image_size.width &= ~3; image_size.height &= ~3; @@ -346,12 +346,12 @@ Player::emit_audio (weak_ptr weak_piece, shared_ptr audio) AudioMapping map = content->audio_mapping (); for (int i = 0; i < map.content_channels(); ++i) { for (int j = 0; j < _film->audio_channels(); ++j) { - if (map.get (i, static_cast (j)) > 0) { + if (map.get (i, static_cast (j)) > 0) { dcp_mapped->accumulate_channel ( audio->data.get(), i, - static_cast (j), - map.get (i, static_cast (j)) + static_cast (j), + map.get (i, static_cast (j)) ); } } @@ -450,6 +450,10 @@ Player::setup_pieces () for (ContentList::iterator i = content.begin(); i != content.end(); ++i) { + if (!(*i)->paths_valid ()) { + continue; + } + shared_ptr decoder; optional frc; @@ -547,7 +551,11 @@ Player::content_changed (weak_ptr w, int property, bool frequent) _have_valid_pieces = false; Changed (frequent); - } else if (property == SubtitleContentProperty::SUBTITLE_OFFSET || property == SubtitleContentProperty::SUBTITLE_SCALE) { + } else if ( + property == SubtitleContentProperty::SUBTITLE_X_OFFSET || + property == SubtitleContentProperty::SUBTITLE_Y_OFFSET || + property == SubtitleContentProperty::SUBTITLE_SCALE + ) { update_subtitle_from_image (); update_subtitle_from_text (); @@ -562,6 +570,7 @@ Player::content_changed (weak_ptr w, int property, bool frequent) } else if (property == ContentProperty::PATH) { + _have_valid_pieces = false; Changed (frequent); } } @@ -574,7 +583,7 @@ Player::playlist_changed () } void -Player::set_video_container_size (libdcp::Size s) +Player::set_video_container_size (dcp::Size s) { _video_container_size = s; @@ -649,9 +658,10 @@ Player::update_subtitle_from_image () assert (sc); dcpomatic::Rect in_rect = _image_subtitle.subtitle->rect; - libdcp::Size scaled_size; + dcp::Size scaled_size; - in_rect.y += sc->subtitle_offset (); + in_rect.x += sc->subtitle_x_offset (); + in_rect.y += sc->subtitle_y_offset (); /* We will scale the subtitle up to fit _video_container_size, and also by the additional subtitle_scale */ scaled_size.width = in_rect.width * _video_container_size.width * sc->subtitle_scale (); @@ -679,8 +689,8 @@ Player::update_subtitle_from_image () true ); - _out_subtitle.from = _image_subtitle.subtitle->dcp_time; - _out_subtitle.to = _image_subtitle.subtitle->dcp_time_to; + _out_subtitle.from = _image_subtitle.subtitle->dcp_time + piece->content->position (); + _out_subtitle.to = _image_subtitle.subtitle->dcp_time_to + piece->content->position (); } /** Re-emit the last frame that was emitted, using current settings for crop, ratio, scaler and subtitles. @@ -721,8 +731,8 @@ Player::set_approximate_size () PlayerImage::PlayerImage ( shared_ptr in, Crop crop, - libdcp::Size inter_size, - libdcp::Size out_size, + dcp::Size inter_size, + dcp::Size out_size, Scaler const * scaler ) : _in (in)