#include "lib/player.h"
#include "lib/video_content.h"
#include "lib/image_content.h"
-#include "lib/text_subtitle_content.h"
+#include "lib/string_text_file_content.h"
#include "lib/content_factory.h"
#include "lib/dcp_content.h"
-#include "lib/subtitle_content.h"
+#include "lib/text_content.h"
#include "lib/butler.h"
#include "lib/compose.hpp"
#include "test.h"
film->examine_and_add_content (c);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<TextSubtitleContent> s (new TextSubtitleContent (film, "test/data/subrip.srt"));
+ shared_ptr<StringTextFileContent> s (new StringTextFileContent (film, "test/data/subrip.srt"));
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
shared_ptr<DCPContent> dcp (new DCPContent (film, private_data / "awkward_subs"));
film->examine_and_add_content (dcp, true);
BOOST_REQUIRE (!wait_for_jobs ());
- dcp->subtitle->set_use (true);
+ dcp->only_text()->set_use (true);
shared_ptr<Player> player (new Player (film, film->playlist()));
player->set_fast ();
- player->set_always_burn_subtitles (true);
+ player->set_always_burn_open_subtitles ();
player->set_play_referenced ();
shared_ptr<Butler> butler (new Butler (player, film->log(), AudioMapping(), 2));
shared_ptr<DCPContent> dcp (new DCPContent (film, private_data / "awkward_subs2"));
film->examine_and_add_content (dcp, true);
BOOST_REQUIRE (!wait_for_jobs ());
- dcp->subtitle->set_use (true);
+ dcp->only_text()->set_use (true);
shared_ptr<Player> player (new Player (film, film->playlist()));
player->set_fast ();
- player->set_always_burn_subtitles (true);
+ player->set_always_burn_open_subtitles ();
player->set_play_referenced ();
shared_ptr<Butler> butler (new Butler (player, film->log(), AudioMapping(), 2));
check_image(String::compose("test/data/player_seek_test2_%1.png", i), String::compose("build/test/player_seek_test2_%1.png", i), 0.011);
}
}
+
+/** Test a bug when trimmed content follows other content */
+BOOST_AUTO_TEST_CASE (player_trim_test)
+{
+ shared_ptr<Film> film = new_test_film2 ("player_trim_test");
+ shared_ptr<Content> A = content_factory(film, "test/data/flat_red.png").front();
+ film->examine_and_add_content (A);
+ BOOST_REQUIRE (!wait_for_jobs ());
+ A->video->set_length (10 * 24);
+ shared_ptr<Content> B = content_factory(film, "test/data/flat_red.png").front();
+ film->examine_and_add_content (B);
+ BOOST_REQUIRE (!wait_for_jobs ());
+ B->video->set_length (10 * 24);
+ B->set_position (DCPTime::from_seconds (10));
+ B->set_trim_start (ContentTime::from_seconds (2));
+
+ 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);
+}