Exemplo n.º 1
0
static gboolean
gst_camerabin_set_scene_mode (GstPhotography * photo, GstSceneMode scene_mode)
{
  GstCameraBin *camera;
  gboolean ret = TRUE;

  g_return_val_if_fail (photo != NULL, FALSE);

  camera = GST_CAMERABIN (photo);

  /* Cache the setting */
  camera->photo_settings.scene_mode = scene_mode;

  gst_camerabin_handle_scene_mode (camera, scene_mode);

  if (PHOTOGRAPHY_IS_OK (camera->src_vid_src)) {
    ret = gst_photography_set_scene_mode (GST_PHOTOGRAPHY (camera->src_vid_src),
        scene_mode);
    if (ret) {
      gst_photography_get_config (GST_PHOTOGRAPHY (camera->src_vid_src),
          &camera->photo_settings);
    }
  }
  return ret;
}
Exemplo n.º 2
0
void Pipeline::setVideoMode()
{
    g_object_set(camerabin, "mode", 1, NULL);

    // set auto scene mode
    gst_photography_set_scene_mode(GST_PHOTOGRAPHY(videoSrc),
                                   GST_PHOTOGRAPHY_SCENE_MODE_AUTO);
    // disable autofocus
    gst_photography_set_autofocus (GST_PHOTOGRAPHY(videoSrc), FALSE);
    // disable flash
    g_object_set(videoSrc, "video-torch", FALSE, NULL);
}
Exemplo n.º 3
0
static gboolean
gst_camerabin_get_config (GstPhotography * photo, GstPhotoSettings * config)
{
  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_config (GST_PHOTOGRAPHY (camera->src_vid_src),
        config);
  }
  return ret;
}
Exemplo n.º 4
0
GstPhotography *CameraBinSession::photography()
{
    if (GST_IS_PHOTOGRAPHY(m_pipeline)) {
        return GST_PHOTOGRAPHY(m_pipeline);
    }

    if (!m_videoSrc) {
        m_videoSrc = buildVideoSrc();

        if (m_videoSrc)
            g_object_set(m_pipeline, VIDEO_SOURCE_PROPERTY, m_videoSrc, NULL);
        else
            g_object_get(m_pipeline, VIDEO_SOURCE_PROPERTY, &m_videoSrc, NULL);

        updateVideoSourceCaps();
        m_videoInputHasChanged = false;
    }

    if (m_videoSrc && GST_IS_PHOTOGRAPHY(m_videoSrc))
        return GST_PHOTOGRAPHY(m_videoSrc);

    return 0;
}
Exemplo n.º 5
0
static void
gst_camerabin_set_autofocus (GstPhotography * photo, gboolean on)
{
  GstCameraBin *camera;

  g_return_if_fail (photo != NULL);

  camera = GST_CAMERABIN (photo);

  GST_DEBUG_OBJECT (camera, "setting autofocus %s", on ? "ON" : "OFF");

  if (PHOTOGRAPHY_IS_OK (camera->src_vid_src)) {
    gst_photography_set_autofocus (GST_PHOTOGRAPHY (camera->src_vid_src), on);
  }
}
Exemplo n.º 6
0
static gboolean
gst_camerabin_get_scene_mode (GstPhotography * photo, GstSceneMode * scene_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_scene_mode (GST_PHOTOGRAPHY (camera->src_vid_src),
        scene_mode);
  }
  return ret;
}
Exemplo n.º 7
0
static gboolean
gst_camerabin_get_iso_speed (GstPhotography * photo, guint * iso_speed)
{
  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_iso_speed (GST_PHOTOGRAPHY (camera->src_vid_src),
        iso_speed);
  }
  return ret;
}
Exemplo n.º 8
0
/**
 * gst_base_camera_src_get_photography:
 * @self: the camerasrc bin
 *
 * Get object implementing photography interface, if there is one.  Otherwise
 * returns NULL.
 */
