diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-04-24 21:39:42 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-04-24 21:39:42 +0200 |
| commit | c1d782e29c4fd0ae6de7a3c5b0f47833580293bd (patch) | |
| tree | d90ff8554a2a04d60966ab928708187053610228 /src/asset.cc | |
| parent | 232e17ff2944d4e0dca311be9b1bc703055d71b4 (diff) | |
wip: add AssetMap and fix everything up.dcp-editor
Diffstat (limited to 'src/asset.cc')
| -rw-r--r-- | src/asset.cc | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/asset.cc b/src/asset.cc index eb6f4a07..21282e9d 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" @@ -98,37 +99,24 @@ 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), - canonical(file) - ); - - if (!path) { + if (!relative_to_root(root, file)) { /* The path of this asset is not within our DCP, so we assume it's an external (referenced) one. */ 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); } |
