mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
camerabin: photography interface properties. Fixes #573370 (partially)
Added GObject properties to photography interface and implemented them in camerabin. Changed zooming to check if video-source has zoom property.
This commit is contained in:
parent
2c158ffad9
commit
62ddc73623
6 changed files with 435 additions and 84 deletions
|
@ -34,7 +34,8 @@
|
|||
* The interface allows access to some common digital imaging controls
|
||||
*/
|
||||
|
||||
static void gst_photography_iface_init (GstPhotographyInterface * iface);
|
||||
static void gst_photography_iface_base_init (GstPhotographyInterface * iface);
|
||||
static void gst_photography_iface_class_init (gpointer g_class);
|
||||
|
||||
GType
|
||||
gst_photography_get_type (void)
|
||||
|
@ -44,14 +45,14 @@ gst_photography_get_type (void)
|
|||
if (!gst_photography_type) {
|
||||
static const GTypeInfo gst_photography_info = {
|
||||
sizeof (GstPhotographyInterface),
|
||||
(GBaseInitFunc) gst_photography_iface_init,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(GBaseInitFunc) gst_photography_iface_base_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
(GClassInitFunc) gst_photography_iface_class_init, /* class_init */
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
0, /* n_preallocs */
|
||||
NULL, /* instance_init */
|
||||
};
|
||||
|
||||
gst_photography_type = g_type_register_static (G_TYPE_INTERFACE,
|
||||
|
@ -64,7 +65,7 @@ gst_photography_get_type (void)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_photography_iface_init (GstPhotographyInterface * iface)
|
||||
gst_photography_iface_base_init (GstPhotographyInterface * iface)
|
||||
{
|
||||
/* default virtual functions */
|
||||
iface->get_ev_compensation = NULL;
|
||||
|
@ -382,7 +383,7 @@ gst_photography_set_autofocus (GstPhotography * photo, gboolean on)
|
|||
* Returns: TRUE if configuration was set successfully, otherwise FALSE.
|
||||
*/
|
||||
gboolean
|
||||
gst_photography_set_config (GstPhotography * photo, GstPhotoSettings *config)
|
||||
gst_photography_set_config (GstPhotography * photo, GstPhotoSettings * config)
|
||||
{
|
||||
GstPhotographyInterface *iface;
|
||||
gboolean ret = FALSE;
|
||||
|
@ -421,3 +422,77 @@ gst_photography_get_config (GstPhotography * photo, GstPhotoSettings * config)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Photography class initialization stuff */
|
||||
static void
|
||||
gst_photography_iface_class_init (gpointer g_class)
|
||||
{
|
||||
/* create interface signals and properties here. */
|
||||
|
||||
/* White balance */
|
||||
g_object_interface_install_property (g_class,
|
||||
g_param_spec_enum (GST_PHOTOGRAPHY_PROP_WB_MODE,
|
||||
"White balance mode property",
|
||||
"White balance affects the color temperature of the photo",
|
||||
GST_TYPE_WHITE_BALANCE_MODE,
|
||||
GST_PHOTOGRAPHY_WB_MODE_AUTO, G_PARAM_READWRITE));
|
||||
|
||||
/* Colour tone */
|
||||
g_object_interface_install_property (g_class,
|
||||
g_param_spec_enum (GST_PHOTOGRAPHY_PROP_COLOUR_TONE,
|
||||
"Colour tone mode property",
|
||||
"Colour tone setting changes colour shading in the photo",
|
||||
GST_TYPE_COLOUR_TONE_MODE,
|
||||
GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL, G_PARAM_READWRITE));
|
||||
|
||||
/* Scene mode */
|
||||
g_object_interface_install_property (g_class,
|
||||
g_param_spec_enum (GST_PHOTOGRAPHY_PROP_SCENE_MODE,
|
||||
"Scene mode property",
|
||||
"Scene mode works as a preset for different photo shooting mode settings",
|
||||
GST_TYPE_SCENE_MODE,
|
||||
GST_PHOTOGRAPHY_SCENE_MODE_AUTO, G_PARAM_READWRITE));
|
||||
|
||||
/* Flash mode */
|
||||
g_object_interface_install_property (g_class,
|
||||
g_param_spec_enum (GST_PHOTOGRAPHY_PROP_FLASH_MODE,
|
||||
"Flash mode property",
|
||||
"Flash mode defines how the flash light should be used",
|
||||
GST_TYPE_FLASH_MODE,
|
||||
GST_PHOTOGRAPHY_FLASH_MODE_AUTO, G_PARAM_READWRITE));
|
||||
|
||||
/* Capabilities */
|
||||
g_object_interface_install_property (g_class,
|
||||
g_param_spec_ulong (GST_PHOTOGRAPHY_PROP_CAPABILITIES,
|
||||
"Photo capabilities bitmask",
|
||||
"Tells the photo capabilities of the device",
|
||||
0, G_MAXULONG, 0, G_PARAM_READABLE));
|
||||
|
||||
/* EV_compensation */
|
||||
g_object_interface_install_property (g_class,
|
||||
g_param_spec_float (GST_PHOTOGRAPHY_PROP_EV_COMP,
|
||||
"EV compensation property",
|
||||
"EV compensation affects the brightness of the image",
|
||||
-2.5, 2.5, 0, G_PARAM_READWRITE));
|
||||
|
||||
/* ISO value */
|
||||
g_object_interface_install_property (g_class,
|
||||
g_param_spec_uint (GST_PHOTOGRAPHY_PROP_ISO_SPEED,
|
||||
"ISO speed property",
|
||||
"ISO speed defines the light sensitivity (0 = auto)",
|
||||
0, 6400, 0, G_PARAM_READWRITE));
|
||||
|
||||
/* Aperture */
|
||||
g_object_interface_install_property (g_class,
|
||||
g_param_spec_uint (GST_PHOTOGRAPHY_PROP_APERTURE,
|
||||
"Aperture property",
|
||||
"Aperture defines the size of lens opening (0 = auto)",
|
||||
0, G_MAXUINT8, 0, G_PARAM_READWRITE));
|
||||
|
||||
/* Exposure */
|
||||
g_object_interface_install_property (g_class,
|
||||
g_param_spec_uint (GST_PHOTOGRAPHY_PROP_EXPOSURE,
|
||||
"Exposure time in milliseconds",
|
||||
"Exposure time defines how long the shutter will stay open (0 = auto)",
|
||||
0, G_MAXUINT32, 0, G_PARAM_READWRITE));
|
||||
}
|
||||
|
|
|
@ -51,6 +51,19 @@ G_BEGIN_DECLS
|
|||
/* Custom GstMessage name that will be sent to GstBus when shake risk changes */
|
||||
#define GST_PHOTOGRAPHY_SHAKE_RISK "shake-risk"
|
||||
|
||||
/* Interface property names */
|
||||
#define GST_PHOTOGRAPHY_PROP_WB_MODE "white-balance-mode"
|
||||
#define GST_PHOTOGRAPHY_PROP_COLOUR_TONE "colour-tone-mode"
|
||||
#define GST_PHOTOGRAPHY_PROP_SCENE_MODE "scene-mode"
|
||||
#define GST_PHOTOGRAPHY_PROP_FLASH_MODE "flash-mode"
|
||||
#define GST_PHOTOGRAPHY_PROP_FOCUS_STATUS "focus-status"
|
||||
#define GST_PHOTOGRAPHY_PROP_CAPABILITIES "capabilities"
|
||||
#define GST_PHOTOGRAPHY_PROP_SHAKE_RISK "shake-risk"
|
||||
#define GST_PHOTOGRAPHY_PROP_EV_COMP "ev-compensation"
|
||||
#define GST_PHOTOGRAPHY_PROP_ISO_SPEED "iso-speed"
|
||||
#define GST_PHOTOGRAPHY_PROP_APERTURE "aperture"
|
||||
#define GST_PHOTOGRAPHY_PROP_EXPOSURE "exposure"
|
||||
|
||||
/**
|
||||
* GstPhotography:
|
||||
*
|
||||
|
|
|
@ -24,6 +24,40 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_FILENAME,
|
||||
ARG_MODE,
|
||||
ARG_FLAGS,
|
||||
ARG_MUTE,
|
||||
ARG_ZOOM,
|
||||
ARG_IMAGE_POST,
|
||||
ARG_IMAGE_ENC,
|
||||
ARG_VIDEO_POST,
|
||||
ARG_VIDEO_ENC,
|
||||
ARG_AUDIO_ENC,
|
||||
ARG_VIDEO_MUX,
|
||||
ARG_VF_SINK,
|
||||
ARG_VIDEO_SRC,
|
||||
ARG_AUDIO_SRC,
|
||||
ARG_INPUT_CAPS,
|
||||
ARG_FILTER_CAPS,
|
||||
ARG_PREVIEW_CAPS,
|
||||
ARG_WB_MODE,
|
||||
ARG_COLOUR_TONE,
|
||||
ARG_SCENE_MODE,
|
||||
ARG_FLASH_MODE,
|
||||
ARG_FOCUS_STATUS,
|
||||
ARG_CAPABILITIES,
|
||||
ARG_SHAKE_RISK,
|
||||
ARG_EV_COMP,
|
||||
ARG_ISO_SPEED,
|
||||
ARG_APERTURE,
|
||||
ARG_EXPOSURE
|
||||
};
|
||||
|
||||
/**
|
||||
* GstCameraBinFlags:
|
||||
* @GST_CAMERABIN_FLAG_SOURCE_RESIZE: enable video crop and scale
|
||||
|
|
|
@ -185,27 +185,6 @@ enum
|
|||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_FILENAME,
|
||||
ARG_MODE,
|
||||
ARG_FLAGS,
|
||||
ARG_MUTE,
|
||||
ARG_ZOOM,
|
||||
ARG_IMAGE_POST,
|
||||
ARG_IMAGE_ENC,
|
||||
ARG_VIDEO_POST,
|
||||
ARG_VIDEO_ENC,
|
||||
ARG_AUDIO_ENC,
|
||||
ARG_VIDEO_MUX,
|
||||
ARG_VF_SINK,
|
||||
ARG_VIDEO_SRC,
|
||||
ARG_AUDIO_SRC,
|
||||
ARG_INPUT_CAPS,
|
||||
ARG_FILTER_CAPS,
|
||||
ARG_PREVIEW_CAPS
|
||||
};
|
||||
|
||||
/*
|
||||
* defines and static global vars
|
||||
|
@ -339,6 +318,9 @@ static void gst_camerabin_set_property (GObject * object, guint prop_id,
|
|||
static void gst_camerabin_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec);
|
||||
|
||||
static void gst_camerabin_override_photo_properties (GObjectClass *
|
||||
gobject_class);
|
||||
|
||||
/*
|
||||
* GstElement function declarations
|
||||
*/
|
||||
|
@ -1030,29 +1012,19 @@ gst_camerabin_change_filename (GstCameraBin * camera, const gchar * name)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_camerabin_set_photo_iface_zoom (GstCameraBin * camera, gint zoom)
|
||||
gst_camerabin_set_videosrc_zoom (GstCameraBin * camera, gint zoom)
|
||||
{
|
||||
GstPhotography *photo = NULL;
|
||||
GstPhotoCaps pcaps = GST_PHOTOGRAPHY_CAPS_NONE;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
if (GST_IS_ELEMENT (camera->src_vid_src) &&
|
||||
gst_element_implements_interface (camera->src_vid_src,
|
||||
GST_TYPE_PHOTOGRAPHY)) {
|
||||
/* Try setting zoom using photography interface */
|
||||
photo = GST_PHOTOGRAPHY (camera->src_vid_src);
|
||||
if (photo) {
|
||||
pcaps = gst_photography_get_capabilities (photo);
|
||||
}
|
||||
if (pcaps & GST_PHOTOGRAPHY_CAPS_ZOOM) {
|
||||
GST_DEBUG_OBJECT (camera, "setting zoom %d using photography interface",
|
||||
zoom);
|
||||
ret = gst_photography_set_zoom (photo, (gfloat) zoom / 100.0);
|
||||
}
|
||||
if (g_object_class_find_property (G_OBJECT_GET_CLASS (camera->src_vid_src),
|
||||
"zoom")) {
|
||||
g_object_set (G_OBJECT (camera->src_vid_src), "zoom",
|
||||
(gfloat) zoom / 100, NULL);
|
||||
ret = TRUE;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
gst_camerabin_set_element_zoom (GstCameraBin * camera, gint zoom)
|
||||
{
|
||||
|
@ -1110,8 +1082,8 @@ gst_camerabin_setup_zoom (GstCameraBin * camera)
|
|||
|
||||
GST_INFO_OBJECT (camera, "setting zoom %d", zoom);
|
||||
|
||||
if (gst_camerabin_set_photo_iface_zoom (camera, zoom)) {
|
||||
GST_INFO_OBJECT (camera, "zoom set using photography interface");
|
||||
if (gst_camerabin_set_videosrc_zoom (camera, zoom)) {
|
||||
GST_INFO_OBJECT (camera, "zoom set using videosrc");
|
||||
} else if (gst_camerabin_set_element_zoom (camera, zoom)) {
|
||||
GST_INFO_OBJECT (camera, "zoom set using gst elements");
|
||||
} else {
|
||||
|
@ -2721,6 +2693,8 @@ gst_camerabin_class_init (GstCameraBinClass * klass)
|
|||
__gst_camerabin_marshal_BOOLEAN__STRING, G_TYPE_BOOLEAN, 1,
|
||||
G_TYPE_STRING);
|
||||
|
||||
gst_camerabin_override_photo_properties (gobject_class);
|
||||
|
||||
klass->user_start = gst_camerabin_user_start;
|
||||
klass->user_stop = gst_camerabin_user_stop;
|
||||
klass->user_pause = gst_camerabin_user_pause;
|
||||
|
@ -2856,12 +2830,46 @@ gst_camerabin_finalize (GObject * object)
|
|||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_camerabin_override_photo_properties (GObjectClass * gobject_class)
|
||||
{
|
||||
g_object_class_override_property (gobject_class, ARG_WB_MODE,
|
||||
GST_PHOTOGRAPHY_PROP_WB_MODE);
|
||||
|
||||
g_object_class_override_property (gobject_class, ARG_COLOUR_TONE,
|
||||
GST_PHOTOGRAPHY_PROP_COLOUR_TONE);
|
||||
|
||||
g_object_class_override_property (gobject_class, ARG_SCENE_MODE,
|
||||
GST_PHOTOGRAPHY_PROP_SCENE_MODE);
|
||||
|
||||
g_object_class_override_property (gobject_class, ARG_FLASH_MODE,
|
||||
GST_PHOTOGRAPHY_PROP_FLASH_MODE);
|
||||
|
||||
g_object_class_override_property (gobject_class, ARG_CAPABILITIES,
|
||||
GST_PHOTOGRAPHY_PROP_CAPABILITIES);
|
||||
|
||||
g_object_class_override_property (gobject_class, ARG_EV_COMP,
|
||||
GST_PHOTOGRAPHY_PROP_EV_COMP);
|
||||
|
||||
g_object_class_override_property (gobject_class, ARG_ISO_SPEED,
|
||||
GST_PHOTOGRAPHY_PROP_ISO_SPEED);
|
||||
|
||||
g_object_class_override_property (gobject_class, ARG_APERTURE,
|
||||
GST_PHOTOGRAPHY_PROP_APERTURE);
|
||||
|
||||
g_object_class_override_property (gobject_class, ARG_EXPOSURE,
|
||||
GST_PHOTOGRAPHY_PROP_EXPOSURE);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_camerabin_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstCameraBin *camera = GST_CAMERABIN (object);
|
||||
|
||||
if (gst_camerabin_photography_set_property (camera, prop_id, value))
|
||||
return;
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_MUTE:
|
||||
gst_camerabin_video_set_mute (GST_CAMERABIN_VIDEO (camera->vidbin),
|
||||
|
@ -3015,6 +3023,9 @@ gst_camerabin_get_property (GObject * object, guint prop_id,
|
|||
{
|
||||
GstCameraBin *camera = GST_CAMERABIN (object);
|
||||
|
||||
if (gst_camerabin_photography_get_property (camera, prop_id, value))
|
||||
return;
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_FILENAME:
|
||||
g_value_set_string (value, camera->filename->str);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <string.h>
|
||||
#include "gstcamerabinphotography.h"
|
||||
#include "gstcamerabin.h"
|
||||
#include "gstcamerabin-enum.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (camerabinphoto_debug);
|
||||
#define GST_CAT_DEFAULT camerabinphoto_debug
|
||||
|
@ -234,37 +235,6 @@ gst_camerabin_get_flash_mode (GstPhotography * photo, GstFlashMode * flash_mode)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_camerabin_set_zoom (GstPhotography * photo, gfloat zoom)
|
||||
{
|
||||
GstCameraBin *camera;
|
||||
|
||||
g_return_val_if_fail (photo != NULL, FALSE);
|
||||
|
||||
camera = GST_CAMERABIN (photo);
|
||||
|
||||
/* camerabin can zoom by itself */
|
||||
g_object_set (camera, "zoom", (gint) (CLAMP (zoom, 1.0, 10.0) * 100), NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_camerabin_get_zoom (GstPhotography * photo, gfloat * zoom)
|
||||
{
|
||||
GstCameraBin *camera;
|
||||
gint cb_zoom = 0;
|
||||
|
||||
g_return_val_if_fail (photo != NULL, FALSE);
|
||||
|
||||
camera = GST_CAMERABIN (photo);
|
||||
|
||||
g_object_get (camera, "zoom", &cb_zoom, NULL);
|
||||
*zoom = (gfloat) (cb_zoom / 100.0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_camerabin_set_scene_mode (GstPhotography * photo, GstSceneMode scene_mode)
|
||||
{
|
||||
|
@ -345,6 +315,70 @@ gst_camerabin_set_autofocus (GstPhotography * photo, gboolean on)
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_camerabin_get_aperture (GstPhotography * photo, guint * aperture)
|
||||
{
|
||||
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_aperture (GST_PHOTOGRAPHY (camera->src_vid_src),
|
||||
aperture);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_camerabin_set_aperture (GstPhotography * photo, guint aperture)
|
||||
{
|
||||
GstCameraBin *camera;
|
||||
|
||||
g_return_if_fail (photo != NULL);
|
||||
|
||||
camera = GST_CAMERABIN (photo);
|
||||
|
||||
if (PHOTOGRAPHY_IS_OK (camera->src_vid_src)) {
|
||||
gst_photography_set_aperture (GST_PHOTOGRAPHY (camera->src_vid_src),
|
||||
aperture);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_camerabin_get_exposure (GstPhotography * photo, guint32 * exposure)
|
||||
{
|
||||
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_exposure (GST_PHOTOGRAPHY (camera->src_vid_src),
|
||||
exposure);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_camerabin_set_exposure (GstPhotography * photo, guint32 exposure)
|
||||
{
|
||||
GstCameraBin *camera;
|
||||
|
||||
g_return_if_fail (photo != NULL);
|
||||
|
||||
camera = GST_CAMERABIN (photo);
|
||||
|
||||
if (PHOTOGRAPHY_IS_OK (camera->src_vid_src)) {
|
||||
gst_photography_set_exposure (GST_PHOTOGRAPHY (camera->src_vid_src),
|
||||
exposure);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_camerabin_set_config (GstPhotography * photo, GstPhotoSettings * config)
|
||||
{
|
||||
|
@ -409,6 +443,181 @@ gst_camerabin_handle_scene_mode (GstCameraBin * camera, GstSceneMode scene_mode)
|
|||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_camerabin_photography_get_property (GstCameraBin * camera, guint prop_id,
|
||||
GValue * value)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
|
||||
GST_DEBUG_OBJECT (camera, "Photointerface property: %d", prop_id);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_WB_MODE:
|
||||
{
|
||||
GstWhiteBalanceMode wb_mode;
|
||||
GST_DEBUG_OBJECT (camera, "==== GETTING PROP_WB_MODE ====");
|
||||
if (gst_camerabin_get_white_balance_mode ((GstPhotography *) camera,
|
||||
&wb_mode)) {
|
||||
g_value_set_enum (value, wb_mode);
|
||||
}
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
case ARG_COLOUR_TONE:
|
||||
{
|
||||
GstColourToneMode tone;
|
||||
GST_DEBUG_OBJECT (camera, "==== GETTING PROP_COLOUR_TONE ====");
|
||||
if (gst_camerabin_get_colour_tone_mode ((GstPhotography *) camera, &tone)) {
|
||||
g_value_set_enum (value, tone);
|
||||
}
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
case ARG_SCENE_MODE:
|
||||
{
|
||||
GstSceneMode scene;
|
||||
GST_DEBUG_OBJECT (camera, "==== GETTING PROP_SCENE_MODE ====");
|
||||
if (gst_camerabin_get_scene_mode ((GstPhotography *) camera, &scene)) {
|
||||
g_value_set_enum (value, scene);
|
||||
}
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
case ARG_FLASH_MODE:
|
||||
{
|
||||
GstFlashMode flash;
|
||||
GST_DEBUG_OBJECT (camera, "==== GETTING PROP_FLASH_MODE ====");
|
||||
if (gst_camerabin_get_flash_mode ((GstPhotography *) camera, &flash)) {
|
||||
g_value_set_enum (value, flash);
|
||||
}
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
case ARG_CAPABILITIES:
|
||||
{
|
||||
gulong capabilities;
|
||||
GST_DEBUG_OBJECT (camera, "==== GETTING PROP_CAPABILITIES ====");
|
||||
capabilities =
|
||||
(gulong) gst_camerabin_get_capabilities ((GstPhotography *) camera);
|
||||
g_value_set_ulong (value, capabilities);
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
case ARG_EV_COMP:
|
||||
{
|
||||
gfloat ev_comp;
|
||||
GST_DEBUG_OBJECT (camera, "==== GETTING PROP_EV_COMP ====");
|
||||
if (gst_camerabin_get_ev_compensation ((GstPhotography *) camera,
|
||||
&ev_comp)) {
|
||||
g_value_set_float (value, ev_comp);
|
||||
}
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
case ARG_ISO_SPEED:
|
||||
{
|
||||
guint iso_speed;
|
||||
GST_DEBUG_OBJECT (camera, "==== GETTING PROP_ISO_SPEED ====");
|
||||
if (gst_camerabin_get_iso_speed ((GstPhotography *) camera, &iso_speed)) {
|
||||
g_value_set_uint (value, iso_speed);
|
||||
}
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
case ARG_APERTURE:
|
||||
{
|
||||
guint aperture;
|
||||
GST_DEBUG_OBJECT (camera, "==== GETTING PROP_APERTURE ====");
|
||||
if (gst_camerabin_get_aperture ((GstPhotography *) camera, &aperture)) {
|
||||
g_value_set_uint (value, aperture);
|
||||
}
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
case ARG_EXPOSURE:
|
||||
{
|
||||
guint32 exposure;
|
||||
GST_DEBUG_OBJECT (camera, "==== GETTING PROP_EXPOSURE ====");
|
||||
if (gst_camerabin_get_exposure ((GstPhotography *) camera, &exposure)) {
|
||||
g_value_set_uint (value, exposure);
|
||||
}
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
gboolean
|
||||
gst_camerabin_photography_set_property (GstCameraBin * camera, guint prop_id,
|
||||
const GValue * value)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_WB_MODE:
|
||||
GST_DEBUG_OBJECT (camera, "==== SETTING PROP_WB_MODE ====");
|
||||
gst_camerabin_set_white_balance_mode ((GstPhotography *) camera,
|
||||
g_value_get_enum (value));
|
||||
ret = TRUE;
|
||||
break;
|
||||
case ARG_COLOUR_TONE:
|
||||
GST_DEBUG_OBJECT (camera, "==== SETTING PROP_COLOUR_TONE ====");
|
||||
gst_camerabin_set_colour_tone_mode ((GstPhotography *) camera,
|
||||
g_value_get_enum (value));
|
||||
ret = TRUE;
|
||||
break;
|
||||
case ARG_SCENE_MODE:
|
||||
GST_DEBUG_OBJECT (camera, "==== SETTING PROP_SCENE_MODE ====");
|
||||
gst_camerabin_set_scene_mode ((GstPhotography *) camera,
|
||||
g_value_get_enum (value));
|
||||
ret = TRUE;
|
||||
break;
|
||||
case ARG_FLASH_MODE:
|
||||
GST_DEBUG_OBJECT (camera, "==== SETTING PROP_FLASH_MODE ====");
|
||||
gst_camerabin_set_flash_mode ((GstPhotography *) camera,
|
||||
g_value_get_enum (value));
|
||||
ret = TRUE;
|
||||
break;
|
||||
case ARG_EV_COMP:
|
||||
GST_DEBUG_OBJECT (camera, "==== SETTING PROP_EV_COMP ====");
|
||||
gst_camerabin_set_ev_compensation ((GstPhotography *) camera,
|
||||
g_value_get_float (value));
|
||||
ret = TRUE;
|
||||
break;
|
||||
case ARG_ISO_SPEED:
|
||||
GST_DEBUG_OBJECT (camera, "==== SETTING PROP_ISO_SPEED ====");
|
||||
gst_camerabin_set_iso_speed ((GstPhotography *) camera,
|
||||
g_value_get_uint (value));
|
||||
ret = TRUE;
|
||||
break;
|
||||
case ARG_APERTURE:
|
||||
GST_DEBUG_OBJECT (camera, "==== SETTING PROP_APERTURE ====");
|
||||
gst_camerabin_set_aperture ((GstPhotography *) camera,
|
||||
g_value_get_uint (value));
|
||||
ret = TRUE;
|
||||
break;
|
||||
case ARG_EXPOSURE:
|
||||
GST_DEBUG_OBJECT (camera, "==== SETTING PROP_EXPOSURE ====");
|
||||
gst_camerabin_set_exposure ((GstPhotography *) camera,
|
||||
g_value_get_uint (value));
|
||||
ret = TRUE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gst_camerabin_photography_init (GstPhotographyInterface * iface)
|
||||
{
|
||||
|
@ -435,9 +644,6 @@ gst_camerabin_photography_init (GstPhotographyInterface * iface)
|
|||
iface->set_flash_mode = gst_camerabin_set_flash_mode;
|
||||
iface->get_flash_mode = gst_camerabin_get_flash_mode;
|
||||
|
||||
iface->set_zoom = gst_camerabin_set_zoom;
|
||||
iface->get_zoom = gst_camerabin_get_zoom;
|
||||
|
||||
iface->get_capabilities = gst_camerabin_get_capabilities;
|
||||
|
||||
iface->set_autofocus = gst_camerabin_set_autofocus;
|
||||
|
|
|
@ -25,6 +25,18 @@
|
|||
|
||||
#include <gst/interfaces/photography.h>
|
||||
|
||||
#include "gstcamerabin.h"
|
||||
|
||||
gboolean
|
||||
gst_camerabin_photography_set_property (GstCameraBin * camerabin,
|
||||
guint prop_id,
|
||||
const GValue * value);
|
||||
|
||||
gboolean
|
||||
gst_camerabin_photography_get_property (GstCameraBin * camerabin,
|
||||
guint prop_id,
|
||||
GValue * value);
|
||||
|
||||
void gst_camerabin_photography_init (GstPhotographyInterface * iface);
|
||||
|
||||
#endif /* #ifndef __GST_CAMERABIN_PHOTOGRAPHY_H__ */
|
||||
|
|
Loading…
Reference in a new issue