Parent class for DCP assets, i.e. picture, sound, subtitles, closed captions, CPLs, fonts.
More...
#include <asset.h>
|
| Asset () |
|
| Asset (boost::filesystem::path file) |
|
| Asset (std::string id, boost::filesystem::path file) |
|
virtual bool | equals (std::shared_ptr< const Asset > other, EqualityOptions const &opt, NoteHandler note) const |
|
virtual void | add_to_assetmap (AssetMap &asset_map, boost::filesystem::path root) const |
|
virtual void | add_to_pkl (std::shared_ptr< PKL > pkl, boost::filesystem::path root) const |
|
boost::optional< boost::filesystem::path > | file () const |
|
void | set_file (boost::filesystem::path file) const |
|
void | set_file_preserving_hash (boost::filesystem::path file) const |
|
void | rename_file (boost::filesystem::path file) |
|
std::string | hash (boost::function< void(int64_t, int64_t)> progress={}) const |
|
void | set_hash (std::string hash) |
|
void | unset_hash () |
|
| Object () |
|
| Object (std::string id) |
|
| Object (Object const &other) |
|
Object & | operator= (Object const &other) |
|
std::string | id () const |
|
|
static void | add_file_to_assetmap (AssetMap &asset_map, boost::filesystem::path root, boost::filesystem::path file, std::string id) |
|
|
boost::optional< boost::filesystem::path > | _file |
|
std::string | _id |
|
|
virtual std::string | pkl_type (Standard standard) const =0 |
|
|
boost::optional< std::string > | _hash |
|
Parent class for DCP assets, i.e. picture, sound, subtitles, closed captions, CPLs, fonts.
Note that this class is not used for ReelAssets; those are just for the metadata that gets put into <Reel>s.
Definition at line 72 of file asset.h.
◆ Asset() [1/3]
Create an Asset with a randomly-generated ID
Definition at line 64 of file asset.cc.
◆ Asset() [2/3]
Asset::Asset |
( |
boost::filesystem::path |
file | ) |
|
|
explicit |
Create an Asset from a given file with a randomly-generated ID
- Parameters
-
Definition at line 70 of file asset.cc.
◆ Asset() [3/3]
Asset::Asset |
( |
std::string |
id, |
|
|
boost::filesystem::path |
file |
|
) |
| |
Create an Asset from a given file with a given ID
- Parameters
-
Definition at line 77 of file asset.cc.
◆ file()
boost::optional<boost::filesystem::path> dcp::Asset::file |
( |
| ) |
const |
|
inline |
- Returns
- the most recent disk file used to read or write this asset, if there is one
Definition at line 100 of file asset.h.
◆ hash()
std::string dcp::Asset::hash |
( |
boost::function< void(int64_t, int64_t)> |
progress = {} | ) |
const |
Calculate the hash of this asset's file, if it has not already been calculated, then return it
- Parameters
-
progress | Function that will be called with the number of bytes calculated and the total number of bytes |
- Returns
- the hash
◆ pkl_type()
virtual std::string dcp::Asset::pkl_type |
( |
Standard |
standard | ) |
const |
|
privatepure virtual |
◆ rename_file()
void Asset::rename_file |
( |
boost::filesystem::path |
file | ) |
|
Set the file that holds this asset on disk. The new file must be exactly the same as the old one, as this function assumes that the object's hash does not change.
- Parameters
-
Definition at line 178 of file asset.cc.
◆ set_file()
void Asset::set_file |
( |
boost::filesystem::path |
file | ) |
const |
Set the file that holds this asset on disk. Calling this function clears this object's store of its hash, so you should call ::hash after this.
- Parameters
-
Definition at line 163 of file asset.cc.
◆ set_file_preserving_hash()
void Asset::set_file_preserving_hash |
( |
boost::filesystem::path |
file | ) |
const |
Set the file that holds this asset on disk. Calling this function preserves the object's store of its hash, so if the object already has a hash it is up to the caller to ensure that the new file has the same hash.
- Parameters
-
Definition at line 171 of file asset.cc.
◆ _file
boost::optional<boost::filesystem::path> dcp::Asset::_file |
|
mutableprotected |
The most recent disk file used to read or write this asset
Definition at line 143 of file asset.h.
◆ _hash
boost::optional<std::string> dcp::Asset::_hash |
|
mutableprivate |
Hash of _file if it has been computed
Definition at line 154 of file asset.h.
The documentation for this class was generated from the following files: