diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-01-17 22:16:05 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-01-17 22:16:05 +0000 |
| commit | 9fd79fb05fa47833ed431d83d73fd6d9a4a9f774 (patch) | |
| tree | ce80b7905738eb342536f48ebb1712ad0f47ab1f /src | |
| parent | f389d903e967f44a5d6eed60df48bd5a89994bb2 (diff) | |
Asset -> MXF in some cases.
Diffstat (limited to 'src')
| -rw-r--r-- | src/cpl.cc | 16 | ||||
| -rw-r--r-- | src/dcp.cc | 4 | ||||
| -rw-r--r-- | src/kdm.cc | 6 | ||||
| -rw-r--r-- | src/mono_picture_mxf.cc (renamed from src/mono_picture_asset.cc) | 30 | ||||
| -rw-r--r-- | src/mono_picture_mxf.h (renamed from src/mono_picture_asset.h) | 14 | ||||
| -rw-r--r-- | src/mono_picture_mxf_writer.cc (renamed from src/mono_picture_asset_writer.cc) | 22 | ||||
| -rw-r--r-- | src/mono_picture_mxf_writer.h (renamed from src/mono_picture_asset_writer.h) | 8 | ||||
| -rw-r--r-- | src/mxf.cc (renamed from src/mxf_asset.cc) | 16 | ||||
| -rw-r--r-- | src/mxf.h (renamed from src/mxf_asset.h) | 12 | ||||
| -rw-r--r-- | src/picture_mxf.cc (renamed from src/picture_asset.cc) | 18 | ||||
| -rw-r--r-- | src/picture_mxf.h (renamed from src/picture_asset.h) | 14 | ||||
| -rw-r--r-- | src/picture_mxf_writer.cc (renamed from src/picture_asset_writer.cc) | 6 | ||||
| -rw-r--r-- | src/picture_mxf_writer.h (renamed from src/picture_asset_writer.h) | 12 | ||||
| -rw-r--r-- | src/picture_mxf_writer_common.cc (renamed from src/picture_asset_writer_common.cc) | 2 | ||||
| -rw-r--r-- | src/reel.cc | 12 | ||||
| -rw-r--r-- | src/reel.h | 16 | ||||
| -rw-r--r-- | src/sound_mxf.cc (renamed from src/sound_asset.cc) | 36 | ||||
| -rw-r--r-- | src/sound_mxf.h (renamed from src/sound_asset.h) | 22 | ||||
| -rw-r--r-- | src/stereo_picture_mxf.cc (renamed from src/stereo_picture_asset.cc) | 30 | ||||
| -rw-r--r-- | src/stereo_picture_mxf.h (renamed from src/stereo_picture_asset.h) | 14 | ||||
| -rw-r--r-- | src/stereo_picture_mxf_writer.cc (renamed from src/stereo_picture_asset_writer.cc) | 22 | ||||
| -rw-r--r-- | src/stereo_picture_mxf_writer.h (renamed from src/stereo_picture_asset_writer.h) | 8 | ||||
| -rw-r--r-- | src/wscript | 28 |
23 files changed, 185 insertions, 183 deletions
@@ -21,9 +21,9 @@ #include "cpl.h" #include "parse/cpl.h" #include "util.h" -#include "mono_picture_asset.h" -#include "stereo_picture_asset.h" -#include "sound_asset.h" +#include "mono_picture_mxf.h" +#include "stereo_picture_mxf.h" +#include "sound_mxf.h" #include "subtitle_asset.h" #include "parse/asset_map.h" #include "reel.h" @@ -94,8 +94,8 @@ CPL::CPL (boost::filesystem::path directory, string file, list<PathAssetMap> ass _fps = p->edit_rate.numerator; _length += p->duration; - shared_ptr<PictureAsset> picture; - shared_ptr<SoundAsset> sound; + shared_ptr<PictureMXF> picture; + shared_ptr<SoundMXF> sound; shared_ptr<SubtitleAsset> subtitle; /* Some rather twisted logic to decide if we are 3D or not; @@ -109,7 +109,7 @@ CPL::CPL (boost::filesystem::path directory, string file, list<PathAssetMap> ass try { pair<string, shared_ptr<const parse::AssetMapAsset> > asset = asset_from_id (asset_maps, p->id); - picture.reset (new MonoPictureAsset (asset.first, asset.second->chunks.front()->path)); + picture.reset (new MonoPictureMXF (asset.first, asset.second->chunks.front()->path)); picture->read (); picture->set_edit_rate (_fps); @@ -129,7 +129,7 @@ CPL::CPL (boost::filesystem::path directory, string file, list<PathAssetMap> ass try { pair<string, shared_ptr<const parse::AssetMapAsset> > asset = asset_from_id (asset_maps, p->id); - picture.reset (new StereoPictureAsset (asset.first, asset.second->chunks.front()->path)); + picture.reset (new StereoPictureMXF (asset.first, asset.second->chunks.front()->path)); picture->read (); picture->set_edit_rate (_fps); @@ -153,7 +153,7 @@ CPL::CPL (boost::filesystem::path directory, string file, list<PathAssetMap> ass try { pair<string, shared_ptr<const parse::AssetMapAsset> > asset = asset_from_id (asset_maps, (*i)->asset_list->main_sound->id); - sound.reset (new SoundAsset (asset.first, asset.second->chunks.front()->path)); + sound.reset (new SoundMXF (asset.first, asset.second->chunks.front()->path)); shared_ptr<parse::MainSound> s = (*i)->asset_list->main_sound; sound->read (); @@ -33,8 +33,8 @@ #include <xmlsec/xmldsig.h> #include <xmlsec/app.h> #include "dcp.h" -#include "sound_asset.h" -#include "picture_asset.h" +#include "sound_mxf.h" +#include "picture_mxf.h" #include "subtitle_asset.h" #include "util.h" #include "metadata.h" @@ -32,7 +32,7 @@ #include "exceptions.h" #include "signer.h" #include "cpl.h" -#include "mxf_asset.h" +#include "mxf.h" #include "xml/kdm_smpte.h" using std::list; @@ -127,7 +127,7 @@ KDM::KDM ( list<shared_ptr<const ContentAsset> > assets = cpl->assets (); for (list<shared_ptr<const ContentAsset> >::iterator i = assets.begin(); i != assets.end(); ++i) { /* XXX: non-MXF assets? */ - shared_ptr<const MXFAsset> mxf = boost::dynamic_pointer_cast<const MXFAsset> (*i); + shared_ptr<const MXF> mxf = boost::dynamic_pointer_cast<const MXF> (*i); if (mxf) { apu.key_id_list.push_back (xml::TypedKeyId (mxf->key_type(), "urn:uuid:" + mxf->key_id())); } @@ -140,7 +140,7 @@ KDM::KDM ( for (list<shared_ptr<const ContentAsset> >::iterator i = assets.begin(); i != assets.end(); ++i) { /* XXX: non-MXF assets? */ - shared_ptr<const MXFAsset> mxf = boost::dynamic_pointer_cast<const MXFAsset> (*i); + shared_ptr<const MXF> mxf = boost::dynamic_pointer_cast<const MXF> (*i); if (mxf) { KDMKey kkey ( signer, cpl->id (), mxf->key_type (), mxf->key_id (), diff --git a/src/mono_picture_asset.cc b/src/mono_picture_mxf.cc index 295d8a87..30973e5a 100644 --- a/src/mono_picture_asset.cc +++ b/src/mono_picture_mxf.cc @@ -17,8 +17,8 @@ */ -#include "mono_picture_asset.h" -#include "mono_picture_asset_writer.h" +#include "mono_picture_mxf.h" +#include "mono_picture_mxf_writer.h" #include "AS_DCP.h" #include "KM_fileio.h" #include "exceptions.h" @@ -31,14 +31,14 @@ using boost::dynamic_pointer_cast; using boost::lexical_cast; using namespace dcp; -MonoPictureAsset::MonoPictureAsset (boost::filesystem::path directory, boost::filesystem::path mxf_name) - : PictureAsset (directory, mxf_name) +MonoPictureMXF::MonoPictureMXF (boost::filesystem::path directory, boost::filesystem::path mxf_name) + : PictureMXF (directory, mxf_name) { } void -MonoPictureAsset::read () +MonoPictureMXF::read () { ASDCP::JP2K::MXFReader reader; Kumu::Result_t r = reader.OpenRead (path().string().c_str()); @@ -59,21 +59,21 @@ MonoPictureAsset::read () } boost::filesystem::path -MonoPictureAsset::path_from_list (int f, vector<boost::filesystem::path> const & files) const +MonoPictureMXF::path_from_list (int f, vector<boost::filesystem::path> const & files) const { return files[f]; } shared_ptr<const MonoPictureFrame> -MonoPictureAsset::get_frame (int n) const +MonoPictureMXF::get_frame (int n) const { return shared_ptr<const MonoPictureFrame> (new MonoPictureFrame (path(), n, _decryption_context)); } bool -MonoPictureAsset::equals (shared_ptr<const ContentAsset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const +MonoPictureMXF::equals (shared_ptr<const ContentAsset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const { - if (!MXFAsset::equals (other, opt, note)) { + if (!MXF::equals (other, opt, note)) { return false; } @@ -102,7 +102,7 @@ MonoPictureAsset::equals (shared_ptr<const ContentAsset> other, EqualityOptions return false; } - shared_ptr<const MonoPictureAsset> other_picture = dynamic_pointer_cast<const MonoPictureAsset> (other); + shared_ptr<const MonoPictureMXF> other_picture = dynamic_pointer_cast<const MonoPictureMXF> (other); assert (other_picture); for (int i = 0; i < _intrinsic_duration; ++i) { @@ -126,21 +126,21 @@ MonoPictureAsset::equals (shared_ptr<const ContentAsset> other, EqualityOptions return true; } -shared_ptr<PictureAssetWriter> -MonoPictureAsset::start_write (bool overwrite) +shared_ptr<PictureMXFWriter> +MonoPictureMXF::start_write (bool overwrite) { /* XXX: can't we use shared_ptr here? */ - return shared_ptr<MonoPictureAssetWriter> (new MonoPictureAssetWriter (this, overwrite)); + return shared_ptr<MonoPictureMXFWriter> (new MonoPictureMXFWriter (this, overwrite)); } string -MonoPictureAsset::cpl_node_name () const +MonoPictureMXF::cpl_node_name () const { return "MainPicture"; } int -MonoPictureAsset::edit_rate_factor () const +MonoPictureMXF::edit_rate_factor () const { return 1; } diff --git a/src/mono_picture_asset.h b/src/mono_picture_mxf.h index 76a1f990..029ccce5 100644 --- a/src/mono_picture_asset.h +++ b/src/mono_picture_mxf.h @@ -17,23 +17,23 @@ */ -#ifndef LIBDCP_MONO_PICTURE_ASSET_H -#define LIBDCP_MONO_PICTURE_ASSET_H +#ifndef LIBDCP_MONO_PICTURE_MXF_H +#define LIBDCP_MONO_PICTURE_MXF_H -#include "picture_asset.h" +#include "picture_mxf.h" namespace dcp { /** A 2D (monoscopic) picture asset */ -class MonoPictureAsset : public PictureAsset +class MonoPictureMXF : public PictureMXF { public: - MonoPictureAsset (boost::filesystem::path directory, boost::filesystem::path mxf_name); + MonoPictureMXF (boost::filesystem::path directory, boost::filesystem::path mxf_name); void read (); - /** Start a progressive write to a MonoPictureAsset */ - boost::shared_ptr<PictureAssetWriter> start_write (bool); + /** Start a progressive write to a MonoPictureMXF */ + boost::shared_ptr<PictureMXFWriter> start_write (bool); boost::shared_ptr<const MonoPictureFrame> get_frame (int n) const; bool equals (boost::shared_ptr<const ContentAsset> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> note) const; diff --git a/src/mono_picture_asset_writer.cc b/src/mono_picture_mxf_writer.cc index 87f37a2d..24ca2079 100644 --- a/src/mono_picture_asset_writer.cc +++ b/src/mono_picture_mxf_writer.cc @@ -19,11 +19,11 @@ #include "AS_DCP.h" #include "KM_fileio.h" -#include "mono_picture_asset_writer.h" +#include "mono_picture_mxf_writer.h" #include "exceptions.h" -#include "picture_asset.h" +#include "picture_mxf.h" -#include "picture_asset_writer_common.cc" +#include "picture_mxf_writer_common.cc" using std::istream; using std::ostream; @@ -32,7 +32,7 @@ using boost::shared_ptr; using boost::lexical_cast; using namespace dcp; -struct MonoPictureAssetWriter::ASDCPState : public ASDCPStateBase +struct MonoPictureMXFWriter::ASDCPState : public ASDCPStateBase { ASDCP::JP2K::MXFWriter mxf_writer; }; @@ -40,21 +40,21 @@ struct MonoPictureAssetWriter::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. */ -MonoPictureAssetWriter::MonoPictureAssetWriter (PictureAsset* asset, bool overwrite) - : PictureAssetWriter (asset, overwrite) - , _state (new MonoPictureAssetWriter::ASDCPState) +MonoPictureMXFWriter::MonoPictureMXFWriter (PictureMXF* asset, bool overwrite) + : PictureMXFWriter (asset, overwrite) + , _state (new MonoPictureMXFWriter::ASDCPState) { _state->encryption_context = asset->encryption_context (); } void -MonoPictureAssetWriter::start (uint8_t* data, int size) +MonoPictureMXFWriter::start (uint8_t* data, int size) { dcp::start (this, _state, _asset, data, size); } FrameInfo -MonoPictureAssetWriter::write (uint8_t* data, int size) +MonoPictureMXFWriter::write (uint8_t* data, int size) { assert (!_finalized); @@ -79,7 +79,7 @@ MonoPictureAssetWriter::write (uint8_t* data, int size) } void -MonoPictureAssetWriter::fake_write (int size) +MonoPictureMXFWriter::fake_write (int size) { assert (_started); assert (!_finalized); @@ -93,7 +93,7 @@ MonoPictureAssetWriter::fake_write (int size) } void -MonoPictureAssetWriter::finalize () +MonoPictureMXFWriter::finalize () { assert (!_finalized); diff --git a/src/mono_picture_asset_writer.h b/src/mono_picture_mxf_writer.h index b4da70b4..4faa6b60 100644 --- a/src/mono_picture_asset_writer.h +++ b/src/mono_picture_mxf_writer.h @@ -22,7 +22,7 @@ #include <fstream> #include <boost/shared_ptr.hpp> #include <boost/utility.hpp> -#include "picture_asset_writer.h" +#include "picture_mxf_writer.h" namespace dcp { @@ -36,7 +36,7 @@ namespace dcp { * The action of finalize() can't be done in MonoPictureAssetWriter's destructor as it may * throw an exception. */ -class MonoPictureAssetWriter : public PictureAssetWriter +class MonoPictureMXFWriter : public PictureMXFWriter { public: FrameInfo write (uint8_t *, int); @@ -44,9 +44,9 @@ public: void finalize (); private: - friend class MonoPictureAsset; + friend class MonoPictureMXF; - MonoPictureAssetWriter (PictureAsset *, bool); + MonoPictureMXFWriter (PictureMXF *, bool); void start (uint8_t *, int); /* do this with an opaque pointer so we don't have to include diff --git a/src/mxf_asset.cc b/src/mxf.cc index c2d19a39..e37b2822 100644 --- a/src/mxf_asset.cc +++ b/src/mxf.cc @@ -28,7 +28,7 @@ #include "AS_DCP.h" #include "KM_prng.h" #include "KM_util.h" -#include "mxf_asset.h" +#include "mxf.h" #include "util.h" #include "metadata.h" #include "exceptions.h" @@ -42,7 +42,7 @@ using boost::lexical_cast; using boost::dynamic_pointer_cast; using namespace dcp; -MXFAsset::MXFAsset (boost::filesystem::path directory, boost::filesystem::path file_name) +MXF::MXF (boost::filesystem::path directory, boost::filesystem::path file_name) : ContentAsset (directory, file_name) , _progress (0) , _encryption_context (0) @@ -52,14 +52,14 @@ MXFAsset::MXFAsset (boost::filesystem::path directory, boost::filesystem::path f } -MXFAsset::~MXFAsset () +MXF::~MXF () { delete _encryption_context; delete _decryption_context; } void -MXFAsset::fill_writer_info (ASDCP::WriterInfo* writer_info) +MXF::fill_writer_info (ASDCP::WriterInfo* writer_info) { writer_info->ProductVersion = _metadata.product_version; writer_info->CompanyName = _metadata.company_name; @@ -85,13 +85,13 @@ MXFAsset::fill_writer_info (ASDCP::WriterInfo* writer_info) } bool -MXFAsset::equals (shared_ptr<const ContentAsset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const +MXF::equals (shared_ptr<const ContentAsset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const { if (!ContentAsset::equals (other, opt, note)) { return false; } - shared_ptr<const MXFAsset> other_mxf = dynamic_pointer_cast<const MXFAsset> (other); + shared_ptr<const MXF> other_mxf = dynamic_pointer_cast<const MXF> (other); if (!other_mxf) { note (ERROR, "comparing an MXF asset with a non-MXF asset"); return false; @@ -108,7 +108,7 @@ MXFAsset::equals (shared_ptr<const ContentAsset> other, EqualityOptions opt, boo } void -MXFAsset::write_to_cpl (xmlpp::Element* node) const +MXF::write_to_cpl (xmlpp::Element* node) const { pair<string, string> const attr = cpl_node_attribute (); xmlpp::Element* a = node->add_child (cpl_node_name ()); @@ -127,7 +127,7 @@ MXFAsset::write_to_cpl (xmlpp::Element* node) const } void -MXFAsset::set_key (Key key) +MXF::set_key (Key key) { _key = key; diff --git a/src/mxf_asset.h b/src/mxf.h index 4af7a38d..3e9e6666 100644 --- a/src/mxf_asset.h +++ b/src/mxf.h @@ -35,19 +35,21 @@ namespace dcp class MXFMetadata; -/** @brief Parent class for assets which have MXF files */ -class MXFAsset : public ContentAsset +/** @class MXF + * @brief Parent class for classes which represent MXF files. + */ +class MXF : public ContentAsset { public: - /** Construct an MXFAsset. + /** Construct an MXF. * This class will not write anything to disk in this constructor, but subclasses may. * * @param directory Directory where MXF file is. * @param file_name Name of MXF file. */ - MXFAsset (boost::filesystem::path directory, boost::filesystem::path file_name); + MXF (boost::filesystem::path directory, boost::filesystem::path file_name); - ~MXFAsset (); + ~MXF (); virtual bool equals (boost::shared_ptr<const ContentAsset> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> note) const; virtual void write_to_cpl (xmlpp::Element *) const; diff --git a/src/picture_asset.cc b/src/picture_mxf.cc index 94ebefaa..3221a88f 100644 --- a/src/picture_asset.cc +++ b/src/picture_mxf.cc @@ -31,11 +31,11 @@ #include <libxml++/nodes/element.h> #include "AS_DCP.h" #include "KM_fileio.h" -#include "picture_asset.h" +#include "picture_mxf.h" #include "util.h" #include "exceptions.h" #include "xyz_frame.h" -#include "picture_asset_writer.h" +#include "picture_mxf_writer.h" using std::string; using std::ostream; @@ -52,16 +52,16 @@ using boost::dynamic_pointer_cast; using boost::lexical_cast; using namespace dcp; -PictureAsset::PictureAsset (boost::filesystem::path directory, boost::filesystem::path mxf_name) - : MXFAsset (directory, mxf_name) +PictureMXF::PictureMXF (boost::filesystem::path directory, boost::filesystem::path mxf_name) + : MXF (directory, mxf_name) { } void -PictureAsset::write_to_cpl (xmlpp::Element* node) const +PictureMXF::write_to_cpl (xmlpp::Element* node) const { - MXFAsset::write_to_cpl (node); + MXF::write_to_cpl (node); xmlpp::Node::NodeList c = node->get_children (); xmlpp::Node::NodeList::iterator i = c.begin(); @@ -82,7 +82,7 @@ PictureAsset::write_to_cpl (xmlpp::Element* node) const } bool -PictureAsset::descriptor_equals ( +PictureMXF::descriptor_equals ( ASDCP::JP2K::PictureDescriptor const & a, ASDCP::JP2K::PictureDescriptor const & b, boost::function<void (NoteType, string)> note ) const { @@ -124,7 +124,7 @@ PictureAsset::descriptor_equals ( } bool -PictureAsset::frame_buffer_equals ( +PictureMXF::frame_buffer_equals ( int frame, EqualityOptions opt, boost::function<void (NoteType, string)> note, uint8_t const * data_A, unsigned int size_A, uint8_t const * data_B, unsigned int size_B ) const @@ -202,7 +202,7 @@ PictureAsset::frame_buffer_equals ( } string -PictureAsset::key_type () const +PictureMXF::key_type () const { return "MDIK"; } diff --git a/src/picture_asset.h b/src/picture_mxf.h index d9b9919b..1966ee8e 100644 --- a/src/picture_asset.h +++ b/src/picture_mxf.h @@ -17,15 +17,15 @@ */ -#ifndef LIBDCP_PICTURE_ASSET_H -#define LIBDCP_PICTURE_ASSET_H +#ifndef LIBDCP_PICTURE_MXF_H +#define LIBDCP_PICTURE_MXF_H /** @file src/picture_asset.h * @brief An asset made up of JPEG2000 data */ #include <openjpeg.h> -#include "mxf_asset.h" +#include "mxf.h" #include "util.h" #include "metadata.h" @@ -40,10 +40,10 @@ namespace dcp class MonoPictureFrame; class StereoPictureFrame; -class PictureAssetWriter; +class PictureMXFWriter; /** @brief An asset made up of JPEG2000 data */ -class PictureAsset : public MXFAsset +class PictureMXF : public MXF { public: /** Construct a PictureAsset. @@ -51,7 +51,7 @@ public: * @param directory Directory where MXF file is. * @param mxf_name Name of MXF file. */ - PictureAsset (boost::filesystem::path directory, boost::filesystem::path mxf_name); + PictureMXF (boost::filesystem::path directory, boost::filesystem::path mxf_name); /** Start a progressive write to this asset. * The following parameters must be set up (if required) before calling this: @@ -62,7 +62,7 @@ public: * @param overwrite true to overwrite an existing MXF file; in this mode, writing can be resumed to a partially-written MXF; false if the * MXF file does not exist. */ - virtual boost::shared_ptr<PictureAssetWriter> start_write (bool overwrite) = 0; + virtual boost::shared_ptr<PictureMXFWriter> start_write (bool overwrite) = 0; virtual void read () = 0; virtual void create (std::vector<boost::filesystem::path> const &) {} diff --git a/src/picture_asset_writer.cc b/src/picture_mxf_writer.cc index c1c9bd85..61dd854b 100644 --- a/src/picture_asset_writer.cc +++ b/src/picture_mxf_writer.cc @@ -21,9 +21,9 @@ #include <stdint.h> #include "AS_DCP.h" #include "KM_fileio.h" -#include "picture_asset_writer.h" +#include "picture_mxf_writer.h" #include "exceptions.h" -#include "picture_asset.h" +#include "picture_mxf.h" using std::istream; using std::ostream; @@ -83,7 +83,7 @@ FrameInfo::write (FILE* f) const } -PictureAssetWriter::PictureAssetWriter (PictureAsset* asset, bool overwrite) +PictureMXFWriter::PictureMXFWriter (PictureMXF* asset, bool overwrite) : _asset (asset) , _frames_written (0) , _started (false) diff --git a/src/picture_asset_writer.h b/src/picture_mxf_writer.h index c6c00d87..3d10288f 100644 --- a/src/picture_asset_writer.h +++ b/src/picture_mxf_writer.h @@ -27,7 +27,7 @@ namespace dcp { -class PictureAsset; +class PictureMXF; struct FrameInfo { @@ -48,21 +48,21 @@ struct FrameInfo std::string hash; }; -class PictureAssetWriter : public boost::noncopyable +class PictureMXFWriter : public boost::noncopyable { public: - virtual ~PictureAssetWriter () {} + virtual ~PictureMXFWriter () {} virtual FrameInfo write (uint8_t *, int) = 0; virtual void finalize () = 0; virtual void fake_write (int) = 0; protected: template <class P, class Q> - friend void start (PictureAssetWriter *, boost::shared_ptr<P>, Q *, uint8_t *, int); + friend void start (PictureMXFWriter *, boost::shared_ptr<P>, Q *, uint8_t *, int); - PictureAssetWriter (PictureAsset *, bool); + PictureMXFWriter (PictureMXF *, bool); - PictureAsset* _asset; + PictureMXF* _asset; /** Number of picture frames written to the asset so far. For stereo assets * this will be incremented for each eye (i.e. there will be twice the number diff --git a/src/picture_asset_writer_common.cc b/src/picture_mxf_writer_common.cc index bb1316c7..07a0964a 100644 --- a/src/picture_asset_writer_common.cc +++ b/src/picture_mxf_writer_common.cc @@ -33,7 +33,7 @@ struct ASDCPStateBase }; template <class P, class Q> -void dcp::start (PictureAssetWriter* writer, shared_ptr<P> state, Q* asset, uint8_t* data, int size) +void dcp::start (PictureMXFWriter* writer, shared_ptr<P> state, Q* asset, uint8_t* data, int size) { if (ASDCP_FAILURE (state->j2k_parser.OpenReadFrame (data, size, state->frame_buffer))) { boost::throw_exception (MiscError ("could not parse J2K frame")); diff --git a/src/reel.cc b/src/reel.cc index 7a54059e..9f514d88 100644 --- a/src/reel.cc +++ b/src/reel.cc @@ -20,10 +20,10 @@ #include <libxml++/nodes/element.h> #include "reel.h" #include "util.h" -#include "picture_asset.h" -#include "mono_picture_asset.h" -#include "stereo_picture_asset.h" -#include "sound_asset.h" +#include "picture_mxf.h" +#include "mono_picture_mxf.h" +#include "stereo_picture_mxf.h" +#include "sound_mxf.h" #include "subtitle_asset.h" #include "kdm.h" @@ -41,7 +41,7 @@ Reel::write_to_cpl (xmlpp::Element* node) const reel->add_child("Id")->add_child_text ("urn:uuid:" + make_uuid()); xmlpp::Element* asset_list = reel->add_child ("AssetList"); - if (_main_picture && dynamic_pointer_cast<MonoPictureAsset> (_main_picture)) { + if (_main_picture && dynamic_pointer_cast<MonoPictureMXF> (_main_picture)) { /* Mono pictures come before other stuff... */ _main_picture->write_to_cpl (asset_list); } @@ -54,7 +54,7 @@ Reel::write_to_cpl (xmlpp::Element* node) const _main_subtitle->write_to_cpl (asset_list); } - if (_main_picture && dynamic_pointer_cast<StereoPictureAsset> (_main_picture)) { + if (_main_picture && dynamic_pointer_cast<StereoPictureMXF> (_main_picture)) { /* ... but stereo pictures must come after */ _main_picture->write_to_cpl (asset_list); } @@ -33,8 +33,8 @@ namespace xmlpp { namespace dcp { -class PictureAsset; -class SoundAsset; +class PictureMXF; +class SoundMXF; class SubtitleAsset; class KDM; @@ -43,8 +43,8 @@ class Reel { public: Reel ( - boost::shared_ptr<PictureAsset> picture, - boost::shared_ptr<SoundAsset> sound, + boost::shared_ptr<PictureMXF> picture, + boost::shared_ptr<SoundMXF> sound, boost::shared_ptr<SubtitleAsset> subtitle ) : _main_picture (picture) @@ -52,11 +52,11 @@ public: , _main_subtitle (subtitle) {} - boost::shared_ptr<const PictureAsset> main_picture () const { + boost::shared_ptr<const PictureMXF> main_picture () const { return _main_picture; } - boost::shared_ptr<const SoundAsset> main_sound () const { + boost::shared_ptr<const SoundMXF> main_sound () const { return _main_sound; } @@ -75,8 +75,8 @@ public: void add_kdm (KDM const &); private: - boost::shared_ptr<PictureAsset> _main_picture; - boost::shared_ptr<SoundAsset> _main_sound; + boost::shared_ptr<PictureMXF> _main_picture; + boost::shared_ptr<SoundMXF> _main_sound; boost::shared_ptr<SubtitleAsset> _main_subtitle; }; diff --git a/src/sound_asset.cc b/src/sound_mxf.cc index 5a1ce06b..b569c57a 100644 --- a/src/sound_asset.cc +++ b/src/sound_mxf.cc @@ -28,7 +28,7 @@ #include <libxml++/nodes/element.h> #include "KM_fileio.h" #include "AS_DCP.h" -#include "sound_asset.h" +#include "sound_mxf.h" #include "util.h" #include "exceptions.h" #include "sound_frame.h" @@ -42,8 +42,8 @@ using boost::shared_ptr; using boost::lexical_cast; using namespace dcp; -SoundAsset::SoundAsset (boost::filesystem::path directory, boost::filesystem::path mxf_name) - : MXFAsset (directory, mxf_name) +SoundMXF::SoundMXF (boost::filesystem::path directory, boost::filesystem::path mxf_name) + : MXF (directory, mxf_name) , _channels (0) , _sampling_rate (0) { @@ -51,7 +51,7 @@ SoundAsset::SoundAsset (boost::filesystem::path directory, boost::filesystem::pa } void -SoundAsset::read () +SoundMXF::read () { ASDCP::PCM::MXFReader reader; Kumu::Result_t r = reader.OpenRead (path().string().c_str()); @@ -72,15 +72,15 @@ SoundAsset::read () } string -SoundAsset::cpl_node_name () const +SoundMXF::cpl_node_name () const { return "MainSound"; } bool -SoundAsset::equals (shared_ptr<const ContentAsset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const +SoundMXF::equals (shared_ptr<const ContentAsset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const { - if (!MXFAsset::equals (other, opt, note)) { + if (!MXF::equals (other, opt, note)) { return false; } @@ -154,20 +154,20 @@ SoundAsset::equals (shared_ptr<const ContentAsset> other, EqualityOptions opt, b } shared_ptr<const SoundFrame> -SoundAsset::get_frame (int n) const +SoundMXF::get_frame (int n) const { /* XXX: should add on entry point here? */ return shared_ptr<const SoundFrame> (new SoundFrame (path().string(), n, _decryption_context)); } -shared_ptr<SoundAssetWriter> -SoundAsset::start_write () +shared_ptr<SoundMXFWriter> +SoundMXF::start_write () { /* XXX: can't we use a shared_ptr here? */ - return shared_ptr<SoundAssetWriter> (new SoundAssetWriter (this)); + return shared_ptr<SoundMXFWriter> (new SoundMXFWriter (this)); } -struct SoundAssetWriter::ASDCPState +struct SoundMXFWriter::ASDCPState { ASDCP::PCM::MXFWriter mxf_writer; ASDCP::PCM::FrameBuffer frame_buffer; @@ -176,8 +176,8 @@ struct SoundAssetWriter::ASDCPState ASDCP::AESEncContext* encryption_context; }; -SoundAssetWriter::SoundAssetWriter (SoundAsset* a) - : _state (new SoundAssetWriter::ASDCPState) +SoundMXFWriter::SoundMXFWriter (SoundMXF* a) + : _state (new SoundMXFWriter::ASDCPState) , _asset (a) , _finalized (false) , _frames_written (0) @@ -209,7 +209,7 @@ SoundAssetWriter::SoundAssetWriter (SoundAsset* a) } void -SoundAssetWriter::write (float const * const * data, int frames) +SoundMXFWriter::write (float const * const * data, int frames) { for (int i = 0; i < frames; ++i) { @@ -236,7 +236,7 @@ SoundAssetWriter::write (float const * const * data, int frames) } void -SoundAssetWriter::write_current_frame () +SoundMXFWriter::write_current_frame () { ASDCP::Result_t const r = _state->mxf_writer.WriteFrame (_state->frame_buffer, _state->encryption_context, 0); if (ASDCP_FAILURE (r)) { @@ -247,7 +247,7 @@ SoundAssetWriter::write_current_frame () } void -SoundAssetWriter::finalize () +SoundMXFWriter::finalize () { if (_frame_buffer_offset > 0) { write_current_frame (); @@ -263,7 +263,7 @@ SoundAssetWriter::finalize () } string -SoundAsset::key_type () const +SoundMXF::key_type () const { return "MDAK"; } diff --git a/src/sound_asset.h b/src/sound_mxf.h index ce08c512..eec3fab6 100644 --- a/src/sound_asset.h +++ b/src/sound_mxf.h @@ -24,7 +24,7 @@ * @brief An asset made up of PCM audio data files */ -#include "mxf_asset.h" +#include "mxf.h" #include "types.h" #include "metadata.h" @@ -32,22 +32,22 @@ namespace dcp { class SoundFrame; -class SoundAsset; +class SoundMXF; -class SoundAssetWriter +class SoundMXFWriter { public: void write (float const * const *, int); void finalize (); private: - friend class SoundAsset; + friend class SoundMXF; - SoundAssetWriter (SoundAsset *); + SoundMXFWriter (SoundMXF *); /* no copy construction */ - SoundAssetWriter (SoundAssetWriter const &); - SoundAssetWriter& operator= (SoundAssetWriter const &); + SoundMXFWriter (SoundMXFWriter const &); + SoundMXFWriter& operator= (SoundMXFWriter const &); void write_current_frame (); @@ -58,21 +58,21 @@ private: struct ASDCPState; boost::shared_ptr<ASDCPState> _state; - SoundAsset* _asset; + SoundMXF* _asset; bool _finalized; int _frames_written; int _frame_buffer_offset; }; /** @brief An asset made up of WAV files */ -class SoundAsset : public MXFAsset +class SoundMXF : public MXF { public: - SoundAsset (boost::filesystem::path directory, boost::filesystem::path mxf_name); + SoundMXF (boost::filesystem::path directory, boost::filesystem::path mxf_name); void read (); - boost::shared_ptr<SoundAssetWriter> start_write (); + boost::shared_ptr<SoundMXFWriter> start_write (); bool equals (boost::shared_ptr<const ContentAsset> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> note) const; diff --git a/src/stereo_picture_asset.cc b/src/stereo_picture_mxf.cc index 711a8090..29283746 100644 --- a/src/stereo_picture_asset.cc +++ b/src/stereo_picture_mxf.cc @@ -18,10 +18,10 @@ */ #include "AS_DCP.h" -#include "stereo_picture_asset.h" +#include "stereo_picture_mxf.h" #include "stereo_picture_frame.h" #include "exceptions.h" -#include "stereo_picture_asset_writer.h" +#include "stereo_picture_mxf_writer.h" using std::string; using std::pair; @@ -31,9 +31,9 @@ using boost::dynamic_pointer_cast; using namespace dcp; bool -StereoPictureAsset::equals (shared_ptr<const ContentAsset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const +StereoPictureMXF::equals (shared_ptr<const ContentAsset> other, EqualityOptions opt, boost::function<void (NoteType, string)> note) const { - if (!MXFAsset::equals (other, opt, note)) { + if (!MXF::equals (other, opt, note)) { return false; } @@ -62,7 +62,7 @@ StereoPictureAsset::equals (shared_ptr<const ContentAsset> other, EqualityOption return false; } - shared_ptr<const StereoPictureAsset> other_picture = dynamic_pointer_cast<const StereoPictureAsset> (other); + shared_ptr<const StereoPictureMXF> other_picture = dynamic_pointer_cast<const StereoPictureMXF> (other); assert (other_picture); for (int i = 0; i < _intrinsic_duration; ++i) { @@ -89,14 +89,14 @@ StereoPictureAsset::equals (shared_ptr<const ContentAsset> other, EqualityOption return true; } -StereoPictureAsset::StereoPictureAsset (boost::filesystem::path directory, boost::filesystem::path mxf_name) - : PictureAsset (directory, mxf_name) +StereoPictureMXF::StereoPictureMXF (boost::filesystem::path directory, boost::filesystem::path mxf_name) + : PictureMXF (directory, mxf_name) { } void -StereoPictureAsset::read () +StereoPictureMXF::read () { ASDCP::JP2K::MXFSReader reader; Kumu::Result_t r = reader.OpenRead (path().string().c_str()); @@ -114,25 +114,25 @@ StereoPictureAsset::read () } shared_ptr<const StereoPictureFrame> -StereoPictureAsset::get_frame (int n) const +StereoPictureMXF::get_frame (int n) const { return shared_ptr<const StereoPictureFrame> (new StereoPictureFrame (path().string(), n)); } -shared_ptr<PictureAssetWriter> -StereoPictureAsset::start_write (bool overwrite) +shared_ptr<PictureMXFWriter> +StereoPictureMXF::start_write (bool overwrite) { - return shared_ptr<StereoPictureAssetWriter> (new StereoPictureAssetWriter (this, overwrite)); + return shared_ptr<StereoPictureMXFWriter> (new StereoPictureMXFWriter (this, overwrite)); } string -StereoPictureAsset::cpl_node_name () const +StereoPictureMXF::cpl_node_name () const { return "msp-cpl:MainStereoscopicPicture"; } pair<string, string> -StereoPictureAsset::cpl_node_attribute () const +StereoPictureMXF::cpl_node_attribute () const { if (_interop) { return make_pair ("xmlns:msp-cpl", "http://www.digicine.com/schemas/437-Y/2007/Main-Stereo-Picture-CPL"); @@ -144,7 +144,7 @@ StereoPictureAsset::cpl_node_attribute () const } int -StereoPictureAsset::edit_rate_factor () const +StereoPictureMXF::edit_rate_factor () const { return 2; } diff --git a/src/stereo_picture_asset.h b/src/stereo_picture_mxf.h index a6620dcf..2e16b22c 100644 --- a/src/stereo_picture_asset.h +++ b/src/stereo_picture_mxf.h @@ -17,23 +17,23 @@ */ -#ifndef LIBDCP_STEREO_PICTURE_ASSET_H -#define LIBDCP_STEREO_PICTURE_ASSET_H +#ifndef LIBDCP_STEREO_PICTURE_MXF_H +#define LIBDCP_STEREO_PICTURE_MXF_H -#include "picture_asset.h" +#include "picture_mxf.h" namespace dcp { /** A 3D (stereoscopic) picture asset */ -class StereoPictureAsset : public PictureAsset +class StereoPictureMXF : public PictureMXF { public: - StereoPictureAsset (boost::filesystem::path directory, boost::filesystem::path mxf_name); + StereoPictureMXF (boost::filesystem::path directory, boost::filesystem::path mxf_name); void read (); - /** Start a progressive write to a StereoPictureAsset */ - boost::shared_ptr<PictureAssetWriter> start_write (bool); + /** Start a progressive write to a StereoPictureMXF */ + boost::shared_ptr<PictureMXFWriter> start_write (bool); boost::shared_ptr<const StereoPictureFrame> get_frame (int n) const; bool equals (boost::shared_ptr<const ContentAsset> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> note) const; diff --git a/src/stereo_picture_asset_writer.cc b/src/stereo_picture_mxf_writer.cc index 04ca0590..b988d75a 100644 --- a/src/stereo_picture_asset_writer.cc +++ b/src/stereo_picture_mxf_writer.cc @@ -19,11 +19,11 @@ #include "AS_DCP.h" #include "KM_fileio.h" -#include "stereo_picture_asset_writer.h" +#include "stereo_picture_mxf_writer.h" #include "exceptions.h" -#include "picture_asset.h" +#include "picture_mxf.h" -#include "picture_asset_writer_common.cc" +#include "picture_mxf_writer_common.cc" using std::istream; using std::ostream; @@ -31,21 +31,21 @@ using std::string; using boost::shared_ptr; using namespace dcp; -struct StereoPictureAssetWriter::ASDCPState : public ASDCPStateBase +struct StereoPictureMXFWriter::ASDCPState : public ASDCPStateBase { ASDCP::JP2K::MXFSWriter mxf_writer; }; -StereoPictureAssetWriter::StereoPictureAssetWriter (PictureAsset* asset, bool overwrite) - : PictureAssetWriter (asset, overwrite) - , _state (new StereoPictureAssetWriter::ASDCPState) +StereoPictureMXFWriter::StereoPictureMXFWriter (PictureMXF* asset, bool overwrite) + : PictureMXFWriter (asset, overwrite) + , _state (new StereoPictureMXFWriter::ASDCPState) , _next_eye (EYE_LEFT) { _state->encryption_context = asset->encryption_context (); } void -StereoPictureAssetWriter::start (uint8_t* data, int size) +StereoPictureMXFWriter::start (uint8_t* data, int size) { dcp::start (this, _state, _asset, data, size); } @@ -55,7 +55,7 @@ StereoPictureAssetWriter::start (uint8_t* data, int size) * @param size Size of data. */ FrameInfo -StereoPictureAssetWriter::write (uint8_t* data, int size) +StereoPictureMXFWriter::write (uint8_t* data, int size) { assert (!_finalized); @@ -89,7 +89,7 @@ StereoPictureAssetWriter::write (uint8_t* data, int size) } void -StereoPictureAssetWriter::fake_write (int size) +StereoPictureMXFWriter::fake_write (int size) { assert (_started); assert (!_finalized); @@ -104,7 +104,7 @@ StereoPictureAssetWriter::fake_write (int size) } void -StereoPictureAssetWriter::finalize () +StereoPictureMXFWriter::finalize () { assert (!_finalized); diff --git a/src/stereo_picture_asset_writer.h b/src/stereo_picture_mxf_writer.h index 96572989..384250db 100644 --- a/src/stereo_picture_asset_writer.h +++ b/src/stereo_picture_mxf_writer.h @@ -22,7 +22,7 @@ #include <fstream> #include <boost/shared_ptr.hpp> #include <boost/utility.hpp> -#include "picture_asset_writer.h" +#include "picture_mxf_writer.h" namespace dcp { @@ -36,7 +36,7 @@ namespace dcp { * The action of finalize() can't be done in MonoPictureAssetWriter's destructor as it may * throw an exception. */ -class StereoPictureAssetWriter : public PictureAssetWriter +class StereoPictureMXFWriter : public PictureMXFWriter { public: FrameInfo write (uint8_t *, int); @@ -44,9 +44,9 @@ public: void finalize (); private: - friend class StereoPictureAsset; + friend class StereoPictureMXF; - StereoPictureAssetWriter (PictureAsset *, bool); + StereoPictureMXFWriter (PictureMXF *, bool); void start (uint8_t *, int); /* do this with an opaque pointer so we don't have to include diff --git a/src/wscript b/src/wscript index db0cc628..bcdc149c 100644 --- a/src/wscript +++ b/src/wscript @@ -26,23 +26,23 @@ def build(bld): kdm.cc key.cc metadata.cc - mono_picture_asset.cc - mono_picture_asset_writer.cc + mono_picture_mxf.cc + mono_picture_mxf_writer.cc mono_picture_frame.cc - mxf_asset.cc + mxf.cc object.cc - picture_asset.cc - picture_asset_writer.cc + picture_mxf.cc + picture_mxf_writer.cc rec709_linearised_gamma_lut.cc reel.cc rgb_xyz.cc signer.cc signer_chain.cc - sound_asset.cc + sound_mxf.cc sound_frame.cc srgb_linearised_gamma_lut.cc - stereo_picture_asset.cc - stereo_picture_asset_writer.cc + stereo_picture_mxf.cc + stereo_picture_mxf_writer.cc stereo_picture_frame.cc subtitle_asset.cc types.cc @@ -70,22 +70,22 @@ def build(bld): lut.h lut_cache.h metadata.h - mono_picture_asset.h + mono_picture_mxf.h mono_picture_frame.h - mxf_asset.h + mxf.h object.h - picture_asset.h - picture_asset_writer.h + picture_mxf.h + picture_mxf_writer.h rgb_xyz.h rec709_linearised_gamma_lut.h reel.h argb_frame.h signer.h signer_chain.h - sound_asset.h + sound_mxf.h sound_frame.h srgb_linearised_gamma_lut.h - stereo_picture_asset.h + stereo_picture_mxf.h stereo_picture_frame.h subtitle_asset.h types.h |
