From bfc511b3e2fae3540db2679bfb4532cf4d1e6d05 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 17 Jan 2014 17:51:54 +0000 Subject: New Asset and Object classes; make CPL use them. --- src/asset.cc | 34 ++++++++++++++++++++++++++++++++++ src/asset.h | 36 ++++++++++++++++++++++++++++++++++++ src/cpl.cc | 2 +- src/cpl.h | 13 +++++-------- src/object.cc | 36 ++++++++++++++++++++++++++++++++++++ src/object.h | 39 +++++++++++++++++++++++++++++++++++++++ src/wscript | 3 +++ 7 files changed, 154 insertions(+), 9 deletions(-) create mode 100644 src/asset.cc create mode 100644 src/asset.h create mode 100644 src/object.cc create mode 100644 src/object.h (limited to 'src') diff --git a/src/asset.cc b/src/asset.cc new file mode 100644 index 00000000..0147eba2 --- /dev/null +++ b/src/asset.cc @@ -0,0 +1,34 @@ +/* + Copyright (C) 2014 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "asset.h" + +using std::string; +using namespace dcp; + +Asset::Asset () +{ + +} + +Asset::Asset (string id) + : Object (id) +{ + +} diff --git a/src/asset.h b/src/asset.h new file mode 100644 index 00000000..86d4734e --- /dev/null +++ b/src/asset.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2014 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "object.h" + +namespace dcp { + +/** @class Asset + * @brief Parent class for DCP assets, i.e. picture/sound/subtitles, CPLs and PKLs. + */ + +class Asset : public Object +{ +public: + Asset (); + Asset (std::string id); + +}; + +} diff --git a/src/cpl.cc b/src/cpl.cc index ec5534e0..843f98d9 100644 --- a/src/cpl.cc +++ b/src/cpl.cc @@ -50,7 +50,7 @@ CPL::CPL (boost::filesystem::path directory, string name, ContentKind content_ki , _length (length) , _fps (frames_per_second) { - _id = make_uuid (); + } /** Construct a CPL object from a XML file. diff --git a/src/cpl.h b/src/cpl.h index ead09f24..0a427dfc 100644 --- a/src/cpl.h +++ b/src/cpl.h @@ -30,6 +30,7 @@ #include "types.h" #include "certificates.h" #include "key.h" +#include "asset.h" namespace dcp { @@ -45,8 +46,10 @@ class MXFMetadata; class Signer; class KDM; -/** @brief A CPL within a DCP */ -class CPL +/** @class CPL + * @brief A Composition Playlist. + */ +class CPL : public Asset { public: CPL (boost::filesystem::path directory, std::string name, ContentKind content_kind, int length, int frames_per_second); @@ -88,10 +91,6 @@ public: void set_mxf_keys (Key); - std::string id () const { - return _id; - } - bool equals (CPL const & other, EqualityOptions options, boost::function note) const; void write_xml (bool, XMLMetadata const &, boost::shared_ptr) const; @@ -115,8 +114,6 @@ private: /** reels */ std::list > _reels; - /** our UUID */ - std::string _id; /** a SHA1 digest of our XML */ mutable std::string _digest; }; diff --git a/src/object.cc b/src/object.cc new file mode 100644 index 00000000..e9a4f62b --- /dev/null +++ b/src/object.cc @@ -0,0 +1,36 @@ +/* + Copyright (C) 2014 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "object.h" +#include "util.h" + +using std::string; +using namespace dcp; + +Object::Object () + : _id (make_uuid ()) +{ + +} + +Object::Object (string id) + : _id (id) +{ + +} diff --git a/src/object.h b/src/object.h new file mode 100644 index 00000000..f2ef4c13 --- /dev/null +++ b/src/object.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2014 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include + +namespace dcp { + +/** Some part of a DCP that has a UUID */ +class Object +{ +public: + Object (); + Object (std::string id); + + std::string id () const { + return _id; + } + +protected: + std::string _id; +}; + +} diff --git a/src/wscript b/src/wscript index 7cc5e5ea..db0cc628 100644 --- a/src/wscript +++ b/src/wscript @@ -13,6 +13,7 @@ def build(bld): obj.use = 'libkumu-libdcp libasdcp-libdcp' obj.source = """ argb_frame.cc + asset.cc certificates.cc colour_matrix.cc content_asset.cc @@ -29,6 +30,7 @@ def build(bld): mono_picture_asset_writer.cc mono_picture_frame.cc mxf_asset.cc + object.cc picture_asset.cc picture_asset_writer.cc rec709_linearised_gamma_lut.cc @@ -71,6 +73,7 @@ def build(bld): mono_picture_asset.h mono_picture_frame.h mxf_asset.h + object.h picture_asset.h picture_asset_writer.h rgb_xyz.h -- cgit v1.2.3