It builds again.
authorCarl Hetherington <cth@carlh.net>
Wed, 12 Feb 2014 23:26:07 +0000 (23:26 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 12 Feb 2014 23:26:07 +0000 (23:26 +0000)
14 files changed:
src/lib/writer.cc
test/audio_delay_test.cc
test/audio_mapping_test.cc
test/client_server_test.cc
test/colour_conversion_test.cc
test/ffmpeg_audio_test.cc
test/image_test.cc
test/make_black_test.cc
test/ratio_test.cc
test/recover_test.cc
test/silence_padding_test.cc
test/stream_test.cc
test/subrip_test.cc
test/test.cc

index 24adffec65a891b0abb1dc8a260aa3879ec4206c..a4c10195c5b156aba190b0ccb4d90560109f58a0 100644 (file)
 #include <libdcp/mono_picture_mxf.h>
 #include <libdcp/stereo_picture_mxf.h>
 #include <libdcp/sound_mxf.h>
+#include <libdcp/sound_mxf_writer.h>
 #include <libdcp/reel.h>
+#include <libdcp/reel_mono_picture_asset.h>
+#include <libdcp/reel_stereo_picture_asset.h>
+#include <libdcp/reel_sound_asset.h>
 #include <libdcp/dcp.h>
 #include <libdcp/cpl.h>
 #include "writer.h"
@@ -48,6 +52,7 @@ using std::cout;
 using std::stringstream;
 using boost::shared_ptr;
 using boost::weak_ptr;
+using boost::dynamic_pointer_cast;
 
 int const Writer::_maximum_frames_in_memory = Config::instance()->num_local_encoding_threads() + 4;
 
@@ -80,33 +85,33 @@ Writer::Writer (shared_ptr<const Film> f, weak_ptr<Job> j)
        */
 
        if (_film->three_d ()) {
-               _picture_mxf.reset (new dcp::StereoPictureMXF (_film->internal_video_mxf_dir (), _film->internal_video_mxf_filename ()));
+               _picture_mxf.reset (new dcp::StereoPictureMXF (dcp::Fraction (_film->video_frame_rate (), 1)));
        } else {
-               _picture_mxf.reset (new dcp::MonoPictureMXF (_film->internal_video_mxf_dir (), _film->internal_video_mxf_filename ()));
+               _picture_mxf.reset (new dcp::MonoPictureMXF (dcp::Fraction (_film->video_frame_rate (), 1)));
        }
 
-       _picture_mxf->set_edit_rate (_film->video_frame_rate ());
        _picture_mxf->set_size (fit_ratio_within (_film->container()->ratio(), _film->full_frame ()));
 
        if (_film->encrypted ()) {
-               _picture_asset->set_key (_film->key ());
+               _picture_mxf->set_key (_film->key ());
        }
        
-       _picture_mxf_writer = _picture_asset->start_write (_first_nonexistant_frame > 0, _film->interop() ? dcp::INTEROP : dcp::SMPTE);
+       _picture_mxf_writer = _picture_mxf->start_write (
+               _film->internal_video_mxf_dir() / _film->internal_video_mxf_filename(),
+               _film->interop() ? dcp::INTEROP : dcp::SMPTE,
+               _first_nonexistant_frame > 0
+               );
 
-       _sound_mxf.reset (new dcp::SoundMXF (_film->directory (), _film->audio_mxf_filename ()));
-       _sound_mxf->set_edit_rate (_film->video_frame_rate ());
-       _sound_mxf->set_channels (_film->audio_channels ());
-       _sound_mxf->set_sampling_rate (_film->audio_frame_rate ());
+       _sound_mxf.reset (new dcp::SoundMXF (dcp::Fraction (_film->video_frame_rate(), 1), _film->audio_frame_rate (), _film->audio_channels ()));
 
        if (_film->encrypted ()) {
-               _sound_asset->set_key (_film->key ());
+               _sound_mxf->set_key (_film->key ());
        }
        
-       /* Write the sound asset into the film directory so that we leave the creation
+       /* Write the sound MXF into the film directory so that we leave the creation
           of the DCP directory until the last minute.
        */
-       _sound_asset_writer = _sound_asset->start_write ();
+       _sound_mxf_writer = _sound_mxf->start_write (_film->directory() / _film->audio_mxf_filename(), _film->interop() ? dcp::INTEROP : dcp::SMPTE);
 
        _thread = new boost::thread (boost::bind (&Writer::thread, this));
 
@@ -183,7 +188,7 @@ Writer::fake_write (int frame, Eyes eyes)
 void
 Writer::write (shared_ptr<const AudioBuffers> audio)
 {
-       _sound_asset_writer->write (audio->data(), audio->frames());
+       _sound_mxf_writer->write (audio->data(), audio->frames());
 }
 
 /** This must be called from Writer::thread() with an appropriate lock held */
@@ -256,7 +261,7 @@ try
                                        qi.encoded.reset (new EncodedData (_film->j2c_path (qi.frame, qi.eyes, false)));
                                }
 
