+
+list<shared_ptr<Font> >
+Player::get_subtitle_fonts ()
+{
+ if (!_have_valid_pieces) {
+ setup_pieces ();
+ }
+
+ list<shared_ptr<Font> > fonts;
+ BOOST_FOREACH (shared_ptr<Piece>& p, _pieces) {
+ shared_ptr<SubtitleContent> sc = dynamic_pointer_cast<SubtitleContent> (p->content);
+ if (sc) {
+ /* XXX: things may go wrong if there are duplicate font IDs
+ with different font files.
+ */
+ list<shared_ptr<Font> > f = sc->fonts ();
+ copy (f.begin(), f.end(), back_inserter (fonts));
+ }
+ }
+
+ return fonts;
+}
+
+/** Set this player never to produce any video data */
+void
+Player::set_ignore_video ()
+{
+ _ignore_video = true;
+}
+
+/** 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, 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;
+}