+
+/** Set this player never to produce any audio data */
+void
+Player::set_ignore_audio ()
+{
+ _ignore_audio = true;
+}
+
+/** Set whether or not this player should always burn text subtitles into the image,
+ * regardless of the content settings.
+ * @param burn true to always burn subtitles, false to obey content settings.
+ */
+void
+Player::set_always_burn_subtitles (bool burn)
+{
+ _always_burn_subtitles = burn;
+}
+
+void
+Player::set_fast ()
+{
+ _fast = true;
+ _have_valid_pieces = false;
+}
+
+void
+Player::set_play_referenced ()
+{
+ _play_referenced = true;
+ _have_valid_pieces = false;
+}
+
+list<ReferencedReelAsset>
+Player::get_reel_assets ()
+{
+ list<ReferencedReelAsset> a;
+
+ BOOST_FOREACH (shared_ptr<Content> i, _playlist->content ()) {
+ shared_ptr<DCPContent> j = dynamic_pointer_cast<DCPContent> (i);
+ if (!j) {
+ continue;
+ }
+
+ scoped_ptr<DCPDecoder> decoder;
+ try {
+ decoder.reset (new DCPDecoder (j, _film->log(), false));
+ } catch (...) {
+ return a;
+ }
+
+ int64_t offset = 0;
+ BOOST_FOREACH (shared_ptr<dcp::Reel> k, decoder->reels()) {
+ DCPTime const from = i->position() + DCPTime::from_frames (offset, _film->video_frame_rate());
+ if (j->reference_video ()) {
+ a.push_back (
+ ReferencedReelAsset (
+ k->main_picture (),
+ DCPTimePeriod (from, from + DCPTime::from_frames (k->main_picture()->duration(), _film->video_frame_rate()))
+ )
+ );
+ }
+
+ if (j->reference_audio ()) {
+ a.push_back (
+ ReferencedReelAsset (
+ k->main_sound (),
+ DCPTimePeriod (from, from + DCPTime::from_frames (k->main_sound()->duration(), _film->video_frame_rate()))
+ )
+ );
+ }
+
+ if (j->reference_subtitle ()) {
+ DCPOMATIC_ASSERT (k->main_subtitle ());
+ a.push_back (
+ ReferencedReelAsset (
+ k->main_subtitle (),
+ DCPTimePeriod (from, from + DCPTime::from_frames (k->main_subtitle()->duration(), _film->video_frame_rate()))
+ )
+ );
+ }
+
+ /* Assume that main picture duration is the length of the reel */
+ offset += k->main_picture()->duration ();
+ }
+ }
+
+ return a;
+}
+
+list<shared_ptr<Piece> >
+Player::overlaps (DCPTime from, DCPTime to, boost::function<bool (Content *)> valid)
+{
+ if (!_have_valid_pieces) {
+ setup_pieces ();
+ }
+
+ list<shared_ptr<Piece> > overlaps;
+ BOOST_FOREACH (shared_ptr<Piece> i, _pieces) {
+ if (valid (i->content.get ()) && i->content->position() < to && i->content->end() > from) {
+ overlaps.push_back (i);
+ }
+ }
+
+ return overlaps;
+}