-                               dcp::FrameInfo fin = _picture_asset_writer->write (qi.encoded->data(), qi.encoded->size());
+                               dcp::FrameInfo fin = _picture_mxf_writer->write (qi.encoded->data(), qi.encoded->size());
                                qi.encoded->write_info (_film, qi.frame, qi.eyes, fin);
                                _last_written[qi.eyes] = qi.encoded;
                                ++_full_written;
@@ -264,14 +269,14 @@ try
                        }
                        case QueueItem::FAKE:
                                _film->log()->log (String::compose (N_("Writer FAKE-writes %1 to MXF"), qi.frame));
-                               _picture_asset_writer->fake_write (qi.size);
+                               _picture_mxf_writer->fake_write (qi.size);
                                _last_written[qi.eyes].reset ();
                                ++_fake_written;
                                break;
                        case QueueItem::REPEAT:
                        {
                                _film->log()->log (String::compose (N_("Writer REPEAT-writes %1 to MXF"), qi.frame));
-                               dcp::FrameInfo fin = _picture_asset_writer->write (
+                               dcp::FrameInfo fin = _picture_mxf_writer->write (
                                        _last_written[qi.eyes]->data(),
                                        _last_written[qi.eyes]->size()
                                        );
@@ -371,13 +376,9 @@ Writer::finish ()
        
        terminate_thread (true);
 
-       _picture_asset_writer->finalize ();
-       _sound_asset_writer->finalize ();
+       _picture_mxf_writer->finalize ();
+       _sound_mxf_writer->finalize ();
        
-       int const frames = _last_written_frame + 1;
-
-       _picture_asset->set_duration (frames);
-
        /* Hard-link the video MXF into the DCP */
        boost::filesystem::path video_from;
        video_from /= _film->internal_video_mxf_dir();
@@ -395,11 +396,6 @@ Writer::finish ()
                _film->log()->log ("Hard-link failed; fell back to copying");
        }
 
-       /* And update the asset */
-
-       _picture_asset->set_directory (_film->dir (_film->dcp_name ()));
-       _picture_asset->set_file_name (_film->video_mxf_filename ());
-
        /* Move the audio MXF into the DCP */
 
        boost::filesystem::path audio_to;
@@ -413,42 +409,45 @@ Writer::finish ()
                        );
        }
 
-       _sound_asset->set_directory (_film->dir (_film->dcp_name ()));
-       _sound_asset->set_duration (frames);
-       
        dcp::DCP dcp (_film->dir (_film->dcp_name()));
 
        shared_ptr<dcp::CPL> cpl (
                new dcp::CPL (
-                       _film->dir (_film->dcp_name()),
                        _film->dcp_name(),
-                       _film->dcp_content_type()->libdcp_kind (),
-                       frames,
-                       _film->video_frame_rate ()
+                       _film->dcp_content_type()->libdcp_kind ()
                        )
                );
        
-       dcp.add_cpl (cpl);
+       dcp.add (cpl);
 
-       cpl->add_reel (shared_ptr<dcp::Reel> (new dcp::Reel (
-                                                        _picture_asset,
-                                                        _sound_asset,
-                                                        shared_ptr<dcp::SubtitleAsset> ()
-                                                        )
-                              ));
+       shared_ptr<dcp::Reel> reel (new dcp::Reel ());
+
+       shared_ptr<dcp::MonoPictureMXF> mono = dynamic_pointer_cast<dcp::MonoPictureMXF> (_picture_mxf);
+       if (mono) {
+               reel->add (shared_ptr<dcp::ReelPictureAsset> (new dcp::ReelMonoPictureAsset (mono, 0)));
+       }
+
+       shared_ptr<dcp::StereoPictureMXF> stereo = dynamic_pointer_cast<dcp::StereoPictureMXF> (_picture_mxf);
+       if (stereo) {
+               reel->add (shared_ptr<dcp::ReelPictureAsset> (new dcp::ReelStereoPictureAsset (stereo, 0)));
+       }
+
+       reel->add (shared_ptr<dcp::ReelSoundAsset> (new dcp::ReelSoundAsset (_sound_mxf, 0)));
+       
+       cpl->add (reel);
 
        shared_ptr<Job> job = _job.lock ();
        assert (job);
 
        job->sub (_("Computing image digest"));
-       _picture_asset->compute_digest (boost::bind (&Job::set_progress, job.get(), _1, false));
+       _picture_mxf->hash (boost::bind (&Job::set_progress, job.get(), _1, false));
 
        job->sub (_("Computing audio digest"));
-       _sound_asset->compute_digest (boost::bind (&Job::set_progress, job.get(), _1, false));
+       _sound_mxf->hash (boost::bind (&Job::set_progress, job.get(), _1, false));
 
        dcp::XMLMetadata meta = Config::instance()->dcp_metadata ();
        meta.set_issue_date_now ();
