[DEV] add mine format for raw images and add setter of data after init

This commit is contained in:
Edouard DUPIN 2016-07-26 23:21:27 +02:00
parent 338fbfac4b
commit 47c69df1e0
3 changed files with 22 additions and 1 deletions

View File

@ -37,6 +37,13 @@ zeus::File::File(const std::string& _mineType, std::vector<uint8_t> _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<uint8_t>& _data) {
setData(_offset, &_data[0], _data.size());
}

View File

@ -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<uint8_t> _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

View File

@ -112,6 +112,14 @@ static std::vector<std::pair<std::string, std::string>> 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) {