+++ /dev/null
-/*
- Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
-
- This file is part of DCP-o-matic.
-
- DCP-o-matic is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- DCP-o-matic is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-
-#include "empty.h"
-#include "film.h"
-#include "playlist.h"
-#include "content.h"
-#include "content_part.h"
-#include "dcp_content.h"
-#include "dcpomatic_time_coalesce.h"
-#include "piece.h"
-#include <iostream>
-
-
-using std::cout;
-using std::list;
-using std::shared_ptr;
-using std::dynamic_pointer_cast;
-using std::function;
-using namespace dcpomatic;
-
-
-Empty::Empty (shared_ptr<const Film> film, shared_ptr<const Playlist> playlist, function<bool (shared_ptr<const Content>)> part, DCPTime length)
-{
- list<DCPTimePeriod> full;
- for (auto i: playlist->content()) {
- if (part(i) && i->paths_valid()) {
- full.push_back (DCPTimePeriod(i->position(), i->end(film)));
- }
- }
-
- _periods = subtract (DCPTimePeriod(DCPTime(), length), coalesce(full));
-
- if (!_periods.empty()) {
- _position = _periods.front().from;
- }
-}
-
-
-void
-Empty::set_position (DCPTime position)
-{
- _position = position;
-
- for (auto i: _periods) {
- if (i.contains(_position)) {
- return;
- }
- }
-
- for (auto i: _periods) {
- if (i.from > _position) {
- _position = i.from;
- return;
- }
- }
-}
-
-
-DCPTimePeriod
-Empty::period_at_position () const
-{
- for (auto i: _periods) {
- if (i.contains(_position)) {
- return DCPTimePeriod (_position, i.to);
- }
- }
-
- DCPOMATIC_ASSERT (false);
-}
-
-
-bool
-Empty::done () const
-{
- DCPTime latest;
- for (auto i: _periods) {
- latest = max (latest, i.to);
- }
-
- return _position >= latest;
-}
+++ /dev/null
-/*
- Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
-
- This file is part of DCP-o-matic.
-
- DCP-o-matic is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- DCP-o-matic is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-
-#ifndef DCPOMATIC_EMPTY_H
-#define DCPOMATIC_EMPTY_H
-
-
-#include "playlist.h"
-#include "dcpomatic_time.h"
-#include "content_part.h"
-#include <list>
-
-
-struct empty_test1;
-struct empty_test2;
-struct empty_test3;
-struct empty_test_with_overlapping_content;
-struct player_subframe_test;
-
-
-class Empty
-{
-public:
- Empty () {}
- Empty (std::shared_ptr<const Film> film, std::shared_ptr<const Playlist> playlist, std::function<bool (std::shared_ptr<const Content>)> part, dcpomatic::DCPTime length);
-
- dcpomatic::DCPTime position () const {
- return _position;
- }
-
- dcpomatic::DCPTimePeriod period_at_position () const;
-
- bool done () const;
-
- void set_position (dcpomatic::DCPTime amount);
-
-private:
- friend struct ::empty_test1;
- friend struct ::empty_test2;
- friend struct ::empty_test3;
- friend struct ::empty_test_with_overlapping_content;
- friend struct ::player_subframe_test;
-
- std::list<dcpomatic::DCPTimePeriod> _periods;
- dcpomatic::DCPTime _position;
-};
-
-
-#endif
--- /dev/null
+/*
+ Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "content.h"
+#include "content_part.h"
+#include "dcp_content.h"
+#include "dcpomatic_time_coalesce.h"
+#include "empty_audio.h"
+#include "film.h"
+#include "piece.h"
+#include "playlist.h"
+#include <iostream>
+
+
+using std::cout;
+using std::dynamic_pointer_cast;
+using std::function;
+using std::list;
+using std::shared_ptr;
+using namespace dcpomatic;
+
+
+EmptyAudio::EmptyAudio (shared_ptr<const Film> film, shared_ptr<const Playlist> playlist, DCPTime length)
+{
+ list<DCPTimePeriod> full;
+ for (auto i: playlist->content()) {
+ if (i->audio && i->paths_valid()) {
+ full.push_back (DCPTimePeriod(i->position(), i->end(film)));
+ }
+ }
+
+ _periods = subtract (DCPTimePeriod(DCPTime(), length), coalesce(full));
+
+ if (!_periods.empty()) {
+ _position = _periods.front().from;
+ }
+}
+
+
+void
+EmptyAudio::set_position (DCPTime position)
+{
+ _position = position;
+
+ for (auto i: _periods) {
+ if (i.contains(_position)) {
+ return;
+ }
+ }
+
+ for (auto i: _periods) {
+ if (i.from > _position) {
+ _position = i.from;
+ return;
+ }
+ }
+}
+
+
+DCPTimePeriod
+EmptyAudio::period_at_position () const
+{
+ for (auto i: _periods) {
+ if (i.contains(_position)) {
+ return DCPTimePeriod (_position, i.to);
+ }
+ }
+
+ DCPOMATIC_ASSERT (false);
+}
+
+
+bool
+EmptyAudio::done () const
+{
+ DCPTime latest;
+ for (auto i: _periods) {
+ latest = max (latest, i.to);
+ }
+
+ return _position >= latest;
+}
--- /dev/null
+/*
+ Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#ifndef DCPOMATIC_EMPTY_AUDIO_H
+#define DCPOMATIC_EMPTY_AUDIO_H
+
+
+#include "content_part.h"
+#include "dcpomatic_time.h"
+#include "playlist.h"
+#include <list>
+
+
+struct empty_audio_test1;
+struct empty_audio_test2;
+struct empty_audio_test3;
+struct empty_audio_test_with_overlapping_content;
+struct player_subframe_test;
+
+
+class EmptyAudio
+{
+public:
+ EmptyAudio () {}
+ EmptyAudio (std::shared_ptr<const Film> film, std::shared_ptr<const Playlist> playlist, dcpomatic::DCPTime length);
+
+ dcpomatic::DCPTime position () const {
+ return _position;
+ }
+
+ dcpomatic::DCPTimePeriod period_at_position () const;
+
+ bool done () const;
+
+ void set_position (dcpomatic::DCPTime amount);
+
+private:
+ friend struct ::empty_audio_test1;
+ friend struct ::empty_audio_test2;
+ friend struct ::empty_audio_test3;
+ friend struct ::empty_audio_test_with_overlapping_content;
+ friend struct ::player_subframe_test;
+
+ std::list<dcpomatic::DCPTimePeriod> _periods;
+ dcpomatic::DCPTime _position;
+};
+
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "content.h"
+#include "content_part.h"
+#include "dcp_content.h"
+#include "dcpomatic_time_coalesce.h"
+#include "empty_video.h"
+#include "film.h"
+#include "piece.h"
+#include "playlist.h"
+#include "video_content.h"
+#include <iostream>
+
+
+using std::cout;
+using std::dynamic_pointer_cast;
+using std::function;
+using std::list;
+using std::shared_ptr;
+using namespace dcpomatic;
+
+
+EmptyVideo::EmptyVideo (shared_ptr<const Film> film, shared_ptr<const Playlist> playlist, DCPTime length)
+{
+ list<DCPTimePeriod> full;
+ for (auto i: playlist->content()) {
+ if (i->video && i->video->use() && i->can_be_played() && i->paths_valid()) {
+ full.push_back (DCPTimePeriod(i->position(), i->end(film)));
+ }
+ }
+
+ _periods = subtract (DCPTimePeriod(DCPTime(), length), coalesce(full));
+
+ if (!_periods.empty()) {
+ _position = _periods.front().from;
+ }
+}
+
+
+void
+EmptyVideo::set_position (DCPTime position)
+{
+ _position = position;
+
+ for (auto i: _periods) {
+ if (i.contains(_position)) {
+ return;
+ }
+ }
+
+ for (auto i: _periods) {
+ if (i.from > _position) {
+ _position = i.from;
+ return;
+ }
+ }
+}
+
+
+DCPTimePeriod
+EmptyVideo::period_at_position () const
+{
+ for (auto i: _periods) {
+ if (i.contains(_position)) {
+ return DCPTimePeriod (_position, i.to);
+ }
+ }
+
+ DCPOMATIC_ASSERT (false);
+}
+
+
+bool
+EmptyVideo::done () const
+{
+ DCPTime latest;
+ for (auto i: _periods) {
+ latest = max (latest, i.to);
+ }
+
+ return _position >= latest;
+}
--- /dev/null
+/*
+ Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#ifndef DCPOMATIC_EMPTY_VIDEO_H
+#define DCPOMATIC_EMPTY_VIDEO_H
+
+
+#include "content_part.h"
+#include "dcpomatic_time.h"
+#include "playlist.h"
+#include <list>
+
+
+struct empty_video_test1;
+struct empty_video_test2;
+struct empty_video_test3;
+struct empty_video_test_with_overlapping_content;
+struct player_subframe_test;
+
+
+class EmptyVideo
+{
+public:
+ EmptyVideo () {}
+ EmptyVideo (std::shared_ptr<const Film> film, std::shared_ptr<const Playlist> playlist, dcpomatic::DCPTime length);
+
+ dcpomatic::DCPTime position () const {
+ return _position;
+ }
+
+ dcpomatic::DCPTimePeriod period_at_position () const;
+
+ bool done () const;
+
+ void set_position (dcpomatic::DCPTime amount);
+
+private:
+ friend struct ::empty_video_test1;
+ friend struct ::empty_video_test2;
+ friend struct ::empty_video_test3;
+ friend struct ::empty_video_test_with_overlapping_content;
+ friend struct ::player_subframe_test;
+
+ std::list<dcpomatic::DCPTimePeriod> _periods;
+ dcpomatic::DCPTime _position;
+};
+
+
+#endif
}
-bool
-have_video (shared_ptr<const Content> content)
-{
- return static_cast<bool>(content->video) && content->video->use() && content->can_be_played();
-}
-
-
-bool
-have_audio (shared_ptr<const Content> content)
-{
- return static_cast<bool>(content->audio);
-}
-
-
void
Player::setup_pieces_unlocked ()
{
}
}
- _black = Empty (_film, playlist(), bind(&have_video, _1), _playback_length);
- _silent = Empty (_film, playlist(), bind(&have_audio, _1), _playback_length);
+ _black = EmptyVideo (_film, playlist(), _playback_length);
+ _silent = EmptyAudio (_film, playlist(), _playback_length);
_next_video_time = boost::none;
_next_video_eyes = Eyes::BOTH;
#include "content_audio.h"
#include "content_text.h"
#include "content_video.h"
-#include "empty.h"
+#include "empty_audio.h"
+#include "empty_video.h"
#include "film.h"
#include "image.h"
#include "player_text.h"
};
std::map<AudioStreamPtr, StreamState> _stream_states;
- Empty _black;
- Empty _silent;
+ EmptyVideo _black;
+ EmptyAudio _silent;
ActiveText _active_texts[static_cast<int>(TextType::COUNT)];
std::shared_ptr<AudioProcessor> _audio_processor;
dkdm_wrapper.cc
dolby_cp750.cc
emailer.cc
- empty.cc
+ empty_audio.cc
+ empty_video.cc
encoder.cc
encode_server.cc
encode_server_finder.cc
*/
+#include "lib/audio_content.h"
#include "lib/dcp_content_type.h"
#include "lib/decoder.h"
-#include "lib/empty.h"
+#include "lib/empty_audio.h"
+#include "lib/empty_video.h"
#include "lib/film.h"
#include "lib/image_content.h"
#include "lib/player.h"
using namespace dcpomatic;
-bool
-has_video (shared_ptr<const Content> content)
+BOOST_AUTO_TEST_CASE (empty_video_test1)
{
- return static_cast<bool>(content->video);
+ auto film = new_test_film2 ("empty_video_test1");
+ film->set_sequence (false);
+ auto contentA = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
+ auto contentB = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
+
+ film->examine_and_add_content (contentA);
+ film->examine_and_add_content (contentB);
+ BOOST_REQUIRE (!wait_for_jobs());
+
+ int const vfr = film->video_frame_rate ();
+
+ /* 0 1 2 3 4 5 6 7
+ * A A A B
+ */
+ contentA->video->set_length (3);
+ contentA->set_position (film, DCPTime::from_frames(2, vfr));
+ contentB->video->set_length (1);
+ contentB->set_position (film, DCPTime::from_frames(7, vfr));
+
+ EmptyVideo black (film, film->playlist(), film->playlist()->length(film));
+ BOOST_REQUIRE_EQUAL (black._periods.size(), 2U);
+ auto i = black._periods.begin();
+ BOOST_CHECK (i->from == DCPTime::from_frames(0, vfr));
+ BOOST_CHECK (i->to == DCPTime::from_frames(2, vfr));
+ ++i;
+ BOOST_CHECK (i->from == DCPTime::from_frames(5, vfr));
+ BOOST_CHECK (i->to == DCPTime::from_frames(7, vfr));
}
-BOOST_AUTO_TEST_CASE (empty_test1)
+BOOST_AUTO_TEST_CASE (empty_audio_test1)
{
- auto film = new_test_film2 ("empty_test1");
+ auto film = new_test_film2 ("empty_audio_test1");
film->set_sequence (false);
auto contentA = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
auto contentB = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
film->examine_and_add_content (contentB);
BOOST_REQUIRE (!wait_for_jobs());
+ /* Make this content look like it has audio so we can test the EmptyAudio class */
+ contentA->audio = make_shared<AudioContent>(contentA.get());
+ contentB->audio = make_shared<AudioContent>(contentB.get());
+
int const vfr = film->video_frame_rate ();
/* 0 1 2 3 4 5 6 7
contentB->video->set_length (1);
contentB->set_position (film, DCPTime::from_frames(7, vfr));
- Empty black (film, film->playlist(), bind(&has_video, _1), film->playlist()->length(film));
- BOOST_REQUIRE_EQUAL (black._periods.size(), 2U);
- auto i = black._periods.begin();
+ EmptyAudio silent (film, film->playlist(), film->playlist()->length(film));
+ BOOST_REQUIRE_EQUAL (silent._periods.size(), 2U);
+ auto i = silent._periods.begin();
BOOST_CHECK (i->from == DCPTime::from_frames(0, vfr));
BOOST_CHECK (i->to == DCPTime::from_frames(2, vfr));
++i;
/** Some tests where the first empty period is not at time 0 */
-BOOST_AUTO_TEST_CASE (empty_test2)
+BOOST_AUTO_TEST_CASE (empty_video_test2)
{
- auto film = new_test_film2 ("empty_test2");
+ auto film = new_test_film2 ("empty_video_test2");
film->set_sequence (false);
auto contentA = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
auto contentB = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
contentB->video->set_length (1);
contentB->set_position (film, DCPTime::from_frames(7, vfr));
- Empty black (film, film->playlist(), bind(&has_video, _1), film->playlist()->length(film));
+ EmptyVideo black (film, film->playlist(), film->playlist()->length(film));
BOOST_REQUIRE_EQUAL (black._periods.size(), 1U);
BOOST_CHECK (black._periods.front().from == DCPTime::from_frames(3, vfr));
BOOST_CHECK (black._periods.front().to == DCPTime::from_frames(7, vfr));
}
+/** Some tests where the first empty period is not at time 0 */
+BOOST_AUTO_TEST_CASE (empty_audio_test2)
+{
+ auto film = new_test_film2 ("empty_audio_test2");
+ film->set_sequence (false);
+ auto contentA = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
+ auto contentB = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
+
+ film->examine_and_add_content (contentA);
+ film->examine_and_add_content (contentB);
+ BOOST_REQUIRE (!wait_for_jobs());
+
+ /* Make this content look like it has audio so we can test the EmptyAudio class */
+ contentA->audio = make_shared<AudioContent>(contentA.get());
+ contentB->audio = make_shared<AudioContent>(contentB.get());
+
+ int const vfr = film->video_frame_rate ();
+
+ /* 0 1 2 3 4 5 6 7
+ * A A A B
+ */
+ contentA->video->set_length (3);
+ contentA->set_position (film, DCPTime(0));
+ contentB->video->set_length (1);
+ contentB->set_position (film, DCPTime::from_frames(7, vfr));
+
+ EmptyAudio silent (film, film->playlist(), film->playlist()->length(film));
+ BOOST_REQUIRE_EQUAL (silent._periods.size(), 1U);
+ BOOST_CHECK (silent._periods.front().from == DCPTime::from_frames(3, vfr));
+ BOOST_CHECK (silent._periods.front().to == DCPTime::from_frames(7, vfr));
+
+ /* position should initially be the start of the first empty period */
+ BOOST_CHECK (silent.position() == DCPTime::from_frames(3, vfr));
+
+ /* check that done() works */
+ BOOST_CHECK (!silent.done ());
+ silent.set_position (DCPTime::from_frames (4, vfr));
+ BOOST_CHECK (!silent.done ());
+ silent.set_position (DCPTime::from_frames (7, vfr));
+ BOOST_CHECK (silent.done ());
+}
+
+
/** Test for when the film's playlist is not the same as the one passed into Empty */
-BOOST_AUTO_TEST_CASE (empty_test3)
+BOOST_AUTO_TEST_CASE (empty_video_test3)
{
- auto film = new_test_film2 ("empty_test3");
+ auto film = new_test_film2 ("empty_video_test3");
film->set_sequence (false);
auto contentA = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
auto contentB = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
auto playlist = make_shared<Playlist>();
playlist->add (film, contentB);
- Empty black (film, playlist, bind(&has_video, _1), playlist->length(film));
+ EmptyVideo black (film, playlist, playlist->length(film));
BOOST_REQUIRE_EQUAL (black._periods.size(), 1U);
BOOST_CHECK (black._periods.front().from == DCPTime::from_frames(0, vfr));
BOOST_CHECK (black._periods.front().to == DCPTime::from_frames(7, vfr));
}
-BOOST_AUTO_TEST_CASE (empty_test_with_overlapping_content)
+/** Test for when the film's playlist is not the same as the one passed into Empty */
+BOOST_AUTO_TEST_CASE (empty_audio_test3)
+{
+ auto film = new_test_film2 ("empty_audio_test3");
+ film->set_sequence (false);
+ auto contentA = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
+ auto contentB = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
+
+ film->examine_and_add_content (contentA);
+ film->examine_and_add_content (contentB);
+ BOOST_REQUIRE (!wait_for_jobs());
+
+ /* Make this content look like it has audio so we can test the EmptyAudio class */
+ contentA->audio = make_shared<AudioContent>(contentA.get());
+ contentB->audio = make_shared<AudioContent>(contentB.get());
+
+ int const vfr = film->video_frame_rate ();
+
+ /* 0 1 2 3 4 5 6 7
+ * A A A B
+ */
+ contentA->video->set_length (3);
+ contentA->set_position (film, DCPTime(0));
+ contentB->video->set_length (1);
+ contentB->set_position (film, DCPTime::from_frames(7, vfr));
+
+ auto playlist = make_shared<Playlist>();
+ playlist->add (film, contentB);
+ EmptyAudio silent (film, playlist, playlist->length(film));
+ BOOST_REQUIRE_EQUAL (silent._periods.size(), 1U);
+ BOOST_CHECK (silent._periods.front().from == DCPTime::from_frames(0, vfr));
+ BOOST_CHECK (silent._periods.front().to == DCPTime::from_frames(7, vfr));
+
+ /* position should initially be the start of the first empty period */
+ BOOST_CHECK (silent.position() == DCPTime::from_frames(0, vfr));
+}
+
+
+BOOST_AUTO_TEST_CASE (empty_video_test_with_overlapping_content)
{
- auto film = new_test_film2 ("empty_test_with_overlapping_content");
+ auto film = new_test_film2 ("empty_video_test_with_overlapping_content");
film->set_sequence (false);
auto contentA = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
auto contentB = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
contentB->video->set_length (vfr * 1);
contentB->set_position (film, DCPTime::from_seconds(1));
- Empty black(film, film->playlist(), bind(&has_video, _1), film->playlist()->length(film));
+ EmptyVideo black(film, film->playlist(), film->playlist()->length(film));
BOOST_REQUIRE (black._periods.empty());
}
+
+BOOST_AUTO_TEST_CASE (empty_audio_test_with_overlapping_content)
+{
+ auto film = new_test_film2 ("empty_audio_test_with_overlapping_content");
+ film->set_sequence (false);
+ auto contentA = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
+ auto contentB = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
+
+ film->examine_and_add_content (contentA);
+ film->examine_and_add_content (contentB);
+ BOOST_REQUIRE (!wait_for_jobs());
+
+ /* Make this content look like it has audio so we can test the EmptyAudio class */
+ contentA->audio = make_shared<AudioContent>(contentA.get());
+ contentB->audio = make_shared<AudioContent>(contentB.get());
+
+ int const vfr = film->video_frame_rate ();
+
+ contentA->video->set_length (vfr * 3);
+ contentA->set_position (film, DCPTime());
+ contentB->video->set_length (vfr * 1);
+ contentB->set_position (film, DCPTime::from_seconds(1));
+
+ EmptyAudio silent(film, film->playlist(), film->playlist()->length(film));
+
+ BOOST_REQUIRE (silent._periods.empty());
+}
+