GstPhotography *
gst_base_camera_src_get_photography (GstBaseCameraSrc * self)
{
  GstElement *elem;

  if (GST_IS_PHOTOGRAPHY (self)) {
    elem = GST_ELEMENT (self);
  } else {
    elem = gst_bin_get_by_interface (GST_BIN (self), GST_TYPE_PHOTOGRAPHY);
  }

  if (elem) {
    return GST_PHOTOGRAPHY (self);
  }

  return NULL;
}
Exemplo n.º 9
0
static gboolean
gst_camerabin_get_ev_compensation (GstPhotography * photo,
    gfloat * ev_compensation)
{
  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_ev_compensation (GST_PHOTOGRAPHY
        (camera->src_vid_src), ev_compensation);
  }
  return ret;
}
Exemplo n.º 10
0
static gboolean
gst_camerabin_set_iso_speed (GstPhotography * photo, guint iso_speed)
{
  GstCameraBin *camera;
  gboolean ret = TRUE;

  g_return_val_if_fail (photo != NULL, FALSE);

  camera = GST_CAMERABIN (photo);

  /* Cache the setting */
  camera->photo_settings.iso_speed = iso_speed;

  if (PHOTOGRAPHY_IS_OK (camera->src_vid_src)) {
    ret = gst_photography_set_iso_speed (GST_PHOTOGRAPHY (camera->src_vid_src),
        iso_speed);
  }
  return ret;
}
Exemplo n.º 11
0
static gboolean
gst_camerabin_set_flash_mode (GstPhotography * photo, GstFlashMode flash_mode)
{
  GstCameraBin *camera;
  gboolean ret = TRUE;

  g_return_val_if_fail (photo != NULL, FALSE);

  camera = GST_CAMERABIN (photo);

  /* Cache the setting */
  camera->photo_settings.flash_mode = flash_mode;

  if (PHOTOGRAPHY_IS_OK (camera->src_vid_src)) {
    ret = gst_photography_set_flash_mode (GST_PHOTOGRAPHY (camera->src_vid_src),
        flash_mode);
  }
  return ret;
}
Exemplo n.º 12
0
static GstPhotoCaps
gst_camerabin_get_capabilities (GstPhotography * photo)
{
  GstCameraBin *camera;
  /* camerabin can zoom by itself */
  GstPhotoCaps pcaps = GST_PHOTOGRAPHY_CAPS_ZOOM;

  g_return_val_if_fail (photo != NULL, FALSE);

  camera = GST_CAMERABIN (photo);

  if (GST_IS_ELEMENT (camera->src_vid_src) &&
      gst_element_implements_interface (camera->src_vid_src,
          GST_TYPE_PHOTOGRAPHY)) {
    GstPhotography *p2 = GST_PHOTOGRAPHY (camera->src_vid_src);
    pcaps |= gst_photography_get_capabilities (p2);
  }

  return pcaps;
}
Exemplo n.º 13
0
static gboolean
gst_camerabin_set_ev_compensation (GstPhotography * photo,
    gfloat ev_compensation)
{
  GstCameraBin *camera;
  gboolean ret = TRUE;

  g_return_val_if_fail (photo != NULL, FALSE);

  camera = GST_CAMERABIN (photo);

  /* Cache the setting */
  camera->photo_settings.ev_compensation = ev_compensation;

  if (PHOTOGRAPHY_IS_OK (camera->src_vid_src)) {
    ret =
        gst_photography_set_ev_compensation (GST_PHOTOGRAPHY
        (camera->src_vid_src), ev_compensation);
  }
  return ret;
}
Exemplo n.º 14
0
static gboolean
gst_camerabin_set_config (GstPhotography * photo, GstPhotoSettings * config)
{
  GstCameraBin *camera;
  gboolean ret = TRUE;
  g_return_val_if_fail (photo != NULL, FALSE);
  camera = GST_CAMERABIN (photo);

  /* Cache the settings */
  memcpy (&camera->photo_settings, config, sizeof (GstPhotoSettings));

  /* Handle night mode */
  gst_camerabin_handle_scene_mode (camera, config->scene_mode);

  if (PHOTOGRAPHY_IS_OK (camera->src_vid_src)) {
    ret =
        gst_photography_set_config (GST_PHOTOGRAPHY (camera->src_vid_src),
        config);
  }
  return ret;
}
Exemplo n.º 15
0
static void gst_imx_v4l2src_get_property(GObject *object, guint prop_id,
		GValue *value, GParamSpec *pspec)
{
	GstImxV4l2VideoSrc *v4l2src = GST_IMX_V4L2SRC(object);

	switch (prop_id)
	{
		case IMX_V4L2SRC_CAPTURE_MODE:
			g_value_set_int(value, v4l2src->capture_mode);
			break;

		case IMX_V4L2SRC_FRAMERATE_NUM:
			g_value_set_int(value, v4l2src->fps_n);
			break;

		case IMX_V4L2SRC_INPUT:
			g_value_set_int(value, v4l2src->input);
			break;

		case IMX_V4L2SRC_DEVICE:
			g_value_set_string(value, v4l2src->devicename);
			break;

		case IMX_V4L2SRC_QUEUE_SIZE:
			g_value_set_int(value, v4l2src->queue_size);
			break;

		case IMX_V4L2SRC_CROP_META_X:
			g_value_set_int(value, v4l2src->metaCropX);
			break;

		case IMX_V4L2SRC_CROP_META_Y:
			g_value_set_int(value, v4l2src->metaCropY);
			break;

		case IMX_V4L2SRC_CROP_META_WIDTH:
			g_value_set_int(value, v4l2src->metaCropWidth);
			break;

		case IMX_V4L2SRC_CROP_META_HEIGHT:
			g_value_set_int(value, v4l2src->metaCropHeight);
			break;

		case PROP_FOCUS_MODE:
			{
				GstPhotographyFocusMode focus_mode;
				gst_imx_v4l2src_get_focus_mode(GST_PHOTOGRAPHY(v4l2src), &focus_mode);
				g_value_set_enum(value, focus_mode);
			}
			break;

		case PROP_WB_MODE:
			g_value_set_enum(value, GST_PHOTOGRAPHY_WB_MODE_AUTO);
			break;

		case PROP_COLOR_TONE:
			g_value_set_enum(value, GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL);
			break;

		case PROP_SCENE_MODE:
			g_value_set_enum(value, GST_TYPE_PHOTOGRAPHY_SCENE_MODE);
			break;

		case PROP_FLASH_MODE:
			g_value_set_enum(value, GST_PHOTOGRAPHY_FLASH_MODE_AUTO);
			break;

		case PROP_FLICKER_MODE:
			g_value_set_enum(value, GST_PHOTOGRAPHY_FLICKER_REDUCTION_OFF);
			break;

		case PROP_CAPABILITIES:
			g_value_set_ulong(value, GST_PHOTOGRAPHY_CAPS_NONE);
			break;

		case PROP_EV_COMP:
			g_value_set_float(value, 0.0f);
			break;

		case PROP_ISO_SPEED:
			g_value_set_uint(value, 0);
			break;

		case PROP_APERTURE:
			g_value_set_uint(value, 0);
			break;

		case PROP_EXPOSURE_TIME:
			g_value_set_uint(value, 0);
			break;

		case PROP_IMAGE_CAPTURE_SUPPORTED_CAPS:
		case PROP_IMAGE_PREVIEW_SUPPORTED_CAPS:
			if (v4l2src->fd_obj_v4l)
				gst_value_set_caps(value, gst_imx_v4l2src_caps_for_current_setup(v4l2src));
			else
				GST_DEBUG_OBJECT(v4l2src, "not connected to hardware, don't know supported caps");
			break;

		case PROP_ZOOM:
			g_value_set_float(value, 1.0f);
			break;

		case PROP_COLOR_TEMPERATURE:
			g_value_set_uint(value, 0);
			break;

		case PROP_WHITE_POINT:
			g_value_set_boxed(value, NULL);
			break;

		case PROP_ANALOG_GAIN:
			g_value_set_float(value, 1.0f);
			break;

		case PROP_LENS_FOCUS:
			g_value_set_float(value, 0.0f);
			break;

		case PROP_MIN_EXPOSURE_TIME:
			g_value_set_uint(value, 0);
			break;

		case PROP_MAX_EXPOSURE_TIME:
			g_value_set_uint(value, 0);
			break;

		case PROP_NOISE_REDUCTION:
			g_value_set_flags(value, 0);
			break;

		default:
			G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
			break;
	}
}
Exemplo n.º 16
0
static void gst_imx_v4l2src_set_property(GObject *object, guint prop_id,
		const GValue *value, GParamSpec *pspec)
{
	GstImxV4l2VideoSrc *v4l2src = GST_IMX_V4L2SRC(object);

	switch (prop_id)
	{
		case IMX_V4L2SRC_CAPTURE_MODE:
			v4l2src->capture_mode = g_value_get_int(value);
			break;

		case IMX_V4L2SRC_FRAMERATE_NUM:
			v4l2src->fps_n = g_value_get_int(value);
			break;

		case IMX_V4L2SRC_INPUT:
			v4l2src->input = g_value_get_int(value);
			break;

		case IMX_V4L2SRC_DEVICE:
			if (v4l2src->devicename)
				g_free(v4l2src->devicename);
			v4l2src->devicename = g_strdup(g_value_get_string(value));
			break;

		case IMX_V4L2SRC_QUEUE_SIZE:
			v4l2src->queue_size = g_value_get_int(value);
			break;

		case IMX_V4L2SRC_CROP_META_X:
			v4l2src->metaCropX = g_value_get_int(value);
			break;

		case IMX_V4L2SRC_CROP_META_Y:
			v4l2src->metaCropY = g_value_get_int(value);
			break;

		case IMX_V4L2SRC_CROP_META_WIDTH:
			v4l2src->metaCropWidth = g_value_get_int(value);
			break;

		case IMX_V4L2SRC_CROP_META_HEIGHT:
			v4l2src->metaCropHeight = g_value_get_int(value);
			break;

		case PROP_FOCUS_MODE:
			gst_imx_v4l2src_set_focus_mode(GST_PHOTOGRAPHY(v4l2src), g_value_get_enum(value));
			break;

		case PROP_WB_MODE:
		case PROP_COLOR_TONE:
		case PROP_SCENE_MODE:
		case PROP_FLASH_MODE:
		case PROP_FLICKER_MODE:
		case PROP_CAPABILITIES:
		case PROP_EV_COMP:
		case PROP_ISO_SPEED:
		case PROP_APERTURE:
		case PROP_EXPOSURE_TIME:
		case PROP_IMAGE_CAPTURE_SUPPORTED_CAPS:
		case PROP_IMAGE_PREVIEW_SUPPORTED_CAPS:
		case PROP_ZOOM:
		case PROP_COLOR_TEMPERATURE:
		case PROP_WHITE_POINT:
		case PROP_ANALOG_GAIN:
		case PROP_LENS_FOCUS:
		case PROP_MIN_EXPOSURE_TIME:
		case PROP_MAX_EXPOSURE_TIME:
		case PROP_NOISE_REDUCTION:
			GST_WARNING_OBJECT(v4l2src, "setting GstPhotography properties is not supported");
			break;

		default:
			G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
			break;
	}
}
Exemplo n.º 17
0
static void
test_photography_properties (GstElement * cam)
{
  GTypeClass *tclass;
  gulong capabilities;
  guint aperture;
  guint32 exposure;
  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;
  GstFocusMode fm, orig_fm;
  GstFlickerReductionMode flm, orig_flm;
  GstCaps *caps = NULL;

  if (!GST_IS_PHOTOGRAPHY (cam)) {
    GST_WARNING
        ("omitting photography properties test, not photography interface");
    return;
  }

  /* NOTE: unit testing uses videotestsrc element which is doesn't implement
     photography interface so we just check that values returned
     are sane */

  /* read only flags */
  g_object_get (GST_PHOTOGRAPHY (cam), "capabilities", &capabilities, NULL);
  fail_if (capabilities < 0, "getting photography capabilities failed");

  /* for image-capture-supported-caps we should get something always */
  g_object_get (GST_PHOTOGRAPHY (cam), "image-capture-supported-caps", &caps,
      NULL);
  fail_if (caps == NULL, "getting photography capabilities failed");
  if (caps)
    gst_caps_unref (caps);

  exposure = 0;                 /* auto */
  g_object_set (GST_PHOTOGRAPHY (cam), "exposure", exposure, NULL);
  g_object_get (GST_PHOTOGRAPHY (cam), "exposure", &exposure, NULL);
  fail_if (exposure < 0, "setting photography exposure failed");

  aperture = 0;                 /* auto */
  g_object_set (GST_PHOTOGRAPHY (cam), "aperture", aperture, NULL);
  g_object_get (GST_PHOTOGRAPHY (cam), "aperture", &aperture, NULL);
  fail_if (aperture < 0 || aperture > 255,
      "setting photography aperture failed");

  for (ev_comp = -2.5; ev_comp <= 2.5; ev_comp += 0.5) {
    orig_ev_comp = ev_comp;
    g_object_set (GST_PHOTOGRAPHY (cam), "ev-compensation", ev_comp, NULL);
    g_object_get (GST_PHOTOGRAPHY (cam), "ev-compensation", &ev_comp, NULL);
    fail_if (ev_comp < -2.5 || ev_comp > 2.5,
        "setting photography ev compensation failed");
    ev_comp = orig_ev_comp;
  }

  /* FIXME: what are the actual iso values? */
  for (iso_speed = 100; iso_speed <= 800; iso_speed *= 2) {
    orig_iso_speed = iso_speed;
    g_object_set (GST_PHOTOGRAPHY (cam), "iso-speed", iso_speed, NULL);
    g_object_get (GST_PHOTOGRAPHY (cam), "iso-speed", &iso_speed, NULL);
    fail_if (iso_speed < 0 || iso_speed > 800,
        "setting photography iso speed failed");
    iso_speed = orig_iso_speed;
  }

  tclass = g_type_class_ref (GST_TYPE_FLASH_MODE);
  for (flash = 0; flash < G_ENUM_CLASS (tclass)->n_values; flash++) {
    orig_flash = flash;
    g_object_set (GST_PHOTOGRAPHY (cam), "flash-mode", flash, NULL);
    g_object_get (GST_PHOTOGRAPHY (cam), "flash-mode", &flash, NULL);
    fail_if (flash < 0 || flash >= G_ENUM_CLASS (tclass)->n_values,
        "setting photography flash failed");
    flash = orig_flash;
  }
  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;
    g_object_set (G_OBJECT (cam), "white-balance-mode", wb, NULL);
    g_object_get (G_OBJECT (cam), "white-balance-mode", &wb, NULL);
    fail_if (wb < 0 || wb >= G_ENUM_CLASS (tclass)->n_values,
        "setting photography white balance mode failed");
    wb = orig_wb;
  }
  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;
    g_object_set (G_OBJECT (cam), "colour-tone-mode", ct, NULL);
    g_object_get (G_OBJECT (cam), "colour-tone-mode", &ct, NULL);
    fail_if (ct < 0 || ct >= G_ENUM_CLASS (tclass)->n_values,
        "setting photography colour tone mode failed");
    ct = orig_ct;
  }
  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;
    g_object_set (G_OBJECT (cam), "scene-mode", sm, NULL);
    g_object_get (G_OBJECT (cam), "scene-mode", &sm, NULL);
    fail_if (sm < 0 || sm > G_ENUM_CLASS (tclass)->n_values,
        "setting photography scene mode failed");
    sm = orig_sm;
  }
  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;
    g_object_set (G_OBJECT (cam), "focus-mode", fm, NULL);
    g_object_get (G_OBJECT (cam), "focus-mode", &fm, NULL);
    fail_if (fm < 0 || fm > G_ENUM_CLASS (tclass)->n_values,
        "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;
    g_object_set (G_OBJECT (cam), "flicker-mode", flm, NULL);
    g_object_get (G_OBJECT (cam), "flicker-mode", &flm, NULL);
    fail_if (flm < 0 || flm > G_ENUM_CLASS (tclass)->n_values,
        "setting photography flicker reduction mode failed");
    flm = orig_flm;
    g_usleep (PHOTO_SETTING_DELAY_US);
  }
  g_type_class_unref (tclass);
}
Exemplo n.º 18
0
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);
  }
}