/* Open an image. Try the created image decoder one by one. Once one is able to open the image that decoder is save in  */
lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t *dsc, const void *src, const lv_style_t *style)
/* Open an image. Try the created image decoder one by one. Once one is able to open the image that decoder is save in  */
lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t *dsc, const void *src, const lv_style_t *style)
{
    dsc->style     = style;
    dsc->src       = src;
    dsc->src_type  = lv_img_src_get_type(src);
    dsc->user_data = NULL;
    lv_res_t res = LV_RES_INV;
    lv_img_decoder_t * d;
    LV_LL_READ(LV_GC_ROOT(_lv_img_defoder_ll), d)
    {
        if(d->info_cb == NULL || d->open_cb == NULL) continue;
        res = d->info_cb(d, src, &dsc->header);
        if(res != LV_RES_OK) continue;
        dsc->error_msg = NULL;
        dsc->img_data  = NULL;
        dsc->decoder   = d;
        res = d->open_cb(d, dsc);
        if(res == LV_RES_OK) break;
    }
    if(res == LV_RES_INV) {
        memset(dsc, 0, sizeof(lv_img_decoder_dsc_t));
    }
    return res;
}