evas - avif - fix for 0.8.2 libavif that broke api

also require 0.8.2 ... as well - no point trying to support older
versions forever and this is still experimental.

fixes T8844
@fix
This commit is contained in:
Carsten Haitzler 2020-12-18 11:16:38 +00:00
parent 5f3152a30b
commit 00f5eed1d2
2 changed files with 5 additions and 11 deletions

View File

@ -10,7 +10,7 @@ giflib = cc.find_library('gif')
webp = dependency('libwebp', version: ['>=0.5.0'], required: get_option('evas-loaders-disabler').contains('webp') == false) webp = dependency('libwebp', version: ['>=0.5.0'], required: get_option('evas-loaders-disabler').contains('webp') == false)
webpdemux = dependency('libwebpdemux', version: ['>=0.5.0'], required: get_option('evas-loaders-disabler').contains('webp') == false) webpdemux = dependency('libwebpdemux', version: ['>=0.5.0'], required: get_option('evas-loaders-disabler').contains('webp') == false)
libopenjp2 = dependency('libopenjp2', required: get_option('evas-loaders-disabler').contains('jp2k') == false) libopenjp2 = dependency('libopenjp2', required: get_option('evas-loaders-disabler').contains('jp2k') == false)
libavif = dependency('libavif', required: get_option('evas-loaders-disabler').contains('avif') == false) libavif = dependency('libavif', required: get_option('evas-loaders-disabler').contains('avif') == false, version: '>= 0.8.2')
evas_image_loaders_file = [ evas_image_loaders_file = [
['avif', 'shared', [libavif]], ['avif', 'shared', [libavif]],

View File

@ -43,7 +43,6 @@ evas_image_load_file_head_avif_internal(Evas_Loader_Internal *loader,
int *error) int *error)
{ {
Evas_Image_Animated *animated; Evas_Image_Animated *animated;
avifROData raw;
avifDecoder *decoder; avifDecoder *decoder;
avifResult res; avifResult res;
Eina_Bool ret; Eina_Bool ret;
@ -55,9 +54,6 @@ evas_image_load_file_head_avif_internal(Evas_Loader_Internal *loader,
prop->h = 0; prop->h = 0;
prop->alpha = EINA_FALSE; prop->alpha = EINA_FALSE;
raw.size = length;
raw.data = (const uint8_t *)map;
decoder = avifDecoderCreate(); decoder = avifDecoderCreate();
if (!decoder) if (!decoder)
{ {
@ -65,7 +61,8 @@ evas_image_load_file_head_avif_internal(Evas_Loader_Internal *loader,
return ret; return ret;
} }
res = avifDecoderParse(decoder, &raw); avifDecoderSetIOMemory(decoder, (const uint8_t *)map, length);
res = avifDecoderParse(decoder);
if (res != AVIF_RESULT_OK) if (res != AVIF_RESULT_OK)
{ {
ERR("avif file format invalid"); ERR("avif file format invalid");
@ -141,7 +138,6 @@ evas_image_load_file_data_avif_internal(Evas_Loader_Internal *loader,
decoder = loader->decoder; decoder = loader->decoder;
if (!decoder) if (!decoder)
{ {
avifROData raw;
decoder = avifDecoderCreate(); decoder = avifDecoderCreate();
if (!decoder) if (!decoder)
{ {
@ -149,10 +145,8 @@ evas_image_load_file_data_avif_internal(Evas_Loader_Internal *loader,
return EINA_FALSE; return EINA_FALSE;
} }
raw.size = length; avifDecoderSetIOMemory(decoder, (const uint8_t *)map, length);
raw.data = (const uint8_t *)map; res = avifDecoderParse(decoder);
res = avifDecoderParse(decoder, &raw);
if (res != AVIF_RESULT_OK) if (res != AVIF_RESULT_OK)
{ {
*error = EVAS_LOAD_ERROR_GENERIC; *error = EVAS_LOAD_ERROR_GENERIC;