New Asset and Object classes; make CPL use them.
authorCarl Hetherington <cth@carlh.net>
Fri, 17 Jan 2014 17:51:54 +0000 (17:51 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 17 Jan 2014 17:51:54 +0000 (17:51 +0000)
src/asset.cc [new file with mode: 0644]
src/asset.h [new file with mode: 0644]
src/cpl.cc
src/cpl.h
src/object.cc [new file with mode: 0644]
src/object.h [new file with mode: 0644]
src/wscript

diff --git a/src/asset.cc b/src/asset.cc
new file mode 100644 (file)
index 0000000..0147eba
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+
+    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 (file)
index 0000000..86d4734
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+
+    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);
+
+};
+
+}
index ec5534e0abb149fc3b20c6571ab1ac5397f56d72..843f98d948ecf39b59b37fd2a7741c2d4f0ff0ab 100644 (file)
@@ -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.
index ead09f24251a710c519ed7b502cca25e7a24f554..0a427dfca0039e1f1effc398ec33ef6a20c32006 100644 (file)
--- 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<void (NoteType, std::string)> note) const;
        
        void write_xml (bool, XMLMetadata const &, boost::shared_ptr<const Signer>) const;
@@ -115,8 +114,6 @@ private:
        /** reels */
        std::list<boost::shared_ptr<Reel> > _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 (file)
index 0000000..e9a4f62
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+
+    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 (file)
index 0000000..f2ef4c1
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+
+    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 <string>
+
+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;
+};
+       
+}
index 7cc5e5ea84921ba3bfc823ae579f1ef0e6c337e4..db0cc6283f8b1d1ef18459b5adc998d95902852e 100644 (file)
@@ -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