From fe99eae4b95c5fcf2f3730efad4a18d0cb5c29bc Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 5 Jun 2015 00:05:32 +0100 Subject: [PATCH] MXF -> Asset in lots of places. --- examples/make_dcp.cc | 28 ++++++------- examples/read_dcp.cc | 22 +++++----- src/{mxf_writer.cc => asset_writer.cc} | 16 +++---- src/{mxf_writer.h => asset_writer.h} | 24 +++++------ src/dcp.cc | 14 +++---- src/decrypted_kdm.h | 8 ++-- src/key.h | 2 +- ...o_picture_mxf.cc => mono_picture_asset.cc} | 28 ++++++------- ...ono_picture_mxf.h => mono_picture_asset.h} | 30 ++++++------- ...writer.cc => mono_picture_asset_writer.cc} | 34 +++++++-------- ...f_writer.h => mono_picture_asset_writer.h} | 26 ++++++------ src/mono_picture_frame.cc | 8 ++-- src/mono_picture_frame.h | 2 +- src/mxf.h | 4 +- src/{picture_mxf.cc => picture_asset.cc} | 16 +++---- src/{picture_mxf.h => picture_asset.h} | 24 +++++------ ..._mxf_writer.cc => picture_asset_writer.cc} | 12 +++--- ...re_mxf_writer.h => picture_asset_writer.h} | 24 +++++------ ...mmon.cc => picture_asset_writer_common.cc} | 2 +- src/reel.cc | 18 ++++---- src/reel_asset.cc | 14 +++---- src/reel_asset.h | 6 +-- src/reel_mono_picture_asset.cc | 8 ++-- src/reel_mono_picture_asset.h | 8 ++-- src/reel_mxf_asset.h | 2 +- src/reel_picture_asset.cc | 4 +- src/reel_picture_asset.h | 12 +++--- src/reel_sound_asset.cc | 2 +- src/reel_sound_asset.h | 16 +++---- src/reel_stereo_picture_asset.cc | 4 +- src/reel_stereo_picture_asset.h | 4 +- src/reel_subtitle_asset.h | 2 +- src/{sound_mxf.cc => sound_asset.cc} | 25 +++++------ src/{sound_mxf.h => sound_asset.h} | 24 +++++------ ...nd_mxf_writer.cc => sound_asset_writer.cc} | 42 +++++++++---------- ...ound_mxf_writer.h => sound_asset_writer.h} | 24 +++++------ src/sound_frame.cc | 6 +-- src/sound_frame.h | 2 +- ...picture_mxf.cc => stereo_picture_asset.cc} | 24 +++++------ ...o_picture_mxf.h => stereo_picture_asset.h} | 18 ++++---- ...iter.cc => stereo_picture_asset_writer.cc} | 32 +++++++------- ...writer.h => stereo_picture_asset_writer.h} | 8 ++-- src/stereo_picture_frame.cc | 8 ++-- src/stereo_picture_frame.h | 2 +- src/types.h | 3 -- src/wscript | 32 +++++++------- test/cpl_sar_test.cc | 4 +- test/dcp_test.cc | 26 ++++++------ test/decryption_test.cc | 6 +-- test/encryption_test.cc | 16 +++---- test/recovery_test.cc | 10 ++--- test/round_trip_test.cc | 28 ++++++------- tools/dcpdiff.cc | 7 +--- tools/dcpinfo.cc | 16 +++---- 54 files changed, 389 insertions(+), 398 deletions(-) rename src/{mxf_writer.cc => asset_writer.cc} (84%) rename src/{mxf_writer.h => asset_writer.h} (69%) rename src/{mono_picture_mxf.cc => mono_picture_asset.cc} (80%) rename src/{mono_picture_mxf.h => mono_picture_asset.h} (60%) rename src/{mono_picture_mxf_writer.cc => mono_picture_asset_writer.cc} (71%) rename src/{mono_picture_mxf_writer.h => mono_picture_asset_writer.h} (65%) rename src/{picture_mxf.cc => picture_asset.cc} (93%) rename src/{picture_mxf.h => picture_asset.h} (84%) rename src/{picture_mxf_writer.cc => picture_asset_writer.cc} (79%) rename src/{picture_mxf_writer.h => picture_asset_writer.h} (72%) rename src/{picture_mxf_writer_common.cc => picture_asset_writer_common.cc} (94%) rename src/{sound_mxf.cc => sound_asset.cc} (88%) rename src/{sound_mxf.h => sound_asset.h} (77%) rename src/{sound_mxf_writer.cc => sound_asset_writer.cc} (72%) rename src/{sound_mxf_writer.h => sound_asset_writer.h} (71%) rename src/{stereo_picture_mxf.cc => stereo_picture_asset.cc} (82%) rename src/{stereo_picture_mxf.h => stereo_picture_asset.h} (67%) rename src/{stereo_picture_mxf_writer.cc => stereo_picture_asset_writer.cc} (72%) rename src/{stereo_picture_mxf_writer.h => stereo_picture_asset_writer.h} (90%) diff --git a/examples/make_dcp.cc b/examples/make_dcp.cc index d8339171..7b15e5e0 100644 --- a/examples/make_dcp.cc +++ b/examples/make_dcp.cc @@ -33,10 +33,10 @@ #include "dcp.h" #include "cpl.h" -#include "mono_picture_mxf.h" -#include "mono_picture_mxf_writer.h" -#include "sound_mxf.h" -#include "sound_mxf_writer.h" +#include "mono_picture_asset.h" +#include "mono_picture_asset_writer.h" +#include "sound_asset.h" +#include "sound_asset_writer.h" #include "reel.h" #include "file.h" #include "reel_mono_picture_asset.h" @@ -49,15 +49,15 @@ main () /* Create a directory to put the DCP in */ boost::filesystem::create_directory ("DCP"); - /* Make a picture MXF. This is a file which combines JPEG2000 files together to make + /* Make a picture asset. This is a file which combines JPEG2000 files together to make up the video of the DCP. First, create the object, specifying a frame rate of 24 frames per second. */ - boost::shared_ptr picture_mxf (new dcp::MonoPictureMXF (dcp::Fraction (24, 1))); + boost::shared_ptr picture_asset (new dcp::MonoPictureAsset (dcp::Fraction (24, 1))); /* Start off a write to it */ - boost::shared_ptr picture_writer = picture_mxf->start_write ("DCP/picture.mxf", dcp::SMPTE, false); + boost::shared_ptr picture_writer = picture_asset->start_write ("DCP/picture.mxf", dcp::SMPTE, false); /* Write 24 frames of the same JPEG2000 file */ dcp::File picture ("examples/help.j2c"); @@ -71,8 +71,8 @@ main () /* Now create a sound MXF. As before, create an object and a writer. When creating the object we specify the sampling rate (48kHz) and the number of channels (2). */ - boost::shared_ptr sound_mxf (new dcp::SoundMXF (dcp::Fraction (24, 1), 48000, 2)); - boost::shared_ptr sound_writer = sound_mxf->start_write ("DCP/sound.mxf", dcp::SMPTE); + boost::shared_ptr sound_asset (new dcp::SoundAsset (dcp::Fraction (24, 1), 48000, 2)); + boost::shared_ptr sound_writer = sound_asset->start_write ("DCP/sound.mxf", dcp::SMPTE); /* Write some sine waves */ float* audio[2]; @@ -93,10 +93,10 @@ main () boost::shared_ptr reel (new dcp::Reel ()); /* Add picture and sound to it. The zeros are the `entry points', i.e. the first - (video) frame from the MXFs that the reel should play. + (video) frame from the assets that the reel should play. */ - reel->add (boost::shared_ptr (new dcp::ReelMonoPictureAsset (picture_mxf, 0))); - reel->add (boost::shared_ptr (new dcp::ReelSoundAsset (sound_mxf, 0))); + reel->add (boost::shared_ptr (new dcp::ReelMonoPictureAsset (picture_asset, 0))); + reel->add (boost::shared_ptr (new dcp::ReelSoundAsset (sound_asset, 0))); /* Make a CPL with this reel */ boost::shared_ptr cpl (new dcp::CPL ("My film", dcp::FEATURE)); @@ -105,8 +105,8 @@ main () /* Write the DCP */ dcp::DCP dcp ("DCP"); dcp.add (cpl); - dcp.add (picture_mxf); - dcp.add (sound_mxf); + dcp.add (picture_asset); + dcp.add (sound_asset); dcp.write_xml (dcp::SMPTE); return 0; diff --git a/examples/read_dcp.cc b/examples/read_dcp.cc index 068fc09b..c7efd77b 100644 --- a/examples/read_dcp.cc +++ b/examples/read_dcp.cc @@ -19,7 +19,7 @@ /* If you are using an installed libdcp, these #includes would need to be changed to #include -#include +#include ... etc. ... */ @@ -28,9 +28,9 @@ #include "reel.h" #include "reel_picture_asset.h" #include "mono_picture_frame.h" -#include "mono_picture_mxf.h" -#include "stereo_picture_mxf.h" -#include "sound_mxf.h" +#include "mono_picture_asset.h" +#include "stereo_picture_asset.h" +#include "sound_asset.h" #include "subtitle_asset.h" #include "xyz_image.h" #include "colour_conversion.h" @@ -60,11 +60,11 @@ main () std::list > assets = dcp.assets (); std::cout << "DCP has " << assets.size() << " assets.\n"; for (std::list >::const_iterator i = assets.begin(); i != assets.end(); ++i) { - if (boost::dynamic_pointer_cast (*i)) { + if (boost::dynamic_pointer_cast (*i)) { std::cout << "2D picture\n"; - } else if (boost::dynamic_pointer_cast (*i)) { + } else if (boost::dynamic_pointer_cast (*i)) { std::cout << "3D picture\n"; - } else if (boost::dynamic_pointer_cast (*i)) { + } else if (boost::dynamic_pointer_cast (*i)) { std::cout << "Sound\n"; } else if (boost::dynamic_pointer_cast (*i)) { std::cout << "Subtitle\n"; @@ -77,11 +77,13 @@ main () /* Take the first CPL */ boost::shared_ptr cpl = dcp.cpls().front (); - /* Get the MXF of the picture asset in the first reel */ - boost::shared_ptr picture_mxf = boost::dynamic_pointer_cast (cpl->reels().front()->main_picture()->mxf ()); + /* Get the picture asset in the first reel */ + boost::shared_ptr picture_asset = boost::dynamic_pointer_cast ( + cpl->reels().front()->main_picture()->asset() + ); /* Get the 1000th frame of it */ - boost::shared_ptr picture_frame_j2k = picture_mxf->get_frame(999); + boost::shared_ptr picture_frame_j2k = picture_asset->get_frame(999); /* Get the frame as an XYZ image */ boost::shared_ptr picture_image_xyz = picture_frame_j2k->xyz_image (); diff --git a/src/mxf_writer.cc b/src/asset_writer.cc similarity index 84% rename from src/mxf_writer.cc rename to src/asset_writer.cc index ab1eac1a..eb55feaf 100644 --- a/src/mxf_writer.cc +++ b/src/asset_writer.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2012-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 @@ -17,11 +17,11 @@ */ -/** @file src/mxf_writer.h - * @brief MXFWriter class. +/** @file src/asset_writer.h + * @brief AssetWriter class. */ -#include "mxf_writer.h" +#include "asset_writer.h" #include "mxf.h" #include "dcp_assert.h" #include "AS_DCP.h" @@ -29,11 +29,11 @@ using namespace dcp; -/** Create an MXFWriter. +/** Create an AssetWriter. * @param mxf MXF that we are writing. * @param file File to write to. */ -MXFWriter::MXFWriter (MXF* mxf, boost::filesystem::path file) +AssetWriter::AssetWriter (MXF* mxf, boost::filesystem::path file) : _mxf (mxf) , _file (file) , _frames_written (0) @@ -55,13 +55,13 @@ MXFWriter::MXFWriter (MXF* mxf, boost::filesystem::path file) } } -MXFWriter::~MXFWriter () +AssetWriter::~AssetWriter () { delete _encryption_context; } void -MXFWriter::finalize () +AssetWriter::finalize () { DCP_ASSERT (!_finalized); _finalized = true; diff --git a/src/mxf_writer.h b/src/asset_writer.h similarity index 69% rename from src/mxf_writer.h rename to src/asset_writer.h index c7924c9a..31d2f7ae 100644 --- a/src/mxf_writer.h +++ b/src/asset_writer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2012-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 @@ -17,12 +17,12 @@ */ -/** @file src/mxf_writer.h - * @brief MXFWriter class. +/** @file src/asset_writer.h + * @brief AssetWriter class. */ -#ifndef LIBDCP_MXF_WRITER_H -#define LIBDCP_MXF_WRITER_H +#ifndef LIBDCP_ASSET_WRITER_H +#define LIBDCP_ASSET_WRITER_H #include @@ -34,20 +34,20 @@ namespace dcp { class MXF; -/** @class MXFWriter - * @brief Parent class for classes which can write MXF files. +/** @class AssetWriter + * @brief Parent class for classes which can write MXF-based assets. * - * The MXFWriter lasts for the duration of the write and is then discarded. - * They can only be created by calling start_write() on an MXF object. + * The AssetWriter lasts for the duration of the write and is then discarded. + * They can only be created by calling start_write() on an appropriate Asset object. */ -class MXFWriter : public boost::noncopyable +class AssetWriter : public boost::noncopyable { public: - virtual ~MXFWriter (); + virtual ~AssetWriter (); virtual void finalize (); protected: - MXFWriter (MXF* mxf, boost::filesystem::path file); + AssetWriter (MXF* mxf, boost::filesystem::path file); /** MXF that we are writing */ MXF* _mxf; diff --git a/src/dcp.cc b/src/dcp.cc index e1b632c6..abeafdfb 100644 --- a/src/dcp.cc +++ b/src/dcp.cc @@ -23,12 +23,12 @@ #include "raw_convert.h" #include "dcp.h" -#include "sound_mxf.h" -#include "picture_mxf.h" +#include "sound_asset.h" +#include "picture_asset.h" #include "interop_subtitle_asset.h" #include "smpte_subtitle_asset.h" -#include "mono_picture_mxf.h" -#include "stereo_picture_mxf.h" +#include "mono_picture_asset.h" +#include "stereo_picture_asset.h" #include "util.h" #include "metadata.h" #include "exceptions.h" @@ -149,14 +149,14 @@ DCP::read (bool keep_going, ReadErrors* errors) case ASDCP::ESS_MPEG2_VES: throw DCPReadError ("MPEG2 video essences are not supported"); case ASDCP::ESS_JPEG_2000: - _assets.push_back (shared_ptr (new MonoPictureMXF (path))); + _assets.push_back (shared_ptr (new MonoPictureAsset (path))); break; case ASDCP::ESS_PCM_24b_48k: case ASDCP::ESS_PCM_24b_96k: - _assets.push_back (shared_ptr (new SoundMXF (path))); + _assets.push_back (shared_ptr (new SoundAsset (path))); break; case ASDCP::ESS_JPEG_2000_S: - _assets.push_back (shared_ptr (new StereoPictureMXF (path))); + _assets.push_back (shared_ptr (new StereoPictureAsset (path))); break; case ASDCP::ESS_TIMED_TEXT: _assets.push_back (shared_ptr (new SMPTESubtitleAsset (path))); diff --git a/src/decrypted_kdm.h b/src/decrypted_kdm.h index 91b2f7d3..5ea67861 100644 --- a/src/decrypted_kdm.h +++ b/src/decrypted_kdm.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2014 Carl Hetherington + Copyright (C) 2013-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 @@ -45,7 +45,7 @@ class CPL; * has been created (by some other means) ready for encryption later. * * A DecryptedKDM object can be created either from an EncryptedKDM and private key file, - * or from the details of the MXFs that the KDM should protect. + * or from the details of the assets that the KDM should protect. */ class DecryptedKDM { @@ -57,7 +57,7 @@ public: /** Construct a DecryptedKDM. * @param cpl CPL that the keys are for. - * @param key Key that was used to encrypt the MXFs. + * @param key Key that was used to encrypt the assets. * @param not_valid_before Start time for the KDM. * @param not_valid_after End time for the KDM. */ @@ -79,7 +79,7 @@ public: */ EncryptedKDM encrypt (boost::shared_ptr signer, Certificate recipient, Formulation formulation) const; - /** @return This KDM's (decrypted) keys, which could be used to decrypt MXFs. */ + /** @return This KDM's (decrypted) keys, which could be used to decrypt assets. */ std::list keys () const { return _keys; } diff --git a/src/key.h b/src/key.h index 248a2a95..9d16c8a1 100644 --- a/src/key.h +++ b/src/key.h @@ -30,7 +30,7 @@ namespace dcp { /** @class Key - * @brief A key for decrypting/encrypting MXFs. + * @brief A key for decrypting/encrypting assets. */ class Key { diff --git a/src/mono_picture_mxf.cc b/src/mono_picture_asset.cc similarity index 80% rename from src/mono_picture_mxf.cc rename to src/mono_picture_asset.cc index faae8cd8..19210ce8 100644 --- a/src/mono_picture_mxf.cc +++ b/src/mono_picture_asset.cc @@ -17,8 +17,8 @@ */ -#include "mono_picture_mxf.h" -#include "mono_picture_mxf_writer.h" +#include "mono_picture_asset.h" +#include "mono_picture_asset_writer.h" #include "AS_DCP.h" #include "KM_fileio.h" #include "exceptions.h" @@ -32,8 +32,8 @@ using boost::shared_ptr; using boost::dynamic_pointer_cast; using namespace dcp; -MonoPictureMXF::MonoPictureMXF (boost::filesystem::path file) - : PictureMXF (file) +MonoPictureAsset::MonoPictureAsset (boost::filesystem::path file) + : PictureAsset (file) { ASDCP::JP2K::MXFReader reader; Kumu::Result_t r = reader.OpenRead (file.string().c_str()); @@ -56,22 +56,22 @@ MonoPictureMXF::MonoPictureMXF (boost::filesystem::path file) _id = read_writer_info (info); } -MonoPictureMXF::MonoPictureMXF (Fraction edit_rate) - : PictureMXF (edit_rate) +MonoPictureAsset::MonoPictureAsset (Fraction edit_rate) + : PictureAsset (edit_rate) { } shared_ptr -MonoPictureMXF::get_frame (int n) const +MonoPictureAsset::get_frame (int n) const { return shared_ptr (new MonoPictureFrame (_file, n, _decryption_context)); } bool -MonoPictureMXF::equals (shared_ptr other, EqualityOptions opt, NoteHandler note) const +MonoPictureAsset::equals (shared_ptr other, EqualityOptions opt, NoteHandler note) const { - if (!dynamic_pointer_cast (other)) { + if (!dynamic_pointer_cast (other)) { return false; } @@ -100,7 +100,7 @@ MonoPictureMXF::equals (shared_ptr other, EqualityOptions opt, Note return false; } - shared_ptr other_picture = dynamic_pointer_cast (other); + shared_ptr other_picture = dynamic_pointer_cast (other); DCP_ASSERT (other_picture); for (int i = 0; i < _intrinsic_duration; ++i) { @@ -124,15 +124,15 @@ MonoPictureMXF::equals (shared_ptr other, EqualityOptions opt, Note return true; } -shared_ptr -MonoPictureMXF::start_write (boost::filesystem::path file, Standard standard, bool overwrite) +shared_ptr +MonoPictureAsset::start_write (boost::filesystem::path file, Standard standard, bool overwrite) { /* XXX: can't we use shared_ptr here? */ - return shared_ptr (new MonoPictureMXFWriter (this, file, standard, overwrite)); + return shared_ptr (new MonoPictureAssetWriter (this, file, standard, overwrite)); } string -MonoPictureMXF::cpl_node_name () const +MonoPictureAsset::cpl_node_name () const { return "MainPicture"; } diff --git a/src/mono_picture_mxf.h b/src/mono_picture_asset.h similarity index 60% rename from src/mono_picture_mxf.h rename to src/mono_picture_asset.h index 4e5211ca..fc1e4f9c 100644 --- a/src/mono_picture_mxf.h +++ b/src/mono_picture_asset.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2012-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 @@ -17,33 +17,33 @@ */ -#ifndef LIBDCP_MONO_PICTURE_MXF_H -#define LIBDCP_MONO_PICTURE_MXF_H +#ifndef LIBDCP_MONO_PICTURE_ASSET_H +#define LIBDCP_MONO_PICTURE_ASSET_H -#include "picture_mxf.h" +#include "picture_asset.h" namespace dcp { -class MonoPictureMXFWriter; +class MonoPictureAssetWriter; -/** @class MonoPictureMXF - * @brief A 2D (monoscopic) picture MXF. +/** @class MonoPictureAsset + * @brief A 2D (monoscopic) picture asset. */ -class MonoPictureMXF : public PictureMXF +class MonoPictureAsset : public PictureAsset { public: - /** Create a MonoPictureMXF by reading a file. - * @param file MXF file to read. + /** Create a MonoPictureAsset by reading a file. + * @param file Asset file to read. */ - MonoPictureMXF (boost::filesystem::path file); + MonoPictureAsset (boost::filesystem::path file); - /** Create a MonoPictureMXF with a given edit rate. + /** Create a MonoPictureAsset with a given edit rate. * @param edit_rate Edit rate (i.e. frame rate) in frames per second. */ - MonoPictureMXF (Fraction edit_rate); + MonoPictureAsset (Fraction edit_rate); - /** Start a progressive write to a MonoPictureMXF */ - boost::shared_ptr start_write (boost::filesystem::path, Standard standard, bool); + /** Start a progressive write to a MonoPictureAsset */ + boost::shared_ptr start_write (boost::filesystem::path, Standard standard, bool); bool equals ( boost::shared_ptr other, diff --git a/src/mono_picture_mxf_writer.cc b/src/mono_picture_asset_writer.cc similarity index 71% rename from src/mono_picture_mxf_writer.cc rename to src/mono_picture_asset_writer.cc index f0914cdc..0f09f8fe 100644 --- a/src/mono_picture_mxf_writer.cc +++ b/src/mono_picture_asset_writer.cc @@ -17,18 +17,18 @@ */ -/** @file src/mono_picture_mxf_writer.cc - * @brief MonoPictureMXFWriter class +/** @file src/mono_picture_asset_writer.cc + * @brief MonoPictureAssetWriter class */ #include "AS_DCP.h" #include "KM_fileio.h" -#include "mono_picture_mxf_writer.h" +#include "mono_picture_asset_writer.h" #include "exceptions.h" -#include "picture_mxf.h" +#include "picture_asset.h" #include "dcp_assert.h" -#include "picture_mxf_writer_common.cc" +#include "picture_asset_writer_common.cc" using std::istream; using std::ostream; @@ -36,7 +36,7 @@ using std::string; using boost::shared_ptr; using namespace dcp; -struct MonoPictureMXFWriter::ASDCPState : public ASDCPStateBase +struct MonoPictureAssetWriter::ASDCPState : public ASDCPStateBase { ASDCP::JP2K::MXFWriter mxf_writer; }; @@ -44,22 +44,22 @@ struct MonoPictureMXFWriter::ASDCPState : public ASDCPStateBase /** @param a Asset to write to. `a' must not be deleted while * this writer class still exists, or bad things will happen. */ -MonoPictureMXFWriter::MonoPictureMXFWriter (PictureMXF* asset, boost::filesystem::path file, Standard standard, bool overwrite) - : PictureMXFWriter (asset, file, standard, overwrite) - , _state (new MonoPictureMXFWriter::ASDCPState) +MonoPictureAssetWriter::MonoPictureAssetWriter (PictureAsset* asset, boost::filesystem::path file, Standard standard, bool overwrite) + : PictureAssetWriter (asset, file, standard, overwrite) + , _state (new MonoPictureAssetWriter::ASDCPState) { } void -MonoPictureMXFWriter::start (uint8_t* data, int size) +MonoPictureAssetWriter::start (uint8_t* data, int size) { - dcp::start (this, _state, _standard, _picture_mxf, data, size); - _picture_mxf->set_frame_rate (_picture_mxf->edit_rate()); + dcp::start (this, _state, _standard, _picture_asset, data, size); + _picture_asset->set_frame_rate (_picture_asset->edit_rate()); } FrameInfo -MonoPictureMXFWriter::write (uint8_t* data, int size) +MonoPictureAssetWriter::write (uint8_t* data, int size) { DCP_ASSERT (!_finalized); @@ -84,7 +84,7 @@ MonoPictureMXFWriter::write (uint8_t* data, int size) } void -MonoPictureMXFWriter::fake_write (int size) +MonoPictureAssetWriter::fake_write (int size) { DCP_ASSERT (_started); DCP_ASSERT (!_finalized); @@ -98,14 +98,14 @@ MonoPictureMXFWriter::fake_write (int size) } void -MonoPictureMXFWriter::finalize () +MonoPictureAssetWriter::finalize () { Kumu::Result_t r = _state->mxf_writer.Finalize(); if (ASDCP_FAILURE (r)) { boost::throw_exception (MXFFileError ("error in finalizing video MXF", _file.string(), r)); } - _picture_mxf->_intrinsic_duration = _frames_written; - PictureMXFWriter::finalize (); + _picture_asset->_intrinsic_duration = _frames_written; + PictureAssetWriter::finalize (); } diff --git a/src/mono_picture_mxf_writer.h b/src/mono_picture_asset_writer.h similarity index 65% rename from src/mono_picture_mxf_writer.h rename to src/mono_picture_asset_writer.h index 7cad54e0..6478c9bf 100644 --- a/src/mono_picture_mxf_writer.h +++ b/src/mono_picture_asset_writer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2012-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 @@ -17,14 +17,14 @@ */ -/** @file src/mono_picture_mxf_writer.h - * @brief MonoPictureMXFWriter class +/** @file src/mono_picture_asset_writer.h + * @brief MonoPictureAssetWriter class */ -#ifndef LIBDCP_MONO_PICTURE_MXF_WRITER_H -#define LIBDCP_MONO_PICTURE_MXF_WRITER_H +#ifndef LIBDCP_MONO_PICTURE_ASSET_WRITER_H +#define LIBDCP_MONO_PICTURE_ASSET_WRITER_H -#include "picture_mxf_writer.h" +#include "picture_asset_writer.h" #include #include #include @@ -33,17 +33,17 @@ namespace dcp { -/** @class MonoPictureMXFWriter - * @brief A helper class for writing to MonoPictureMXFs +/** @class MonoPictureAssetWriter + * @brief A helper class for writing to MonoPictureAssets * - * Objects of this class can only be created with MonoPictureMXF::start_write(). + * Objects of this class can only be created with MonoPictureAsset::start_write(). * - * Frames can be written to the MonoPictureMXF by calling write() with a JPEG2000 image + * Frames can be written to the MonoPictureAsset by calling write() with a JPEG2000 image * (a verbatim .j2c file). finalize() must be called after the last frame has been written. * The action of finalize() can't be done in MonoPictureAssetWriter's destructor as it may * throw an exception. */ -class MonoPictureMXFWriter : public PictureMXFWriter +class MonoPictureAssetWriter : public PictureAssetWriter { public: FrameInfo write (uint8_t *, int); @@ -51,9 +51,9 @@ public: void finalize (); private: - friend class MonoPictureMXF; + friend class MonoPictureAsset; - MonoPictureMXFWriter (PictureMXF *, boost::filesystem::path file, Standard standard, bool); + MonoPictureAssetWriter (PictureAsset *, boost::filesystem::path file, Standard standard, bool); void start (uint8_t *, int); /* do this with an opaque pointer so we don't have to include diff --git a/src/mono_picture_frame.cc b/src/mono_picture_frame.cc index 689a8b21..1237fd90 100644 --- a/src/mono_picture_frame.cc +++ b/src/mono_picture_frame.cc @@ -56,16 +56,16 @@ MonoPictureFrame::MonoPictureFrame (boost::filesystem::path path) } /** Make a picture frame from a 2D (monoscopic) asset. - * @param mxf_path Path to the asset's MXF file. + * @param path Path to the asset's MXF file. * @param n Frame within the asset, not taking EntryPoint into account. * @param c Context for decryption, or 0. */ -MonoPictureFrame::MonoPictureFrame (boost::filesystem::path mxf_path, int n, ASDCP::AESDecContext* c) +MonoPictureFrame::MonoPictureFrame (boost::filesystem::path path, int n, ASDCP::AESDecContext* c) { ASDCP::JP2K::MXFReader reader; - Kumu::Result_t r = reader.OpenRead (mxf_path.string().c_str()); + Kumu::Result_t r = reader.OpenRead (path.string().c_str()); if (ASDCP_FAILURE (r)) { - boost::throw_exception (FileError ("could not open MXF file for reading", mxf_path, r)); + boost::throw_exception (FileError ("could not open MXF file for reading", path, r)); } /* XXX: unfortunate guesswork on this buffer size */ diff --git a/src/mono_picture_frame.h b/src/mono_picture_frame.h index 91089262..d4853d52 100644 --- a/src/mono_picture_frame.h +++ b/src/mono_picture_frame.h @@ -46,7 +46,7 @@ class XYZImage; class MonoPictureFrame : public boost::noncopyable { public: - MonoPictureFrame (boost::filesystem::path mxf_path, int n, ASDCP::AESDecContext *); + MonoPictureFrame (boost::filesystem::path path, int n, ASDCP::AESDecContext *); MonoPictureFrame (boost::filesystem::path path); MonoPictureFrame (); ~MonoPictureFrame (); diff --git a/src/mxf.h b/src/mxf.h index e05ddbcd..a9f1bfa3 100644 --- a/src/mxf.h +++ b/src/mxf.h @@ -39,7 +39,7 @@ namespace dcp { class MXFMetadata; -class PictureMXFWriter; +class PictureAssetWriter; /** @class MXF * @brief Parent class for classes which represent MXF files. @@ -88,7 +88,7 @@ public: protected: template - friend void start (PictureMXFWriter* writer, boost::shared_ptr

