#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"
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;
*/
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));
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 */
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;
}
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()
);
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();
_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;
);
}
- _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)
#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"
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 */
/* 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);
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);
}
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) {
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;
/* 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");
#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"
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);
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);
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);
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);
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);
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;
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 */
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));
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));
/** 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));
}
*/
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);
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;
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));
}
*/
#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"
using boost::shared_ptr;
static void
-note (libdcp::NoteType, string n)
+note (dcp::NoteType, string n)
{
cout << n << "\n";
}
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 (¬e, _1, _2)));
}
#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"
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);
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);
}
*/
#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"
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");
}
}
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";
}
}
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)));