Custom decoder info function not being called

Description

All 4 functions implemented and registered by " lv_image_decoder_set_xxxx "

decoder_info
decoder_open
decoder_get_area
decoder_close

Tryed 2 ways :

    • “img_dsc” allocated and filled (defined as LV_COLOR_FORMAT_RAW)

then I call these to show on the screen :

lv_obj_t* img = lv_img_create(lv_scr_act());
lv_img_set_src(img, img_dsc);

    • No “img_dsc”…instead I’m calling lv_img_set_src(img, “A/1”);

The number 2 method expects some kind of file to be open…which I don’t have.

I put a Breakpoint at the very beginning of my “decoder_info” function…it never gets there.

I’m trying to link my SPI-Flash functions to LVGL using this custom decoder…no file system, just reading straight from the flash memory.

so, if you can debug your code - put BP on lv_img_set_src(img, img_dsc); and step into lv_img_set_src and check what errors ocuured

I did exaclty that.

I commented few lines of code in the file “lv_image_decode.c”…and everything is working now.

329 - if(src_type == LV_IMAGE_SRC_FILE) {
330 - lv_fs_res_t fs_res = lv_fs_open(&dsc->file, src, LV_FS_MODE_RD);
331 - if(fs_res != LV_FS_RES_OK) {
332 - LV_LOG_ERROR(“File open failed: %” LV_PRIu32, (uint32_t)fs_res);
333 - return NULL;
334 - }
335 - }

LVGL probably expects me to create a file system interface…which I was not willing to do.

it seems like you incorect initialized img_dsc struct. as far as i understand you wanted the img src to be a LV_IMG_SRC_VARIABLE, and it is defined as LV_IMG_SRC_FILE, so img decoder tried to open file

Well…there are few reasons for that :slight_smile:

1 - LV_IMG_SRC_VARIABLE does not exist…the closest I could find is LV_IMAGE_SRC_VARIABLE

2 - even defining a header with LV_IMAGE_SRC_VARIABLE (before lv_img_create / lv_img_set_src)…NO callbacks are called.

3 - Oficial Documentation and Forum have very few references and troubleshooting about custom decoders…I tryed to follow the ones I could find…unsuccessfully.

4 - I just started with LVGL last week. My experience on it is pretty bad…so I decided to hammer the library to fit my needs.