state, Standard standard, Q* mxf, uint8_t* data, int size); + friend void start (PictureAssetWriter* writer, boost::shared_ptr

state, Standard standard, Q* mxf, uint8_t* data, int size); std::string read_writer_info (ASDCP::WriterInfo const &); /** Fill in a ADSCP::WriteInfo struct. diff --git a/src/picture_mxf.cc b/src/picture_asset.cc similarity index 93% rename from src/picture_mxf.cc rename to src/picture_asset.cc index caa3d1a6..ef3ff1f4 100644 --- a/src/picture_mxf.cc +++ b/src/picture_asset.cc @@ -17,11 +17,11 @@ */ -#include "picture_mxf.h" +#include "picture_asset.h" #include "util.h" #include "exceptions.h" #include "xyz_image.h" -#include "picture_mxf_writer.h" +#include "picture_asset_writer.h" #include "dcp_assert.h" #include "compose.hpp" #include "AS_DCP.h" @@ -47,14 +47,14 @@ using std::cout; using boost::shared_ptr; using namespace dcp; -PictureMXF::PictureMXF (boost::filesystem::path file) +PictureAsset::PictureAsset (boost::filesystem::path file) : Asset (file) , _intrinsic_duration (0) { } -PictureMXF::PictureMXF (Fraction edit_rate) +PictureAsset::PictureAsset (Fraction edit_rate) : _edit_rate (edit_rate) , _intrinsic_duration (0) { @@ -62,7 +62,7 @@ PictureMXF::PictureMXF (Fraction edit_rate) } void -PictureMXF::read_picture_descriptor (ASDCP::JP2K::PictureDescriptor const & desc) +PictureAsset::read_picture_descriptor (ASDCP::JP2K::PictureDescriptor const & desc) { _size.width = desc.StoredWidth; _size.height = desc.StoredHeight; @@ -73,7 +73,7 @@ PictureMXF::read_picture_descriptor (ASDCP::JP2K::PictureDescriptor const & desc } bool -PictureMXF::descriptor_equals ( +PictureAsset::descriptor_equals ( ASDCP::JP2K::PictureDescriptor const & a, ASDCP::JP2K::PictureDescriptor const & b, NoteHandler note ) const { @@ -115,7 +115,7 @@ PictureMXF::descriptor_equals ( } bool -PictureMXF::frame_buffer_equals ( +PictureAsset::frame_buffer_equals ( int frame, EqualityOptions opt, NoteHandler note, uint8_t const * data_A, unsigned int size_A, uint8_t const * data_B, unsigned int size_B ) const @@ -189,7 +189,7 @@ PictureMXF::frame_buffer_equals ( } string -PictureMXF::pkl_type (Standard standard) const +PictureAsset::pkl_type (Standard standard) const { switch (standard) { case INTEROP: diff --git a/src/picture_mxf.h b/src/picture_asset.h similarity index 84% rename from src/picture_mxf.h rename to src/picture_asset.h index c5066513..51b69e7c 100644 --- a/src/picture_mxf.h +++ b/src/picture_asset.h @@ -17,11 +17,11 @@ */ -#ifndef LIBDCP_PICTURE_MXF_H -#define LIBDCP_PICTURE_MXF_H +#ifndef LIBDCP_PICTURE_ASSET_H +#define LIBDCP_PICTURE_ASSET_H -/** @file src/picture_mxf.h - * @brief PictureMXF class. +/** @file src/picture_asset.h + * @brief PictureAsset class. */ #include "mxf.h" @@ -40,18 +40,18 @@ namespace dcp class MonoPictureFrame; class StereoPictureFrame; -class PictureMXFWriter; +class PictureAssetWriter; -/** @class PictureMXF +/** @class PictureAsset * @brief An asset made up of JPEG2000 data. */ -class PictureMXF : public Asset, public MXF +class PictureAsset : public Asset, public MXF { public: - PictureMXF (boost::filesystem::path file); - PictureMXF (Fraction edit_rate); + PictureAsset (boost::filesystem::path file); + PictureAsset (Fraction edit_rate); - virtual boost::shared_ptr start_write ( + virtual boost::shared_ptr start_write ( boost::filesystem::path file, Standard standard, bool overwrite @@ -90,8 +90,8 @@ public: } protected: - friend class MonoPictureMXFWriter; - friend class StereoPictureMXFWriter; + friend class MonoPictureAssetWriter; + friend class StereoPictureAssetWriter; bool frame_buffer_equals ( int frame, EqualityOptions opt, NoteHandler note, diff --git a/src/picture_mxf_writer.cc b/src/picture_asset_writer.cc similarity index 79% rename from src/picture_mxf_writer.cc rename to src/picture_asset_writer.cc index 4593c49a..b47aaabd 100644 --- a/src/picture_mxf_writer.cc +++ b/src/picture_asset_writer.cc @@ -18,9 +18,9 @@ */ #include "KM_fileio.h" -#include "picture_mxf_writer.h" +#include "picture_asset_writer.h" #include "exceptions.h" -#include "picture_mxf.h" +#include "picture_asset.h" #include "AS_DCP.h" #include #include @@ -31,12 +31,12 @@ using std::string; using boost::shared_ptr; using namespace dcp; -PictureMXFWriter::PictureMXFWriter (PictureMXF* mxf, boost::filesystem::path file, Standard standard, bool overwrite) - : MXFWriter (mxf, file) - , _picture_mxf (mxf) +PictureAssetWriter::PictureAssetWriter (PictureAsset* asset, boost::filesystem::path file, Standard standard, bool overwrite) + : AssetWriter (asset, file) + , _picture_asset (asset) , _started (false) , _standard (standard) , _overwrite (overwrite) { - mxf->set_file (file); + asset->set_file (file); } diff --git a/src/picture_mxf_writer.h b/src/picture_asset_writer.h similarity index 72% rename from src/picture_mxf_writer.h rename to src/picture_asset_writer.h index 6626f8b8..48832e43 100644 --- a/src/picture_mxf_writer.h +++ b/src/picture_asset_writer.h @@ -17,16 +17,16 @@ */ -/** @file src/picture_mxf_writer.h - * @brief PictureMXFWriter and FrameInfo classes. +/** @file src/picture_asset_writer.h + * @brief PictureAssetWriter and FrameInfo classes. */ -#ifndef LIBDCP_PICTURE_MXF_WRITER_H -#define LIBDCP_PICTURE_MXF_WRITER_H +#ifndef LIBDCP_PICTURE_ASSET_WRITER_H +#define LIBDCP_PICTURE_ASSET_WRITER_H #include "metadata.h" #include "types.h" -#include "mxf_writer.h" +#include "asset_writer.h" #include #include #include @@ -35,7 +35,7 @@ namespace dcp { -class PictureMXF; +class PictureAsset; /** @class FrameInfo * @brief Information about a single frame (either a monoscopic frame or a left *or* right eye stereoscopic frame) @@ -58,10 +58,10 @@ struct FrameInfo std::string hash; }; -/** @class PictureMXFWriter - * @brief Parent class for classes which write picture MXF files. +/** @class PictureAssetWriter + * @brief Parent class for classes which write picture assets. */ -class PictureMXFWriter : public MXFWriter +class PictureAssetWriter : public AssetWriter { public: virtual FrameInfo write (uint8_t *, int) = 0; @@ -69,11 +69,11 @@ public: protected: template - friend void start (PictureMXFWriter *, boost::shared_ptr

