QVariant CameraBinImageProcessing::parameter( QCameraImageProcessingControl::ProcessingParameter parameter) const { switch (parameter) { case QCameraImageProcessingControl::WhiteBalancePreset: return QVariant::fromValue<QCameraImageProcessing::WhiteBalanceMode>(whiteBalanceMode()); case QCameraImageProcessingControl::ColorFilter: #ifdef HAVE_GST_PHOTOGRAPHY if (GstPhotography *photography = m_session->photography()) { #if GST_CHECK_VERSION(1, 0, 0) GstPhotographyColorToneMode mode = GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL; gst_photography_get_color_tone_mode(photography, &mode); #else GstColourToneMode mode = GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL; gst_photography_get_colour_tone_mode(photography, &mode); #endif return QVariant::fromValue(m_filterMap.key(mode, QCameraImageProcessing::ColorFilterNone)); } #endif return QVariant::fromValue(QCameraImageProcessing::ColorFilterNone); default: return m_values.contains(parameter) ? QVariant(m_values.value(parameter)) : QVariant(); } }
QVariant CameraBinImageProcessing::parameter( QCameraImageProcessingControl::ProcessingParameter parameter) const { switch (parameter) { case QCameraImageProcessingControl::WhiteBalancePreset: { const QCameraImageProcessing::WhiteBalanceMode mode = whiteBalanceMode(); #ifdef USE_V4L if (mode == QCameraImageProcessing::WhiteBalanceAuto || mode == QCameraImageProcessing::WhiteBalanceManual) { return m_v4lImageControl->parameter(parameter); } #endif return QVariant::fromValue<QCameraImageProcessing::WhiteBalanceMode>(mode); } case QCameraImageProcessingControl::ColorTemperature: { #ifdef USE_V4L return m_v4lImageControl->parameter(parameter); #else return QVariant(); #endif } case QCameraImageProcessingControl::ColorFilter: #ifdef HAVE_GST_PHOTOGRAPHY if (GstPhotography *photography = m_session->photography()) { #if GST_CHECK_VERSION(1, 0, 0) GstPhotographyColorToneMode mode = GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL; gst_photography_get_color_tone_mode(photography, &mode); #else GstColourToneMode mode = GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL; gst_photography_get_colour_tone_mode(photography, &mode); #endif return QVariant::fromValue(m_filterMap.key(mode, QCameraImageProcessing::ColorFilterNone)); } #endif return QVariant::fromValue(QCameraImageProcessing::ColorFilterNone); default: { const bool isGstParameterSupported = m_values.contains(parameter); #ifdef USE_V4L if (!isGstParameterSupported) { if (parameter == QCameraImageProcessingControl::BrightnessAdjustment || parameter == QCameraImageProcessingControl::ContrastAdjustment || parameter == QCameraImageProcessingControl::SaturationAdjustment || parameter == QCameraImageProcessingControl::SharpeningAdjustment) { return m_v4lImageControl->parameter(parameter); } } #endif return isGstParameterSupported ? QVariant(m_values.value(parameter)) : QVariant(); } } }
static gboolean gst_camerabin_get_colour_tone_mode (GstPhotography * photo, GstColourToneMode * colour_tone_mode) { GstCameraBin *camera; gboolean ret = FALSE; g_return_val_if_fail (photo != NULL, FALSE); camera = GST_CAMERABIN (photo); if (PHOTOGRAPHY_IS_OK (camera->src_vid_src)) { ret = gst_photography_get_colour_tone_mode (GST_PHOTOGRAPHY (camera->src_vid_src), colour_tone_mode); } return ret; }
static void test_photography_settings (GstElement * cam) { GTypeClass *tclass; gfloat ev_comp, orig_ev_comp; guint iso_speed = 100, orig_iso_speed; GstFlashMode flash, orig_flash; GstWhiteBalanceMode wb, orig_wb; GstColourToneMode ct, orig_ct; GstSceneMode sm, orig_sm; GstFlickerReductionMode flm, orig_flm; GstFocusMode fm, orig_fm; gfloat zoom, orig_zoom; if (!GST_IS_PHOTOGRAPHY (cam)) { GST_WARNING ("omitting photography settings test, " "photography interface not implemented"); return; } for (ev_comp = -3.0; ev_comp <= 3.0; ev_comp += 0.5) { orig_ev_comp = ev_comp; gst_photography_set_ev_compensation (GST_PHOTOGRAPHY (cam), ev_comp); gst_photography_get_ev_compensation (GST_PHOTOGRAPHY (cam), &ev_comp); fail_if (orig_ev_comp != ev_comp, "setting photography ev compensation failed"); ev_comp = orig_ev_comp; g_usleep (PHOTO_SETTING_DELAY_US); } /* FIXME: what are the actual iso values? */ for (iso_speed = 100; iso_speed <= 800; iso_speed *= 2) { orig_iso_speed = iso_speed; gst_photography_set_iso_speed (GST_PHOTOGRAPHY (cam), iso_speed); gst_photography_get_iso_speed (GST_PHOTOGRAPHY (cam), &iso_speed); fail_if (orig_iso_speed != iso_speed, "setting photography iso speed failed"); iso_speed = orig_iso_speed; g_usleep (PHOTO_SETTING_DELAY_US); } tclass = g_type_class_ref (GST_TYPE_FLASH_MODE); for (flash = 0; flash < G_ENUM_CLASS (tclass)->n_values; flash++) { orig_flash = flash; gst_photography_set_flash_mode (GST_PHOTOGRAPHY (cam), flash); gst_photography_get_flash_mode (GST_PHOTOGRAPHY (cam), &flash); fail_if (orig_flash != flash, "setting photography flash failed"); flash = orig_flash; g_usleep (PHOTO_SETTING_DELAY_US); } g_type_class_unref (tclass); tclass = g_type_class_ref (GST_TYPE_WHITE_BALANCE_MODE); for (wb = 0; wb < G_ENUM_CLASS (tclass)->n_values; wb++) { orig_wb = wb; gst_photography_set_white_balance_mode (GST_PHOTOGRAPHY (cam), wb); gst_photography_get_white_balance_mode (GST_PHOTOGRAPHY (cam), &wb); fail_if (orig_wb != wb, "setting photography white balance mode failed"); wb = orig_wb; g_usleep (PHOTO_SETTING_DELAY_US); } g_type_class_unref (tclass); tclass = g_type_class_ref (GST_TYPE_COLOUR_TONE_MODE); for (ct = 0; ct < G_ENUM_CLASS (tclass)->n_values; ct++) { orig_ct = ct; gst_photography_set_colour_tone_mode (GST_PHOTOGRAPHY (cam), ct); gst_photography_get_colour_tone_mode (GST_PHOTOGRAPHY (cam), &ct); fail_if (orig_ct != ct, "setting photography colour tone mode failed"); ct = orig_ct; g_usleep (PHOTO_SETTING_DELAY_US); } g_type_class_unref (tclass); tclass = g_type_class_ref (GST_TYPE_SCENE_MODE); for (sm = 0; sm < G_ENUM_CLASS (tclass)->n_values; sm++) { orig_sm = sm; gst_photography_set_scene_mode (GST_PHOTOGRAPHY (cam), sm); gst_photography_get_scene_mode (GST_PHOTOGRAPHY (cam), &sm); fail_if (orig_sm != sm, "setting photography scene mode failed"); sm = orig_sm; g_usleep (PHOTO_SETTING_DELAY_US); } g_type_class_unref (tclass); tclass = g_type_class_ref (GST_TYPE_FOCUS_MODE); for (fm = 0; fm < G_ENUM_CLASS (tclass)->n_values; fm++) { orig_fm = fm; gst_photography_set_focus_mode (GST_PHOTOGRAPHY (cam), fm); gst_photography_get_focus_mode (GST_PHOTOGRAPHY (cam), &fm); fail_if (orig_fm != fm, "setting photography focus mode failed"); fm = orig_fm; g_usleep (PHOTO_SETTING_DELAY_US); } g_type_class_unref (tclass); tclass = g_type_class_ref (GST_TYPE_FLICKER_REDUCTION_MODE); for (flm = 0; flm < G_ENUM_CLASS (tclass)->n_values; flm++) { orig_flm = flm; gst_photography_set_flicker_mode (GST_PHOTOGRAPHY (cam), flm); gst_photography_get_flicker_mode (GST_PHOTOGRAPHY (cam), &flm); fail_if (orig_flm != flm, "setting photography flicker mode failed"); flm = orig_flm; g_usleep (PHOTO_SETTING_DELAY_US); } g_type_class_unref (tclass); for (zoom = 1.0; zoom <= 10.0; zoom += 1.0) { orig_zoom = zoom; gst_photography_set_zoom (GST_PHOTOGRAPHY (cam), zoom); gst_photography_get_zoom (GST_PHOTOGRAPHY (cam), &zoom); fail_if (orig_zoom != zoom, "setting photography zoom failed"); zoom = orig_zoom; g_usleep (PHOTO_SETTING_DELAY_US); } }