, _ignore_audio(false)
, _ignore_text(false)
, _always_burn_open_subtitles(false)
+ , _fast(false)
, _tolerant (film->tolerant())
+ , _play_referenced(false)
, _audio_merger (_film->audio_frame_rate())
, _subtitle_alignment (subtitle_alignment)
{
, _ignore_audio(false)
, _ignore_text(false)
, _always_burn_open_subtitles(false)
+ , _fast(false)
, _tolerant (film->tolerant())
+ , _play_referenced(false)
, _audio_merger (_film->audio_frame_rate())
{
construct ();
}
-void
-Player::setup_pieces ()
-{
- boost::mutex::scoped_lock lm (_mutex);
- setup_pieces_unlocked ();
-}
-
-
bool
have_video (shared_ptr<const Content> content)
{
void
-Player::setup_pieces_unlocked ()
+Player::setup_pieces ()
{
+ boost::mutex::scoped_lock lm (_mutex);
+
_playback_length = _playlist ? _playlist->length(_film) : _film->length();
auto old_pieces = _pieces;
{
Change (ChangeType::PENDING, PlayerProperty::VIDEO_CONTAINER_SIZE, false);
- {
- boost::mutex::scoped_lock lm (_mutex);
-
- if (s == _video_container_size) {
- lm.unlock ();
- Change (ChangeType::CANCELLED, PlayerProperty::VIDEO_CONTAINER_SIZE, false);
- return;
- }
+ if (s == _video_container_size) {
+ Change(ChangeType::CANCELLED, PlayerProperty::VIDEO_CONTAINER_SIZE, false);
+ return;
+ }
- _video_container_size = s;
+ _video_container_size = s;
+ {
+ boost::mutex::scoped_lock lm (_mutex);
_black_image = make_shared<Image>(AV_PIX_FMT_RGB24, _video_container_size, Image::Alignment::PADDED);
_black_image->make_black ();
}
void
Player::set_fast ()
{
- boost::mutex::scoped_lock lm (_mutex);
_fast = true;
- setup_pieces_unlocked ();
+ setup_pieces();
}
void
Player::set_play_referenced ()
{
- boost::mutex::scoped_lock lm (_mutex);
_play_referenced = true;
- setup_pieces_unlocked ();
+ setup_pieces();
}
}
/* i.image will already have been scaled to fit _video_container_size */
- dcp::Size scaled_size (i.rectangle.width * _video_container_size.width, i.rectangle.height * _video_container_size.height);
+ dcp::Size scaled_size (i.rectangle.width * _video_container_size.load().width, i.rectangle.height * _video_container_size.load().height);
captions.push_back (
PositionImage (
i.image,
Position<int> (
- lrint(_video_container_size.width * i.rectangle.x),
- lrint(_video_container_size.height * i.rectangle.y)
+ lrint(_video_container_size.load().width * i.rectangle.x),
+ lrint(_video_container_size.load().height * i.rectangle.y)
)
)
);
auto image = sub.image;
/* We will scale the subtitle up to fit _video_container_size */
- int const width = sub.rectangle.width * _video_container_size.width;
- int const height = sub.rectangle.height * _video_container_size.height;
+ int const width = sub.rectangle.width * _video_container_size.load().width;
+ int const height = sub.rectangle.height * _video_container_size.load().height;
if (width == 0 || height == 0) {
return;
}
{
Change (ChangeType::PENDING, PlayerProperty::DCP_DECODE_REDUCTION, false);
- {
- boost::mutex::scoped_lock lm (_mutex);
-
- if (reduction == _dcp_decode_reduction) {
- lm.unlock ();
- Change (ChangeType::CANCELLED, PlayerProperty::DCP_DECODE_REDUCTION, false);
- return;
- }
-
- _dcp_decode_reduction = reduction;
- setup_pieces_unlocked ();
+ if (reduction == _dcp_decode_reduction.load()) {
+ Change(ChangeType::CANCELLED, PlayerProperty::DCP_DECODE_REDUCTION, false);
+ return;
}
+ _dcp_decode_reduction = reduction;
+ setup_pieces();
+
Change (ChangeType::DONE, PlayerProperty::DCP_DECODE_REDUCTION, false);
}
optional<DCPTime>
-Player::content_time_to_dcp (shared_ptr<const Content> content, ContentTime t)
+Player::content_time_to_dcp (shared_ptr<const Content> content, ContentTime t) const
{
boost::mutex::scoped_lock lm (_mutex);
optional<ContentTime>
-Player::dcp_to_content_time (shared_ptr<const Content> content, DCPTime t)
+Player::dcp_to_content_time (shared_ptr<const Content> content, DCPTime t) const
{
boost::mutex::scoped_lock lm (_mutex);