bool CameraBinExposure::setExposureParameter(ExposureParameter parameter, const QVariant& value) { QVariant oldValue = exposureParameter(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; default: return false; } QVariant newValue = exposureParameter(parameter); if (!qFuzzyCompare(oldValue.toReal(), newValue.toReal())) emit exposureParameterChanged(parameter); return true; }
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; }