src/player/SpiffsUtils.cpp
// header is CODEC-HEIGHT-WIDTH
header is CODEC-HEIGHT-WIDTH
header is CODEC - HEIGHT - WIDTH
bool SpiffsUtils::readImageHeader() {
    if (_file.available()) {
        uint8_t codec = _file.read();
        if (codec != RUNTIME_CODEC && codec != NO_CODEC) {
            LOGE(SPIF_U, "Image not encoded with known codec.");
            clearImageHeader();
            return false;
        }
        _header.codec = codec;
    }
    if (_file.available()) {
        _header.height = _file.read();
    }
    if (_file.available()) {
    	uint8_t widthUpper = _file.read();
        uint8_t widthLower= _file.read();
        _header.width = widthLower + 256 * widthUpper;
    }
    if (!_file.available()) {
        LOGE(SPIF_U, "Cannot read header from image.");
        clearImageHeader();
		return false;
    }
    LOGI(SPIF_U, "Header: encoding: %d, height: %d, width: %d", _header.codec, _header.height, _header.width)
    return true;
}
bool SpiffsUtils :: readImageHeader ( ) { if ( _file . available ( ) ) { uint8_t codec = _file . read ( ) ; if ( codec != RUNTIME_CODEC && codec != NO_CODEC ) { LOGE ( SPIF_U , " " ) ; clearImageHeader ( ) ; return false ; } _header . codec = codec ; } if ( _file . available ( ) ) { _header . height = _file . read ( ) ; } if ( _file . available ( ) ) { uint8_t widthUpper = _file . read ( ) ; uint8_t widthLower = _file . read ( ) ; _header . width = widthLower + 256 * widthUpper ; } if ( ! _file . available ( ) ) { LOGE ( SPIF_U , " " ) ; clearImageHeader ( ) ; return false ; } LOGI ( SPIF_U , " " , _header . codec , _header . height , _header . width ) return true ; }
header is CODEC-HEIGHT-WIDTH
header is CODEC - HEIGHT - WIDTH