diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-06-12 22:27:11 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-06-12 22:27:11 +0100 |
| commit | 4e411ea97b4dab8a5fa282d1d4cf7971ef1e24ad (patch) | |
| tree | 06db8731e77dfeaf537f2814d73c7a599035b95c /test | |
| parent | 8102046b2f29e0c7b234c29bf204b056cb30e64f (diff) | |
| parent | 66162217d93baa3fd50594bb013a44bbd779d02a (diff) | |
Merge master.
Diffstat (limited to 'test')
| -rw-r--r-- | test/4k_test.cc | 2 | ||||
| -rw-r--r-- | test/audio_delay_test.cc | 2 | ||||
| -rw-r--r-- | test/black_fill_test.cc | 2 | ||||
| -rw-r--r-- | test/client_server_test.cc | 83 | ||||
| -rw-r--r-- | test/colour_conversion_test.cc | 4 | ||||
| -rw-r--r-- | test/film_metadata_test.cc | 2 | ||||
| -rw-r--r-- | test/frame_rate_test.cc | 1 | ||||
| -rw-r--r-- | test/isdcf_name_test.cc | 105 | ||||
| -rw-r--r-- | test/play_test.cc | 4 | ||||
| -rw-r--r-- | test/recover_test.cc | 2 | ||||
| -rw-r--r-- | test/scaling_test.cc | 2 | ||||
| -rw-r--r-- | test/silence_padding_test.cc | 2 | ||||
| -rw-r--r-- | test/test.cc | 2 | ||||
| -rw-r--r-- | test/wscript | 1 |
14 files changed, 200 insertions, 14 deletions
diff --git a/test/4k_test.cc b/test/4k_test.cc index 1e0b42697..fa5b33bb9 100644 --- a/test/4k_test.cc +++ b/test/4k_test.cc @@ -39,7 +39,7 @@ BOOST_AUTO_TEST_CASE (fourk_test) shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/test.mp4")); c->set_scale (VideoContentScale (Ratio::from_id ("185"))); film->set_resolution (RESOLUTION_4K); - film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR")); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_container (Ratio::from_id ("185")); film->examine_and_add_content (c); wait_for_jobs (); diff --git a/test/audio_delay_test.cc b/test/audio_delay_test.cc index 87e6071a0..68e14ff3c 100644 --- a/test/audio_delay_test.cc +++ b/test/audio_delay_test.cc @@ -45,7 +45,7 @@ void test_audio_delay (int delay_in_ms) { string const film_name = "audio_delay_test_" + lexical_cast<string> (delay_in_ms); shared_ptr<Film> film = new_test_film (film_name); - film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR")); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_container (Ratio::from_id ("185")); film->set_name (film_name); diff --git a/test/black_fill_test.cc b/test/black_fill_test.cc index 7741277a5..148ec9738 100644 --- a/test/black_fill_test.cc +++ b/test/black_fill_test.cc @@ -33,7 +33,7 @@ using boost::shared_ptr; BOOST_AUTO_TEST_CASE (black_fill_test) { shared_ptr<Film> film = new_test_film ("black_fill_test"); - film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR")); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_name ("black_fill_test"); film->set_container (Ratio::from_id ("185")); film->set_sequence_video (false); diff --git a/test/client_server_test.cc b/test/client_server_test.cc index c0eddd8f6..1816de8e6 100644 --- a/test/client_server_test.cc +++ b/test/client_server_test.cc @@ -50,7 +50,7 @@ do_remote_encode (shared_ptr<DCPVideoFrame> frame, ServerDescription description BOOST_CHECK_EQUAL (memcmp (locally_encoded->data(), remotely_encoded->data(), locally_encoded->size()), 0); } -BOOST_AUTO_TEST_CASE (client_server_test) +BOOST_AUTO_TEST_CASE (client_server_test_rgb) { shared_ptr<Image> image (new Image (PIX_FMT_RGB24, dcp::Size (1998, 1080), true)); uint8_t* p = image->data()[0]; @@ -78,7 +78,86 @@ BOOST_AUTO_TEST_CASE (client_server_test) p += sub_image->stride()[0]; } - shared_ptr<FileLog> log (new FileLog ("build/test/client_server_test.log")); + shared_ptr<FileLog> log (new FileLog ("build/test/client_server_test_rgb.log")); + + shared_ptr<PlayerVideoFrame> pvf ( + new PlayerVideoFrame ( + shared_ptr<ImageProxy> (new RawImageProxy (image, log)), + Crop (), + dcp::Size (1998, 1080), + dcp::Size (1998, 1080), + Scaler::from_id ("bicubic"), + EYES_BOTH, + PART_WHOLE, + ColourConversion () + ) + ); + + pvf->set_subtitle (PositionImage (sub_image, Position<int> (50, 60))); + + shared_ptr<DCPVideoFrame> frame ( + new DCPVideoFrame ( + pvf, + 0, + 24, + 200000000, + RESOLUTION_2K, + log + ) + ); + + shared_ptr<EncodedData> locally_encoded = frame->encode_locally (); + BOOST_ASSERT (locally_encoded); + + Server* server = new Server (log, true); + + new thread (boost::bind (&Server::run, server, 2)); + + /* Let the server get itself ready */ + dcpomatic_sleep (1); + + ServerDescription description ("localhost", 2); + + list<thread*> threads; + for (int i = 0; i < 8; ++i) { + threads.push_back (new thread (boost::bind (do_remote_encode, frame, description, locally_encoded))); + } + + for (list<thread*>::iterator i = threads.begin(); i != threads.end(); ++i) { + (*i)->join (); + } + + for (list<thread*>::iterator i = threads.begin(); i != threads.end(); ++i) { + delete *i; + } +} + +BOOST_AUTO_TEST_CASE (client_server_test_yuv) +{ + shared_ptr<Image> image (new Image (PIX_FMT_YUV420P, dcp::Size (1998, 1080), true)); + uint8_t* p = image->data()[0]; + + for (int i = 0; i < image->components(); ++i) { + uint8_t* p = image->data()[i]; + for (int j = 0; j < image->line_size()[i]; ++j) { + *p++ = j % 256; + } + } + + shared_ptr<Image> sub_image (new Image (PIX_FMT_RGBA, dcp::Size (100, 200), true)); + p = sub_image->data()[0]; + for (int y = 0; y < 200; ++y) { + uint8_t* q = p; + for (int x = 0; x < 100; ++x) { + *q++ = y % 256; + *q++ = x % 256; + *q++ = (x + y) % 256; + *q++ = 1; + } + p += sub_image->stride()[0]; + } + + shared_ptr<FileLog> log (new FileLog ("build/test/client_server_test_yuv.log")); shared_ptr<PlayerVideoFrame> pvf ( new PlayerVideoFrame ( diff --git a/test/colour_conversion_test.cc b/test/colour_conversion_test.cc index 6dba4b71c..7de169dd3 100644 --- a/test/colour_conversion_test.cc +++ b/test/colour_conversion_test.cc @@ -32,6 +32,6 @@ BOOST_AUTO_TEST_CASE (colour_conversion_test) ColourConversion A (2.4, true, dcp::colour_matrix::srgb_to_xyz, 2.6); ColourConversion B (2.4, false, dcp::colour_matrix::srgb_to_xyz, 2.6); - BOOST_CHECK_EQUAL (A.identifier(), "246ff9b7dc32c0488948a32a713924b3"); - BOOST_CHECK_EQUAL (B.identifier(), "a8d1da30f96a121d8db06a03409758b3"); + BOOST_CHECK_EQUAL (A.identifier(), "1e720d2d99add654d7816f3b72da815e"); + BOOST_CHECK_EQUAL (B.identifier(), "18751a247b22682b725bf9c4caf71522"); } diff --git a/test/film_metadata_test.cc b/test/film_metadata_test.cc index cc29f4472..70f29b998 100644 --- a/test/film_metadata_test.cc +++ b/test/film_metadata_test.cc @@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE (film_metadata_test) shared_ptr<Film> f = new_test_film ("film_metadata_test"); boost::filesystem::path dir = test_film_dir ("film_metadata_test"); - f->_dci_date = boost::gregorian::from_undelimited_string ("20130211"); + f->_isdcf_date = boost::gregorian::from_undelimited_string ("20130211"); BOOST_CHECK (f->container() == 0); BOOST_CHECK (f->dcp_content_type() == 0); diff --git a/test/frame_rate_test.cc b/test/frame_rate_test.cc index e1d4e4370..e8ebcea3b 100644 --- a/test/frame_rate_test.cc +++ b/test/frame_rate_test.cc @@ -28,6 +28,7 @@ #include "lib/ffmpeg_content.h" #include "lib/playlist.h" #include "lib/ffmpeg_audio_stream.h" +#include "lib/frame_rate_change.h" #include "test.h" using boost::shared_ptr; diff --git a/test/isdcf_name_test.cc b/test/isdcf_name_test.cc new file mode 100644 index 000000000..dd1b64162 --- /dev/null +++ b/test/isdcf_name_test.cc @@ -0,0 +1,105 @@ +/* + Copyright (C) 2014 Carl Hetherington <cth@carlh.net> + + 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 <boost/test/unit_test.hpp> +#include "lib/film.h" +#include "lib/ratio.h" +#include "lib/dcp_content_type.h" +#include "lib/image_content.h" +#include "test.h" + +using std::cout; +using boost::shared_ptr; + +BOOST_AUTO_TEST_CASE (isdcf_name_test) +{ + shared_ptr<Film> film = new_test_film ("isdcf_name_test"); + + /* A basic test */ + + film->set_name ("My Nice Film"); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); + film->set_container (Ratio::from_id ("185")); + film->_isdcf_date = boost::gregorian::date (2014, boost::gregorian::Jul, 4); + ISDCFMetadata m; + m.content_version = 1; + m.audio_language = "EN"; + m.subtitle_language = "XX"; + m.territory = "UK"; + m.rating = "PG"; + m.studio = "ST"; + m.facility = "FA"; + m.package_type = "OV"; + film->set_isdcf_metadata (m); + film->set_interop (true); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilm_FTR-1_F_EN-XX_UK-PG_51_2K_ST_20140704_FA_IOP_OV"); + + /* Test a long name and some different data */ + + film->set_name ("My Nice Film With A Very Long Name"); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR")); + film->set_container (Ratio::from_id ("239")); + film->_isdcf_date = boost::gregorian::date (2014, boost::gregorian::Jul, 4); + film->set_audio_channels (1); + film->set_resolution (RESOLUTION_4K); + m.content_version = 2; + m.audio_language = "DE"; + m.subtitle_language = "FR"; + m.territory = "US"; + m.rating = "R"; + m.studio = "DI"; + m.facility = "PP"; + m.package_type = "VF"; + film->set_isdcf_metadata (m); + film->set_interop (false); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_S_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF"); + + /* Test interior aspect ratio: shouldn't be shown with trailers */ + + shared_ptr<ImageContent> content (new ImageContent (film, "test/data/simple_testcard_640x480.png")); + film->examine_and_add_content (content); + wait_for_jobs (); + content->set_scale (VideoContentScale (Ratio::from_id ("133"))); + film->set_container (Ratio::from_id ("185")); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_F_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF"); + + /* But should be shown for anything else */ + + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("XSN")); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-2_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF"); + + /* Test 3D */ + + film->set_three_d (true); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-2-3D_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE-3D_VF"); + + /* Test content type modifiers */ + + film->set_three_d (false); + m.temp_version = true; + m.pre_release = true; + m.red_band = true; + m.chain = "MyChain"; + m.two_d_version_of_three_d = true; + m.mastered_luminance = "4fl"; + film->set_isdcf_metadata (m); + film->set_video_frame_rate (48); + BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_XSN-2-Temp-Pre-RedBand-MyChain-2D-4fl-48_F-133_DE-FR_US-R_10_4K_DI_20140704_PP_SMPTE_VF"); +} + diff --git a/test/play_test.cc b/test/play_test.cc index 1ba2e7d88..067f772ff 100644 --- a/test/play_test.cc +++ b/test/play_test.cc @@ -82,7 +82,7 @@ private: BOOST_AUTO_TEST_CASE (play_test) { shared_ptr<Film> film = new_test_film ("play_test"); - film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR")); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_container (Ratio::from_id ("185")); film->set_name ("play_test"); @@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE (play_test) } } - player->seek (10 * TIME_HZ / 25, true); + wrap.seek (10 * TIME_HZ / 25, true); optional<Video> v = wrap.get_video (); BOOST_CHECK (v); BOOST_CHECK_EQUAL (v.get().time, 10 * TIME_HZ / 25); diff --git a/test/recover_test.cc b/test/recover_test.cc index 31b882a2e..ae1009ea7 100644 --- a/test/recover_test.cc +++ b/test/recover_test.cc @@ -44,7 +44,7 @@ note (dcp::NoteType t, string n) BOOST_AUTO_TEST_CASE (recover_test) { shared_ptr<Film> film = new_test_film ("recover_test"); - film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR")); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_container (Ratio::from_id ("185")); film->set_name ("recover_test"); film->set_three_d (true); diff --git a/test/scaling_test.cc b/test/scaling_test.cc index 704c2c7da..441af6bf3 100644 --- a/test/scaling_test.cc +++ b/test/scaling_test.cc @@ -56,7 +56,7 @@ static void scaling_test_for (shared_ptr<Film> film, shared_ptr<VideoContent> co BOOST_AUTO_TEST_CASE (scaling_test) { shared_ptr<Film> film = new_test_film ("scaling_test"); - film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR")); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_name ("scaling_test"); shared_ptr<ImageContent> imc (new ImageContent (film, "test/data/simple_testcard_640x480.png")); diff --git a/test/silence_padding_test.cc b/test/silence_padding_test.cc index 82b9def0e..d876a0228 100644 --- a/test/silence_padding_test.cc +++ b/test/silence_padding_test.cc @@ -43,7 +43,7 @@ test_silence_padding (int channels) { string const film_name = "silence_padding_test_" + lexical_cast<string> (channels); shared_ptr<Film> film = new_test_film (film_name); - film->set_dcp_content_type (DCPContentType::from_dci_name ("FTR")); + film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR")); film->set_container (Ratio::from_id ("185")); film->set_name (film_name); diff --git a/test/test.cc b/test/test.cc index f57023836..1d8041656 100644 --- a/test/test.cc +++ b/test/test.cc @@ -67,7 +67,7 @@ struct TestConfig Config::instance()->set_num_local_encoding_threads (1); Config::instance()->set_server_port_base (61920); - Config::instance()->set_default_dci_metadata (DCIMetadata ()); + Config::instance()->set_default_isdcf_metadata (ISDCFMetadata ()); Config::instance()->set_default_container (static_cast<Ratio*> (0)); Config::instance()->set_default_dcp_content_type (static_cast<DCPContentType*> (0)); Config::instance()->set_default_audio_delay (0); diff --git a/test/wscript b/test/wscript index c825506fb..380d40d84 100644 --- a/test/wscript +++ b/test/wscript @@ -34,6 +34,7 @@ def build(bld): film_metadata_test.cc frame_rate_test.cc image_test.cc + isdcf_name_test.cc job_test.cc make_black_test.cc player_test.cc |
