Add a somewhat dubious constructor.
[libdcp.git] / src / asset_map.h
index 56370ab9ac8d8d221bf6cb24a5ad7080f330a7b9..10a0915f23643c7ada179b77b78abc696937a7d6 100644 (file)
@@ -1,26 +1,53 @@
+/*
+    Copyright (C) 2012 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.
+
+*/
+
+/** @file  src/asset_map.h
+ *  @brief Classes used to parse a AssetMap.
+ */
+
+#include <stdint.h>
 #include <boost/shared_ptr.hpp>
 #include "xml.h"
 
 namespace libdcp {
 
-class AssetMapAsset : public XMLNode
+class Chunk : public XMLNode
 {
 public:
-       AssetMapAsset ();
-       AssetMapAsset (xmlpp::Node const * node);
+       Chunk ();
+       Chunk (xmlpp::Node const * node);
 
-       std::string id;
-       std::string packing_list;
-       boost::shared_ptr<ChunkList> 
+       std::string path;
+       int64_t volume_index;
+       int64_t offset;
+       int64_t length;
 };
 
-class AssetMapAssetList : public XMLNode
+class AssetMapAsset : public XMLNode
 {
 public:
-       AssetMapAssetList ();
-       AssetMapAssetList (xmlpp::Node const * node);
+       AssetMapAsset ();
+       AssetMapAsset (xmlpp::Node const * node);
 
-       std::list<boost::shared_ptr<AssetMapAsset> > assets;
+       std::string id;
+       std::string packing_list;
+       std::list<boost::shared_ptr<Chunk> > chunks;
 };
 
 class AssetMap : public XMLFile
@@ -28,10 +55,14 @@ class AssetMap : public XMLFile
 public:
        AssetMap (std::string file);
 
+       boost::shared_ptr<AssetMapAsset> asset_from_id (std::string id) const;
+       
        std::string id;
        std::string creator;
-       int volume_count;
+       int64_t volume_count;
        std::string issue_date;
        std::string issuer;
-       boost::shared_ptr<AssetMapAssetList> asset_list;
+       std::list<boost::shared_ptr<AssetMapAsset> > assets;
 };
+
+}