, _playlist (playlist)
, _have_valid_pieces (false)
, _ignore_video (false)
+ , _ignore_audio (false)
, _ignore_text (false)
, _always_burn_open_subtitles (false)
, _fast (false)
continue;
}
+ if (_ignore_video && _ignore_audio && i->text.empty()) {
+ /* We're only interested in text and this content has none */
+ continue;
+ }
+
shared_ptr<Decoder> decoder = decoder_factory (i, _film->log(), _fast);
FrameRateChange frc (i->active_video_frame_rate(), _film->video_frame_rate());
decoder->video->set_ignore (true);
}
+ if (decoder->audio && _ignore_audio) {
+ decoder->audio->set_ignore (true);
+ }
+
if (_ignore_text) {
BOOST_FOREACH (shared_ptr<TextDecoder> i, decoder->text) {
i->set_ignore (true);
Player::set_ignore_video ()
{
_ignore_video = true;
+ _have_valid_pieces = false;
+}
+
+void
+Player::set_ignore_audio ()
+{
+ _ignore_audio = true;
+ _have_valid_pieces = false;
}
void
void set_video_container_size (dcp::Size);
void set_ignore_video ();
+ void set_ignore_audio ();
void set_ignore_text ();
void set_always_burn_open_subtitles ();
void set_fast ();
/** true if the player should ignore all video; i.e. never produce any */
bool _ignore_video;
+ bool _ignore_audio;
/** true if the player should ignore all text; i.e. never produce any */
bool _ignore_text;
bool _always_burn_open_subtitles;
film->make_dcp ();
BOOST_REQUIRE (!wait_for_jobs ());
}
+
+struct Sub {
+ PlayerText text;
+ TextType type;
+ DCPTimePeriod period;
+};
+
+static void
+store (list<Sub>* out, PlayerText text, TextType type, DCPTimePeriod period)
+{
+ Sub s;
+ s.text = text;
+ s.type = type;
+ s.period = period;
+ out->push_back (s);
+}
+
+/** Test ignoring both video and audio */
+BOOST_AUTO_TEST_CASE (player_ignore_video_and_audio_test)
+{
+ shared_ptr<Film> film = new_test_film2 ("player_ignore_video_and_audio_test");
+ shared_ptr<Content> ff = content_factory(film, private_data / "boon_telly.mkv").front();
+ film->examine_and_add_content (ff);
+ shared_ptr<Content> text = content_factory(film, "test/data/subrip.srt").front();
+ film->examine_and_add_content (text);
+ BOOST_REQUIRE (!wait_for_jobs());
+ text->only_text()->set_type (TEXT_CLOSED_CAPTION);
+ text->only_text()->set_use (true);
+
+ shared_ptr<Player> player (new Player(film, film->playlist()));
+ player->set_ignore_video ();
+ player->set_ignore_audio ();
+
+ list<Sub> out;
+ player->Text.connect (bind (&store, &out, _1, _2, _3));
+ while (!player->pass ()) {}
+
+ BOOST_CHECK_EQUAL (out.size(), 6);
+}