/* Copyright (C) 2015 Carl Hetherington This program 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, 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. */ #include "lib/film.h" #include "lib/ffmpeg_content.h" #include "test.h" #include using std::string; using std::list; using boost::shared_ptr; BOOST_AUTO_TEST_CASE (ffmpeg_time_calculation_test) { shared_ptr film = new_test_film ("ffmpeg_time_calculation_test"); string const xml = "" "FFmpeg" "/home/c.hetherington/DCP/clapperboard.mp4" "2760e03c7251480f7f02c01a907792673784335" "0" "0" "0" "1353600" "1280" "720" "25" "0" "0" "0" "0" "0" "" "178" "" "" "" "ModifiedGamma" "2.222222222222222" "0.081" "0.099" "4.5" "" "0.64" "0.33" "0.3" "0.6" "0.15" "0.06" "0.3127" "0.329" "2.6" "" "0" "0" "0" "0" "0" "0" "0" "1" "1" "" "" "1" "und; 2 channels" "2" "44100" "2" "0" "" "2" "12" "1" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "1" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "" "" "0" ""; shared_ptr doc (new cxml::Document); doc->read_string (xml); list notes; shared_ptr content (new FFmpegContent (film, doc, film->state_version(), notes)); /* 25fps content, 25fps DCP */ film->set_video_frame_rate (25); BOOST_CHECK_EQUAL (content->full_length(), 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(), 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(), 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(), 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(), DCPTime::from_seconds (content->video_length() * (50.0 / 60) / 25.0)); } /* XXX much more stuff to test */