From 47c69df1e078eb0a09cce5a170745f4a76409933 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 26 Jul 2016 23:21:27 +0200 Subject: [PATCH] [DEV] add mine format for raw images and add setter of data after init --- zeus/File.cpp | 7 +++++++ zeus/File.h | 8 +++++++- zeus/mineType.cpp | 8 ++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/zeus/File.cpp b/zeus/File.cpp index 8e55add..7748ce8 100644 --- a/zeus/File.cpp +++ b/zeus/File.cpp @@ -37,6 +37,13 @@ zeus::File::File(const std::string& _mineType, std::vector _data, int32 } } +zeus::File::File(const std::string& _mineType, int32_t _size) : + m_mineType(_mineType), + m_data() { + m_data.resize(_size); + m_fileSize = _size; +} + void zeus::File::setData(uint64_t _offset, const std::vector& _data) { setData(_offset, &_data[0], _data.size()); } diff --git a/zeus/File.h b/zeus/File.h index 0baedf6..7990bfc 100644 --- a/zeus/File.h +++ b/zeus/File.h @@ -29,9 +29,15 @@ namespace zeus { * @brief Constructor of a typed file * @param[in] _mineType mine type of the file * @param[in] _data data of the file - * @param[in] _fileSize théoric file size + * @param[in] _fileSize theoric file size */ File(const std::string& _mineType, std::vector _data, int32_t _fileSize = -1); + /** + * @brief Constructor of a typed file + * @param[in] _mineType mine type of the file + * @param[in] _fileSize preallocation size (data will be set after ...) + */ + File(const std::string& _mineType, int32_t _size); /** * @brief get the théoric file size * @return size of the file diff --git a/zeus/mineType.cpp b/zeus/mineType.cpp index fe5df4f..3880a54 100644 --- a/zeus/mineType.cpp +++ b/zeus/mineType.cpp @@ -112,6 +112,14 @@ static std::vector> mineList = { /* Miscellaneous text files */ { "bup", "text/bup"}, /* DVD backup */ { "ifo", "text/ifo"}, /* DVD information */ + + /* Some Raw format for images */ + { "yuv422", "image/x-raw/yuv422"}, + { "yuv420", "image/x-raw/yuv420"}, + { "yuv411", "image/x-raw/yuv411"}, + { "rgb", "image/x-raw/r8g8b8"}, + { "rgba", "image/x-raw/r8g8b8a8"}, + }; std::string zeus::getMineType(const std::string& _extention) {