bool GPhotoExposureControl::setValue(QCameraExposureControl::ExposureParameter parameter, const QVariant &value)
{
    m_requestedValues[parameter] = value;
    emit requestedValueChanged(parameter);

    // Try to set parameters only on loaded camera
    if (m_state == QCamera::UnloadedState)
        return false;

    if (parameter == ExposureCompensation) {
        bool result = m_session->setParameter("exposurecompensation", value);

        if (result) {
            emit actualValueChanged(parameter);
            return true;
        }
    } else if (parameter == ISO) {
        QVariant v = value;
        if (!v.isValid())
            v = -1;
        bool result = m_session->setParameter("iso", v);

        if (result) {
            emit actualValueChanged(parameter);
            return true;
        }
    } else {
        qWarning() << "Currently unsupported parameter" << parameter << "change requested";
    }

    return false;
}
bool CameraBinExposure::setValue(ExposureParameter parameter, const QVariant& value)
{
    QVariant oldValue = actualValue(parameter);

    switch (parameter) {
    case QCameraExposureControl::ExposureCompensation:
        gst_photography_set_ev_compensation(m_session->photography(), value.toReal());
        break;
    case QCameraExposureControl::ISO:
        gst_photography_set_iso_speed(m_session->photography(), value.toInt());
        break;
    case QCameraExposureControl::Aperture:
        gst_photography_set_aperture(m_session->photography(), guint(value.toReal()*1000000));
        break;
    case QCameraExposureControl::ShutterSpeed:
        gst_photography_set_exposure(m_session->photography(), guint(value.toReal()*1000000));
        break;
    case QCameraExposureControl::ExposureMode:
    {
        QCameraExposure::ExposureMode mode = QCameraExposure::ExposureMode(value.toInt());
        GstSceneMode sceneMode;
        gst_photography_get_scene_mode(m_session->photography(), &sceneMode);

        switch (mode) {
        case QCameraExposure::ExposureManual:
            sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_MANUAL;
            break;
        case QCameraExposure::ExposurePortrait:
            sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT;
            break;
        case QCameraExposure::ExposureSports:
            sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_SPORT;
            break;
        case QCameraExposure::ExposureNight:
            sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_NIGHT;
            break;
        case QCameraExposure::ExposureAuto:
            sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_AUTO;
            break;
        default:
            break;
        }

        gst_photography_set_scene_mode(m_session->photography(), sceneMode);
        break;
    }
    default:
        return false;
    }

    if (!qFuzzyCompare(m_requestedValues.value(parameter).toReal(), value.toReal())) {
        m_requestedValues[parameter] = value;
        emit requestedValueChanged(parameter);
    }

    QVariant newValue = actualValue(parameter);
    if (!qFuzzyCompare(oldValue.toReal(), newValue.toReal()))
        emit actualValueChanged(parameter);

    return true;
}