-       dcp.write_xml (_film->interop (), meta, _film->is_signed() ? make_signer () : shared_ptr<const dcp::Signer> ());
+       dcp.write_xml (_film->interop () ? dcp::INTEROP : dcp::SMPTE, meta, _film->is_signed() ? make_signer () : shared_ptr<const dcp::Signer> ());
 
        _film->log()->log (
                String::compose (N_("Wrote %1 FULL, %2 FAKE, %3 REPEAT; %4 pushed to disk"), _full_written, _fake_written, _repeat_written, _pushed_to_disk)
index 77243ea6d0e46d04b56dbeb34c33b5120977efc5..e8112613c8b2f563bd209b91681af2b07741e9c1 100644 (file)
@@ -21,7 +21,8 @@
 #include <libdcp/sound_frame.h>
 #include <libdcp/cpl.h>
 #include <libdcp/reel.h>
-#include <libdcp/sound_asset.h>
+#include <libdcp/sound_mxf.h>
+#include <libdcp/reel_sound_asset.h>
 #include "lib/sndfile_content.h"
 #include "lib/dcp_content_type.h"
 #include "lib/ratio.h"
@@ -53,10 +54,10 @@ void test_audio_delay (int delay_in_ms)
        boost::filesystem::path path = "build/test";
        path /= film_name;
        path /= film->dcp_name ();
-       libdcp::DCP check (path.string ());
+       dcp::DCP check (path.string ());
        check.read ();
 
-       shared_ptr<const libdcp::SoundAsset> sound_asset = check.cpls().front()->reels().front()->main_sound ();
+       shared_ptr<const dcp::ReelSoundAsset> sound_asset = check.cpls().front()->reels().front()->main_sound ();
        BOOST_CHECK (sound_asset);
 
        /* Sample index in the DCP */
@@ -66,11 +67,11 @@ void test_audio_delay (int delay_in_ms)
        /* Delay in frames */
        int const delay_in_frames = delay_in_ms * 48000 / 1000;
 
-       while (n < sound_asset->intrinsic_duration()) {
-               shared_ptr<const libdcp::SoundFrame> sound_frame = sound_asset->get_frame (frame++);
+       while (n < sound_asset->mxf()->intrinsic_duration()) {
+               shared_ptr<const dcp::SoundFrame> sound_frame = sound_asset->mxf()->get_frame (frame++);
                uint8_t const * d = sound_frame->data ();
                
-               for (int i = 0; i < sound_frame->size(); i += (3 * sound_asset->channels())) {
+               for (int i = 0; i < sound_frame->size(); i += (3 * sound_asset->mxf()->channels())) {
 
                        /* Mono input so it will appear on centre */
                        int const sample = d[i + 7] | (d[i + 8] << 8);
index a2a74104b513820e367b43d67d2609beb099c324..1fc20dcaf6e0433dcfcaebdcf3afc4a0ddcc955c 100644 (file)
@@ -35,10 +35,10 @@ BOOST_AUTO_TEST_CASE (audio_mapping_test)
 
        for (int i = 0; i < 4; ++i) {
                for (int j = 0; j < MAX_AUDIO_CHANNELS; ++j) {
-                       BOOST_CHECK_EQUAL (four.get (i, static_cast<libdcp::Channel> (j)), i == j ? 1 : 0);
+                       BOOST_CHECK_EQUAL (four.get (i, static_cast<dcp::Channel> (j)), i == j ? 1 : 0);
                }
        }
 
-       four.set (0, libdcp::RIGHT, 1);
-       BOOST_CHECK_EQUAL (four.get (0, libdcp::RIGHT), 1);
+       four.set (0, dcp::RIGHT, 1);
+       BOOST_CHECK_EQUAL (four.get (0, dcp::RIGHT), 1);
 }
index 1ad156ae38f98495ce3a23e58e71ce3da6c18369..a80297ec690b132c041aa9d643f882c6457ff168 100644 (file)
@@ -41,7 +41,7 @@ do_remote_encode (shared_ptr<DCPVideoFrame> frame, ServerDescription description
 
 BOOST_AUTO_TEST_CASE (client_server_test)
 {
-       shared_ptr<Image> image (new Image (PIX_FMT_RGB24, libdcp::Size (1998, 1080), true));
+       shared_ptr<Image> image (new Image (PIX_FMT_RGB24, dcp::Size (1998, 1080), true));
        uint8_t* p = image->data()[0];
        
        for (int y = 0; y < 1080; ++y) {
@@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE (client_server_test)
                p += image->stride()[0];
        }
 
-       shared_ptr<Image> sub_image (new Image (PIX_FMT_RGBA, libdcp::Size (100, 200), true));
+       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;
index 3e90d542a8b74586ad5d1b5d8ecd2f1a089df1a2..96c4d08a4fc19528d7d763b427b0b86ee23df5df 100644 (file)
@@ -26,8 +26,8 @@ using std::cout;
 /* Basic test of identifier() for ColourConversion (i.e. a hash of the numbers) */
 BOOST_AUTO_TEST_CASE (colour_conversion_test)
 {
-       ColourConversion A (2.4, true, libdcp::colour_matrix::srgb_to_xyz, 2.6);
-       ColourConversion B (2.4, false, libdcp::colour_matrix::srgb_to_xyz, 2.6);
+       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");
index bba05ae9bef5a4db7ffbdb52f0d7860f153fd225..f4954f517daa9db38a38edc167fede450caf710c 100644 (file)
@@ -24,8 +24,9 @@
 #include <boost/test/unit_test.hpp>
 #include <libdcp/cpl.h>
 #include <libdcp/dcp.h>
-#include <libdcp/sound_asset.h>
+#include <libdcp/sound_mxf.h>
 #include <libdcp/sound_frame.h>
+#include <libdcp/reel_sound_asset.h>
 #include <libdcp/reel.h>
 #include "lib/sndfile_content.h"
 #include "lib/film.h"
@@ -59,56 +60,56 @@ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test)
        boost::filesystem::path path = "build/test";
        path /= "ffmpeg_audio_test";
        path /= film->dcp_name ();
-       libdcp::DCP check (path.string ());
+       dcp::DCP check (path.string ());
        check.read ();
 
-       shared_ptr<const libdcp::SoundAsset> sound_asset = check.cpls().front()->reels().front()->main_sound ();
+       shared_ptr<const dcp::ReelSoundAsset> sound_asset = check.cpls().front()->reels().front()->main_sound ();
        BOOST_CHECK (sound_asset);
-       BOOST_CHECK (sound_asset->channels () == 6);
+       BOOST_CHECK (sound_asset->mxf()->channels () == 6);
 
        /* Sample index in the DCP */
        int n = 0;
        /* DCP sound asset frame */
        int frame = 0;
 
-       while (n < sound_asset->intrinsic_duration()) {
-               shared_ptr<const libdcp::SoundFrame> sound_frame = sound_asset->get_frame (frame++);
+       while (n < sound_asset->mxf()->intrinsic_duration()) {
+               shared_ptr<const dcp::SoundFrame> sound_frame = sound_asset->mxf()->get_frame (frame++);
                uint8_t const * d = sound_frame->data ();
                
-               for (int i = 0; i < sound_frame->size(); i += (3 * sound_asset->channels())) {
+               for (int i = 0; i < sound_frame->size(); i += (3 * sound_asset->mxf()->channels())) {
 
-                       if (sound_asset->channels() > 0) {
+                       if (sound_asset->mxf()->channels() > 0) {
                                /* L should be silent */
                                int const sample = d[i + 0] | (d[i + 1] << 8);
                                BOOST_CHECK_EQUAL (sample, 0);
                        }
 
-                       if (sound_asset->channels() > 1) {
+                       if (sound_asset->mxf()->channels() > 1) {
                                /* R should be silent */
                                int const sample = d[i + 2] | (d[i + 3] << 8);
                                BOOST_CHECK_EQUAL (sample, 0);
                        }
                        
-                       if (sound_asset->channels() > 2) {
+                       if (sound_asset->mxf()->channels() > 2) {
                                /* Mono input so it will appear on centre */
                                int const sample = d[i + 7] | (d[i + 8] << 8);
                                BOOST_CHECK_EQUAL (sample, n);
                        }
 
-                       if (sound_asset->channels() > 3) {
+                       if (sound_asset->mxf()->channels() > 3) {
                                /* Lfe should be silent */
                                int const sample = d[i + 9] | (d[i + 10] << 8);
                                BOOST_CHECK_EQUAL (sample, 0);
                        }
 
-                       if (sound_asset->channels() > 4) {
+                       if (sound_asset->mxf()->channels() > 4) {
                                /* Ls should be silent */
                                int const sample = d[i + 11] | (d[i + 12] << 8);
                                BOOST_CHECK_EQUAL (sample, 0);
                        }
 
 
-                       if (sound_asset->channels() > 5) {
+                       if (sound_asset->mxf()->channels() > 5) {
                                /* Rs should be silent */
                                int const sample = d[i + 13] | (d[i + 14] << 8);
                                BOOST_CHECK_EQUAL (sample, 0);
index 51ad49ebf63479694cd2c4099686a3e630babe7d..622a9e4db28544e82c051eba6d4026bb72fb7e9e 100644 (file)
@@ -28,7 +28,7 @@ using boost::shared_ptr;
 
 BOOST_AUTO_TEST_CASE (aligned_image_test)
 {
-       Image* s = new Image (PIX_FMT_RGB24, libdcp::Size (50, 50), true);
+       Image* s = new Image (PIX_FMT_RGB24, dcp::Size (50, 50), true);
        BOOST_CHECK_EQUAL (s->components(), 1);
        /* 160 is 150 aligned to the nearest 32 bytes */
        BOOST_CHECK_EQUAL (s->stride()[0], 160);
@@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE (aligned_image_test)
        BOOST_CHECK (t->stride()[0] == s->stride()[0]);
 
        /* assignment operator */
-       Image* u = new Image (PIX_FMT_YUV422P, libdcp::Size (150, 150), false);
+       Image* u = new Image (PIX_FMT_YUV422P, dcp::Size (150, 150), false);
        *u = *s;
        BOOST_CHECK_EQUAL (u->components(), 1);
        BOOST_CHECK_EQUAL (u->stride()[0], 160);
@@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE (aligned_image_test)
 
 BOOST_AUTO_TEST_CASE (compact_image_test)
 {
-       Image* s = new Image (PIX_FMT_RGB24, libdcp::Size (50, 50), false);
+       Image* s = new Image (PIX_FMT_RGB24, dcp::Size (50, 50), false);
        BOOST_CHECK_EQUAL (s->components(), 1);
        BOOST_CHECK_EQUAL (s->stride()[0], 50 * 3);
        BOOST_CHECK_EQUAL (s->line_size()[0], 50 * 3);
@@ -104,7 +104,7 @@ BOOST_AUTO_TEST_CASE (compact_image_test)
        BOOST_CHECK (t->stride()[0] == s->stride()[0]);
 
        /* assignment operator */
-       Image* u = new Image (PIX_FMT_YUV422P, libdcp::Size (150, 150), true);
+       Image* u = new Image (PIX_FMT_YUV422P, dcp::Size (150, 150), true);
        *u = *s;
        BOOST_CHECK_EQUAL (u->components(), 1);
        BOOST_CHECK_EQUAL (u->stride()[0], 50 * 3);
@@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE (compact_image_test)
 BOOST_AUTO_TEST_CASE (crop_image_test)
 {
        /* This was to check out a bug with valgrind, and is probably not very useful */
-       shared_ptr<Image> image (new Image (PIX_FMT_YUV420P, libdcp::Size (16, 16), true));
+       shared_ptr<Image> image (new Image (PIX_FMT_YUV420P, dcp::Size (16, 16), true));
        image->make_black ();
        Crop crop;
        crop.top = 3;
@@ -141,7 +141,7 @@ BOOST_AUTO_TEST_CASE (crop_image_test)
 BOOST_AUTO_TEST_CASE (crop_image_test2)
 {
        /* Here's a 1998 x 1080 image which is black */
-       shared_ptr<Image> image (new Image (PIX_FMT_YUV420P, libdcp::Size (1998, 1080), true));
+       shared_ptr<Image> image (new Image (PIX_FMT_YUV420P, dcp::Size (1998, 1080), true));
        image->make_black ();
 
        /* Crop it by 1 pixel */
@@ -170,7 +170,7 @@ boost::shared_ptr<Image>
 read_file (string file)
 {
        Magick::Image magick_image (file.c_str ());
-       libdcp::Size size (magick_image.columns(), magick_image.rows());
+       dcp::Size size (magick_image.columns(), magick_image.rows());
 
        boost::shared_ptr<Image> image (new Image (PIX_FMT_RGB24, size, true));
 
@@ -214,7 +214,7 @@ write_file (shared_ptr<Image> image, string file)
 
 static
 void
-crop_scale_window_single (AVPixelFormat in_format, libdcp::Size in_size, Crop crop, libdcp::Size inter_size, libdcp::Size out_size)
+crop_scale_window_single (AVPixelFormat in_format, dcp::Size in_size, Crop crop, dcp::Size inter_size, dcp::Size out_size)
 {
        /* Set up our test image */
        shared_ptr<Image> test (new Image (in_format, in_size, true));
@@ -262,12 +262,12 @@ crop_scale_window_single (AVPixelFormat in_format, libdcp::Size in_size, Crop cr
 /** Test Image::crop_scale_window against separate calls to crop/scale/copy */
 BOOST_AUTO_TEST_CASE (crop_scale_window_test)
 {
-       crop_scale_window_single (AV_PIX_FMT_YUV422P, libdcp::Size (640, 480), Crop (), libdcp::Size (640, 480), libdcp::Size (640, 480));
-       crop_scale_window_single (AV_PIX_FMT_YUV422P, libdcp::Size (640, 480), Crop (2, 4, 6, 8), libdcp::Size (640, 480), libdcp::Size (640, 480));
-       crop_scale_window_single (AV_PIX_FMT_YUV422P, libdcp::Size (640, 480), Crop (2, 4, 6, 8), libdcp::Size (1920, 1080), libdcp::Size (1998, 1080));
-       crop_scale_window_single (AV_PIX_FMT_YUV422P, libdcp::Size (640, 480), Crop (1, 4, 6, 8), libdcp::Size (1920, 1080), libdcp::Size (1998, 1080));
-       crop_scale_window_single (AV_PIX_FMT_YUV420P, libdcp::Size (640, 480), Crop (16, 16, 0, 0), libdcp::Size (1920, 1080), libdcp::Size (1998, 1080));
-       crop_scale_window_single (AV_PIX_FMT_YUV420P, libdcp::Size (640, 480), Crop (16, 3, 3, 0), libdcp::Size (1920, 1080), libdcp::Size (1998, 1080));
-       crop_scale_window_single (AV_PIX_FMT_RGB24, libdcp::Size (1000, 800), Crop (0, 0, 0, 0), libdcp::Size (1920, 1080), libdcp::Size (1998, 1080));
-       crop_scale_window_single (AV_PIX_FMT_RGB24, libdcp::Size (1000, 800), Crop (55, 0, 1, 9), libdcp::Size (1920, 1080), libdcp::Size (1998, 1080));
+       crop_scale_window_single (AV_PIX_FMT_YUV422P, dcp::Size (640, 480), Crop (), dcp::Size (640, 480), dcp::Size (640, 480));
+       crop_scale_window_single (AV_PIX_FMT_YUV422P, dcp::Size (640, 480), Crop (2, 4, 6, 8), dcp::Size (640, 480), dcp::Size (640, 480));
+       crop_scale_window_single (AV_PIX_FMT_YUV422P, dcp::Size (640, 480), Crop (2, 4, 6, 8), dcp::Size (1920, 1080), dcp::Size (1998, 1080));
+       crop_scale_window_single (AV_PIX_FMT_YUV422P, dcp::Size (640, 480), Crop (1, 4, 6, 8), dcp::Size (1920, 1080), dcp::Size (1998, 1080));
+       crop_scale_window_single (AV_PIX_FMT_YUV420P, dcp::Size (640, 480), Crop (16, 16, 0, 0), dcp::Size (1920, 1080), dcp::Size (1998, 1080));
+       crop_scale_window_single (AV_PIX_FMT_YUV420P, dcp::Size (640, 480), Crop (16, 3, 3, 0), dcp::Size (1920, 1080), dcp::Size (1998, 1080));
+       crop_scale_window_single (AV_PIX_FMT_RGB24, dcp::Size (1000, 800), Crop (0, 0, 0, 0), dcp::Size (1920, 1080), dcp::Size (1998, 1080));
+       crop_scale_window_single (AV_PIX_FMT_RGB24, dcp::Size (1000, 800), Crop (55, 0, 1, 9), dcp::Size (1920, 1080), dcp::Size (1998, 1080));
 }
index 7c0f92142b0f2f9faf4e68c58d66fc89b79b7e38..8507f58916c3deb0131c260b88bc7b4919be4f05 100644 (file)
@@ -32,8 +32,8 @@ using std::list;
 */
 BOOST_AUTO_TEST_CASE (make_black_test)
 {
-       libdcp::Size in_size (512, 512);
-       libdcp::Size out_size (1024, 1024);
+       dcp::Size in_size (512, 512);
+       dcp::Size out_size (1024, 1024);
 
        list<AVPixelFormat> pix_fmts;
        pix_fmts.push_back (AV_PIX_FMT_RGB24);
index f3cbb504f0b874b9d5ef97b65d681b2e91ff33f3..946eac1640063ca8a0465ee083af9d840b29c0a3 100644 (file)
@@ -28,7 +28,7 @@ using std::ostream;
 namespace libdcp {
        
 ostream&
-operator<< (ostream& s, libdcp::Size const & t)
+operator<< (ostream& s, dcp::Size const & t)
 {
        s << t.width << "x" << t.height;
        return s;
@@ -42,38 +42,38 @@ BOOST_AUTO_TEST_CASE (ratio_test)
 
        Ratio const * r = Ratio::from_id ("119");
        BOOST_CHECK (r);
-       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), libdcp::Size (2048, 1080)), libdcp::Size (1290, 1080));
+       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), dcp::Size (2048, 1080)), dcp::Size (1290, 1080));
 
        r = Ratio::from_id ("133");
        BOOST_CHECK (r);
-       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), libdcp::Size (2048, 1080)), libdcp::Size (1440, 1080));
+       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), dcp::Size (2048, 1080)), dcp::Size (1440, 1080));
 
        r = Ratio::from_id ("137");
        BOOST_CHECK (r);
-       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), libdcp::Size (2048, 1080)), libdcp::Size (1480, 1080));
+       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), dcp::Size (2048, 1080)), dcp::Size (1480, 1080));
 
        r = Ratio::from_id ("138");
        BOOST_CHECK (r);
-       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), libdcp::Size (2048, 1080)), libdcp::Size (1485, 1080));
+       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), dcp::Size (2048, 1080)), dcp::Size (1485, 1080));
 
        r = Ratio::from_id ("166");
        BOOST_CHECK (r);
-       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), libdcp::Size (2048, 1080)), libdcp::Size (1800, 1080));
+       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), dcp::Size (2048, 1080)), dcp::Size (1800, 1080));
 
        r = Ratio::from_id ("178");
        BOOST_CHECK (r);
