diff --git a/vrs/utils/cli/DataExtraction.cpp b/vrs/utils/cli/DataExtraction.cpp index 5d4d0869..88d3a7c9 100644 --- a/vrs/utils/cli/DataExtraction.cpp +++ b/vrs/utils/cli/DataExtraction.cpp @@ -32,15 +32,25 @@ using namespace std; namespace vrs::utils { -void extractImages(const string& path, FilteredFileReader& filteredReader, bool extractImagesRaw) { +void extractImages( + const string& path, + FilteredFileReader& filteredReader, + bool extractImagesRaw, + ImageNamer* imageNamer) { if (path.length() > 0) { os::makeDirectories(path); } + ImageNamer defaultImageNamer; + if (imageNamer == nullptr) { + imageNamer = &defaultImageNamer; + } + imageNamer->init(filteredReader.reader); uint32_t imageCounter = 0; deque> extractors; for (auto id : filteredReader.filter.streams) { if (filteredReader.reader.mightContainImages(id)) { - extractors.emplace_back(make_unique(path, imageCounter, extractImagesRaw)); + extractors.emplace_back( + make_unique(*imageNamer, path, imageCounter, extractImagesRaw)); filteredReader.reader.setStreamPlayer(id, extractors.back().get()); } } diff --git a/vrs/utils/cli/DataExtraction.h b/vrs/utils/cli/DataExtraction.h index 79f3130d..00403105 100644 --- a/vrs/utils/cli/DataExtraction.h +++ b/vrs/utils/cli/DataExtraction.h @@ -20,6 +20,8 @@ namespace vrs::utils { +class ImageNamer; + /// Helper for cli tool to extract images from a VRS file into image files. /// Streams containing no images will be ignored. /// @param folderPath: path to a folder where to extract the files @@ -27,11 +29,13 @@ namespace vrs::utils { /// @param extractImagesRaw: if true, raw images will be saved as ".raw" files with no processing, /// otherwise, raw images will be saved as png files, even if that means that a pixel format /// conversion is performed. +/// @param imageNamer: an optional helper to customize how extracted images are named. /// @return A status code, 0 meaning success. void extractImages( const std::string& path, FilteredFileReader& filteredReader, - bool extractImagesRaw = false); + bool extractImagesRaw = false, + ImageNamer* imageNamer = nullptr); /// Helper for cli tool to extract raw audio streams from a VRS file into WAV files. /// Streams containing no audio will be ignored.