summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-12-22 00:09:57 +0100
committerCarl Hetherington <cth@carlh.net>2025-09-02 22:40:13 +0200
commit33b0928b20618da5bc295711bfdf3d638863afa5 (patch)
tree24af21c6a7b863d914991ae837c36b6b9b50bcce /test
parent6784eb8de2451afd2dedc15c05eac043011b5afb (diff)
Untested conversion to num/den DCPTime.arbitrary-hz
Summary of required changes: Replace ::from_frames with a constructor that takes num/den. Provide and use member to_debug_string() instead of to_string(). Provide and use member to_serializable_string() and string constructor instead of fmt::to_string on .get() and number constructor. Provide and use content_time() member instead of ContentTime constructor from DCPTime. Use frames_round(96000) instead of get() when comparing times to see if they are "close enough". Provide and use DCPTime(x, FrameRateChange) constructor when converting from ContentTime. Use .seconds() when calculating proportions or sometimes when dividing by HZ. Provide and use operator bool(). Pass explicit 96000 denominator in a lot of places. Add member max() and use it instead of static max() Change BOOST_CHECK_EQUAL to BOOST_CHECK Provide operator/ and use it instead of .get() / 2.
Diffstat (limited to 'test')
-rw-r--r--test/audio_analysis_test.cc6
-rw-r--r--test/audio_merger_test.cc26
-rw-r--r--test/audio_ring_buffers_test.cc6
-rw-r--r--test/butler_test.cc4
-rw-r--r--test/content_test.cc4
-rw-r--r--test/cover_sheet_test.cc20
-rw-r--r--test/dcp_decoder_test.cc2
-rw-r--r--test/dcp_subtitle_test.cc2
-rw-r--r--test/dcpomatic_time_test.cc56
-rw-r--r--test/empty_test.cc32
-rw-r--r--test/ffmpeg_decoder_sequential_test.cc4
-rw-r--r--test/import_dcp_test.cc2
-rw-r--r--test/player_test.cc30
-rw-r--r--test/reel_writer_test.cc2
-rw-r--r--test/reels_test.cc156
-rw-r--r--test/subtitle_charset_test.cc2
-rw-r--r--test/subtitle_reel_test.cc2
-rw-r--r--test/time_calculation_test.cc102
-rw-r--r--test/torture_test.cc4
-rw-r--r--test/util_test.cc10
-rw-r--r--test/vf_test.cc8
-rw-r--r--test/writer_test.cc4
22 files changed, 242 insertions, 242 deletions
diff --git a/test/audio_analysis_test.cc b/test/audio_analysis_test.cc
index 2ae91a90f..cbd1ef7cc 100644
--- a/test/audio_analysis_test.cc
+++ b/test/audio_analysis_test.cc
@@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE (audio_analysis_serialisation_test)
vector<AudioAnalysis::PeakTime> peak;
for (int i = 0; i < channels; ++i) {
- peak.push_back (AudioAnalysis::PeakTime(random_float(), DCPTime(rand())));
+ peak.push_back (AudioAnalysis::PeakTime(random_float(), DCPTime(rand(), 96000)));
}
a.set_sample_peak (peak);
@@ -91,8 +91,8 @@ BOOST_AUTO_TEST_CASE (audio_analysis_serialisation_test)
BOOST_REQUIRE_EQUAL (b.sample_peak().size(), 3U);
for (int i = 0; i < channels; ++i) {
- BOOST_CHECK_CLOSE (b.sample_peak()[i].peak, peak[i].peak, 1);
- BOOST_CHECK_EQUAL (b.sample_peak()[i].time.get(), peak[i].time.get());
+ BOOST_CHECK_CLOSE(b.sample_peak()[i].peak, peak[i].peak, 1);
+ BOOST_CHECK(b.sample_peak()[i].time == peak[i].time);
}
BOOST_CHECK_EQUAL (a.samples_per_point(), 100);
diff --git a/test/audio_merger_test.cc b/test/audio_merger_test.cc
index b08d9c9f5..b787b88cf 100644
--- a/test/audio_merger_test.cc
+++ b/test/audio_merger_test.cc
@@ -73,21 +73,21 @@ BOOST_AUTO_TEST_CASE(audio_merger_test1)
push(merger, 0, 64, 0);
push(merger, 0, 64, 22);
- auto tb = merger.pull(DCPTime::from_frames(22, sampling_rate));
+ auto tb = merger.pull(DCPTime(22, sampling_rate));
BOOST_REQUIRE(tb.size() == 1U);
BOOST_CHECK(tb.front().first != shared_ptr<const AudioBuffers>());
BOOST_CHECK_EQUAL(tb.front().first->frames(), 22);
- BOOST_CHECK_EQUAL(tb.front().second.get(), 0);
+ BOOST_CHECK(tb.front().second == DCPTime{});
/* And they should be a staircase */
for (int i = 0; i < 22; ++i) {
BOOST_CHECK_EQUAL(tb.front().first->data()[0][i], i);
}
- tb = merger.pull(DCPTime::from_frames(22 + 64, sampling_rate));
+ tb = merger.pull(DCPTime(22 + 64, sampling_rate));
BOOST_REQUIRE(tb.size() == 1U);
BOOST_CHECK_EQUAL(tb.front().first->frames(), 64);
- BOOST_CHECK_EQUAL(tb.front().second.get(), DCPTime::from_frames(22, sampling_rate).get());
+ BOOST_CHECK(tb.front().second == DCPTime(22, sampling_rate));
/* Check the sample values */
for (int i = 0; i < 64; ++i) {
@@ -108,14 +108,14 @@ BOOST_AUTO_TEST_CASE(audio_merger_test2)
push(merger, 0, 64, 9);
/* There's nothing from 0 to 9 */
- auto tb = merger.pull(DCPTime::from_frames(9, sampling_rate));
+ auto tb = merger.pull(DCPTime(9, sampling_rate));
BOOST_CHECK_EQUAL(tb.size(), 0U);
/* Then there's our data at 9 */
- tb = merger.pull(DCPTime::from_frames(9 + 64, sampling_rate));
+ tb = merger.pull(DCPTime(9 + 64, sampling_rate));
BOOST_CHECK_EQUAL(tb.front().first->frames(), 64);
- BOOST_CHECK_EQUAL(tb.front().second.get(), DCPTime::from_frames(9, sampling_rate).get());
+ BOOST_CHECK(tb.front().second == DCPTime(9, sampling_rate));
/* Check the sample values */
for (int i = 0; i < 64; ++i) {
@@ -134,18 +134,18 @@ BOOST_AUTO_TEST_CASE(audio_merger_test3)
/* Get them back */
- auto tb = merger.pull(DCPTime::from_frames(100, sampling_rate));
+ auto tb = merger.pull(DCPTime(100, sampling_rate));
BOOST_REQUIRE(tb.size() == 1U);
BOOST_CHECK_EQUAL(tb.front().first->frames(), 64);
- BOOST_CHECK_EQUAL(tb.front().second.get(), DCPTime::from_frames(17, sampling_rate).get());
+ BOOST_CHECK(tb.front().second == DCPTime(17, sampling_rate));
for (int i = 0; i < 64; ++i) {
BOOST_CHECK_EQUAL(tb.front().first->data()[0][i], i);
}
- tb = merger.pull(DCPTime::from_frames(200, sampling_rate));
+ tb = merger.pull(DCPTime(200, sampling_rate));
BOOST_REQUIRE(tb.size() == 1U);
BOOST_CHECK_EQUAL(tb.front().first->frames(), 64);
- BOOST_CHECK_EQUAL(tb.front().second.get(), DCPTime::from_frames(114, sampling_rate).get());
+ BOOST_CHECK(tb.front().second == DCPTime(114, sampling_rate));
for (int i = 0; i < 64; ++i) {
BOOST_CHECK_EQUAL(tb.front().first->data()[0][i], i);
}
@@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE(audio_merger_test4)
merger->clear();
} else if (cmd == "push") {
BOOST_REQUIRE(i != tokens.end());
- DCPTime time(dcp::raw_convert<DCPTime::Type>(*i++));
+ DCPTime time(dcp::raw_convert<int64_t>(*i++), 96000);
BOOST_REQUIRE(i != tokens.end());
int const frames = dcp::raw_convert<int>(*i++);
auto buffers = make_shared<AudioBuffers>(1, frames);
@@ -184,7 +184,7 @@ BOOST_AUTO_TEST_CASE(audio_merger_test4)
merger->push(buffers, time);
} else if (cmd == "pull") {
BOOST_REQUIRE(i != tokens.end());
- DCPTime time(dcp::raw_convert<DCPTime::Type>(*i++));
+ DCPTime time(dcp::raw_convert<int64_t>(*i++), 96000);
merger->pull(time);
}
}
diff --git a/test/audio_ring_buffers_test.cc b/test/audio_ring_buffers_test.cc
index 265142d53..b5d63f2bd 100644
--- a/test/audio_ring_buffers_test.cc
+++ b/test/audio_ring_buffers_test.cc
@@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE (audio_ring_buffers_test1)
/* Get the rest */
buffer[51 * 6] = CANARY;
- BOOST_CHECK (*rb.get(buffer, 6, 51) == DCPTime::from_frames(40, 48000));
+ BOOST_CHECK (*rb.get(buffer, 6, 51) == DCPTime(40, 48000));
for (int i = 0; i < 51 * 6; ++i) {
BOOST_REQUIRE_EQUAL (buffer[i], check++);
}
@@ -127,7 +127,7 @@ BOOST_AUTO_TEST_CASE (audio_ring_buffers_test2)
/* Get the rest */
buffer[51 * 6] = CANARY;
- BOOST_CHECK (*rb.get(buffer, 6, 51) == DCPTime::from_frames(40, 48000));
+ BOOST_CHECK (*rb.get(buffer, 6, 51) == DCPTime(40, 48000));
for (int i = 0; i < 51; ++i) {
for (int j = 0; j < 2; ++j) {
BOOST_REQUIRE_EQUAL (buffer[i * 6 + j], check++);
@@ -177,7 +177,7 @@ BOOST_AUTO_TEST_CASE (audio_ring_buffers_test3)
/* Get the rest */
buffer[51 * 2] = CANARY;
- BOOST_CHECK (*rb.get(buffer, 2, 51) == DCPTime::from_frames(40, 48000));
+ BOOST_CHECK (*rb.get(buffer, 2, 51) == DCPTime(40, 48000));
for (int i = 0; i < 51; ++i) {
for (int j = 0; j < 2; ++j) {
BOOST_REQUIRE_EQUAL (buffer[i * 2 + j], check++);
diff --git a/test/butler_test.cc b/test/butler_test.cc
index 706d0e424..8756a1b1b 100644
--- a/test/butler_test.cc
+++ b/test/butler_test.cc
@@ -67,8 +67,8 @@ BOOST_AUTO_TEST_CASE (butler_test1)
);
BOOST_CHECK (butler.get_video(Butler::Behaviour::BLOCKING, 0).second == DCPTime());
- BOOST_CHECK (butler.get_video(Butler::Behaviour::BLOCKING, 0).second == DCPTime::from_frames(1, 24));
- BOOST_CHECK (butler.get_video(Butler::Behaviour::BLOCKING, 0).second == DCPTime::from_frames(2, 24));
+ BOOST_CHECK (butler.get_video(Butler::Behaviour::BLOCKING, 0).second == DCPTime(1, 24));
+ BOOST_CHECK (butler.get_video(Butler::Behaviour::BLOCKING, 0).second == DCPTime(2, 24));
/* XXX: check the frame contents */
float buffer[256 * 6];
diff --git a/test/content_test.cc b/test/content_test.cc
index b6c6703c5..1906a36bc 100644
--- a/test/content_test.cc
+++ b/test/content_test.cc
@@ -118,7 +118,7 @@ BOOST_AUTO_TEST_CASE (content_test4)
BOOST_REQUIRE (!wait_for_jobs());
video->set_trim_end (dcpomatic::ContentTime(3000));
- BOOST_CHECK (video->length_after_trim(film) == DCPTime::from_frames(299, 24));
+ BOOST_CHECK (video->length_after_trim(film) == DCPTime(299, 24));
}
@@ -130,7 +130,7 @@ BOOST_AUTO_TEST_CASE (content_test5)
audio[0]->set_trim_end(dcpomatic::ContentTime(3000));
- BOOST_CHECK(audio[0]->length_after_trim(film) == DCPTime(957000));
+ BOOST_CHECK(audio[0]->length_after_trim(film) == DCPTime(957000, 96000));
}
diff --git a/test/cover_sheet_test.cc b/test/cover_sheet_test.cc
index 484b99ec8..9bf02346d 100644
--- a/test/cover_sheet_test.cc
+++ b/test/cover_sheet_test.cc
@@ -34,16 +34,16 @@ BOOST_AUTO_TEST_CASE(cover_sheet_test)
auto film = new_test_film("cover_sheet_test");
film->set_video_frame_rate(24);
- film->set_marker(dcp::Marker::FFOC, dcpomatic::DCPTime::from_frames(24 * 6 + 9, 24));
- film->set_marker(dcp::Marker::LFOC, dcpomatic::DCPTime::from_frames(24 * 42 + 15, 24));
- film->set_marker(dcp::Marker::FFTC, dcpomatic::DCPTime::from_frames(24 * 95 + 4, 24));
- film->set_marker(dcp::Marker::LFTC, dcpomatic::DCPTime::from_frames(24 * 106 + 1, 24));
- film->set_marker(dcp::Marker::FFOI, dcpomatic::DCPTime::from_frames(24 * 112 + 0, 24));
- film->set_marker(dcp::Marker::LFOI, dcpomatic::DCPTime::from_frames(24 * 142 + 6, 24));
- film->set_marker(dcp::Marker::FFEC, dcpomatic::DCPTime::from_frames(24 * 216 + 23, 24));
- film->set_marker(dcp::Marker::LFEC, dcpomatic::DCPTime::from_frames(24 * 242 + 21, 24));
- film->set_marker(dcp::Marker::FFMC, dcpomatic::DCPTime::from_frames(24 * 250 + 23, 24));
- film->set_marker(dcp::Marker::LFMC, dcpomatic::DCPTime::from_frames(24 * 251 + 21, 24));
+ film->set_marker(dcp::Marker::FFOC, dcpomatic::DCPTime(24 * 6 + 9, 24));
+ film->set_marker(dcp::Marker::LFOC, dcpomatic::DCPTime(24 * 42 + 15, 24));
+ film->set_marker(dcp::Marker::FFTC, dcpomatic::DCPTime(24 * 95 + 4, 24));
+ film->set_marker(dcp::Marker::LFTC, dcpomatic::DCPTime(24 * 106 + 1, 24));
+ film->set_marker(dcp::Marker::FFOI, dcpomatic::DCPTime(24 * 112 + 0, 24));
+ film->set_marker(dcp::Marker::LFOI, dcpomatic::DCPTime(24 * 142 + 6, 24));
+ film->set_marker(dcp::Marker::FFEC, dcpomatic::DCPTime(24 * 216 + 23, 24));
+ film->set_marker(dcp::Marker::LFEC, dcpomatic::DCPTime(24 * 242 + 21, 24));
+ film->set_marker(dcp::Marker::FFMC, dcpomatic::DCPTime(24 * 250 + 23, 24));
+ film->set_marker(dcp::Marker::LFMC, dcpomatic::DCPTime(24 * 251 + 21, 24));
Config::instance()->set_cover_sheet(
"First frame of content: $FFOC\n"
diff --git a/test/dcp_decoder_test.cc b/test/dcp_decoder_test.cc
index cf9950aae..fa5e39323 100644
--- a/test/dcp_decoder_test.cc
+++ b/test/dcp_decoder_test.cc
@@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE (check_reuse_old_data_test)
BOOST_REQUIRE (decoder);
auto reels = decoder->reels();
- ov_content->set_position (test, dcpomatic::DCPTime(96000));
+ ov_content->set_position(test, dcpomatic::DCPTime(96000, 96000));
decoder = std::dynamic_pointer_cast<DCPDecoder>(player->_pieces.front()->decoder);
BOOST_REQUIRE (decoder);
BOOST_REQUIRE (reels == decoder->reels());
diff --git a/test/dcp_subtitle_test.cc b/test/dcp_subtitle_test.cc
index 3888a7b53..0386c3b46 100644
--- a/test/dcp_subtitle_test.cc
+++ b/test/dcp_subtitle_test.cc
@@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test)
film->set_dcp_content_type(DCPContentType::from_isdcf_name("TLR"));
film->set_name("frobozz");
- BOOST_CHECK_EQUAL (content->full_length(film).get(), DCPTime::from_seconds(2).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(2));
content->only_text()->set_use (true);
content->only_text()->set_burn (false);
diff --git a/test/dcpomatic_time_test.cc b/test/dcpomatic_time_test.cc
index 5d23f2478..11756184d 100644
--- a/test/dcpomatic_time_test.cc
+++ b/test/dcpomatic_time_test.cc
@@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE (dcpomatic_time_test)
int k = 0;
for (int64_t i = 0; i < 62000; i += 2000) {
DCPTime d (i);
- ContentTime c (d, frc);
+ auto c = d.content_time(frc);
BOOST_CHECK_EQUAL (c.frames_floor (24.0), j);
++k;
if (k == 2) {
@@ -275,9 +275,9 @@ BOOST_AUTO_TEST_CASE (dcpomatic_time_period_coalesce_test3)
BOOST_AUTO_TEST_CASE (dcpomatic_time_period_coalesce_test4)
{
- DCPTimePeriod A (DCPTime(14), DCPTime(29));
- DCPTimePeriod B (DCPTime(20), DCPTime(91));
- DCPTimePeriod C (DCPTime(35), DCPTime(106));
+ DCPTimePeriod A(DCPTime(14, 96000), DCPTime(29, 96000));
+ DCPTimePeriod B(DCPTime(20, 96000), DCPTime(91, 96000));
+ DCPTimePeriod C(DCPTime(35, 96000), DCPTime(106, 96000));
list<DCPTimePeriod> p;
p.push_back (A);
p.push_back (B);
@@ -289,17 +289,17 @@ BOOST_AUTO_TEST_CASE (dcpomatic_time_period_coalesce_test4)
BOOST_AUTO_TEST_CASE (dcpomatic_time_period_coalesce_test5)
{
- DCPTimePeriod A (DCPTime(14), DCPTime(29));
- DCPTimePeriod B (DCPTime(20), DCPTime(91));
- DCPTimePeriod C (DCPTime(100), DCPTime(106));
+ DCPTimePeriod A(DCPTime(14, 96000), DCPTime(29, 96000));
+ DCPTimePeriod B(DCPTime(20, 96000), DCPTime(91, 96000));
+ DCPTimePeriod C(DCPTime(100, 96000), DCPTime(106, 96000));
list<DCPTimePeriod> p;
p.push_back (A);
p.push_back (B);
p.push_back (C);
list<DCPTimePeriod> q = coalesce (p);
BOOST_REQUIRE_EQUAL (q.size(), 2U);
- BOOST_CHECK (q.front() == DCPTimePeriod(DCPTime(14), DCPTime(91)));
- BOOST_CHECK (q.back() == DCPTimePeriod(DCPTime(100), DCPTime(106)));
+ BOOST_CHECK(q.front() == DCPTimePeriod(DCPTime(14, 96000), DCPTime(91, 96000)));
+ BOOST_CHECK(q.back() == DCPTimePeriod(DCPTime(100, 96000), DCPTime(106, 96000)));
}
BOOST_AUTO_TEST_CASE (test_coalesce_with_overlapping_periods)
@@ -317,36 +317,36 @@ BOOST_AUTO_TEST_CASE (test_coalesce_with_overlapping_periods)
/* Straightforward test of DCPTime::ceil */
BOOST_AUTO_TEST_CASE (dcpomatic_time_ceil_test)
{
- BOOST_CHECK_EQUAL (DCPTime(0).ceil(DCPTime::HZ / 2).get(), 0);
- BOOST_CHECK_EQUAL (DCPTime(1).ceil(DCPTime::HZ / 2).get(), 2);
- BOOST_CHECK_EQUAL (DCPTime(2).ceil(DCPTime::HZ / 2).get(), 2);
- BOOST_CHECK_EQUAL (DCPTime(3).ceil(DCPTime::HZ / 2).get(), 4);
+ BOOST_CHECK(DCPTime(0, 96000).ceil(96000 / 2) == DCPTime(0, 96000));
+ BOOST_CHECK(DCPTime(1, 96000).ceil(96000 / 2) == DCPTime(2, 96000));
+ BOOST_CHECK(DCPTime(2, 96000).ceil(96000 / 2) == DCPTime(2, 96000));
+ BOOST_CHECK(DCPTime(3, 96000).ceil(96000 / 2) == DCPTime(4, 96000));
- BOOST_CHECK_EQUAL (DCPTime(0).ceil(DCPTime::HZ / 42).get(), 0);
- BOOST_CHECK_EQUAL (DCPTime(1).ceil(DCPTime::HZ / 42).get(), 42);
- BOOST_CHECK_EQUAL (DCPTime(42).ceil(DCPTime::HZ / 42).get(), 42);
- BOOST_CHECK_EQUAL (DCPTime(43).ceil(DCPTime::HZ / 42).get(), 84);
+ BOOST_CHECK(DCPTime(0, 96000).ceil(96000 / 42) == DCPTime(0, 96000));
+ BOOST_CHECK(DCPTime(1, 96000).ceil(96000 / 42) == DCPTime(42, 96000));
+ BOOST_CHECK(DCPTime(42, 96000).ceil(96000 / 42) == DCPTime(42, 96000));
+ BOOST_CHECK(DCPTime(43, 96000).ceil(96000 / 42) == DCPTime(84, 96000));
/* Check that rounding up to non-integer frame rates works */
- BOOST_CHECK_EQUAL (DCPTime(45312).ceil(29.976).get(), 48038);
+ BOOST_CHECK(DCPTime(45312, 96000).ceil(29.976) == DCPTime(48038, 96000));
/* Check another tricky case that used to fail */
- BOOST_CHECK_EQUAL (DCPTime(212256039).ceil(23.976).get(), 212256256);
+ BOOST_CHECK(DCPTime(212256039, 96000).ceil(23.976) == DCPTime(212256256, 96000));
}
/* Straightforward test of DCPTime::floor */
BOOST_AUTO_TEST_CASE (dcpomatic_time_floor_test)
{
- BOOST_CHECK_EQUAL (DCPTime(0).floor(DCPTime::HZ / 2).get(), 0);
- BOOST_CHECK_EQUAL (DCPTime(1).floor(DCPTime::HZ / 2).get(), 0);
- BOOST_CHECK_EQUAL (DCPTime(2).floor(DCPTime::HZ / 2).get(), 2);
- BOOST_CHECK_EQUAL (DCPTime(3).floor(DCPTime::HZ / 2).get(), 2);
+ BOOST_CHECK(DCPTime(0, 96000).floor(96000 / 2) == DCPTime(0, 96000));
+ BOOST_CHECK(DCPTime(1, 96000).floor(96000 / 2) == DCPTime(0, 96000));
+ BOOST_CHECK(DCPTime(2, 96000).floor(96000 / 2) == DCPTime(2, 96000));
+ BOOST_CHECK(DCPTime(3, 96000).floor(96000 / 2) == DCPTime(2, 96000));
- BOOST_CHECK_EQUAL (DCPTime(0).floor(DCPTime::HZ / 42).get(), 0);
- BOOST_CHECK_EQUAL (DCPTime(1).floor(DCPTime::HZ / 42).get(), 0);
- BOOST_CHECK_EQUAL (DCPTime(42).floor(DCPTime::HZ / 42.0).get(), 42);
- BOOST_CHECK_EQUAL (DCPTime(43).floor(DCPTime::HZ / 42.0).get(), 42);
+ BOOST_CHECK(DCPTime(0, 96000).floor(96000 / 42) == DCPTime(0, 96000));
+ BOOST_CHECK(DCPTime(1, 96000).floor(96000 / 42) == DCPTime(0, 96000));
+ BOOST_CHECK(DCPTime(42, 96000).floor(96000 / 42.0) == DCPTime(42, 96000));
+ BOOST_CHECK(DCPTime(43, 96000).floor(96000 / 42.0) == DCPTime(42, 96000));
/* Check that rounding down to non-integer frame rates works */
- BOOST_CHECK_EQUAL (DCPTime(45312).floor(29.976).get(), 44836);
+ BOOST_CHECK(DCPTime(45312, 96000).floor(29.976) == DCPTime(44836, 96000));
}
diff --git a/test/empty_test.cc b/test/empty_test.cc
index 50849a1ec..4716b5ab7 100644
--- a/test/empty_test.cc
+++ b/test/empty_test.cc
@@ -69,18 +69,18 @@ BOOST_AUTO_TEST_CASE (empty_test1)
* A A A B
*/
contentA->video->set_length (3);
- contentA->set_position (film, DCPTime::from_frames(2, vfr));
+ contentA->set_position (film, DCPTime(2, vfr));
contentB->video->set_length (1);
- contentB->set_position (film, DCPTime::from_frames(7, vfr));
+ contentB->set_position (film, DCPTime(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();
- BOOST_CHECK (i->from == DCPTime::from_frames(0, vfr));
- BOOST_CHECK (i->to == DCPTime::from_frames(2, vfr));
+ BOOST_CHECK (i->from == DCPTime(0, vfr));
+ BOOST_CHECK (i->to == DCPTime(2, vfr));
++i;
- BOOST_CHECK (i->from == DCPTime::from_frames(5, vfr));
- BOOST_CHECK (i->to == DCPTime::from_frames(7, vfr));
+ BOOST_CHECK (i->from == DCPTime(5, vfr));
+ BOOST_CHECK (i->to == DCPTime(7, vfr));
}
@@ -103,21 +103,21 @@ BOOST_AUTO_TEST_CASE (empty_test2)
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));
+ contentB->set_position (film, DCPTime(7, vfr));
Empty black (film, film->playlist(), bind(&has_video, _1), 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));
+ BOOST_CHECK (black._periods.front().from == DCPTime(3, vfr));
+ BOOST_CHECK (black._periods.front().to == DCPTime(7, vfr));
/* position should initially be the start of the first empty period */
- BOOST_CHECK (black.position() == DCPTime::from_frames(3, vfr));
+ BOOST_CHECK (black.position() == DCPTime(3, vfr));
/* check that done() works */
BOOST_CHECK (!black.done ());
- black.set_position (DCPTime::from_frames (4, vfr));
+ black.set_position (DCPTime (4, vfr));
BOOST_CHECK (!black.done ());
- black.set_position (DCPTime::from_frames (7, vfr));
+ black.set_position (DCPTime (7, vfr));
BOOST_CHECK (black.done ());
}
@@ -141,17 +141,17 @@ BOOST_AUTO_TEST_CASE (empty_test3)
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));
+ contentB->set_position (film, DCPTime(7, vfr));
auto playlist = make_shared<Playlist>();
playlist->add (film, contentB);
Empty black (film, playlist, bind(&has_video, _1), 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_CHECK (black._periods.front().from == DCPTime(0, vfr));
+ BOOST_CHECK (black._periods.front().to == DCPTime(7, vfr));
/* position should initially be the start of the first empty period */
- BOOST_CHECK (black.position() == DCPTime::from_frames(0, vfr));
+ BOOST_CHECK (black.position() == DCPTime(0, vfr));
}
diff --git a/test/ffmpeg_decoder_sequential_test.cc b/test/ffmpeg_decoder_sequential_test.cc
index 43ef3eb68..bef60b6ee 100644
--- a/test/ffmpeg_decoder_sequential_test.cc
+++ b/test/ffmpeg_decoder_sequential_test.cc
@@ -80,9 +80,9 @@ ffmpeg_decoder_sequential_test_one (boost::filesystem::path file, float fps, int
player->Video.connect (bind (&check, _1, _2));
next = DCPTime ();
- frame = DCPTime::from_frames (1, film->video_frame_rate ());
+ frame = DCPTime(1, film->video_frame_rate());
while (!player->pass()) {}
- BOOST_REQUIRE (next == DCPTime::from_frames (video_length, film->video_frame_rate()));
+ BOOST_REQUIRE (next == DCPTime(video_length, film->video_frame_rate()));
}
diff --git a/test/import_dcp_test.cc b/test/import_dcp_test.cc
index 8782e7f73..ed5715c3f 100644
--- a/test/import_dcp_test.cc
+++ b/test/import_dcp_test.cc
@@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE (import_dcp_markers_test)
content[0]->video->set_length (24 * 60 * 10);
- film->set_marker(dcp::Marker::FFOC, dcpomatic::DCPTime::from_frames(1, 24));
+ film->set_marker(dcp::Marker::FFOC, dcpomatic::DCPTime(1, 24));
film->set_marker(dcp::Marker::FFMC, dcpomatic::DCPTime::from_seconds(9.4));
film->set_marker(dcp::Marker::LFMC, dcpomatic::DCPTime::from_seconds(9.99));
diff --git a/test/player_test.cc b/test/player_test.cc
index 7fc21ac36..617e544c7 100644
--- a/test/player_test.cc
+++ b/test/player_test.cc
@@ -107,10 +107,10 @@ BOOST_AUTO_TEST_CASE (player_black_fill_test)
film->set_sequence (false);
contentA->video->set_length (3);
- contentA->set_position (film, DCPTime::from_frames(2, film->video_frame_rate()));
+ contentA->set_position (film, DCPTime(2, film->video_frame_rate()));
contentA->video->set_custom_ratio (1.85);
contentB->video->set_length (1);
- contentB->set_position (film, DCPTime::from_frames(7, film->video_frame_rate()));
+ contentB->set_position (film, DCPTime(7, film->video_frame_rate()));
contentB->video->set_custom_ratio (1.85);
make_and_verify_dcp (
@@ -148,17 +148,17 @@ BOOST_AUTO_TEST_CASE (player_subframe_test)
film->set_video_frame_rate (24);
A->video->set_length (3 * 24);
- BOOST_CHECK (A->full_length(film) == DCPTime::from_frames(3 * 24, 24));
- BOOST_CHECK (B->full_length(film) == DCPTime(289920));
+ BOOST_CHECK (A->full_length(film) == DCPTime(3 * 24, 24));
+ BOOST_CHECK (B->full_length(film) == DCPTime(289920, 96000));
/* Length should be rounded up from B's length to the next video frame */
- BOOST_CHECK (film->length() == DCPTime::from_frames(3 * 24 + 1, 24));
+ BOOST_CHECK (film->length() == DCPTime(3 * 24 + 1, 24));
Player player(film, Image::Alignment::COMPACT, false);
player.setup_pieces();
BOOST_REQUIRE_EQUAL(player._black._periods.size(), 1U);
- BOOST_CHECK(player._black._periods.front() == DCPTimePeriod(DCPTime::from_frames(3 * 24, 24), DCPTime::from_frames(3 * 24 + 1, 24)));
+ BOOST_CHECK(player._black._periods.front() == DCPTimePeriod(DCPTime(3 * 24, 24), DCPTime(3 * 24 + 1, 24)));
BOOST_REQUIRE_EQUAL(player._silent._periods.size(), 1U);
- BOOST_CHECK(player._silent._periods.front() == DCPTimePeriod(DCPTime(289920), DCPTime::from_frames(3 * 24 + 1, 24)));
+ BOOST_CHECK(player._silent._periods.front() == DCPTimePeriod(DCPTime(289920, 96000), DCPTime(3 * 24 + 1, 24)));
}
@@ -220,10 +220,10 @@ BOOST_AUTO_TEST_CASE (player_seek_test)
);
for (int i = 0; i < 10; ++i) {
- auto t = DCPTime::from_frames (i, 24);
+ auto t = DCPTime(i, 24);
butler->seek (t, true);
auto video = butler->get_video(Butler::Behaviour::BLOCKING, 0);
- BOOST_CHECK_EQUAL(video.second.get(), t.get());
+ BOOST_CHECK(video.second == t);
write_image(video.first->image(force(AV_PIX_FMT_RGB24), VideoRange::FULL, true), fmt::format("build/test/player_seek_test_{}.png", i));
/* This 14.08 is empirically chosen (hopefully) to accept changes in rendering between the reference and a test machine
(17.10 and 16.04 seem to anti-alias a little differently) but to reject gross errors e.g. missing fonts or missing
@@ -255,10 +255,10 @@ BOOST_AUTO_TEST_CASE (player_seek_test2)
butler->seek(DCPTime::from_seconds(5), true);
for (int i = 0; i < 10; ++i) {
- auto t = DCPTime::from_seconds(5) + DCPTime::from_frames (i, 24);
+ auto t = DCPTime::from_seconds(5) + DCPTime(i, 24);
butler->seek (t, true);
auto video = butler->get_video(Butler::Behaviour::BLOCKING, 0);
- BOOST_CHECK_EQUAL(video.second.get(), t.get());
+ BOOST_CHECK(video.second == t);
write_image(
video.first->image(force(AV_PIX_FMT_RGB24), VideoRange::FULL, true), fmt::format("build/test/player_seek_test2_{}.png", i)
);
@@ -533,7 +533,7 @@ BOOST_AUTO_TEST_CASE(multiple_sound_files_bug)
auto film = new_test_film("multiple_sound_files_bug", { A, B, C }, &cl);
film->set_audio_channels(16);
- C->set_position(film, DCPTime(3840000));
+ C->set_position(film, DCPTime(3840000, 96000));
make_and_verify_dcp(film, { dcp::VerificationNote::Code::MISSING_CPL_METADATA });
@@ -612,7 +612,7 @@ BOOST_AUTO_TEST_CASE(two_d_in_three_d_duplicates)
BOOST_CHECK(last_eyes != video->eyes());
last_eyes = video->eyes();
if (video->eyes() == Eyes::LEFT) {
- BOOST_CHECK(!last_time || time == *last_time + DCPTime::from_frames(1, 24));
+ BOOST_CHECK(!last_time || time == *last_time + DCPTime(1, 24));
} else {
BOOST_CHECK(time == *last_time);
}
@@ -665,7 +665,7 @@ BOOST_AUTO_TEST_CASE(three_d_in_two_d_chooses_left)
optional<DCPTime> last_time;
player->Video.connect([&last_time, &red_line, &blue_line](shared_ptr<PlayerVideo> video, dcpomatic::DCPTime time) {
BOOST_CHECK(video->eyes() == Eyes::BOTH);
- BOOST_CHECK(!last_time || time == *last_time + DCPTime::from_frames(1, 24));
+ BOOST_CHECK(!last_time || time == *last_time + DCPTime(1, 24));
last_time = time;
auto image = video->image(force(AV_PIX_FMT_RGB24), VideoRange::FULL, false);
@@ -709,7 +709,7 @@ BOOST_AUTO_TEST_CASE(check_seek_with_no_video)
}
BOOST_REQUIRE(earliest);
- BOOST_CHECK(*earliest >= dcpomatic::DCPTime(60 * 60));
+ BOOST_CHECK(*earliest >= dcpomatic::DCPTime::from_seconds(60 * 60));
}
diff --git a/test/reel_writer_test.cc b/test/reel_writer_test.cc
index cb5ad349e..d37aa5a99 100644
--- a/test/reel_writer_test.cc
+++ b/test/reel_writer_test.cc
@@ -57,7 +57,7 @@ static bool equal(J2KFrameInfo a, dcp::File& file, Frame frame, Eyes eyes)
BOOST_AUTO_TEST_CASE (write_frame_info_test)
{
auto film = new_test_film("write_frame_info_test");
- dcpomatic::DCPTimePeriod const period (dcpomatic::DCPTime(0), dcpomatic::DCPTime(96000));
+ dcpomatic::DCPTimePeriod const period(dcpomatic::DCPTime(), dcpomatic::DCPTime(96000, 96000));
J2KFrameInfo info1(0, 123, "12345678901234567890123456789012");
J2KFrameInfo info2(596, 14921, "123acb789f1234ae782012n456339522");
diff --git a/test/reels_test.cc b/test/reels_test.cc
index fcb1aee44..423f55bab 100644
--- a/test/reels_test.cc
+++ b/test/reels_test.cc
@@ -70,21 +70,21 @@ BOOST_AUTO_TEST_CASE (reels_test1)
auto A = make_shared<FFmpegContent>("test/data/test.mp4");
auto B = make_shared<FFmpegContent>("test/data/test.mp4");
auto film = new_test_film("reels_test1", { A, B });
- BOOST_CHECK_EQUAL (A->full_length(film).get(), 288000);
+ BOOST_CHECK(A->full_length(film) == DCPTime(288000, 96000));
film->set_reel_type (ReelType::SINGLE);
auto r = film->reels ();
- BOOST_CHECK_EQUAL (r.size(), 1U);
- BOOST_CHECK_EQUAL (r.front().from.get(), 0);
- BOOST_CHECK_EQUAL (r.front().to.get(), 288000 * 2);
+ BOOST_CHECK_EQUAL(r.size(), 1U);
+ BOOST_CHECK(r.front().from == DCPTime());
+ BOOST_CHECK(r.front().to == DCPTime(288000 * 2, 96000));
film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
r = film->reels ();
- BOOST_CHECK_EQUAL (r.size(), 2U);
- BOOST_CHECK_EQUAL (r.front().from.get(), 0);
- BOOST_CHECK_EQUAL (r.front().to.get(), 288000);
- BOOST_CHECK_EQUAL (r.back().from.get(), 288000);
- BOOST_CHECK_EQUAL (r.back().to.get(), 288000 * 2);
+ BOOST_CHECK_EQUAL(r.size(), 2U);
+ BOOST_CHECK(r.front().from == DCPTime());
+ BOOST_CHECK(r.front().to == DCPTime(288000, 96000));
+ BOOST_CHECK(r.back().from == DCPTime(288000, 96000));
+ BOOST_CHECK(r.back().to == DCPTime(288000 * 2, 96000));
film->set_video_bit_rate(VideoEncoding::JPEG2000, 100000000);
film->set_reel_type (ReelType::BY_LENGTH);
@@ -93,14 +93,14 @@ BOOST_AUTO_TEST_CASE (reels_test1)
r = film->reels ();
BOOST_CHECK_EQUAL (r.size(), 3U);
auto i = r.begin ();
- BOOST_CHECK_EQUAL (i->from.get(), 0);
- BOOST_CHECK_EQUAL (i->to.get(), DCPTime::from_frames(60, 24).get());
+ BOOST_CHECK(i->from == DCPTime());
+ BOOST_CHECK(i->to == DCPTime(60, 24));
++i;
- BOOST_CHECK_EQUAL (i->from.get(), DCPTime::from_frames(60, 24).get());
- BOOST_CHECK_EQUAL (i->to.get(), DCPTime::from_frames(120, 24).get());
+ BOOST_CHECK(i->from == DCPTime(60, 24));
+ BOOST_CHECK(i->to == DCPTime(120, 24));
++i;
- BOOST_CHECK_EQUAL (i->from.get(), DCPTime::from_frames(120, 24).get());
- BOOST_CHECK_EQUAL (i->to.get(), DCPTime::from_frames(144, 24).get());
+ BOOST_CHECK(i->from == DCPTime(120, 24));
+ BOOST_CHECK(i->to == DCPTime(144, 24));
}
@@ -135,14 +135,14 @@ BOOST_AUTO_TEST_CASE (reels_test2)
auto reels = film2->reels ();
BOOST_CHECK_EQUAL(reels.size(), 3U);
auto i = reels.begin();
- BOOST_CHECK_EQUAL (i->from.get(), 0);
- BOOST_CHECK_EQUAL (i->to.get(), 96000);
+ BOOST_CHECK(i->from == DCPTime());
+ BOOST_CHECK(i->to == DCPTime(96000, 96000));
++i;
- BOOST_CHECK_EQUAL (i->from.get(), 96000);
- BOOST_CHECK_EQUAL (i->to.get(), 96000 * 2);
+ BOOST_CHECK(i->from == DCPTime(96000, 96000));
+ BOOST_CHECK(i->to == DCPTime(96000 * 2, 96000));
++i;
- BOOST_CHECK_EQUAL (i->from.get(), 96000 * 2);
- BOOST_CHECK_EQUAL (i->to.get(), 96000 * 3);
+ BOOST_CHECK(i->from == DCPTime(96000 * 2, 96000));
+ BOOST_CHECK(i->to == DCPTime(96000 * 3, 96000));
c->set_reference_video (true);
c->set_reference_audio (true);
@@ -164,17 +164,17 @@ BOOST_AUTO_TEST_CASE (reels_test3)
auto reels = film->reels();
BOOST_REQUIRE_EQUAL (reels.size(), 4U);
auto i = reels.begin ();
- BOOST_CHECK_EQUAL (i->from.get(), 0);
- BOOST_CHECK_EQUAL (i->to.get(), 96000);
+ BOOST_CHECK(i->from == DCPTime());
+ BOOST_CHECK(i->to == DCPTime(96000, 96000));
++i;
- BOOST_CHECK_EQUAL (i->from.get(), 96000);
- BOOST_CHECK_EQUAL (i->to.get(), 96000 * 2);
+ BOOST_CHECK(i->from == DCPTime(96000, 96000));
+ BOOST_CHECK(i->to == DCPTime(96000 * 2, 96000));
++i;
- BOOST_CHECK_EQUAL (i->from.get(), 96000 * 2);
- BOOST_CHECK_EQUAL (i->to.get(), 96000 * 3);
+ BOOST_CHECK(i->from == DCPTime(96000 * 2, 96000));
+ BOOST_CHECK(i->to == DCPTime(96000 * 3, 96000));
++i;
- BOOST_CHECK_EQUAL (i->from.get(), 96000 * 3);
- BOOST_CHECK_EQUAL (i->to.get(), sub->full_length(film).ceil(film->video_frame_rate()).get());
+ BOOST_CHECK(i->from == DCPTime(96000 * 3, 96000));
+ BOOST_CHECK(i->to == sub->full_length(film).ceil(film->video_frame_rate()));
}
@@ -205,17 +205,17 @@ BOOST_AUTO_TEST_CASE (reels_test4)
auto reels = film->reels();
BOOST_REQUIRE_EQUAL (reels.size(), 4U);
auto i = reels.begin ();
- BOOST_CHECK_EQUAL (i->from.get(), 0);
- BOOST_CHECK_EQUAL (i->to.get(), 96000);
+ BOOST_CHECK(i->from == DCPTime());
+ BOOST_CHECK(i->to == DCPTime(96000, 96000));
++i;
- BOOST_CHECK_EQUAL (i->from.get(), 96000);
- BOOST_CHECK_EQUAL (i->to.get(), 96000 * 2);
+ BOOST_CHECK(i->from == DCPTime(96000, 96000));
+ BOOST_CHECK(i->to == DCPTime(96000 * 2, 96000));
++i;
- BOOST_CHECK_EQUAL (i->from.get(), 96000 * 2);
- BOOST_CHECK_EQUAL (i->to.get(), 96000 * 3);
+ BOOST_CHECK(i->from == DCPTime(96000 * 2, 96000));
+ BOOST_CHECK(i->to == DCPTime(96000 * 3, 96000));
++i;
- BOOST_CHECK_EQUAL (i->from.get(), 96000 * 3);
- BOOST_CHECK_EQUAL (i->to.get(), 96000 * 4);
+ BOOST_CHECK(i->from == DCPTime(96000 * 3, 96000));
+ BOOST_CHECK(i->to == DCPTime(96000 * 4, 96000));
make_and_verify_dcp (
film,
@@ -237,16 +237,16 @@ BOOST_AUTO_TEST_CASE (reels_test5)
film->set_sequence (false);
/* Set to 2123 but it will be rounded up to the next frame (4000) */
- dcp->set_position(film, DCPTime(2123));
+ dcp->set_position(film, DCPTime(2123, 96000));
{
auto p = dcp->reels (film);
BOOST_REQUIRE_EQUAL (p.size(), 4U);
auto i = p.begin();
- BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 0), DCPTime(4000 + 96000)));
- BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 96000), DCPTime(4000 + 192000)));
- BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 192000), DCPTime(4000 + 288000)));
- BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 288000), DCPTime(4000 + 384000)));
+ BOOST_CHECK(*i++ == DCPTimePeriod(DCPTime(4000 + 0, 96000), DCPTime(4000 + 96000, 96000)));
+ BOOST_CHECK(*i++ == DCPTimePeriod(DCPTime(4000 + 96000, 96000), DCPTime(4000 + 192000, 96000)));
+ BOOST_CHECK(*i++ == DCPTimePeriod(DCPTime(4000 + 192000, 96000), DCPTime(4000 + 288000, 96000)));
+ BOOST_CHECK(*i++ == DCPTimePeriod(DCPTime(4000 + 288000, 96000), DCPTime(4000 + 384000, 96000)));
}
{
@@ -254,10 +254,10 @@ BOOST_AUTO_TEST_CASE (reels_test5)
auto p = dcp->reels (film);
BOOST_REQUIRE_EQUAL (p.size(), 4U);
auto i = p.begin();
- BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 0), DCPTime(4000 + 48000)));
- BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 48000), DCPTime(4000 + 144000)));
- BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 144000), DCPTime(4000 + 240000)));
- BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 240000), DCPTime(4000 + 336000)));
+ BOOST_CHECK(*i++ == DCPTimePeriod(DCPTime(4000 + 0, 96000), DCPTime(4000 + 48000, 96000)));
+ BOOST_CHECK(*i++ == DCPTimePeriod(DCPTime(4000 + 48000, 96000), DCPTime(4000 + 144000, 96000)));
+ BOOST_CHECK(*i++ == DCPTimePeriod(DCPTime(4000 + 144000, 96000), DCPTime(4000 + 240000, 96000)));
+ BOOST_CHECK(*i++ == DCPTimePeriod(DCPTime(4000 + 240000, 96000), DCPTime(4000 + 336000, 96000)));
}
{
@@ -265,10 +265,10 @@ BOOST_AUTO_TEST_CASE (reels_test5)
auto p = dcp->reels (film);
BOOST_REQUIRE_EQUAL (p.size(), 4U);
auto i = p.begin();
- BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 0), DCPTime(4000 + 48000)));
- BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 48000), DCPTime(4000 + 144000)));
- BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 144000), DCPTime(4000 + 240000)));
- BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 240000), DCPTime(4000 + 288000)));
+ BOOST_CHECK(*i++ == DCPTimePeriod(DCPTime(4000 + 0, 96000), DCPTime(4000 + 48000, 96000)));
+ BOOST_CHECK(*i++ == DCPTimePeriod(DCPTime(4000 + 48000, 96000), DCPTime(4000 + 144000, 96000)));
+ BOOST_CHECK(*i++ == DCPTimePeriod(DCPTime(4000 + 144000, 96000), DCPTime(4000 + 240000, 96000)));
+ BOOST_CHECK(*i++ == DCPTimePeriod(DCPTime(4000 + 240000, 96000), DCPTime(4000 + 288000, 96000)));
}
{
@@ -276,9 +276,9 @@ BOOST_AUTO_TEST_CASE (reels_test5)
auto p = dcp->reels (film);
BOOST_REQUIRE_EQUAL (p.size(), 3U);
auto i = p.begin();
- BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 0), DCPTime(4000 + 48000)));
- BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 48000), DCPTime(4000 + 144000)));
- BOOST_CHECK (*i++ == DCPTimePeriod (DCPTime(4000 + 144000), DCPTime(4000 + 192000)));
+ BOOST_CHECK(*i++ == DCPTimePeriod(DCPTime(4000 + 0, 96000), DCPTime(4000 + 48000, 96000)));
+ BOOST_CHECK(*i++ == DCPTimePeriod(DCPTime(4000 + 48000, 96000), DCPTime(4000 + 144000, 96000)));
+ BOOST_CHECK(*i++ == DCPTimePeriod(DCPTime(4000 + 144000, 96000), DCPTime(4000 + 192000, 96000)));
}
}
@@ -319,8 +319,8 @@ BOOST_AUTO_TEST_CASE (reels_test7)
film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
BOOST_REQUIRE_EQUAL (film->reels().size(), 2U);
- BOOST_CHECK (film->reels().front() == DCPTimePeriod(DCPTime(0), DCPTime::from_frames(2 * 24, 24)));
- BOOST_CHECK (film->reels().back() == DCPTimePeriod(DCPTime::from_frames(2 * 24, 24), DCPTime::from_frames(3 * 24 + 1, 24)));
+ BOOST_CHECK(film->reels().front() == DCPTimePeriod(DCPTime(0), DCPTime(2 * 24, 24)));
+ BOOST_CHECK(film->reels().back() == DCPTimePeriod(DCPTime(2 * 24, 24), DCPTime(3 * 24 + 1, 24)));
make_and_verify_dcp (film);
}
@@ -412,15 +412,15 @@ BOOST_AUTO_TEST_CASE (reels_test11)
A->set_position (film, DCPTime::from_seconds(1));
film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
make_and_verify_dcp (film);
- BOOST_CHECK_EQUAL (A->position().get(), DCPTime::from_seconds(1).get());
- BOOST_CHECK_EQUAL (A->end(film).get(), DCPTime::from_seconds(1 + 10).get());
+ BOOST_CHECK(A->position() == DCPTime::from_seconds(1));
+ BOOST_CHECK(A->end(film) == DCPTime::from_seconds(1 + 10));
auto r = film->reels ();
- BOOST_CHECK_EQUAL (r.size(), 2U);
- BOOST_CHECK_EQUAL (r.front().from.get(), 0);
- BOOST_CHECK_EQUAL (r.front().to.get(), DCPTime::from_seconds(1).get());
- BOOST_CHECK_EQUAL (r.back().from.get(), DCPTime::from_seconds(1).get());
- BOOST_CHECK_EQUAL (r.back().to.get(), DCPTime::from_seconds(1 + 10).get());
+ BOOST_CHECK_EQUAL(r.size(), 2U);
+ BOOST_CHECK(r.front().from == DCPTime());
+ BOOST_CHECK(r.front().to == DCPTime::from_seconds(1));
+ BOOST_CHECK(r.back().from == DCPTime::from_seconds(1));
+ BOOST_CHECK(r.back().to == DCPTime::from_seconds(1 + 10));
}
@@ -448,17 +448,17 @@ BOOST_AUTO_TEST_CASE (reels_test12)
BOOST_REQUIRE_EQUAL (r.size(), 4U);
auto i = r.begin ();
- BOOST_CHECK_EQUAL (i->from.get(), 0);
- BOOST_CHECK_EQUAL (i->to.get(), DCPTime::from_seconds(1).get());
+ BOOST_CHECK(i->from == DCPTime());
+ BOOST_CHECK(i->to == DCPTime::from_seconds(1));
++i;
- BOOST_CHECK_EQUAL (i->from.get(), DCPTime::from_seconds(1).get());
- BOOST_CHECK_EQUAL (i->to.get(), DCPTime::from_seconds(11).get());
+ BOOST_CHECK(i->from == DCPTime::from_seconds(1));
+ BOOST_CHECK(i->to == DCPTime::from_seconds(11));
++i;
- BOOST_CHECK_EQUAL (i->from.get(), DCPTime::from_seconds(11).get());
- BOOST_CHECK_EQUAL (i->to.get(), DCPTime::from_seconds(14).get());
+ BOOST_CHECK(i->from == DCPTime::from_seconds(11));
+ BOOST_CHECK(i->to == DCPTime::from_seconds(14));
++i;
- BOOST_CHECK_EQUAL (i->from.get(), DCPTime::from_seconds(14).get());
- BOOST_CHECK_EQUAL (i->to.get(), DCPTime::from_seconds(19).get());
+ BOOST_CHECK(i->from == DCPTime::from_seconds(14));
+ BOOST_CHECK(i->to == DCPTime::from_seconds(19));
}
@@ -490,7 +490,7 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short1)
A->video->set_length (23);
B->video->set_length (23);
- B->set_position (film, DCPTime::from_frames(23, 24));
+ B->set_position(film, DCPTime(23, 24));
make_and_verify_dcp (film);
@@ -564,10 +564,10 @@ BOOST_AUTO_TEST_CASE (reels_should_not_be_short4)
A->video->set_length (240);
B->video->set_length (23);
- B->set_position (film, DCPTime::from_frames(240, 24));
+ B->set_position(film, DCPTime(240, 24));
BOOST_CHECK_EQUAL (film->reels().size(), 1U);
- BOOST_CHECK (film->reels().front() == dcpomatic::DCPTimePeriod(dcpomatic::DCPTime(), dcpomatic::DCPTime::from_frames(263, 24)));
+ BOOST_CHECK(film->reels().front() == dcpomatic::DCPTimePeriod(dcpomatic::DCPTime(), dcpomatic::DCPTime(263, 24)));
film->write_metadata ();
make_dcp (film, TranscodeJob::ChangedBehaviour::IGNORE);
@@ -617,9 +617,9 @@ BOOST_AUTO_TEST_CASE (repeated_dcp_into_reels)
film2->set_sequence(false);
for (int i = 0; i < 4; ++i) {
- original_dcp[i]->set_position(film2, DCPTime::from_frames(total_frames * i / 4, frame_rate));
- original_dcp[i]->set_trim_start(film2, ContentTime::from_frames(total_frames * i / 4, frame_rate));
- original_dcp[i]->set_trim_end (ContentTime::from_frames(total_frames * (4 - i - 1) / 4, frame_rate));
+ original_dcp[i]->set_position(film2, DCPTime(total_frames * i / 4, frame_rate));
+ original_dcp[i]->set_trim_start(film2, ContentTime(total_frames * i / 4, frame_rate));
+ original_dcp[i]->set_trim_end(ContentTime(total_frames * (4 - i - 1) / 4, frame_rate));
original_dcp[i]->set_reference_video(true);
original_dcp[i]->set_reference_audio(true);
}
@@ -672,8 +672,8 @@ BOOST_AUTO_TEST_CASE(reel_assets_same_length_with_atmos)
auto const reels = film->reels();
BOOST_CHECK_EQUAL(reels.size(), 2U);
- BOOST_CHECK(reels[0] == dcpomatic::DCPTimePeriod({}, dcpomatic::DCPTime::from_frames(240, 24)));
- BOOST_CHECK(reels[1] == dcpomatic::DCPTimePeriod(dcpomatic::DCPTime::from_frames(240, 24), dcpomatic::DCPTime::from_frames(480, 24)));
+ BOOST_CHECK(reels[0] == dcpomatic::DCPTimePeriod({}, dcpomatic::DCPTime(240, 24)));
+ BOOST_CHECK(reels[1] == dcpomatic::DCPTimePeriod(dcpomatic::DCPTime(240, 24), dcpomatic::DCPTime(480, 24)));
make_and_verify_dcp(film, { dcp::VerificationNote::Code::MISSING_CPL_METADATA });
}
diff --git a/test/subtitle_charset_test.cc b/test/subtitle_charset_test.cc
index f4324a646..cf956bf17 100644
--- a/test/subtitle_charset_test.cc
+++ b/test/subtitle_charset_test.cc
@@ -47,5 +47,5 @@ BOOST_AUTO_TEST_CASE (subtitle_charset_test2)
auto ts = dynamic_pointer_cast<StringTextFileContent>(content[0]);
BOOST_REQUIRE (ts);
/* Make sure we got the subtitle data from the file */
- BOOST_REQUIRE_EQUAL(content[0]->full_length(film).get(), 6052032);
+ BOOST_REQUIRE(content[0]->full_length(film) == dcpomatic::DCPTime(6052032, 96000));
}
diff --git a/test/subtitle_reel_test.cc b/test/subtitle_reel_test.cc
index 875fb51fe..3b8f236ba 100644
--- a/test/subtitle_reel_test.cc
+++ b/test/subtitle_reel_test.cc
@@ -242,7 +242,7 @@ BOOST_AUTO_TEST_CASE(bad_subtitle_not_created_at_reel_boundaries)
film->set_reel_type(ReelType::CUSTOM);
content->text[0]->set_language(dcp::LanguageTag("de"));
/* This is 1 frame after the start of the subtitle */
- film->set_custom_reel_boundaries({dcpomatic::DCPTime::from_frames(241, 24)});
+ film->set_custom_reel_boundaries({dcpomatic::DCPTime(241, 24)});
/* This is a tricky situation and the way DoM deals with it gives two Bv2.1
* warnings, but these are "should" not "shall" so I think it's OK.
diff --git a/test/time_calculation_test.cc b/test/time_calculation_test.cc
index abac4a6bd..fb916fa1f 100644
--- a/test/time_calculation_test.cc
+++ b/test/time_calculation_test.cc
@@ -142,19 +142,19 @@ BOOST_AUTO_TEST_CASE(ffmpeg_time_calculation_test)
/* 25fps content, 25fps DCP */
film->set_video_frame_rate(25);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(content->video->length() / 25.0).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(content->video->length() / 25.0));
/* 25fps content, 24fps DCP; length should be increased */
film->set_video_frame_rate(24);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(content->video->length() / 24.0).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(content->video->length() / 24.0));
/* 25fps content, 30fps DCP; length should be decreased */
film->set_video_frame_rate(30);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(content->video->length() / 30.0).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(content->video->length() / 30.0));
/* 25fps content, 50fps DCP; length should be the same */
film->set_video_frame_rate(50);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(content->video->length() / 25.0).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(content->video->length() / 25.0));
/* 25fps content, 60fps DCP; length should be decreased */
film->set_video_frame_rate(60);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(content->video->length() * (50.0 / 60) / 25.0).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(content->video->length() * (50.0 / 60) / 25.0));
/* Make the content audio-only */
content->video.reset();
@@ -162,23 +162,23 @@ BOOST_AUTO_TEST_CASE(ffmpeg_time_calculation_test)
/* 24fps content, 24fps DCP */
film->set_video_frame_rate(24);
content->set_video_frame_rate(film, 24);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(1).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(1));
/* 25fps content, 25fps DCP */
film->set_video_frame_rate(25);
content->set_video_frame_rate(film, 25);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(1).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(1));
/* 25fps content, 24fps DCP; length should be increased */
film->set_video_frame_rate(24);
- BOOST_CHECK_SMALL(labs(content->full_length(film).get() - DCPTime::from_seconds(25.0 / 24).get()), 2L);
+ BOOST_CHECK(DCPTime(content->full_length(film) - DCPTime::from_seconds(25.0 / 24)).abs() < DCPTime(2, 96000));
/* 25fps content, 30fps DCP; length should be decreased */
film->set_video_frame_rate(30);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(25.0 / 30).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(25.0 / 30));
/* 25fps content, 50fps DCP; length should be the same */
film->set_video_frame_rate(50);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(1).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(1));
/* 25fps content, 60fps DCP; length should be decreased */
film->set_video_frame_rate(60);
- BOOST_CHECK_EQUAL(content->full_length(film).get(), DCPTime::from_seconds(50.0 / 60).get());
+ BOOST_CHECK(content->full_length(film) == DCPTime::from_seconds(50.0 / 60));
}
@@ -412,9 +412,9 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
auto piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), 0);
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 12).get(), DCPTime::from_seconds(0.5).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(3.0).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 12) == DCPTime::from_seconds(0.5));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 72) == DCPTime::from_seconds(3.0));
/* Position 3s, no trim, content rate = DCP rate */
content->set_position(film, DCPTime::from_seconds(3));
@@ -424,9 +424,9 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(3.00).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 36).get(), DCPTime::from_seconds(4.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 162).get(), DCPTime::from_seconds(9.75).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime::from_seconds(3.00));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 36) == DCPTime::from_seconds(4.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 162) == DCPTime::from_seconds(9.75));
/* Position 3s, 1.5s trim, content rate = DCP rate */
content->set_position(film, DCPTime::from_seconds(3));
@@ -436,10 +436,10 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(1.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 36).get(), DCPTime::from_seconds(3.00).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(4.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 198).get(), DCPTime::from_seconds(9.75).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime::from_seconds(1.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 36) == DCPTime::from_seconds(3.00));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 72) == DCPTime::from_seconds(4.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 198) == DCPTime::from_seconds(9.75));
/* Position 0, no trim, content rate 24, DCP rate 25.
Now, for example, a DCPTime position of 3s means 3s at 25fps. Since we run the video
@@ -452,9 +452,9 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), 0);
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 15).get(), DCPTime::from_seconds(0.6).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 75).get(), DCPTime::from_seconds(3.0).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime(0));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 15) == DCPTime::from_seconds(0.6));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 75) == DCPTime::from_seconds(3.0));
/* Position 3s, no trim, content rate 24, DCP rate 25 */
content->set_position(film, DCPTime::from_seconds(3));
@@ -464,9 +464,9 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(3.00).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 40).get(), DCPTime::from_seconds(4.60).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 169).get(), DCPTime::from_seconds(9.76).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime::from_seconds(3.00));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 40) == DCPTime::from_seconds(4.60));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 169) == DCPTime::from_seconds(9.76));
/* Position 3s, 1.6s trim, content rate 24, DCP rate 25, so the 1.6s trim is at 24fps */
content->set_position(film, DCPTime::from_seconds(3));
@@ -476,10 +476,10 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), 142080);
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 40).get(), 295680);
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 80).get(), 449280);
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 209).get(), 944640);
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime(142080, 96000));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 40) == DCPTime(295680, 96000));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 80) == DCPTime(449280, 96000));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 209) == DCPTime(944640, 96000));
/* Position 0, no trim, content rate 24, DCP rate 48
Now, for example, a DCPTime position of 3s means 3s at 48fps. Since we run the video
@@ -494,9 +494,9 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), 0);
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 12).get(), DCPTime::from_seconds(0.5).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(3.0).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 12) == DCPTime::from_seconds(0.5));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 72) == DCPTime::from_seconds(3.0));
/* Position 3s, no trim, content rate 24, DCP rate 48 */
content->set_position(film, DCPTime::from_seconds(3));
@@ -506,9 +506,9 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(3.00).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 36).get(), DCPTime::from_seconds(4.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 162).get(), DCPTime::from_seconds(9.75).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime::from_seconds(3.00));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 36) == DCPTime::from_seconds(4.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 162) == DCPTime::from_seconds(9.75));
/* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */
content->set_position(film, DCPTime::from_seconds(3));
@@ -518,10 +518,10 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(1.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 36).get(), DCPTime::from_seconds(3.00).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(4.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 198).get(), DCPTime::from_seconds(9.75).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime::from_seconds(1.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 36) == DCPTime::from_seconds(3.00));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 72) == DCPTime::from_seconds(4.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 198) == DCPTime::from_seconds(9.75));
/* Position 0, no trim, content rate 48, DCP rate 24
Now, for example, a DCPTime position of 3s means 3s at 24fps. Since we run the video
@@ -535,9 +535,9 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), 0);
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 24).get(), DCPTime::from_seconds(0.5).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 144).get(), DCPTime::from_seconds(3.0).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 24) == DCPTime::from_seconds(0.5));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 144) == DCPTime::from_seconds(3.0));
/* Position 3s, no trim, content rate 24, DCP rate 48 */
content->set_position(film, DCPTime::from_seconds(3));
@@ -547,9 +547,9 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(3.00).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(4.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 324).get(), DCPTime::from_seconds(9.75).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime::from_seconds(3.00));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 72) == DCPTime::from_seconds(4.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 324) == DCPTime::from_seconds(9.75));
/* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */
content->set_position(film, DCPTime::from_seconds(3));
@@ -559,10 +559,10 @@ BOOST_AUTO_TEST_CASE(player_time_calculation_test2)
player->setup_pieces();
BOOST_REQUIRE_EQUAL(player->_pieces.size(), 1U);
piece = player->_pieces.front();
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(1.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(3.00).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 144).get(), DCPTime::from_seconds(4.50).get());
- BOOST_CHECK_EQUAL(player->content_video_to_dcp(piece, 396).get(), DCPTime::from_seconds(9.75).get());
+ BOOST_CHECK(player->content_video_to_dcp(piece, 0) == DCPTime::from_seconds(1.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 72) == DCPTime::from_seconds(3.00));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 144) == DCPTime::from_seconds(4.50));
+ BOOST_CHECK(player->content_video_to_dcp(piece, 396) == DCPTime::from_seconds(9.75));
}
/** Test Player::dcp_to_content_audio */
diff --git a/test/torture_test.cc b/test/torture_test.cc
index f03f6d4e5..32a827709 100644
--- a/test/torture_test.cc
+++ b/test/torture_test.cc
@@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE (torture_test1)
auto staircase = content_factory("test/data/staircase.wav")[0];
film->examine_and_add_content({staircase});
BOOST_REQUIRE (!wait_for_jobs());
- staircase->set_position (film, DCPTime::from_frames(2000, film->audio_frame_rate()));
+ staircase->set_position (film, DCPTime(2000, film->audio_frame_rate()));
staircase->set_trim_start(film, ContentTime::from_frames(12, 48000));
staircase->set_trim_end (ContentTime::from_frames (35, 48000));
staircase->audio->set_gain (20 * log10(2));
@@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE (torture_test1)
staircase = content_factory("test/data/staircase.wav")[0];
film->examine_and_add_content({staircase});
BOOST_REQUIRE (!wait_for_jobs());
- staircase->set_position (film, DCPTime::from_frames(50000, film->audio_frame_rate()));
+ staircase->set_position (film, DCPTime(50000, film->audio_frame_rate()));
staircase->set_trim_start(film, ContentTime::from_frames(12, 48000));
staircase->set_trim_end (ContentTime::from_frames(35, 48000));
staircase->audio->set_gain (20 * log10(2));
diff --git a/test/util_test.cc b/test/util_test.cc
index 3431d1856..2c5e37062 100644
--- a/test/util_test.cc
+++ b/test/util_test.cc
@@ -70,8 +70,8 @@ BOOST_AUTO_TEST_CASE(digest_head_tail_test)
BOOST_AUTO_TEST_CASE(timecode_test)
{
- auto t = DCPTime::from_seconds(2 * 60 * 60 + 4 * 60 + 31) + DCPTime::from_frames(19, 24);
- BOOST_CHECK_EQUAL(t.timecode(24), "02:04:31:19");
+ auto t = DCPTime::from_seconds(2 * 60 * 60 + 4 * 60 + 31) + DCPTime(19, 24);
+ BOOST_CHECK_EQUAL(t.timecodeX(24), "02:04:31:19");
}
@@ -93,9 +93,9 @@ BOOST_AUTO_TEST_CASE(seconds_to_approximate_hms_test)
BOOST_AUTO_TEST_CASE(time_to_hmsf_test)
{
- BOOST_CHECK_EQUAL(time_to_hmsf(DCPTime::from_frames(12, 24), 24), "00:00:00.12");
- BOOST_CHECK_EQUAL(time_to_hmsf(DCPTime::from_frames(24, 24), 24), "00:00:01.00");
- BOOST_CHECK_EQUAL(time_to_hmsf(DCPTime::from_frames(32, 24), 24), "00:00:01.08");
+ BOOST_CHECK_EQUAL(time_to_hmsf(DCPTime(12, 24), 24), "00:00:00.12");
+ BOOST_CHECK_EQUAL(time_to_hmsf(DCPTime(24, 24), 24), "00:00:01.00");
+ BOOST_CHECK_EQUAL(time_to_hmsf(DCPTime(32, 24), 24), "00:00:01.08");
BOOST_CHECK_EQUAL(time_to_hmsf(DCPTime::from_seconds(92), 24), "00:01:32.00");
BOOST_CHECK_EQUAL(time_to_hmsf(DCPTime::from_seconds(2 * 60 * 60 + 92), 24), "02:01:32.00");
}
diff --git a/test/vf_test.cc b/test/vf_test.cc
index 4415b79a5..111c738bd 100644
--- a/test/vf_test.cc
+++ b/test/vf_test.cc
@@ -270,13 +270,13 @@ BOOST_AUTO_TEST_CASE (vf_test5)
auto a = get_referenced_reel_assets(vf, vf->playlist());
BOOST_REQUIRE_EQUAL (a.size(), 4U);
auto i = a.begin();
- BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(0), DCPTime(960000)));
+ BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(0, 96000), DCPTime(960000, 96000)));
++i;
- BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(0), DCPTime(960000)));
+ BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(0, 96000), DCPTime(960000, 96000)));
++i;
- BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(960000), DCPTime(1440000)));
+ BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(960000, 96000), DCPTime(1440000, 96000)));
++i;
- BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(960000), DCPTime(1440000)));
+ BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(960000, 96000), DCPTime(1440000, 96000)));
++i;
}
diff --git a/test/writer_test.cc b/test/writer_test.cc
index 6c311437e..a1f8a348e 100644
--- a/test/writer_test.cc
+++ b/test/writer_test.cc
@@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE (test_write_odd_amount_of_silence)
auto audio = make_shared<AudioBuffers>(6, 48000);
audio->make_silent ();
- writer->write (audio, dcpomatic::DCPTime(1));
+ writer->write(audio, dcpomatic::DCPTime(1, 96000));
}
@@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE (interrupt_writer)
for (int i = 0; i < frames; ++i) {
writer->write (video_ptr, i, Eyes::BOTH);
- writer->write (audio, dcpomatic::DCPTime::from_frames(i, 24));
+ writer->write (audio, dcpomatic::DCPTime(i, 24));
}
/* Start digest calculations then abort them; there should be no crash or error */