2 Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * @brief Parent class for assets of DCPs.
24 #ifndef LIBDCP_ASSET_H
25 #define LIBDCP_ASSET_H
28 #include <boost/filesystem.hpp>
29 #include <sigc++/sigc++.h>
39 /** @brief Parent class for assets of DCPs
41 * These are collections of pictures or sound.
46 /** Construct an Asset.
47 * @param directory Directory where our XML or MXF file is.
48 * @param file_name Name of our file within directory.
50 Asset (std::string directory, std::string file_name);
52 /** Write details of the asset to a CPL stream.
55 virtual void write_to_cpl (std::ostream& s) const = 0;
57 /** Write details of the asset to a PKL stream.
60 void write_to_pkl (std::ostream& s) const;
62 /** Write details of the asset to a ASSETMAP stream.
65 void write_to_assetmap (std::ostream& s) const;
67 std::string uuid () const {
71 virtual std::list<std::string> equals (boost::shared_ptr<const Asset> other, EqualityOptions opt) const = 0;
74 friend class PictureAsset;
75 friend class SoundAsset;
77 std::string digest () const;
78 boost::filesystem::path path () const;
80 /** Directory that our MXF or XML file is in */
81 std::string _directory;
82 /** Name of our MXF or XML file */
83 std::string _file_name;
88 /** Digest of our MXF or XML file */
89 mutable std::string _digest;