raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e52391c5851323a37d13e29dbff7bb7c73a4d2b6

commit e52391c5851323a37d13e29dbff7bb7c73a4d2b6
Author: Vincent Torri <vincent.to...@gmail.com>
Date:   Sun Mar 28 21:56:54 2021 +0100

    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
---
 .../evas/image_loaders/avif/evas_image_load_avif.c | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

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)

-- 


Reply via email to