, Standard, Q *, uint8_t *, int); + friend void start (PictureAssetWriter *, boost::shared_ptr

, Standard, Q *, uint8_t *, int); - PictureMXFWriter (PictureMXF *, boost::filesystem::path, Standard standard, bool); + PictureAssetWriter (PictureAsset *, boost::filesystem::path, Standard standard, bool); - PictureMXF* _picture_mxf; + PictureAsset* _picture_asset; bool _started; Standard _standard; bool _overwrite; diff --git a/src/picture_mxf_writer_common.cc b/src/picture_asset_writer_common.cc similarity index 94% rename from src/picture_mxf_writer_common.cc rename to src/picture_asset_writer_common.cc index b625d1ff..b463cb4a 100644 --- a/src/picture_mxf_writer_common.cc +++ b/src/picture_asset_writer_common.cc @@ -32,7 +32,7 @@ struct ASDCPStateBase }; template -void dcp::start (PictureMXFWriter* writer, shared_ptr

state, Standard standard, Q* mxf, uint8_t* data, int size) +void dcp::start (PictureAssetWriter* writer, shared_ptr

state, Standard standard, Q* mxf, uint8_t* data, int size) { mxf->set_file (writer->_file); diff --git a/src/reel.cc b/src/reel.cc index 3a046297..106fbf40 100644 --- a/src/reel.cc +++ b/src/reel.cc @@ -19,10 +19,10 @@ #include "reel.h" #include "util.h" -#include "picture_mxf.h" -#include "mono_picture_mxf.h" -#include "stereo_picture_mxf.h" -#include "sound_mxf.h" +#include "picture_asset.h" +#include "mono_picture_asset.h" +#include "stereo_picture_asset.h" +#include "sound_asset.h" #include "subtitle_asset.h" #include "reel_mono_picture_asset.h" #include "reel_stereo_picture_asset.h" @@ -140,10 +140,10 @@ Reel::add (DecryptedKDM const & kdm) for (list::iterator i = keys.begin(); i != keys.end(); ++i) { if (i->id() == _main_picture->key_id()) { - _main_picture->mxf()->set_key (i->key ()); + _main_picture->asset()->set_key (i->key ()); } if (i->id() == _main_sound->key_id()) { - _main_sound->mxf()->set_key (i->key ()); + _main_sound->asset()->set_key (i->key ()); } } } @@ -167,14 +167,14 @@ void Reel::resolve_refs (list > objects) { if (_main_picture) { - _main_picture->asset().resolve (objects); + _main_picture->asset_ref().resolve (objects); } if (_main_sound) { - _main_sound->asset().resolve (objects); + _main_sound->asset_ref().resolve (objects); } if (_main_subtitle) { - _main_subtitle->asset().resolve (objects); + _main_subtitle->asset_ref().resolve (objects); } } diff --git a/src/reel_asset.cc b/src/reel_asset.cc index 7f129f90..d56a492b 100644 --- a/src/reel_asset.cc +++ b/src/reel_asset.cc @@ -33,7 +33,7 @@ using namespace dcp; ReelAsset::ReelAsset () : Object (make_uuid ()) - , _asset (_id) + , _asset_ref (_id) , _edit_rate (Fraction (24, 1)) , _intrinsic_duration (0) , _entry_point (0) @@ -50,7 +50,7 @@ ReelAsset::ReelAsset () */ ReelAsset::ReelAsset (shared_ptr asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point) : Object (asset->id ()) - , _asset (asset) + , _asset_ref (asset) , _edit_rate (edit_rate) , _intrinsic_duration (intrinsic_duration) , _entry_point (entry_point) @@ -63,7 +63,7 @@ ReelAsset::ReelAsset (shared_ptr asset, Fraction edit_rate, int64_t intri ReelAsset::ReelAsset (shared_ptr node) : Object (node->string_child ("Id")) - , _asset (_id) + , _asset_ref (_id) , _annotation_text (node->optional_string_child ("AnnotationText").get_value_or ("")) , _edit_rate (Fraction (node->string_child ("EditRate"))) , _intrinsic_duration (node->number_child ("IntrinsicDuration")) @@ -73,7 +73,7 @@ ReelAsset::ReelAsset (shared_ptr node) { if (_id.length() > 9) { _id = _id.substr (9); - _asset.set_id (_id); + _asset_ref.set_id (_id); } } @@ -91,7 +91,7 @@ ReelAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const a->add_child("IntrinsicDuration")->add_child_text (raw_convert (_intrinsic_duration)); a->add_child("EntryPoint")->add_child_text (raw_convert (_entry_point)); a->add_child("Duration")->add_child_text (raw_convert (_duration)); - a->add_child("Hash")->add_child_text (_asset.object()->hash ()); + a->add_child("Hash")->add_child_text (_asset_ref.object()->hash ()); } pair @@ -143,8 +143,8 @@ ReelAsset::equals (shared_ptr other, EqualityOptions opt, NoteH } } - if (_asset.resolved () && other->_asset.resolved ()) { - return _asset->equals (other->_asset.object (), opt, note); + if (_asset_ref.resolved () && other->_asset_ref.resolved ()) { + return _asset_ref->equals (other->_asset_ref.object (), opt, note); } return true; diff --git a/src/reel_asset.h b/src/reel_asset.h index 7588c063..118f10a1 100644 --- a/src/reel_asset.h +++ b/src/reel_asset.h @@ -55,8 +55,8 @@ public: virtual bool equals (boost::shared_ptr, EqualityOptions, NoteHandler) const; /** @return a Ref to our actual asset */ - Ref& asset () { - return _asset; + Ref& asset_ref () { + return _asset_ref; } int64_t entry_point () const { @@ -81,7 +81,7 @@ protected: /** Reference to the asset (MXF or XML file) that this reel entry * applies to. */ - Ref _asset; + Ref _asset_ref; private: diff --git a/src/reel_mono_picture_asset.cc b/src/reel_mono_picture_asset.cc index b4ed6301..d41cc2ac 100644 --- a/src/reel_mono_picture_asset.cc +++ b/src/reel_mono_picture_asset.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Carl Hetherington + Copyright (C) 2014-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 @@ -22,7 +22,7 @@ */ #include "reel_mono_picture_asset.h" -#include "mono_picture_mxf.h" +#include "mono_picture_asset.h" #include using std::string; @@ -34,8 +34,8 @@ ReelMonoPictureAsset::ReelMonoPictureAsset () } -ReelMonoPictureAsset::ReelMonoPictureAsset (boost::shared_ptr mxf, int64_t entry_point) - : ReelPictureAsset (mxf, entry_point) +ReelMonoPictureAsset::ReelMonoPictureAsset (boost::shared_ptr asset, int64_t entry_point) + : ReelPictureAsset (asset, entry_point) { } diff --git a/src/reel_mono_picture_asset.h b/src/reel_mono_picture_asset.h index a25550a4..5fcb31c8 100644 --- a/src/reel_mono_picture_asset.h +++ b/src/reel_mono_picture_asset.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Carl Hetherington + Copyright (C) 2014-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 @@ -28,16 +28,16 @@ namespace dcp { -class MonoPictureMXF; +class MonoPictureAsset; /** @class ReelMonoPictureAsset - * @brief Part of a Reel's description which refers to a monoscopic picture MXF. + * @brief Part of a Reel's description which refers to a monoscopic picture asset. */ class ReelMonoPictureAsset : public ReelPictureAsset { public: ReelMonoPictureAsset (); - ReelMonoPictureAsset (boost::shared_ptr content, int64_t entry_point); + ReelMonoPictureAsset (boost::shared_ptr asset, int64_t entry_point); ReelMonoPictureAsset (boost::shared_ptr); private: diff --git a/src/reel_mxf_asset.h b/src/reel_mxf_asset.h index c9637549..2dc3af73 100644 --- a/src/reel_mxf_asset.h +++ b/src/reel_mxf_asset.h @@ -37,7 +37,7 @@ class ReelMXFAsset : public ReelAsset { public: ReelMXFAsset (); - ReelMXFAsset (boost::shared_ptr mxf, boost::optional key_id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); + ReelMXFAsset (boost::shared_ptr asset, boost::optional key_id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); ReelMXFAsset (boost::shared_ptr); /** @return the 4-character key type for this MXF (MDIK, MDAK, etc.) */ diff --git a/src/reel_picture_asset.cc b/src/reel_picture_asset.cc index d222095c..fd18dc30 100644 --- a/src/reel_picture_asset.cc +++ b/src/reel_picture_asset.cc @@ -22,7 +22,7 @@ */ #include "reel_picture_asset.h" -#include "picture_mxf.h" +#include "picture_asset.h" #include "dcp_assert.h" #include "compose.hpp" #include @@ -43,7 +43,7 @@ ReelPictureAsset::ReelPictureAsset () } -ReelPictureAsset::ReelPictureAsset (shared_ptr asset, int64_t entry_point) +ReelPictureAsset::ReelPictureAsset (shared_ptr asset, int64_t entry_point) : ReelMXFAsset (asset, asset->key_id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point) , _frame_rate (asset->frame_rate ()) , _screen_aspect_ratio (asset->screen_aspect_ratio ()) diff --git a/src/reel_picture_asset.h b/src/reel_picture_asset.h index fd4d11fc..a41cd9d2 100644 --- a/src/reel_picture_asset.h +++ b/src/reel_picture_asset.h @@ -25,26 +25,26 @@ #define LIBDCP_REEL_PICTURE_ASSET_H #include "reel_mxf_asset.h" -#include "picture_mxf.h" +#include "picture_asset.h" namespace dcp { /** @class ReelPictureAsset - * @brief Part of a Reel's description which refers to a picture MXF. + * @brief Part of a Reel's description which refers to a picture asset. */ class ReelPictureAsset : public ReelMXFAsset { public: ReelPictureAsset (); - ReelPictureAsset (boost::shared_ptr asset, int64_t entry_point); + ReelPictureAsset (boost::shared_ptr asset, int64_t entry_point); ReelPictureAsset (boost::shared_ptr); virtual void write_to_cpl (xmlpp::Node* node, Standard standard) const; virtual bool equals (boost::shared_ptr, EqualityOptions, NoteHandler) const; - /** @return the PictureMXF that this object refers to */ - boost::shared_ptr mxf () { - return boost::dynamic_pointer_cast (_asset.object ()); + /** @return the PictureAsset that this object refers to */ + boost::shared_ptr asset () { + return boost::dynamic_pointer_cast (_asset_ref.object ()); } /** @return picture frame rate */ diff --git a/src/reel_sound_asset.cc b/src/reel_sound_asset.cc index 504d376d..b3ca5234 100644 --- a/src/reel_sound_asset.cc +++ b/src/reel_sound_asset.cc @@ -29,7 +29,7 @@ using std::string; using boost::shared_ptr; using namespace dcp; -ReelSoundAsset::ReelSoundAsset (shared_ptr asset, int64_t entry_point) +ReelSoundAsset::ReelSoundAsset (shared_ptr asset, int64_t entry_point) : ReelMXFAsset (asset, asset->key_id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point) { diff --git a/src/reel_sound_asset.h b/src/reel_sound_asset.h index 92667429..d7eee59d 100644 --- a/src/reel_sound_asset.h +++ b/src/reel_sound_asset.h @@ -22,7 +22,7 @@ */ #include "reel_mxf_asset.h" -#include "sound_mxf.h" +#include "sound_asset.h" #include #include @@ -34,19 +34,19 @@ namespace dcp { class ReelSoundAsset : public ReelMXFAsset { public: - ReelSoundAsset (boost::shared_ptr content, int64_t entry_point); + ReelSoundAsset (boost::shared_ptr content, int64_t entry_point); ReelSoundAsset (boost::shared_ptr); void write_to_cpl (xmlpp::Node* node, Standard standard) const; - /** @return the SoundMXF that this object refers to */ - boost::shared_ptr mxf () { - return boost::dynamic_pointer_cast (_asset.object ()); + /** @return the SoundAsset that this object refers to */ + boost::shared_ptr asset () { + return boost::dynamic_pointer_cast (_asset_ref.object ()); } - /** @return the SoundMXF that this object refers to */ - boost::shared_ptr mxf () const { - return boost::dynamic_pointer_cast (_asset.object ()); + /** @return the SoundAsset that this object refers to */ + boost::shared_ptr asset () const { + return boost::dynamic_pointer_cast (_asset_ref.object ()); } private: diff --git a/src/reel_stereo_picture_asset.cc b/src/reel_stereo_picture_asset.cc index 09178dc2..e6e17f63 100644 --- a/src/reel_stereo_picture_asset.cc +++ b/src/reel_stereo_picture_asset.cc @@ -22,7 +22,7 @@ */ #include "reel_stereo_picture_asset.h" -#include "stereo_picture_mxf.h" +#include "stereo_picture_asset.h" #include using std::string; @@ -36,7 +36,7 @@ ReelStereoPictureAsset::ReelStereoPictureAsset () } -ReelStereoPictureAsset::ReelStereoPictureAsset (boost::shared_ptr mxf, int64_t entry_point) +ReelStereoPictureAsset::ReelStereoPictureAsset (boost::shared_ptr mxf, int64_t entry_point) : ReelPictureAsset (mxf, entry_point) { diff --git a/src/reel_stereo_picture_asset.h b/src/reel_stereo_picture_asset.h index 57cc4da1..df939a9c 100644 --- a/src/reel_stereo_picture_asset.h +++ b/src/reel_stereo_picture_asset.h @@ -28,7 +28,7 @@ namespace dcp { -class StereoPictureMXF; +class StereoPictureAsset; /** @class ReelStereoPictureAsset * @brief Part of a Reel's description which refers to a stereoscopic picture MXF. @@ -37,7 +37,7 @@ class ReelStereoPictureAsset : public ReelPictureAsset { public: ReelStereoPictureAsset (); - ReelStereoPictureAsset (boost::shared_ptr content, int64_t entry_point); + ReelStereoPictureAsset (boost::shared_ptr content, int64_t entry_point); ReelStereoPictureAsset (boost::shared_ptr); private: diff --git a/src/reel_subtitle_asset.h b/src/reel_subtitle_asset.h index f296fdc6..55881f7e 100644 --- a/src/reel_subtitle_asset.h +++ b/src/reel_subtitle_asset.h @@ -41,7 +41,7 @@ public: ReelSubtitleAsset (boost::shared_ptr); boost::shared_ptr subtitle_asset () const { - return boost::dynamic_pointer_cast (_asset.object ()); + return boost::dynamic_pointer_cast (_asset_ref.object ()); } private: diff --git a/src/sound_mxf.cc b/src/sound_asset.cc similarity index 88% rename from src/sound_mxf.cc rename to src/sound_asset.cc index 19a30bff..3d23b426 100644 --- a/src/sound_mxf.cc +++ b/src/sound_asset.cc @@ -18,14 +18,14 @@ */ /** @file src/sound_mxf.cc - * @brief SoundMXF class. + * @brief SoundAsset class. */ -#include "sound_mxf.h" +#include "sound_asset.h" #include "util.h" #include "exceptions.h" #include "sound_frame.h" -#include "sound_mxf_writer.h" +#include "sound_asset_writer.h" #include "compose.hpp" #include "KM_fileio.h" #include "AS_DCP.h" @@ -43,11 +43,8 @@ using std::list; using boost::shared_ptr; using namespace dcp; -SoundMXF::SoundMXF (boost::filesystem::path file) +SoundAsset::SoundAsset (boost::filesystem::path file) : Asset (file) - , _intrinsic_duration (0) - , _channels (0) - , _sampling_rate (0) { ASDCP::PCM::MXFReader reader; Kumu::Result_t r = reader.OpenRead (file.string().c_str()); @@ -74,7 +71,7 @@ SoundMXF::SoundMXF (boost::filesystem::path file) _id = read_writer_info (info); } -SoundMXF::SoundMXF (Fraction edit_rate, int sampling_rate, int channels) +SoundAsset::SoundAsset (Fraction edit_rate, int sampling_rate, int channels) : _edit_rate (edit_rate) , _intrinsic_duration (0) , _channels (channels) @@ -84,7 +81,7 @@ SoundMXF::SoundMXF (Fraction edit_rate, int sampling_rate, int channels) } bool -SoundMXF::equals (shared_ptr other, EqualityOptions opt, NoteHandler note) const +SoundAsset::equals (shared_ptr other, EqualityOptions opt, NoteHandler note) const { ASDCP::PCM::MXFReader reader_A; Kumu::Result_t r = reader_A.OpenRead (file().string().c_str()); @@ -156,21 +153,21 @@ SoundMXF::equals (shared_ptr other, EqualityOptions opt, NoteHandle } shared_ptr -SoundMXF::get_frame (int n) const +SoundAsset::get_frame (int n) const { /* XXX: should add on entry point here? */ return shared_ptr (new SoundFrame (file(), n, _decryption_context)); } -shared_ptr -SoundMXF::start_write (boost::filesystem::path file, Standard standard) +shared_ptr +SoundAsset::start_write (boost::filesystem::path file, Standard standard) { /* XXX: can't we use a shared_ptr here? */ - return shared_ptr (new SoundMXFWriter (this, file, standard)); + return shared_ptr (new SoundAssetWriter (this, file, standard)); } string -SoundMXF::pkl_type (Standard standard) const +SoundAsset::pkl_type (Standard standard) const { switch (standard) { case INTEROP: diff --git a/src/sound_mxf.h b/src/sound_asset.h similarity index 77% rename from src/sound_mxf.h rename to src/sound_asset.h index ed0a60d6..5a7dc214 100644 --- a/src/sound_mxf.h +++ b/src/sound_asset.h @@ -17,12 +17,12 @@ */ -/** @file src/sound_mxf.h - * @brief SoundMXF class +/** @file src/sound_asset.h + * @brief SoundAsset class */ -#ifndef LIBDCP_SOUND_MXF_H -#define LIBDCP_SOUND_MXF_H +#ifndef LIBDCP_SOUND_ASSET_H +#define LIBDCP_SOUND_ASSET_H #include "mxf.h" #include "types.h" @@ -32,18 +32,18 @@ namespace dcp { class SoundFrame; -class SoundMXFWriter; +class SoundAssetWriter; -/** @class SoundMXF - * @brief Representation of a MXF file containing sound +/** @class SoundAsset + * @brief Representation of a sound asset */ -class SoundMXF : public Asset, public MXF +class SoundAsset : public Asset, public MXF { public: - SoundMXF (boost::filesystem::path file); - SoundMXF (Fraction edit_rate, int sampling_rate, int channels); + SoundAsset (boost::filesystem::path file); + SoundAsset (Fraction edit_rate, int sampling_rate, int channels); - boost::shared_ptr start_write (boost::filesystem::path file, Standard standard); + boost::shared_ptr start_write (boost::filesystem::path file, Standard standard); bool equals ( boost::shared_ptr other, @@ -72,7 +72,7 @@ public: } private: - friend class SoundMXFWriter; + friend class SoundAssetWriter; std::string pkl_type (Standard standard) const; diff --git a/src/sound_mxf_writer.cc b/src/sound_asset_writer.cc similarity index 72% rename from src/sound_mxf_writer.cc rename to src/sound_asset_writer.cc index 71b72aa8..8d302ed3 100644 --- a/src/sound_mxf_writer.cc +++ b/src/sound_asset_writer.cc @@ -17,8 +17,8 @@ */ -#include "sound_mxf_writer.h" -#include "sound_mxf.h" +#include "sound_asset_writer.h" +#include "sound_asset.h" #include "exceptions.h" #include "dcp_assert.h" #include "compose.hpp" @@ -26,7 +26,7 @@ using namespace dcp; -struct SoundMXFWriter::ASDCPState +struct SoundAssetWriter::ASDCPState { ASDCP::PCM::MXFWriter mxf_writer; ASDCP::PCM::FrameBuffer frame_buffer; @@ -34,20 +34,20 @@ struct SoundMXFWriter::ASDCPState ASDCP::PCM::AudioDescriptor audio_desc; }; -SoundMXFWriter::SoundMXFWriter (SoundMXF* m, boost::filesystem::path file, Standard standard) - : MXFWriter (m, file) - , _state (new SoundMXFWriter::ASDCPState) - , _sound_mxf (m) +SoundAssetWriter::SoundAssetWriter (SoundAsset* asset, boost::filesystem::path file, Standard standard) + : AssetWriter (asset, file) + , _state (new SoundAssetWriter::ASDCPState) + , _sound_asset (asset) , _frame_buffer_offset (0) { /* Derived from ASDCP::Wav::SimpleWaveHeader::FillADesc */ - _state->audio_desc.EditRate = ASDCP::Rational (_sound_mxf->edit_rate().numerator, _sound_mxf->edit_rate().denominator); - _state->audio_desc.AudioSamplingRate = ASDCP::Rational (_sound_mxf->sampling_rate(), 1); + _state->audio_desc.EditRate = ASDCP::Rational (_sound_asset->edit_rate().numerator, _sound_asset->edit_rate().denominator); + _state->audio_desc.AudioSamplingRate = ASDCP::Rational (_sound_asset->sampling_rate(), 1); _state->audio_desc.Locked = 0; - _state->audio_desc.ChannelCount = _sound_mxf->channels (); + _state->audio_desc.ChannelCount = _sound_asset->channels (); _state->audio_desc.QuantizationBits = 24; - _state->audio_desc.BlockAlign = 3 * _sound_mxf->channels(); - _state->audio_desc.AvgBps = _sound_mxf->sampling_rate() * _state->audio_desc.BlockAlign; + _state->audio_desc.BlockAlign = 3 * _sound_asset->channels(); + _state->audio_desc.AvgBps = _sound_asset->sampling_rate() * _state->audio_desc.BlockAlign; _state->audio_desc.LinkedTrackID = 0; _state->audio_desc.ChannelFormat = ASDCP::PCM::CF_NONE; @@ -55,18 +55,18 @@ SoundMXFWriter::SoundMXFWriter (SoundMXF* m, boost::filesystem::path file, Stand _state->frame_buffer.Size (ASDCP::PCM::CalcFrameBufferSize (_state->audio_desc)); memset (_state->frame_buffer.Data(), 0, _state->frame_buffer.Capacity()); - _sound_mxf->fill_writer_info (&_state->writer_info, _sound_mxf->id(), standard); + _sound_asset->fill_writer_info (&_state->writer_info, _sound_asset->id(), standard); Kumu::Result_t r = _state->mxf_writer.OpenWrite (file.string().c_str(), _state->writer_info, _state->audio_desc); if (ASDCP_FAILURE (r)) { boost::throw_exception (FileError ("could not open audio MXF for writing", file.string(), r)); } - _sound_mxf->set_file (file); + _sound_asset->set_file (file); } void -SoundMXFWriter::write (float const * const * data, int frames) +SoundAssetWriter::write (float const * const * data, int frames) { DCP_ASSERT (!_finalized); @@ -75,13 +75,13 @@ SoundMXFWriter::write (float const * const * data, int frames) byte_t* out = _state->frame_buffer.Data() + _frame_buffer_offset; /* Write one sample per channel */ - for (int j = 0; j < _sound_mxf->channels(); ++j) { + for (int j = 0; j < _sound_asset->channels(); ++j) { int32_t const s = data[j][i] * (1 << 23); *out++ = (s & 0xff); *out++ = (s & 0xff00) >> 8; *out++ = (s & 0xff0000) >> 16; } - _frame_buffer_offset += 3 * _sound_mxf->channels(); + _frame_buffer_offset += 3 * _sound_asset->channels(); DCP_ASSERT (_frame_buffer_offset <= int (_state->frame_buffer.Capacity())); @@ -95,7 +95,7 @@ SoundMXFWriter::write (float const * const * data, int frames) } void -SoundMXFWriter::write_current_frame () +SoundAssetWriter::write_current_frame () { ASDCP::Result_t const r = _state->mxf_writer.WriteFrame (_state->frame_buffer, _encryption_context, 0); if (ASDCP_FAILURE (r)) { @@ -106,7 +106,7 @@ SoundMXFWriter::write_current_frame () } void -SoundMXFWriter::finalize () +SoundAssetWriter::finalize () { if (_frame_buffer_offset > 0) { write_current_frame (); @@ -116,6 +116,6 @@ SoundMXFWriter::finalize () boost::throw_exception (MiscError ("could not finalise audio MXF")); } - _sound_mxf->_intrinsic_duration = _frames_written; - MXFWriter::finalize (); + _sound_asset->_intrinsic_duration = _frames_written; + AssetWriter::finalize (); } diff --git a/src/sound_mxf_writer.h b/src/sound_asset_writer.h similarity index 71% rename from src/sound_mxf_writer.h rename to src/sound_asset_writer.h index d79c60db..8c54b618 100644 --- a/src/sound_mxf_writer.h +++ b/src/sound_asset_writer.h @@ -17,11 +17,11 @@ */ -/** @file src/sound_mxf_writer.h - * @brief SoundMXFWriter class. +/** @file src/sound_asset_writer.h + * @brief SoundAssetWriter class. */ -#include "mxf_writer.h" +#include "asset_writer.h" #include "types.h" #include #include @@ -29,27 +29,27 @@ namespace dcp { class SoundFrame; -class SoundMXF; +class SoundAsset; -/** @class SoundMXFWriter - * @brief A helper class for writing to SoundMXFs. +/** @class SoundAssetWriter + * @brief A helper class for writing to SoundAssets. * - * Objects of this class can only be created with SoundMXF::start_write(). + * Objects of this class can only be created with SoundAsset::start_write(). * - * Sound samples can be written to the SoundMXF by calling write() with + * Sound samples can be written to the SoundAsset by calling write() with * a buffer of float values. finalize() must be called after the last samples * have been written. */ -class SoundMXFWriter : public MXFWriter +class SoundAssetWriter : public AssetWriter { public: void write (float const * const *, int); void finalize (); private: - friend class SoundMXF; + friend class SoundAsset; - SoundMXFWriter (SoundMXF *, boost::filesystem::path, Standard standard); + SoundAssetWriter (SoundAsset *, boost::filesystem::path, Standard standard); void write_current_frame (); @@ -60,7 +60,7 @@ private: struct ASDCPState; boost::shared_ptr _state; - SoundMXF* _sound_mxf; + SoundAsset* _sound_asset; int _frame_buffer_offset; }; diff --git a/src/sound_frame.cc b/src/sound_frame.cc index c79b29b3..166ac584 100644 --- a/src/sound_frame.cc +++ b/src/sound_frame.cc @@ -29,12 +29,12 @@ using namespace std; using namespace dcp; -SoundFrame::SoundFrame (boost::filesystem::path mxf_path, int n, ASDCP::AESDecContext* c) +SoundFrame::SoundFrame (boost::filesystem::path path, int n, ASDCP::AESDecContext* c) { ASDCP::PCM::MXFReader reader; - Kumu::Result_t r = reader.OpenRead (mxf_path.string().c_str()); + Kumu::Result_t r = reader.OpenRead (path.string().c_str()); if (ASDCP_FAILURE (r)) { - boost::throw_exception (FileError ("could not open MXF file for reading", mxf_path, r)); + boost::throw_exception (FileError ("could not open MXF file for reading", path, r)); } /* XXX: unfortunate guesswork on this buffer size */ diff --git a/src/sound_frame.h b/src/sound_frame.h index 26f738d3..8b53dd71 100644 --- a/src/sound_frame.h +++ b/src/sound_frame.h @@ -44,7 +44,7 @@ namespace dcp { class SoundFrame : public boost::noncopyable { public: - SoundFrame (boost::filesystem::path mxf_path, int n, ASDCP::AESDecContext *); + SoundFrame (boost::filesystem::path path, int n, ASDCP::AESDecContext *); ~SoundFrame (); uint8_t const * data () const; diff --git a/src/stereo_picture_mxf.cc b/src/stereo_picture_asset.cc similarity index 82% rename from src/stereo_picture_mxf.cc rename to src/stereo_picture_asset.cc index 0ac0cc83..452c3675 100644 --- a/src/stereo_picture_mxf.cc +++ b/src/stereo_picture_asset.cc @@ -18,10 +18,10 @@ */ #include "AS_DCP.h" -#include "stereo_picture_mxf.h" +#include "stereo_picture_asset.h" #include "stereo_picture_frame.h" #include "exceptions.h" -#include "stereo_picture_mxf_writer.h" +#include "stereo_picture_asset_writer.h" #include "dcp_assert.h" using std::string; @@ -31,8 +31,8 @@ using boost::shared_ptr; using boost::dynamic_pointer_cast; using namespace dcp; -StereoPictureMXF::StereoPictureMXF (boost::filesystem::path file) - : PictureMXF (file) +StereoPictureAsset::StereoPictureAsset (boost::filesystem::path file) + : PictureAsset (file) { ASDCP::JP2K::MXFSReader reader; Kumu::Result_t r = reader.OpenRead (file.string().c_str()); @@ -55,27 +55,27 @@ StereoPictureMXF::StereoPictureMXF (boost::filesystem::path file) _id = read_writer_info (info); } -StereoPictureMXF::StereoPictureMXF (Fraction edit_rate) - : PictureMXF +StereoPictureAsset::StereoPictureAsset (Fraction edit_rate) + : PictureAsset (edit_rate) { } shared_ptr -StereoPictureMXF::get_frame (int n) const +StereoPictureAsset::get_frame (int n) const { return shared_ptr (new StereoPictureFrame (file().string(), n)); } -shared_ptr -StereoPictureMXF::start_write (boost::filesystem::path file, Standard standard, bool overwrite) +shared_ptr +StereoPictureAsset::start_write (boost::filesystem::path file, Standard standard, bool overwrite) { - return shared_ptr (new StereoPictureMXFWriter (this, file, standard, overwrite)); + return shared_ptr (new StereoPictureAssetWriter (this, file, standard, overwrite)); } bool -StereoPictureMXF::equals (shared_ptr other, EqualityOptions opt, NoteHandler note) const +StereoPictureAsset::equals (shared_ptr other, EqualityOptions opt, NoteHandler note) const { ASDCP::JP2K::MXFSReader reader_A; Kumu::Result_t r = reader_A.OpenRead (file().string().c_str()); @@ -102,7 +102,7 @@ StereoPictureMXF::equals (shared_ptr other, EqualityOptions opt, No return false; } - shared_ptr other_picture = dynamic_pointer_cast (other); + shared_ptr other_picture = dynamic_pointer_cast (other); DCP_ASSERT (other_picture); for (int i = 0; i < _intrinsic_duration; ++i) { diff --git a/src/stereo_picture_mxf.h b/src/stereo_picture_asset.h similarity index 67% rename from src/stereo_picture_mxf.h rename to src/stereo_picture_asset.h index 9a094d19..2fe893de 100644 --- a/src/stereo_picture_mxf.h +++ b/src/stereo_picture_asset.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2012-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 @@ -17,22 +17,22 @@ */ -#ifndef LIBDCP_STEREO_PICTURE_MXF_H -#define LIBDCP_STEREO_PICTURE_MXF_H +#ifndef LIBDCP_STEREO_PICTURE_ASSET_H +#define LIBDCP_STEREO_PICTURE_ASSET_H -#include "picture_mxf.h" +#include "picture_asset.h" namespace dcp { /** A 3D (stereoscopic) picture asset */ -class StereoPictureMXF : public PictureMXF +class StereoPictureAsset : public PictureAsset { public: - StereoPictureMXF (boost::filesystem::path file); - StereoPictureMXF (Fraction edit_rate); + StereoPictureAsset (boost::filesystem::path file); + StereoPictureAsset (Fraction edit_rate); - /** Start a progressive write to a StereoPictureMXF */ - boost::shared_ptr start_write (boost::filesystem::path file, Standard, bool); + /** Start a progressive write to a StereoPictureAsset */ + boost::shared_ptr start_write (boost::filesystem::path file, Standard, bool); bool equals ( boost::shared_ptr other, diff --git a/src/stereo_picture_mxf_writer.cc b/src/stereo_picture_asset_writer.cc similarity index 72% rename from src/stereo_picture_mxf_writer.cc rename to src/stereo_picture_asset_writer.cc index 7a65556f..be265d1e 100644 --- a/src/stereo_picture_mxf_writer.cc +++ b/src/stereo_picture_asset_writer.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2012-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 @@ -17,14 +17,14 @@ */ -#include "stereo_picture_mxf_writer.h" +#include "stereo_picture_asset_writer.h" #include "exceptions.h" #include "dcp_assert.h" -#include "picture_mxf.h" +#include "picture_asset.h" #include "AS_DCP.h" #include "KM_fileio.h" -#include "picture_mxf_writer_common.cc" +#include "picture_asset_writer_common.cc" using std::istream; using std::ostream; @@ -32,24 +32,24 @@ using std::string; using boost::shared_ptr; using namespace dcp; -struct StereoPictureMXFWriter::ASDCPState : public ASDCPStateBase +struct StereoPictureAssetWriter::ASDCPState : public ASDCPStateBase { ASDCP::JP2K::MXFSWriter mxf_writer; }; -StereoPictureMXFWriter::StereoPictureMXFWriter (PictureMXF* mxf, boost::filesystem::path file, Standard standard, bool overwrite) - : PictureMXFWriter (mxf, file, standard, overwrite) - , _state (new StereoPictureMXFWriter::ASDCPState) +StereoPictureAssetWriter::StereoPictureAssetWriter (PictureAsset* mxf, boost::filesystem::path file, Standard standard, bool overwrite) + : PictureAssetWriter (mxf, file, standard, overwrite) + , _state (new StereoPictureAssetWriter::ASDCPState) , _next_eye (EYE_LEFT) { } void -StereoPictureMXFWriter::start (uint8_t* data, int size) +StereoPictureAssetWriter::start (uint8_t* data, int size) { - dcp::start (this, _state, _standard, _picture_mxf, data, size); - _picture_mxf->set_frame_rate (Fraction (_picture_mxf->edit_rate().numerator * 2, _picture_mxf->edit_rate().denominator)); + dcp::start (this, _state, _standard, _picture_asset, data, size); + _picture_asset->set_frame_rate (Fraction (_picture_asset->edit_rate().numerator * 2, _picture_asset->edit_rate().denominator)); } /** Write a frame for one eye. Frames must be written left, then right, then left etc. @@ -57,7 +57,7 @@ StereoPictureMXFWriter::start (uint8_t* data, int size) * @param size Size of data. */ FrameInfo -StereoPictureMXFWriter::write (uint8_t* data, int size) +StereoPictureAssetWriter::write (uint8_t* data, int size) { DCP_ASSERT (!_finalized); @@ -94,7 +94,7 @@ StereoPictureMXFWriter::write (uint8_t* data, int size) } void -StereoPictureMXFWriter::fake_write (int size) +StereoPictureAssetWriter::fake_write (int size) { DCP_ASSERT (_started); DCP_ASSERT (!_finalized); @@ -111,13 +111,13 @@ StereoPictureMXFWriter::fake_write (int size) } void -StereoPictureMXFWriter::finalize () +StereoPictureAssetWriter::finalize () { Kumu::Result_t r = _state->mxf_writer.Finalize(); if (ASDCP_FAILURE (r)) { boost::throw_exception (MXFFileError ("error in finalizing video MXF", _file.string(), r)); } - _picture_mxf->_intrinsic_duration = _frames_written; - PictureMXFWriter::finalize (); + _picture_asset->_intrinsic_duration = _frames_written; + PictureAssetWriter::finalize (); } diff --git a/src/stereo_picture_mxf_writer.h b/src/stereo_picture_asset_writer.h similarity index 90% rename from src/stereo_picture_mxf_writer.h rename to src/stereo_picture_asset_writer.h index 5491a64d..bd41b45e 100644 --- a/src/stereo_picture_mxf_writer.h +++ b/src/stereo_picture_asset_writer.h @@ -17,7 +17,7 @@ */ -#include "picture_mxf_writer.h" +#include "picture_asset_writer.h" #include "types.h" #include #include @@ -37,7 +37,7 @@ namespace dcp { * The action of finalize() can't be done in MonoPictureAssetWriter's destructor as it may * throw an exception. */ -class StereoPictureMXFWriter : public PictureMXFWriter +class StereoPictureAssetWriter : public PictureAssetWriter { public: /** Write a frame for one eye. Frames must be written left, then right, then left etc. @@ -49,9 +49,9 @@ public: void finalize (); private: - friend class StereoPictureMXF; + friend class StereoPictureAsset; - StereoPictureMXFWriter (PictureMXF *, boost::filesystem::path file, Standard, bool); + StereoPictureAssetWriter (PictureAsset *, boost::filesystem::path file, Standard, bool); void start (uint8_t *, int); /* do this with an opaque pointer so we don't have to include diff --git a/src/stereo_picture_frame.cc b/src/stereo_picture_frame.cc index 3ee08303..855795eb 100644 --- a/src/stereo_picture_frame.cc +++ b/src/stereo_picture_frame.cc @@ -37,19 +37,19 @@ using namespace dcp; * @param mxf_path Path to the asset's MXF file. * @param n Frame within the asset, not taking EntryPoint into account. */ -StereoPictureFrame::StereoPictureFrame (boost::filesystem::path mxf_path, int n) +StereoPictureFrame::StereoPictureFrame (boost::filesystem::path path, int n) { ASDCP::JP2K::MXFSReader reader; - Kumu::Result_t r = reader.OpenRead (mxf_path.string().c_str()); + Kumu::Result_t r = reader.OpenRead (path.string().c_str()); if (ASDCP_FAILURE (r)) { - boost::throw_exception (FileError ("could not open MXF file for reading", mxf_path, r)); + boost::throw_exception (FileError ("could not open MXF file for reading", path, r)); } /* XXX: unfortunate guesswork on this buffer size */ _buffer = new ASDCP::JP2K::SFrameBuffer (4 * Kumu::Megabyte); if (ASDCP_FAILURE (reader.ReadFrame (n, *_buffer))) { - boost::throw_exception (DCPReadError (String::compose ("could not read video frame %1 of %2", n, mxf_path.string()))); + boost::throw_exception (DCPReadError (String::compose ("could not read video frame %1 of %2", n, path.string()))); } } diff --git a/src/stereo_picture_frame.h b/src/stereo_picture_frame.h index 0aeb6849..261bac93 100644 --- a/src/stereo_picture_frame.h +++ b/src/stereo_picture_frame.h @@ -38,7 +38,7 @@ class XYZImage; class StereoPictureFrame : public boost::noncopyable { public: - StereoPictureFrame (boost::filesystem::path mxf_path, int n); + StereoPictureFrame (boost::filesystem::path path, int n); StereoPictureFrame (); ~StereoPictureFrame (); diff --git a/src/types.h b/src/types.h index a8e63faf..626666b4 100644 --- a/src/types.h +++ b/src/types.h @@ -160,7 +160,6 @@ struct EqualityOptions , max_std_dev_pixel_error (0) , max_audio_sample_error (0) , cpl_annotation_texts_can_differ (false) - , mxf_filenames_can_differ (false) , reel_annotation_texts_can_differ (false) , reel_hashes_can_differ (false) {} @@ -173,8 +172,6 @@ struct EqualityOptions int max_audio_sample_error; /** true if the nodes of CPLs are allowed to differ */ bool cpl_annotation_texts_can_differ; - /** true if MXF file leafnames are allowed to differ */ - bool mxf_filenames_can_differ; /** true if the nodes of Reels are allowed to differ */ bool reel_annotation_texts_can_differ; /** true if es in Reels can differ */ diff --git a/src/wscript b/src/wscript index 54f3a03b..ac3d9b0c 100644 --- a/src/wscript +++ b/src/wscript @@ -24,14 +24,14 @@ def build(bld): local_time.cc metadata.cc modified_gamma_transfer_function.cc - mono_picture_mxf.cc - mono_picture_mxf_writer.cc + mono_picture_asset.cc + mono_picture_asset_writer.cc mono_picture_frame.cc mxf.cc - mxf_writer.cc + asset_writer.cc object.cc - picture_mxf.cc - picture_mxf_writer.cc + picture_asset.cc + picture_asset_writer.cc reel.cc reel_asset.cc reel_mono_picture_asset.cc @@ -44,11 +44,11 @@ def build(bld): signer.cc smpte_load_font_node.cc smpte_subtitle_asset.cc - sound_mxf.cc - sound_mxf_writer.cc + sound_asset.cc + sound_asset_writer.cc sound_frame.cc - stereo_picture_mxf.cc - stereo_picture_mxf_writer.cc + stereo_picture_asset.cc + stereo_picture_asset_writer.cc stereo_picture_frame.cc subtitle_node.cc subtitle_asset.cc @@ -83,14 +83,14 @@ def build(bld): load_font_node.h local_time.h metadata.h - mono_picture_mxf.h + mono_picture_asset.h mono_picture_frame.h modified_gamma_transfer_function.h mxf.h - mxf_writer.h + asset_writer.h object.h - picture_mxf.h - picture_mxf_writer.h + picture_asset.h + picture_asset_writer.h raw_convert.h rgb_xyz.h reel.h @@ -106,9 +106,9 @@ def build(bld): smpte_load_font_node.h smpte_subtitle_asset.h sound_frame.h - sound_mxf.h - sound_mxf_writer.h - stereo_picture_mxf.h + sound_asset.h + sound_asset_writer.h + stereo_picture_asset.h stereo_picture_frame.h subtitle_node.h subtitle_asset.h diff --git a/test/cpl_sar_test.cc b/test/cpl_sar_test.cc index bce57f58..691439db 100644 --- a/test/cpl_sar_test.cc +++ b/test/cpl_sar_test.cc @@ -19,7 +19,7 @@ #include "cpl.h" #include "reel_mono_picture_asset.h" -#include "mono_picture_mxf.h" +#include "mono_picture_asset.h" #include #include @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE (cpl_sar) { shared_ptr pa ( new dcp::ReelMonoPictureAsset ( - shared_ptr (new dcp::MonoPictureMXF ("test/ref/DCP/dcp_test1/video.mxf")), + shared_ptr (new dcp::MonoPictureAsset ("test/ref/DCP/dcp_test1/video.mxf")), 0 ) ); diff --git a/test/dcp_test.cc b/test/dcp_test.cc index 6da30ffe..c4950704 100644 --- a/test/dcp_test.cc +++ b/test/dcp_test.cc @@ -20,11 +20,11 @@ #include "dcp.h" #include "metadata.h" #include "cpl.h" -#include "mono_picture_mxf.h" -#include "stereo_picture_mxf.h" -#include "picture_mxf_writer.h" -#include "sound_mxf_writer.h" -#include "sound_mxf.h" +#include "mono_picture_asset.h" +#include "stereo_picture_asset.h" +#include "picture_asset_writer.h" +#include "sound_asset_writer.h" +#include "sound_asset.h" #include "reel.h" #include "test.h" #include "file.h" @@ -62,18 +62,18 @@ BOOST_AUTO_TEST_CASE (dcp_test1) cpl->set_content_version_label_text ("81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00"); cpl->set_metadata (xml_meta); - shared_ptr mp (new dcp::MonoPictureMXF (dcp::Fraction (24, 1))); + shared_ptr mp (new dcp::MonoPictureAsset (dcp::Fraction (24, 1))); mp->set_metadata (mxf_meta); - shared_ptr picture_writer = mp->start_write ("build/test/DCP/dcp_test1/video.mxf", dcp::SMPTE, false); + shared_ptr picture_writer = mp->start_write ("build/test/DCP/dcp_test1/video.mxf", dcp::SMPTE, false); dcp::File j2c ("test/data/32x32_red_square.j2c"); for (int i = 0; i < 24; ++i) { picture_writer->write (j2c.data (), j2c.size ()); } picture_writer->finalize (); - shared_ptr ms (new dcp::SoundMXF (dcp::Fraction (24, 1), 48000, 1)); + shared_ptr ms (new dcp::SoundAsset (dcp::Fraction (24, 1), 48000, 1)); ms->set_metadata (mxf_meta); - shared_ptr sound_writer = ms->start_write ("build/test/DCP/dcp_test1/audio.mxf", dcp::SMPTE); + shared_ptr sound_writer = ms->start_write ("build/test/DCP/dcp_test1/audio.mxf", dcp::SMPTE); SF_INFO info; info.format = 0; @@ -133,9 +133,9 @@ BOOST_AUTO_TEST_CASE (dcp_test2) cpl->set_content_version_label_text ("81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00"); cpl->set_metadata (xml_meta); - shared_ptr mp (new dcp::StereoPictureMXF (dcp::Fraction (24, 1))); + shared_ptr mp (new dcp::StereoPictureAsset (dcp::Fraction (24, 1))); mp->set_metadata (mxf_meta); - shared_ptr picture_writer = mp->start_write ("build/test/DCP/dcp_test2/video.mxf", dcp::SMPTE, false); + shared_ptr picture_writer = mp->start_write ("build/test/DCP/dcp_test2/video.mxf", dcp::SMPTE, false); dcp::File j2c ("test/data/32x32_red_square.j2c"); for (int i = 0; i < 24; ++i) { /* Left */ @@ -145,9 +145,9 @@ BOOST_AUTO_TEST_CASE (dcp_test2) } picture_writer->finalize (); - shared_ptr ms (new dcp::SoundMXF (dcp::Fraction (24, 1), 48000, 1)); + shared_ptr ms (new dcp::SoundAsset (dcp::Fraction (24, 1), 48000, 1)); ms->set_metadata (mxf_meta); - shared_ptr sound_writer = ms->start_write ("build/test/DCP/dcp_test2/audio.mxf", dcp::SMPTE); + shared_ptr sound_writer = ms->start_write ("build/test/DCP/dcp_test2/audio.mxf", dcp::SMPTE); SF_INFO info; info.format = 0; diff --git a/test/decryption_test.cc b/test/decryption_test.cc index 0080fe3e..0974b85d 100644 --- a/test/decryption_test.cc +++ b/test/decryption_test.cc @@ -22,7 +22,7 @@ #include "cpl.h" #include "decrypted_kdm.h" #include "encrypted_kdm.h" -#include "mono_picture_mxf.h" +#include "mono_picture_asset.h" #include "reel_picture_asset.h" #include "reel.h" #include "test.h" @@ -42,10 +42,10 @@ pair get_frame (dcp::DCP const & dcp) { shared_ptr reel = dcp.cpls().front()->reels().front (); - shared_ptr picture = reel->main_picture()->mxf (); + shared_ptr picture = reel->main_picture()->asset (); BOOST_CHECK (picture); - shared_ptr mono_picture = dynamic_pointer_cast (picture); + shared_ptr mono_picture = dynamic_pointer_cast (picture); shared_ptr j2k_frame = mono_picture->get_frame (0); shared_ptr xyz = j2k_frame->xyz_image(); diff --git a/test/encryption_test.cc b/test/encryption_test.cc index 6dc37b8d..299e5f9b 100644 --- a/test/encryption_test.cc +++ b/test/encryption_test.cc @@ -23,10 +23,10 @@ #include "dcp.h" #include "signer.h" #include "cpl.h" -#include "mono_picture_mxf.h" -#include "picture_mxf_writer.h" -#include "sound_mxf_writer.h" -#include "sound_mxf.h" +#include "mono_picture_asset.h" +#include "picture_asset_writer.h" +#include "sound_asset_writer.h" +#include "sound_asset.h" #include "reel.h" #include "test.h" #include "file.h" @@ -82,20 +82,20 @@ BOOST_AUTO_TEST_CASE (encryption_test) dcp::Key key; - shared_ptr mp (new dcp::MonoPictureMXF (dcp::Fraction (24, 1))); + shared_ptr mp (new dcp::MonoPictureAsset (dcp::Fraction (24, 1))); mp->set_metadata (mxf_metadata); mp->set_key (key); - shared_ptr writer = mp->start_write ("build/test/DCP/encryption_test/video.mxf", dcp::SMPTE, false); + shared_ptr writer = mp->start_write ("build/test/DCP/encryption_test/video.mxf", dcp::SMPTE, false); dcp::File j2c ("test/data/32x32_red_square.j2c"); for (int i = 0; i < 24; ++i) { writer->write (j2c.data (), j2c.size ()); } writer->finalize (); - shared_ptr ms (new dcp::SoundMXF (dcp::Fraction (24, 1), 48000, 1)); + shared_ptr ms (new dcp::SoundAsset (dcp::Fraction (24, 1), 48000, 1)); ms->set_key (key); - shared_ptr sound_writer = ms->start_write ("build/test/DCP/encryption_test/audio.mxf", dcp::SMPTE); + shared_ptr sound_writer = ms->start_write ("build/test/DCP/encryption_test/audio.mxf", dcp::SMPTE); SF_INFO info; info.format = 0; diff --git a/test/recovery_test.cc b/test/recovery_test.cc index 1d51a711..257c512d 100644 --- a/test/recovery_test.cc +++ b/test/recovery_test.cc @@ -19,8 +19,8 @@ #include #include -#include "mono_picture_mxf_writer.h" -#include "mono_picture_mxf.h" +#include "mono_picture_asset_writer.h" +#include "mono_picture_asset.h" #include "KM_util.h" using std::string; @@ -48,8 +48,8 @@ BOOST_AUTO_TEST_CASE (recovery) boost::filesystem::remove_all ("build/test/baz"); boost::filesystem::create_directories ("build/test/baz"); - shared_ptr mp (new dcp::MonoPictureMXF (dcp::Fraction (24, 1))); - shared_ptr writer = mp->start_write ("build/test/baz/video1.mxf", dcp::SMPTE, false); + shared_ptr mp (new dcp::MonoPictureAsset (dcp::Fraction (24, 1))); + shared_ptr writer = mp->start_write ("build/test/baz/video1.mxf", dcp::SMPTE, false); int written_size = 0; for (int i = 0; i < 24; ++i) { @@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE (recovery) Kumu::ResetTestRNG (); #endif - mp.reset (new dcp::MonoPictureMXF (dcp::Fraction (24, 1))); + mp.reset (new dcp::MonoPictureAsset (dcp::Fraction (24, 1))); writer = mp->start_write ("build/test/baz/video2.mxf", dcp::SMPTE, true); writer->write (data, size); diff --git a/test/round_trip_test.cc b/test/round_trip_test.cc index 9f1030da..a719ff45 100644 --- a/test/round_trip_test.cc +++ b/test/round_trip_test.cc @@ -21,14 +21,14 @@ #include "decrypted_kdm.h" #include "encrypted_kdm.h" #include "signer.h" -#include "mono_picture_mxf.h" -#include "sound_mxf.h" +#include "mono_picture_asset.h" +#include "sound_asset.h" #include "reel.h" #include "test.h" #include "cpl.h" #include "mono_picture_frame.h" #include "certificate_chain.h" -#include "mono_picture_mxf_writer.h" +#include "mono_picture_asset_writer.h" #include "reel_picture_asset.h" #include "reel_mono_picture_asset.h" #include "file.h" @@ -43,7 +43,7 @@ using std::list; using boost::shared_ptr; using boost::scoped_array; -/* Build an encrypted picture MXF and a KDM for it and check that the KDM can be decrypted */ +/* Build an encrypted picture asset and a KDM for it and check that the KDM can be decrypted */ BOOST_AUTO_TEST_CASE (round_trip_test) { shared_ptr signer (new dcp::Signer ("openssl")); @@ -51,8 +51,8 @@ BOOST_AUTO_TEST_CASE (round_trip_test) boost::filesystem::path work_dir = "build/test/round_trip_test"; boost::filesystem::create_directory (work_dir); - shared_ptr mxf_A (new dcp::MonoPictureMXF (dcp::Fraction (24, 1))); - shared_ptr writer = mxf_A->start_write (work_dir / "video.mxf", dcp::SMPTE, false); + shared_ptr asset_A (new dcp::MonoPictureAsset (dcp::Fraction (24, 1))); + shared_ptr writer = asset_A->start_write (work_dir / "video.mxf", dcp::SMPTE, false); dcp::File j2c ("test/data/32x32_red_square.j2c"); for (int i = 0; i < 24; ++i) { writer->write (j2c.data (), j2c.size ()); @@ -61,11 +61,11 @@ BOOST_AUTO_TEST_CASE (round_trip_test) dcp::Key key; - mxf_A->set_key (key); + asset_A->set_key (key); shared_ptr cpl (new dcp::CPL ("A Test DCP", dcp::FEATURE)); shared_ptr reel (new dcp::Reel ()); - reel->add (shared_ptr (new dcp::ReelMonoPictureAsset (mxf_A, 0))); + reel->add (shared_ptr (new dcp::ReelMonoPictureAsset (asset_A, 0))); cpl->add (reel); /* A KDM using our certificate chain's leaf key pair */ @@ -98,16 +98,16 @@ BOOST_AUTO_TEST_CASE (round_trip_test) ++j; } - /* Reload the picture MXF */ - shared_ptr mxf_B ( - new dcp::MonoPictureMXF (work_dir / "video.mxf") + /* Reload the picture asset */ + shared_ptr asset_B ( + new dcp::MonoPictureAsset (work_dir / "video.mxf") ); BOOST_CHECK (!kdm_B.keys().empty ()); - mxf_B->set_key (kdm_B.keys().front().key()); + asset_B->set_key (kdm_B.keys().front().key()); - shared_ptr xyz_A = mxf_A->get_frame(0)->xyz_image (); - shared_ptr xyz_B = mxf_B->get_frame(0)->xyz_image (); + shared_ptr xyz_A = asset_A->get_frame(0)->xyz_image (); + shared_ptr xyz_B = asset_B->get_frame(0)->xyz_image (); scoped_array frame_A (new uint8_t[xyz_A->size().width * xyz_A->size().height * 4]); dcp::xyz_to_rgba (xyz_A, dcp::ColourConversion::srgb_to_xyz(), frame_A.get()); diff --git a/tools/dcpdiff.cc b/tools/dcpdiff.cc index c2a454cf..2cc10e90 100644 --- a/tools/dcpdiff.cc +++ b/tools/dcpdiff.cc @@ -46,7 +46,6 @@ help (string n) << " -V, --version show libdcp version\n" << " -h, --help show this help\n" << " -v, --verbose be verbose\n" - << " -n, --mxf-filenames allow differing MXF filenames\n" << " --cpl-annotation-texts allow differing CPL annotation texts\n" << " -m, --mean-pixel maximum allowed mean pixel error (default 5)\n" << " -s, --std-dev-pixel maximum allowed standard deviation of pixel error (default 5)\n" @@ -115,7 +114,6 @@ main (int argc, char* argv[]) { "version", no_argument, 0, 'V'}, { "help", no_argument, 0, 'h'}, { "verbose", no_argument, 0, 'v'}, - { "mxf-filenames", no_argument, 0, 'n'}, { "mean-pixel", required_argument, 0, 'm'}, { "std-dev-pixel", required_argument, 0, 's'}, { "keep-going", no_argument, 0, 'k'}, @@ -126,7 +124,7 @@ main (int argc, char* argv[]) { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "Vhvnm:s:kACD:", long_options, &option_index); + int c = getopt_long (argc, argv, "Vhvm:s:kACD:", long_options, &option_index); if (c == -1) { break; @@ -142,9 +140,6 @@ main (int argc, char* argv[]) case 'v': verbose = true; break; - case 'n': - options.mxf_filenames_can_differ = true; - break; case 'm': options.max_mean_pixel_error = atof (optarg); break; diff --git a/tools/dcpinfo.cc b/tools/dcpinfo.cc index 119a2106..965088c2 100644 --- a/tools/dcpinfo.cc +++ b/tools/dcpinfo.cc @@ -20,8 +20,8 @@ #include "dcp.h" #include "exceptions.h" #include "reel.h" -#include "sound_mxf.h" -#include "picture_mxf.h" +#include "sound_asset.h" +#include "picture_asset.h" #include "subtitle_asset.h" #include "reel_picture_asset.h" #include "reel_sound_asset.h" @@ -54,22 +54,22 @@ help (string n) static void main_picture (shared_ptr reel) { - if (reel->main_picture() && reel->main_picture()->mxf()) { + if (reel->main_picture() && reel->main_picture()->asset()) { cout << " Picture: " - << reel->main_picture()->mxf()->size().width + << reel->main_picture()->asset()->size().width << "x" - << reel->main_picture()->mxf()->size().height << "\n"; + << reel->main_picture()->asset()->size().height << "\n"; } } static void main_sound (shared_ptr reel) { - if (reel->main_sound() && reel->main_sound()->mxf()) { + if (reel->main_sound() && reel->main_sound()->asset()) { cout << " Sound: " - << reel->main_sound()->mxf()->channels() + << reel->main_sound()->asset()->channels() << " channels at " - << reel->main_sound()->mxf()->sampling_rate() << "Hz\n"; + << reel->main_sound()->asset()->sampling_rate() << "Hz\n"; } } -- 2.30.2