gst_camerasrc_camera_control_set_strobe( GstCameraSrc* camerasrc,
gint type, gint value )
{
- return FALSE;
+ GstCameraSrcClass *bclass;
+ gboolean ret = FALSE;
+ gboolean opened;
+
+ bclass = GST_CAMERA_SRC_GET_CLASS (camerasrc);
+ opened = bclass->is_open (camerasrc);
+ g_return_val_if_fail (opened, FALSE);
+
+ GST_OBJECT_LOCK (camerasrc);
+ camerasrc->cam_ctrl.flash_mode = value;
+ GST_OBJECT_UNLOCK (camerasrc);
+
+ ret = bclass->set_flash_mode(camerasrc, value);
+ return ret;
}
gboolean
gst_camerasrc_camera_control_get_strobe( GstCameraSrc* camerasrc,
gint type, gint *value )
{
- return FALSE;
+ GstCameraSrcClass *bclass;
+ gboolean opened;
+
+ bclass = GST_CAMERA_SRC_GET_CLASS (camerasrc);
+ opened = bclass->is_open (camerasrc);
+ g_return_val_if_fail (opened, FALSE);
+
+ GST_OBJECT_LOCK (camerasrc);
+ *value = camerasrc->cam_ctrl.flash_mode;
+ GST_OBJECT_UNLOCK (camerasrc);
+
+ return TRUE;
}
gboolean
return NULL;
}
+static gboolean
+gst_camerasrc_default_set_flash_mode (GstCameraSrc *camsrc, int value)
+{
+ return TRUE;
+}
+
static void
gst_camerasrc_default_functions_init (GstCameraSrcClass * camera_class)
{
camera_class->read_settings = gst_camerasrc_default_ret_true_with_settings;
camera_class->write_settings = gst_camerasrc_default_write_settings;
camera_class->get_supported_caps = gst_camerasrc_default_get_caps;
+ camera_class->set_flash_mode = gst_camerasrc_default_set_flash_mode;
GST_DEBUG ("Default functions set");
}
typedef struct _GstCameraSrcClass GstCameraSrcClass;
typedef struct _GstCameraFocusStatus GstCameraFocusStatus;
+typedef struct
+{
+ guint flash_mode;
+} GstCameraControlInt;
+
+
/**
* GstCameraSrc:
* @element: the parent element.
GstPhotoCapturePrepared prep_func;
gpointer prep_udata;
+ /* camera control interface related */
+ GstCameraControlInt cam_ctrl;
+
/* Image capture format */
guint capture_w, capture_h;
guint capture_fps_n, capture_fps_d;
gboolean
(*makernote_uninit)(GstCameraSrc * camsrc, int handle);
+ gboolean
+ (*set_flash_mode)(GstCameraSrc *camsrc, int value);
+
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE];
};
GstPhotoSettings * photoconf);
gboolean gst_v4l2camsrc_write_settings (GstCameraSrc * camsrc,
GstPhotoSettings * photoconf, gboolean scene_override);
+gboolean
+gst_v4l2camsrc_set_flash_mode (GstCameraSrc *camsrc, int value);
+
/*
* gst_v4l2camsrc_class_init:
camera_class->makernote_init = GST_DEBUG_FUNCPTR(gst_v4l2camsrc_makernote_init);
camera_class->makernote_deal = GST_DEBUG_FUNCPTR(gst_v4l2camsrc_makernote_deal);
camera_class->makernote_uninit = GST_DEBUG_FUNCPTR(gst_v4l2camsrc_makernote_uninit);
+ camera_class->set_flash_mode = GST_DEBUG_FUNCPTR(gst_v4l2camsrc_set_flash_mode);
+
+
//camera_class->fill_image_tags = GST_DEBUG_FUNCPTR(gst_v4l2camsrc_fill_image_tags);
//camera_class->get_preview_image = GST_DEBUG_FUNCPTR(gst_v4l2camsrc_get_preview_image);
}
}
gboolean
+gst_v4l2camsrc_set_flash_mode (GstCameraSrc * camsrc,
+ int value)
+{
+ GstMFLDV4l2CamSrc *v4l2camsrc;
+ cam_err_t err;
+ gint32 flash;
+
+
+ v4l2camsrc = GST_V4L2CAMSRC (camsrc);
+
+ g_mutex_lock (v4l2camsrc->device_mutex);
+
+ if (!v4l2camsrc->initialized) {
+ GST_DEBUG ("Device not initialized");
+ g_mutex_unlock (v4l2camsrc->device_mutex);
+ return FALSE;
+ }
+
+ switch (value) {
+ case GST_CAMERA_STROBE_CAP_NONE:
+ case GST_CAMERA_STROBE_CAP_OFF:
+ flash = CAM_LIGHT_FLASH_MODE_OFF;
+ break;
+ case GST_CAMERA_STROBE_CAP_ON:
+ flash = CAM_LIGHT_FLASH_MODE_ON;
+ break;
+ case GST_CAMERA_STROBE_CAP_AUTO:
+ flash = CAM_LIGHT_FLASH_MODE_AUTO;
+ break;
+ case GST_CAMERA_STROBE_CAP_REDEYE:
+ flash = CAM_LIGHT_FLASH_MODE_RED_EYE;
+ break;
+ default:
+ flash = CAM_LIGHT_FLASH_MODE_OFF;
+ break;
+ }
+
+ err= cam_feature_set (v4l2camsrc->video_fd, CAM_LIGHT_FLASH_MODE,
+ flash);
+
+ if(err)
+ goto error;
+
+ g_mutex_unlock (v4l2camsrc->device_mutex);
+
+ return TRUE;
+
+/* ERRORS */
+error:
+ {
+ g_mutex_unlock (v4l2camsrc->device_mutex);
+ return FALSE;
+ }
+}
+
+gboolean
gst_v4l2camsrc_write_settings (GstCameraSrc * camsrc,
GstPhotoSettings * photoconf, gboolean scene_override)
{