bool CameraBinLocks::isWhiteBalanceLocked() const { if (GstPhotography *photography = m_session->photography()) { GstPhotographyWhiteBalanceMode whiteBalanceMode; return gst_photography_get_white_balance_mode(photography, &whiteBalanceMode) && whiteBalanceMode == GST_PHOTOGRAPHY_WB_MODE_MANUAL; } else { return false; } }
static gboolean gst_camerabin_get_white_balance_mode (GstPhotography * photo, GstWhiteBalanceMode * white_balance_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_white_balance_mode (GST_PHOTOGRAPHY (camera->src_vid_src), white_balance_mode); } return ret; }
void CameraBinImageProcessing::setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode) { #ifdef HAVE_GST_PHOTOGRAPHY if (isWhiteBalanceModeSupported(mode)) { m_whiteBalanceMode = mode; #if GST_CHECK_VERSION(1, 2, 0) GstPhotographyWhiteBalanceMode currentMode; if (gst_photography_get_white_balance_mode(m_session->photography(), ¤tMode) && currentMode != GST_PHOTOGRAPHY_WB_MODE_MANUAL) #endif { unlockWhiteBalance(); } } #else Q_UNUSED(mode); #endif }
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); } }
QCameraImageProcessing::WhiteBalanceMode CameraBinImageProcessing::whiteBalanceMode() const { GstWhiteBalanceMode wbMode; gst_photography_get_white_balance_mode(m_session->photography(), &wbMode); return m_mappedWbValues[wbMode]; }