diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-04-25 10:26:11 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-04-25 10:26:11 +0200 |
| commit | 7c24b62d51e0ddf14af451ef5a543f07b69f111e (patch) | |
| tree | 6628a7624fb554a4c8ee2ee561fa8228a0bde153 /src/asset.cc | |
| parent | 764a1cc30404861757d9a99e7f0e20341d6ea353 (diff) | |
Move AssetMap handling out to a separate class.
Diffstat (limited to 'src/asset.cc')
| -rw-r--r-- | src/asset.cc | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/asset.cc b/src/asset.cc index 6e200b0d..372779b1 100644 --- a/src/asset.cc +++ b/src/asset.cc @@ -38,6 +38,7 @@ #include "asset.h" +#include "asset_map.h" #include "compose.hpp" #include "dcp_assert.h" #include "exceptions.h" @@ -102,15 +103,15 @@ Asset::add_to_pkl (shared_ptr<PKL> pkl, path root) const void -Asset::write_to_assetmap (xmlpp::Node* node, path root) const +Asset::add_to_assetmap (AssetMap& asset_map, path root) const { DCP_ASSERT (_file); - write_file_to_assetmap (node, root, _file.get(), _id); + add_file_to_assetmap (asset_map, root, _file.get(), _id); } void -Asset::write_file_to_assetmap (xmlpp::Node* node, path root, path file, string id) +Asset::add_file_to_assetmap (AssetMap& asset_map, path root, path file, string id) { auto path = relative_to_root ( canonical(root), @@ -124,15 +125,7 @@ Asset::write_file_to_assetmap (xmlpp::Node* node, path root, path file, string i return; } - auto asset = node->add_child ("Asset"); - asset->add_child("Id")->add_child_text("urn:uuid:" + id); - auto chunk_list = asset->add_child ("ChunkList"); - auto chunk = chunk_list->add_child ("Chunk"); - - chunk->add_child("Path")->add_child_text(path.get().generic_string()); - chunk->add_child("VolumeIndex")->add_child_text("1"); - chunk->add_child("Offset")->add_child_text("0"); - chunk->add_child("Length")->add_child_text(raw_convert<string>(file_size(file))); + asset_map.add_asset(id, file, false); } |
