+
+pair<shared_ptr<AudioBuffers>, DCPTime>
+Player::discard_audio (shared_ptr<const AudioBuffers> audio, DCPTime time, DCPTime discard_to) const
+{
+ DCPTime const discard_time = discard_to - time;
+ Frame const discard_frames = discard_time.frames_round(_film->audio_frame_rate());
+ Frame remaining_frames = audio->frames() - discard_frames;
+ if (remaining_frames <= 0) {
+ return make_pair(shared_ptr<AudioBuffers>(), DCPTime());
+ }
+ shared_ptr<AudioBuffers> cut (new AudioBuffers(audio, remaining_frames, discard_frames));
+ return make_pair(cut, time + discard_time);
+}
+
+void
+Player::set_dcp_decode_reduction (optional<int> reduction)
+{
+ Change (CHANGE_TYPE_PENDING, PlayerProperty::DCP_DECODE_REDUCTION, false);
+
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+
+ if (reduction == _dcp_decode_reduction) {
+ lm.unlock ();
+ Change (CHANGE_TYPE_CANCELLED, PlayerProperty::DCP_DECODE_REDUCTION, false);
+ return;
+ }
+
+ _dcp_decode_reduction = reduction;
+ setup_pieces_unlocked ();
+ }
+
+ Change (CHANGE_TYPE_DONE, PlayerProperty::DCP_DECODE_REDUCTION, false);
+}
+
+optional<DCPTime>
+Player::content_time_to_dcp (shared_ptr<Content> content, ContentTime t)
+{
+ boost::mutex::scoped_lock lm (_mutex);
+
+ for (auto i: _pieces) {
+ if (i->content == content) {
+ return content_time_to_dcp (i, t);
+ }
+ }
+
+ /* We couldn't find this content; perhaps things are being changed over */
+ return optional<DCPTime>();
+}
+
+
+shared_ptr<const Playlist>
+Player::playlist () const
+{
+ return _playlist ? _playlist : _film->playlist();
+}
+
+
+void
+Player::atmos (weak_ptr<Piece>, ContentAtmos data)
+{
+ Atmos (data.data, DCPTime::from_frames(data.frame, _film->video_frame_rate()), data.metadata);
+}
+