diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/asset_map.cc | 8 | ||||
| -rw-r--r-- | src/util.cc | 10 | ||||
| -rw-r--r-- | src/util.h | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/src/asset_map.cc b/src/asset_map.cc index 31809c9b..35f96c45 100644 --- a/src/asset_map.cc +++ b/src/asset_map.cc @@ -22,6 +22,7 @@ */ #include "asset_map.h" +#include "util.h" using namespace std; using namespace boost; @@ -50,6 +51,13 @@ Chunk::Chunk (xmlpp::Node const * node) : XMLNode (node) { path = string_node ("Path"); + + string const prefix = "file://"; + + if (starts_with (path, prefix)) { + path = path.substr (prefix.length()); + } + volume_index = optional_int64_node ("VolumeIndex"); offset = optional_int64_node ("Offset"); length = optional_int64_node ("Length"); diff --git a/src/util.cc b/src/util.cc index ad6a66fe..fd76e556 100644 --- a/src/util.cc +++ b/src/util.cc @@ -149,6 +149,16 @@ libdcp::content_kind_from_string (string type) } bool +libdcp::starts_with (string big, string little) +{ + if (little.size() > big.size()) { + return false; + } + + return big.substr (0, little.length()) == little; +} + +bool libdcp::ends_with (string big, string little) { if (little.size() > big.size()) { @@ -46,6 +46,7 @@ extern std::string make_digest (std::string filename, sigc::signal1<void, float> extern std::string content_kind_to_string (ContentKind kind); extern ContentKind content_kind_from_string (std::string kind); +extern bool starts_with (std::string big, std::string little); extern bool ends_with (std::string big, std::string little); extern opj_image_t* decompress_j2k (uint8_t* data, int64_t size, int reduce); |
