summaryrefslogtreecommitdiff
path: root/src
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 /src
parenta2f672455cd9031f0125f1938a84ccb08f45fe9d (diff)
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
Diffstat (limited to 'src')
-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,
44{ 44{
45 Evas_Image_Animated *animated; 45 Evas_Image_Animated *animated;
46 avifDecoder *decoder; 46 avifDecoder *decoder;
47 const char *codec_name;
47 avifResult res; 48 avifResult res;
48 Eina_Bool ret; 49 Eina_Bool ret;
49 50
@@ -61,6 +62,16 @@ evas_image_load_file_head_avif_internal(Evas_Loader_Internal *loader,
61 return ret; 62 return ret;
62 } 63 }
63 64
65 codec_name = avifCodecName(decoder->codecChoice, AVIF_CODEC_FLAG_CAN_DECODE);
66 if (!codec_name)
67 {
68 ERR("AV1 codec not available");
69 *error = EVAS_LOAD_ERROR_GENERIC;
70 goto destroy_decoder;
71 }
72
73 INF("AV1 codec name (decode): %s", codec_name);
74
64 avifDecoderSetIOMemory(decoder, (const uint8_t *)map, length); 75 avifDecoderSetIOMemory(decoder, (const uint8_t *)map, length);
65 res = avifDecoderParse(decoder); 76 res = avifDecoderParse(decoder);
66 if (res != AVIF_RESULT_OK) 77 if (res != AVIF_RESULT_OK)
@@ -138,6 +149,8 @@ evas_image_load_file_data_avif_internal(Evas_Loader_Internal *loader,
138 decoder = loader->decoder; 149 decoder = loader->decoder;
139 if (!decoder) 150 if (!decoder)
140 { 151 {
152 const char *codec_name;
153
141 decoder = avifDecoderCreate(); 154 decoder = avifDecoderCreate();
142 if (!decoder) 155 if (!decoder)
143 { 156 {
@@ -145,6 +158,17 @@ evas_image_load_file_data_avif_internal(Evas_Loader_Internal *loader,
145 return EINA_FALSE; 158 return EINA_FALSE;
146 } 159 }
147 160
161 codec_name = avifCodecName(decoder->codecChoice,
162 AVIF_CODEC_FLAG_CAN_DECODE);
163 if (!codec_name)
164 {
165 ERR("AV1 codec not available");
166 *error = EVAS_LOAD_ERROR_GENERIC;
167 goto on_error;
168 }
169
170 INF("AV1 codec name (decode): %s", codec_name);
171
148 avifDecoderSetIOMemory(decoder, (const uint8_t *)map, length); 172 avifDecoderSetIOMemory(decoder, (const uint8_t *)map, length);
149 res = avifDecoderParse(decoder); 173 res = avifDecoderParse(decoder);
150 if (res != AVIF_RESULT_OK) 174 if (res != AVIF_RESULT_OK)