From 494406afd32db350778e7b6be2aecc7d10b15125 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 8 Dec 2025 23:31:04 +0100 Subject: Extract read_assetmap(). --- src/dcp.cc | 21 ++++++++++++++------- src/dcp.h | 2 ++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/dcp.cc b/src/dcp.cc index 5bcfca42..c01ecc96 100644 --- a/src/dcp.cc +++ b/src/dcp.cc @@ -136,21 +136,28 @@ DCP::operator=(DCP&& other) } -void -DCP::read (vector* notes, bool ignore_incorrect_picture_mxf_type) +AssetMap +DCP::read_assetmap() const { - /* Read the ASSETMAP and PKL */ + boost::filesystem::path path; - boost::filesystem::path asset_map_path; if (filesystem::exists(_directory / "ASSETMAP")) { - asset_map_path = _directory / "ASSETMAP"; + path = _directory / "ASSETMAP"; } else if (filesystem::exists(_directory / "ASSETMAP.xml")) { - asset_map_path = _directory / "ASSETMAP.xml"; + path = _directory / "ASSETMAP.xml"; } else { boost::throw_exception(MissingAssetmapError(_directory)); } - _asset_map = AssetMap(asset_map_path); + return AssetMap(path); +} + + +void +DCP::read (vector* notes, bool ignore_incorrect_picture_mxf_type) +{ + /* Read the ASSETMAP and PKL */ + _asset_map = read_assetmap(); auto const pkl_paths = _asset_map->pkl_paths(); auto const standard = _asset_map->standard(); diff --git a/src/dcp.h b/src/dcp.h index d9a8c0c6..482f4969 100644 --- a/src/dcp.h +++ b/src/dcp.h @@ -202,6 +202,8 @@ public: private: void write_volindex (Standard standard) const; + /** Throws MissingAssetmapError if asset map could not be found */ + AssetMap read_assetmap() const; /** The directory that we are writing to */ boost::filesystem::path _directory; -- cgit v1.2.3