-       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), libdcp::Size (2048, 1080)), libdcp::Size (1920, 1080));
+       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), dcp::Size (2048, 1080)), dcp::Size (1920, 1080));
 
        r = Ratio::from_id ("185");
        BOOST_CHECK (r);
-       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), libdcp::Size (2048, 1080)), libdcp::Size (1998, 1080));
+       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), dcp::Size (2048, 1080)), dcp::Size (1998, 1080));
 
        r = Ratio::from_id ("239");
        BOOST_CHECK (r);
-       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), libdcp::Size (2048, 1080)), libdcp::Size (2048, 858));
+       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), dcp::Size (2048, 1080)), dcp::Size (2048, 858));
 
        r = Ratio::from_id ("full-frame");
        BOOST_CHECK (r);
-       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), libdcp::Size (2048, 1080)), libdcp::Size (2048, 1080));
+       BOOST_CHECK_EQUAL (fit_ratio_within (r->ratio(), dcp::Size (2048, 1080)), dcp::Size (2048, 1080));
 }
 
index d8caf17fa919c81a3657f5a459ba878671f95fc9..b36130395e5b5efd8eb60846f2e59ccc399a1c46 100644 (file)
@@ -18,7 +18,7 @@
 */
 
 #include <boost/test/unit_test.hpp>
