X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=test%2Ftime_calculation_test.cc;h=c0a75d0fc40a4759f8ee1c52f68a0158f31c1c2b;hb=79f3e6ae2739bdccbb1114ed410bff1452c4aef6;hp=7f13e6c0e64320f1dc7214153b90e063a1a7a855;hpb=150f708d27b25d5b5d4e486d03c5bc4078027997;p=dcpomatic.git diff --git a/test/time_calculation_test.cc b/test/time_calculation_test.cc index 7f13e6c0e..c0a75d0fc 100644 --- a/test/time_calculation_test.cc +++ b/test/time_calculation_test.cc @@ -1,22 +1,28 @@ /* Copyright (C) 2015-2016 Carl Hetherington - This program is free software; you can redistribute it and/or modify + 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. - This program is distributed in the hope that it will be useful, + 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 this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with DCP-o-matic. If not, see . */ +/** @file test/time_calculation_test.cc + * @brief Test calculation of timings when frame rates change. + * @ingroup specific + */ + #include "lib/film.h" #include "lib/ffmpeg_content.h" #include "lib/video_content.h" @@ -42,7 +48,7 @@ static string const xml = "" "1280" "720" "25" - "0" + "2d" "0" "0" "0" @@ -81,8 +87,9 @@ static string const xml = "" "" "1" "und; 2 channels" - "2" + "1" "44100" + "44100" "2" "0" "" @@ -129,19 +136,44 @@ BOOST_AUTO_TEST_CASE (ffmpeg_time_calculation_test) /* 25fps content, 25fps DCP */ film->set_video_frame_rate (25); - BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (content->video->length() / 25.0)); + BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() / 25.0).get()); + /* 25fps content, 24fps DCP; length should be increased */ + film->set_video_frame_rate (24); + BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() / 24.0).get()); + /* 25fps content, 30fps DCP; length should be decreased */ + film->set_video_frame_rate (30); + BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() / 30.0).get()); + /* 25fps content, 50fps DCP; length should be the same */ + film->set_video_frame_rate (50); + BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() / 25.0).get()); + /* 25fps content, 60fps DCP; length should be decreased */ + film->set_video_frame_rate (60); + BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() * (50.0 / 60) / 25.0).get()); + + /* Make the content audio-only */ + content->video.reset (); + + /* 24fps content, 24fps DCP */ + film->set_video_frame_rate (24); + content->set_video_frame_rate (24); + BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(1).get()); + /* 25fps content, 25fps DCP */ + film->set_video_frame_rate (25); + content->set_video_frame_rate (25); + BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(1).get()); /* 25fps content, 24fps DCP; length should be increased */ film->set_video_frame_rate (24); - BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (content->video->length() / 24.0)); + BOOST_CHECK_SMALL (labs (content->full_length().get() - DCPTime::from_seconds(25.0 / 24).get()), 2L); /* 25fps content, 30fps DCP; length should be decreased */ film->set_video_frame_rate (30); - BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (content->video->length() / 30.0)); + BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(25.0 / 30).get()); /* 25fps content, 50fps DCP; length should be the same */ film->set_video_frame_rate (50); - BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (content->video->length() / 25.0)); + BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(1).get()); /* 25fps content, 60fps DCP; length should be decreased */ film->set_video_frame_rate (60); - BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (content->video->length() * (50.0 / 60) / 25.0)); + BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(50.0 / 60).get()); + } /** Test Player::dcp_to_content_video */ @@ -162,7 +194,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) /* Position 0, no trim, content rate = DCP rate */ content->set_position (DCPTime ()); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); @@ -174,7 +206,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) /* Position 3s, no trim, content rate = DCP rate */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); @@ -188,7 +220,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) /* Position 3s, 1.5s trim, content rate = DCP rate */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime::from_seconds (1.5)); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); @@ -205,7 +237,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) */ content->set_position (DCPTime ()); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (25); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); @@ -217,7 +249,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) /* Position 3s, no trim, content rate 24, DCP rate 25 */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (25); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); @@ -229,19 +261,20 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (9.75)), 168); /* Position 3s, 1.6s trim, content rate 24, DCP rate 25. Here the trim is in ContentTime, - so it's 1.6s at 24fps. + so it's 1.6s at 24fps. Note that trims are rounded to the nearest video frame, so + some of these results are not quite what you'd perhaps expect. */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime::from_seconds (1.6)); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (25); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); piece = player->_pieces.front (); BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime ()), 0); BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (0.60)), 0); - BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (3.00)), 38); - BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (4.60)), 78); + BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (3.00)), 39); + BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (4.60)), 79); BOOST_CHECK_EQUAL (player->dcp_to_content_video (piece, DCPTime::from_seconds (9.75)), 207); /* Position 0, no trim, content rate 24, DCP rate 48 @@ -252,7 +285,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) */ content->set_position (DCPTime ()); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (48); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); @@ -264,7 +297,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) /* Position 3s, no trim, content rate 24, DCP rate 48 */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (48); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); @@ -278,7 +311,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) /* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime::from_seconds (1.5)); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (48); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); @@ -296,7 +329,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) */ content->set_position (DCPTime ()); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (48); + content->set_video_frame_rate (48); film->set_video_frame_rate (24); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); @@ -308,7 +341,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) /* Position 3s, no trim, content rate 24, DCP rate 48 */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (48); + content->set_video_frame_rate (48); film->set_video_frame_rate (24); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); @@ -322,7 +355,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) /* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime::from_seconds (1.5)); - content->video->set_frame_rate (48); + content->set_video_frame_rate (48); film->set_video_frame_rate (24); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); @@ -336,7 +369,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test1) /* Position 0s, no trim, content rate 29.9978733, DCP rate 30 */ content->set_position (DCPTime::from_seconds (0)); content->set_trim_start (ContentTime::from_seconds (0)); - content->video->set_frame_rate (29.9978733); + content->set_video_frame_rate (29.9978733); film->set_video_frame_rate (30); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); @@ -367,39 +400,39 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) /* Position 0, no trim, content rate = DCP rate */ content->set_position (DCPTime ()); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); shared_ptr piece = player->_pieces.front (); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime ()); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 12), DCPTime::from_seconds (0.5)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 72), DCPTime::from_seconds (3.0)); + 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()); /* Position 3s, no trim, content rate = DCP rate */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); piece = player->_pieces.front (); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime::from_seconds (3.00)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 36), DCPTime::from_seconds (4.50)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 162), DCPTime::from_seconds (9.75)); + 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()); /* Position 3s, 1.5s trim, content rate = DCP rate */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime::from_seconds (1.5)); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); piece = player->_pieces.front (); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime::from_seconds (1.50)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 36), DCPTime::from_seconds (3.00)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 72), DCPTime::from_seconds (4.50)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 198), DCPTime::from_seconds (9.75)); + 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()); /* 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 @@ -407,39 +440,39 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) */ content->set_position (DCPTime ()); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (25); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); piece = player->_pieces.front (); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime ()); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 15), DCPTime::from_seconds (0.6)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 75), DCPTime::from_seconds (3.0)); + 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()); /* Position 3s, no trim, content rate 24, DCP rate 25 */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (25); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); piece = player->_pieces.front (); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime::from_seconds (3.00)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 40), DCPTime::from_seconds (4.60)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 169), DCPTime::from_seconds (9.76)); + 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()); /* Position 3s, 1.6s trim, content rate 24, DCP rate 25, so the 1.6s trim is at 24fps */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime::from_seconds (1.6)); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (25); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); piece = player->_pieces.front (); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime::from_seconds (1.464)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 40), DCPTime::from_seconds (3.064)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 80), DCPTime::from_seconds (4.664)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 209), DCPTime::from_seconds (9.824)); + BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 0).get(), 138240); + BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 40).get(), 291840); + BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 80).get(), 445440); + BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 209).get(), 940800); /* 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 @@ -449,39 +482,39 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) */ content->set_position (DCPTime ()); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (48); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); piece = player->_pieces.front (); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime ()); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 12), DCPTime::from_seconds (0.5)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 72), DCPTime::from_seconds (3.0)); + 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()); /* Position 3s, no trim, content rate 24, DCP rate 48 */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (48); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); piece = player->_pieces.front (); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime::from_seconds (3.00)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 36), DCPTime::from_seconds (4.50)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 162), DCPTime::from_seconds (9.75)); + 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()); /* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime::from_seconds (1.5)); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (48); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); piece = player->_pieces.front (); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime::from_seconds (1.50)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 36), DCPTime::from_seconds (3.00)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 72), DCPTime::from_seconds (4.50)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 198), DCPTime::from_seconds (9.75)); + 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()); /* 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 @@ -490,39 +523,39 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2) */ content->set_position (DCPTime ()); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (48); + content->set_video_frame_rate (48); film->set_video_frame_rate (24); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); piece = player->_pieces.front (); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime ()); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 24), DCPTime::from_seconds (0.5)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 144), DCPTime::from_seconds (3.0)); + 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()); /* Position 3s, no trim, content rate 24, DCP rate 48 */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (48); + content->set_video_frame_rate (48); film->set_video_frame_rate (24); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); piece = player->_pieces.front (); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime::from_seconds (3.00)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 72), DCPTime::from_seconds (4.50)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 324), DCPTime::from_seconds (9.75)); + 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()); /* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime::from_seconds (1.5)); - content->video->set_frame_rate (48); + content->set_video_frame_rate (48); film->set_video_frame_rate (24); player->setup_pieces (); BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1); piece = player->_pieces.front (); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime::from_seconds (1.50)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 72), DCPTime::from_seconds (3.00)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 144), DCPTime::from_seconds (4.50)); - BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 396), DCPTime::from_seconds (9.75)); + 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()); } /** Test Player::dcp_to_content_audio */ @@ -544,7 +577,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) /* Position 0, no trim, video/audio content rate = video/audio DCP rate */ content->set_position (DCPTime ()); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); stream->_frame_rate = 48000; player->setup_pieces (); @@ -557,7 +590,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) /* Position 3s, no trim, video/audio content rate = video/audio DCP rate */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); stream->_frame_rate = 48000; player->setup_pieces (); @@ -572,7 +605,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) /* Position 3s, 1.5s trim, video/audio content rate = video/audio DCP rate */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime::from_seconds (1.5)); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); stream->_frame_rate = 48000; player->setup_pieces (); @@ -587,7 +620,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) /* Position 0, no trim, content video rate 24, DCP video rate 25, both audio rates still 48k */ content->set_position (DCPTime ()); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (25); stream->_frame_rate = 48000; player->setup_pieces (); @@ -600,7 +633,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) /* Position 3s, no trim, content video rate 24, DCP rate 25, both audio rates still 48k. */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (25); stream->_frame_rate = 48000; player->setup_pieces (); @@ -617,7 +650,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime::from_seconds (1.6)); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (25); stream->_frame_rate = 48000; player->setup_pieces (); @@ -625,9 +658,9 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) piece = player->_pieces.front (); BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime ()), 0); BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (0.60)), 0); - BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (3.00)), 73728); - BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (4.60)), 150528); - BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (9.75)), 397728); + BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (3.00)), 74880); + BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (4.60)), 151680); + BOOST_CHECK_EQUAL (player->dcp_to_resampled_audio (piece, DCPTime::from_seconds (9.75)), 398880); /* Position 0, no trim, content rate 24, DCP rate 48, both audio rates still 48k. Now, for example, a DCPTime position of 3s means 3s at 48fps. Since we run the video @@ -636,7 +669,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) */ content->set_position (DCPTime ()); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (48); stream->_frame_rate = 48000; player->setup_pieces (); @@ -649,7 +682,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) /* Position 3s, no trim, content rate 24, DCP rate 48 */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); stream->_frame_rate = 48000; player->setup_pieces (); @@ -664,7 +697,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) /* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime::from_seconds (1.5)); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); stream->_frame_rate = 48000; player->setup_pieces (); @@ -682,7 +715,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) */ content->set_position (DCPTime ()); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (48); stream->_frame_rate = 48000; player->setup_pieces (); @@ -695,7 +728,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) /* Position 3s, no trim, content rate 24, DCP rate 48 */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); stream->_frame_rate = 48000; player->setup_pieces (); @@ -710,7 +743,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) /* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime::from_seconds (1.5)); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); stream->_frame_rate = 48000; player->setup_pieces (); @@ -725,7 +758,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) /* Position 0, no trim, video content rate = video DCP rate, content audio rate = 44.1k */ content->set_position (DCPTime ()); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); stream->_frame_rate = 44100; player->setup_pieces (); @@ -738,7 +771,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) /* Position 3s, no trim, video content rate = video DCP rate, content audio rate = 44.1k */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime ()); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); stream->_frame_rate = 44100; player->setup_pieces (); @@ -753,7 +786,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) /* Position 3s, 1.5s trim, video content rate = video DCP rate, content audio rate = 44.1k */ content->set_position (DCPTime::from_seconds (3)); content->set_trim_start (ContentTime::from_seconds (1.5)); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); stream->_frame_rate = 44100; player->setup_pieces (); @@ -768,7 +801,7 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test3) /* Check with a large start trim */ content->set_position (DCPTime::from_seconds (0)); content->set_trim_start (ContentTime::from_seconds (54143)); - content->video->set_frame_rate (24); + content->set_video_frame_rate (24); film->set_video_frame_rate (24); stream->_frame_rate = 48000; player->setup_pieces ();