@@ -41,13 +41,16 @@ CMRC_DECLARE(depthai);
4141
4242namespace dai {
4343
44- TarGzAccessor::TarGzAccessor (const std::vector<std::uint8_t >& tarGzFile) {
45- // Load tar.gz archive from memory
44+ TarXzAccessor::TarXzAccessor (const std::vector<std::uint8_t >& tarGzFile) {
45+ // Load tar.xz archive from memory
4646 struct archive * archive = archive_read_new ();
4747 assert (archive != nullptr );
4848
49- archive_read_support_filter_gzip (archive); // Support for gzip compression
50- archive_read_support_format_tar (archive); // Support for tar format
49+ auto err = archive_read_support_format_tar (archive); // Support for tar format
50+ assert (err == ARCHIVE_OK);
51+
52+ err = archive_read_support_filter_xz (archive); // Support for xz compression
53+ assert (err == ARCHIVE_OK);
5154
5255 // Open the memory archive
5356 int r = archive_read_open_memory (archive, tarGzFile.data (), tarGzFile.size ());
@@ -72,27 +75,27 @@ TarGzAccessor::TarGzAccessor(const std::vector<std::uint8_t>& tarGzFile) {
7275}
7376
7477// Method to get file data by path
75- std::optional<std::vector<std::uint8_t >> TarGzAccessor ::getFile (const std::string& path) const {
78+ std::optional<std::vector<std::uint8_t >> TarXzAccessor ::getFile (const std::string& path) const {
7679 auto it = resourceMap.find (path);
7780 if (it != resourceMap.end ()) {
7881 return it->second ; // Return the file data
7982 }
8083 return std::nullopt ; // Return empty optional if file not found
8184}
8285
83- TarGzAccessor Resources::getEmbeddedVisualizer () const {
86+ TarXzAccessor Resources::getEmbeddedVisualizer () const {
8487#ifdef DEPTHAI_EMBED_FRONTEND
8588 // Load visualizer tar.gz archive from memory
8689 auto fs = cmrc::depthai::get_filesystem ();
87- constexpr static auto FILE_NAME = " depthai-visualizer-" DEPTHAI_VISUALIZER_VERSION " .tar.gz " ;
90+ constexpr static auto FILE_NAME = " depthai-visualizer-" DEPTHAI_VISUALIZER_VERSION " .tar.xz " ;
8891 if (!fs.exists (FILE_NAME)) {
8992 throw std::runtime_error (" Visualizer not found in embedded resources" );
9093 }
9194 auto visualizerTarGz = fs.open (FILE_NAME);
9295 std::vector<std::uint8_t > visualizerTarGzData (visualizerTarGz.begin (), visualizerTarGz.end ());
9396
9497 // Create and return TarGzAccessor
95- return TarGzAccessor (visualizerTarGzData);
98+ return TarXzAccessor (visualizerTarGzData);
9699#else
97100 throw std::runtime_error (" Visualizer not embedded in resources" );
98101#endif
0 commit comments