-#include <libdcp/stereo_picture_asset.h>
+#include <libdcp/stereo_picture_mxf.h>
 #include "lib/film.h"
 #include "lib/dcp_content_type.h"
 #include "lib/image_content.h"
@@ -30,7 +30,7 @@ using std::string;
 using boost::shared_ptr;
 
 static void
-note (libdcp::NoteType, string n)
+note (dcp::NoteType, string n)
 {
        cout << n << "\n";
 }
@@ -62,10 +62,10 @@ BOOST_AUTO_TEST_CASE (recover_test)
        film->make_dcp ();
        wait_for_jobs ();
 
-       shared_ptr<libdcp::StereoPictureAsset> A (new libdcp::StereoPictureAsset ("build/test/recover_test", "original.mxf"));
-       shared_ptr<libdcp::StereoPictureAsset> B (new libdcp::StereoPictureAsset ("build/test/recover_test/video", "185_2K_58a090f8d70a2b410c534120d35e5256_24_bicubic_200000000_P_S_3D.mxf"));
+       shared_ptr<dcp::StereoPictureMXF> A (new dcp::StereoPictureMXF ("build/test/recover_test/original.mxf"));
+       shared_ptr<dcp::StereoPictureMXF> B (new dcp::StereoPictureMXF ("build/test/recover_test/video/185_2K_58a090f8d70a2b410c534120d35e5256_24_bicubic_200000000_P_S_3D.mxf"));
 
