For some reason IMG_Load_RW is reporting unsupported type however, if I write it to a file, I can load it fine with a normal IMG_Load(). Any hints on why it won’t load with IMG_Load_RW ?
///temp write to disk to examine jpeg:
ofstream temppic;
temppic.open("/tmp/album-image.jpg",ios::binary | ios::trunc);
if(temppic)
{
temppic.write(pic->picture().data(),pic->picture().size());
temppic.close();
}
if(!picData)
{
ndebug::out(ndebug::LOG_DEBUG,"SearchDir: failed to conver album art into SDL RWop for %s",path.c_str());
return NULL;
}
SDL_Surface * image;
/// This works:
image = IMG_Load("/tmp/album-image.jpg");
/// This doesn’t work:
//image = IMG_Load_RW(picData,1);
if(!image)
{
ndebug::out(ndebug::LOG_ERR,"SearchDir: Failed to load album art image. Error: (%s)",IMG_GetError());
ndebug::out(ndebug::LOG_ERR,"SearchDir: mime type of image: %s",pic->mimeType().toCString());
return NULL;
}
return image;