2 Copyright (C) 2014 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.
24 #ifndef LIBDCP_ASSET_H
25 #define LIBDCP_ASSET_H
29 #include <boost/filesystem.hpp>
30 #include <boost/function.hpp>
31 #include <boost/bind.hpp>
40 * @brief Parent class for DCP assets, i.e. picture, sound, subtitles, CPLs, fonts.
42 * Note that this class is not used for ReelAssets; those are just for the metadata
43 * that gets put into <Reel>s.
45 class Asset : public Object
49 Asset (boost::filesystem::path file);
52 boost::shared_ptr<const Asset> other,
57 /** Write details of the asset to a ASSETMAP.
58 * @param node Parent node.
60 void write_to_assetmap (xmlpp::Node* node, boost::filesystem::path root) const;
62 /** Write details of the asset to a PKL AssetList node.
63 * @param node Parent node.
64 * @param standard Standard to use.
66 void write_to_pkl (xmlpp::Node* node, Standard standard) const;
68 /** @return the most recent disk file used to read or write this asset; may be empty */
69 boost::filesystem::path file () const {
73 void set_file (boost::filesystem::path file) const;
75 /** @return the hash of this asset's file */
76 std::string hash (boost::function<void (float)> progress = 0) const;
79 virtual std::string pkl_type (Standard standard) const = 0;
81 /** The most recent disk file used to read or write this asset; may be empty */
82 mutable boost::filesystem::path _file;
83 /** Hash of _file, or empty if the hash has not yet been computed */
84 mutable std::string _hash;