void QSpotifySession::receiveImageResponse(sp_image *image)
{
    Q_ASSERT(image);
    qDebug() << "QSpotifySession::receiveImageResponse";
    sp_image_remove_load_callback(image, callback_image_loaded, 0);

    QString id = g_imageRequestObject.take(image);
    QImage im;
    if (sp_image_error(image) == SP_ERROR_OK) {
        size_t dataSize;
        const void *data = sp_image_data(image, &dataSize);
        im = QImage::fromData(reinterpret_cast<const uchar *>(data), dataSize, "JPG");
    }

    sp_image_release(image);

    g_imageRequestMutex.lock();
    g_imageRequestImages.insert(id, im);
    g_imageRequestConditions[id]->wakeAll();
    g_imageRequestMutex.unlock();
}
Exemple #2
0
static PyObject *Image_error(Image *self) {
    return  Py_BuildValue("i", sp_image_error(self->_image));
}