-       libdcp::EqualityOptions eq;
+       dcp::EqualityOptions eq;
        eq.mxf_names_can_differ = true;
        BOOST_CHECK (A->equals (B, eq, boost::bind (&note, _1, _2)));
 }
index 82cbad080d9b8eafebf06f0effea0d4efaa12dc9..0e0695c033b0b90af3f9d8ca92c12b5350c20883 100644 (file)
 #include <boost/test/unit_test.hpp>
 #include <libdcp/cpl.h>
 #include <libdcp/dcp.h>
-#include <libdcp/sound_asset.h>
+#include <libdcp/sound_mxf.h>
 #include <libdcp/sound_frame.h>
 #include <libdcp/reel.h>
+#include <libdcp/reel_sound_asset.h>
 #include "lib/sndfile_content.h"
 #include "lib/film.h"
 #include "lib/dcp_content_type.h"
@@ -52,56 +53,56 @@ static void test_silence_padding (int channels)
        boost::filesystem::path path = "build/test";
        path /= film_name;
        path /= film->dcp_name ();
-       libdcp::DCP check (path.string ());
+       dcp::DCP check (path.string ());
        check.read ();
 
-       shared_ptr<const libdcp::SoundAsset> sound_asset = check.cpls().front()->reels().front()->main_sound ();
+       shared_ptr<const dcp::ReelSoundAsset> sound_asset = check.cpls().front()->reels().front()->main_sound ();
        BOOST_CHECK (sound_asset);
