summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2021-03-28 21:56:54 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-03-28 21:56:55 +0100
commite52391c5851323a37d13e29dbff7bb7c73a4d2b6 (patch)
treedbd9ae7486a91f906426b23e21641f7718a19072
parenta2f672455cd9031f0125f1938a84ccb08f45fe9d (diff)
downloadefl-e52391c5851323a37d13e29dbff7bb7c73a4d2b6.tar.gz
Avif image loader: add another check to verify that libavif has been built with an AV1 decoder
Summary: libavif can be built without a AV1 decoder. Check this in the image loader Test Plan: entice Reviewers: raster Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12252
-rw-r--r--src/modules/evas/image_loaders/avif/evas_image_load_avif.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/modules/evas/image_loaders/avif/evas_image_load_avif.c b/src/modules/evas/image_loaders/avif/evas_image_load_avif.c
index f7cfe0ef03..dd564dbc8a 100644
--- a/src/modules/evas/image_loaders/avif/evas_image_load_avif.c
+++ b/src/modules/evas/image_loaders/avif/evas_image_load_avif.c
@@ -44,6 +44,7 @@ evas_image_load_file_head_avif_internal(Evas_Loader_Internal *loader,
{
Evas_Image_Animated *animated;
avifDecoder *decoder;
+ const char *codec_name;
avifResult res;
Eina_Bool ret;
@@ -61,6 +62,16 @@ evas_image_load_file_head_avif_internal(Evas_Loader_Internal *loader,
return ret;
}
+ codec_name = avifCodecName(decoder->codecChoice, AVIF_CODEC_FLAG_CAN_DECODE);
+ if (!codec_name)
+ {
+ ERR("AV1 codec not available");
+ *error = EVAS_LOAD_ERROR_GENERIC;
+ goto destroy_decoder;
+ }
+
+ INF("AV1 codec name (decode): %s", codec_name);
+
avifDecoderSetIOMemory(decoder, (const uint8_t *)map, length);
res = avifDecoderParse(decoder);
if (res != AVIF_RESULT_OK)
@@ -138,6 +149,8 @@ evas_image_load_file_data_avif_internal(Evas_Loader_Internal *loader,
decoder = loader->decoder;
if (!decoder)
{
+ const char *codec_name;
+
decoder = avifDecoderCreate();
if (!decoder)
{
@@ -145,6 +158,17 @@ evas_image_load_file_data_avif_internal(Evas_Loader_Internal *loader,
return EINA_FALSE;
}
+ codec_name = avifCodecName(decoder->codecChoice,
+ AVIF_CODEC_FLAG_CAN_DECODE);
+ if (!codec_name)
+ {
+ ERR("AV1 codec not available");
+ *error = EVAS_LOAD_ERROR_GENERIC;
+ goto on_error;
+ }
+
+ INF("AV1 codec name (decode): %s", codec_name);
+
avifDecoderSetIOMemory(decoder, (const uint8_t *)map, length);
res = avifDecoderParse(decoder);
if (res != AVIF_RESULT_OK)