-       BOOST_CHECK (sound_asset->channels () == channels);
+       BOOST_CHECK (sound_asset->mxf()->channels () == channels);
 
        /* Sample index in the DCP */
        int n = 0;
        /* DCP sound asset frame */
        int frame = 0;
 
-       while (n < sound_asset->intrinsic_duration()) {
-               shared_ptr<const libdcp::SoundFrame> sound_frame = sound_asset->get_frame (frame++);
+       while (n < sound_asset->mxf()->intrinsic_duration()) {
+               shared_ptr<const dcp::SoundFrame> sound_frame = sound_asset->mxf()->get_frame (frame++);
                uint8_t const * d = sound_frame->data ();
                
-               for (int i = 0; i < sound_frame->size(); i += (3 * sound_asset->channels())) {
+               for (int i = 0; i < sound_frame->size(); i += (3 * sound_asset->mxf()->channels())) {
 
-                       if (sound_asset->channels() > 0) {
+                       if (sound_asset->mxf()->channels() > 0) {
                                /* L should be silent */
                                int const sample = d[i + 0] | (d[i + 1] << 8);
                                BOOST_CHECK_EQUAL (sample, 0);
                        }
 
-                       if (sound_asset->channels() > 1) {
+                       if (sound_asset->mxf()->channels() > 1) {
                                /* R should be silent */
                                int const sample = d[i + 2] | (d[i + 3] << 8);
                                BOOST_CHECK_EQUAL (sample, 0);
                        }
                        
-                       if (sound_asset->channels() > 2) {
+                       if (sound_asset->mxf()->channels() > 2) {
                                /* Mono input so it will appear on centre */
                                int const sample = d[i + 7] | (d[i + 8] << 8);
                                BOOST_CHECK_EQUAL (sample, n);
                        }
 
-                       if (sound_asset->channels() > 3) {
+                       if (sound_asset->mxf()->channels() > 3) {
                                /* Lfe should be silent */
                                int const sample = d[i + 9] | (d[i + 10] << 8);
                                BOOST_CHECK_EQUAL (sample, 0);
                        }
 
-                       if (sound_asset->channels() > 4) {
+                       if (sound_asset->mxf()->channels() > 4) {
                                /* Ls should be silent */
                                int const sample = d[i + 11] | (d[i + 12] << 8);
                                BOOST_CHECK_EQUAL (sample, 0);
                        }
 
 
-                       if (sound_asset->channels() > 5) {
+                       if (sound_asset->mxf()->channels() > 5) {
                                /* Rs should be silent */
                                int const sample = d[i + 13] | (d[i + 14] << 8);
                                BOOST_CHECK_EQUAL (sample, 0);
index 6abcf6e22aedf95a0dec879a05746accf4a5d443..c8073c1c8032342a2c4b807c3ad774860b6ce48e 100644 (file)
@@ -73,11 +73,11 @@ BOOST_AUTO_TEST_CASE (stream_test)
        BOOST_CHECK_EQUAL (a.name, "hello there world");
        BOOST_CHECK_EQUAL (a.mapping.content_channels(), 2);
 
-       BOOST_CHECK_EQUAL (a.mapping.get (0, libdcp::LEFT), 1);
-       BOOST_CHECK_EQUAL (a.mapping.get (0, libdcp::RIGHT), 0);
-       BOOST_CHECK_EQUAL (a.mapping.get (0, libdcp::CENTRE), 1);
-       BOOST_CHECK_EQUAL (a.mapping.get (1, libdcp::LEFT), 0);
-       BOOST_CHECK_EQUAL (a.mapping.get (1, libdcp::RIGHT), 1);
-       BOOST_CHECK_EQUAL (a.mapping.get (1, libdcp::CENTRE), 1);
+       BOOST_CHECK_EQUAL (a.mapping.get (0, dcp::LEFT), 1);
+       BOOST_CHECK_EQUAL (a.mapping.get (0, dcp::RIGHT), 0);
+       BOOST_CHECK_EQUAL (a.mapping.get (0, dcp::CENTRE), 1);
+       BOOST_CHECK_EQUAL (a.mapping.get (1, dcp::LEFT), 0);
+       BOOST_CHECK_EQUAL (a.mapping.get (1, dcp::RIGHT), 1);
+       BOOST_CHECK_EQUAL (a.mapping.get (1, dcp::CENTRE), 1);
 }
 
index 12a77c1e1eeae27b6faf6dae56ccd13ab738c2f6..09416b0cb0c4fb7ff9ad368911c6890982ae002c 100644 (file)
@@ -18,7 +18,7 @@
 */
 
 #include <boost/test/unit_test.hpp>
-#include <libdcp/subtitle_asset.h>
+#include <libdcp/subtitle_content.h>
 #include "lib/subrip.h"
 #include "lib/subrip_content.h"
 #include "lib/subrip_decoder.h"
@@ -190,7 +190,7 @@ BOOST_AUTO_TEST_CASE (subrip_render_test)
 
        shared_ptr<Image> image;
        Position<int> position;
-       render_subtitles (dts->subs, libdcp::Size (1998, 1080), image, position);
+       render_subtitles (dts->subs, dcp::Size (1998, 1080), image, position);
        write_image (image, "build/test/subrip_render_test.png");
        check_file ("build/test/subrip_render_test.png", "test/data/subrip_render_test.png");
 }
index e43db71ef9c3ded8b833f3e94c289cc7be2b05fc..1498cd8feb671e06256881132ee3645b3313a6af 100644 (file)
@@ -130,9 +130,9 @@ check_file (boost::filesystem::path ref, boost::filesystem::path check)
 }
 
 static void
-note (libdcp::NoteType t, string n)
+note (dcp::NoteType t, string n)
 {
-       if (t == libdcp::ERROR) {
+       if (t == dcp::ERROR) {
                cerr << n << "\n";
        }
 }
@@ -140,16 +140,16 @@ note (libdcp::NoteType t, string n)
 void
 check_dcp (boost::filesystem::path ref, boost::filesystem::path check)
 {
-       libdcp::DCP ref_dcp (ref);
+       dcp::DCP ref_dcp (ref);
        ref_dcp.read ();
-       libdcp::DCP check_dcp (check);
+       dcp::DCP check_dcp (check);
        check_dcp.read ();
 
-       libdcp::EqualityOptions options;
+       dcp::EqualityOptions options;
        options.max_mean_pixel_error = 5;
        options.max_std_dev_pixel_error = 5;
        options.max_audio_sample_error = 255;
-       options.cpl_names_can_differ = true;
+       options.cpl_annotation_texts_can_differ = true;
        options.mxf_names_can_differ = true;
        
        BOOST_CHECK (ref_dcp.equals (check_dcp, options, boost::bind (note, _1, _2)));