mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
camerabin2: Put enums inside their classes .c
Remove global list of properties' enums and put them inside their classes .c
This commit is contained in:
parent
014b8f97f8
commit
f52d805166
3 changed files with 29 additions and 59 deletions
|
@ -56,6 +56,14 @@
|
||||||
|
|
||||||
#include "gstbasecamerasrc.h"
|
#include "gstbasecamerasrc.h"
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_0,
|
||||||
|
PROP_MODE,
|
||||||
|
PROP_ZOOM,
|
||||||
|
PROP_READY_FOR_CAPTURE
|
||||||
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
/* action signals */
|
/* action signals */
|
||||||
|
@ -346,11 +354,11 @@ gst_base_camera_src_set_property (GObject * object,
|
||||||
GstBaseCameraSrc *self = GST_BASE_CAMERA_SRC (object);
|
GstBaseCameraSrc *self = GST_BASE_CAMERA_SRC (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_MODE:
|
case PROP_MODE:
|
||||||
gst_base_camera_src_set_mode (GST_BASE_CAMERA_SRC (self),
|
gst_base_camera_src_set_mode (GST_BASE_CAMERA_SRC (self),
|
||||||
g_value_get_enum (value));
|
g_value_get_enum (value));
|
||||||
break;
|
break;
|
||||||
case ARG_ZOOM:{
|
case PROP_ZOOM:{
|
||||||
g_atomic_int_set (&self->zoom, g_value_get_int (value));
|
g_atomic_int_set (&self->zoom, g_value_get_int (value));
|
||||||
/* does not set it if in NULL, the src is not created yet */
|
/* does not set it if in NULL, the src is not created yet */
|
||||||
if (GST_STATE (self) != GST_STATE_NULL)
|
if (GST_STATE (self) != GST_STATE_NULL)
|
||||||
|
@ -370,13 +378,13 @@ gst_base_camera_src_get_property (GObject * object,
|
||||||
GstBaseCameraSrc *self = GST_BASE_CAMERA_SRC (object);
|
GstBaseCameraSrc *self = GST_BASE_CAMERA_SRC (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_MODE:
|
case PROP_MODE:
|
||||||
g_value_set_enum (value, self->mode);
|
g_value_set_enum (value, self->mode);
|
||||||
break;
|
break;
|
||||||
case ARG_READY_FOR_CAPTURE:
|
case PROP_READY_FOR_CAPTURE:
|
||||||
g_value_set_boolean (value, !self->capturing);
|
g_value_set_boolean (value, !self->capturing);
|
||||||
break;
|
break;
|
||||||
case ARG_ZOOM:
|
case PROP_ZOOM:
|
||||||
g_value_set_int (value, g_atomic_int_get (&self->zoom));
|
g_value_set_int (value, g_atomic_int_get (&self->zoom));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -475,7 +483,7 @@ gst_base_camera_src_class_init (GstBaseCameraSrcClass * klass)
|
||||||
gobject_class->get_property = gst_base_camera_src_get_property;
|
gobject_class->get_property = gst_base_camera_src_get_property;
|
||||||
|
|
||||||
// g_object_class_install_property ....
|
// g_object_class_install_property ....
|
||||||
g_object_class_install_property (gobject_class, ARG_MODE,
|
g_object_class_install_property (gobject_class, PROP_MODE,
|
||||||
g_param_spec_enum ("mode", "Mode",
|
g_param_spec_enum ("mode", "Mode",
|
||||||
"The capture mode (still image capture or video recording)",
|
"The capture mode (still image capture or video recording)",
|
||||||
GST_TYPE_CAMERABIN_MODE, MODE_IMAGE,
|
GST_TYPE_CAMERABIN_MODE, MODE_IMAGE,
|
||||||
|
@ -492,7 +500,7 @@ gst_base_camera_src_class_init (GstBaseCameraSrcClass * klass)
|
||||||
* function, please schedule a new thread to do it. If you're using glib's
|
* function, please schedule a new thread to do it. If you're using glib's
|
||||||
* mainloop you can use g_idle_add() for example.
|
* mainloop you can use g_idle_add() for example.
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (gobject_class, ARG_READY_FOR_CAPTURE,
|
g_object_class_install_property (gobject_class, PROP_READY_FOR_CAPTURE,
|
||||||
g_param_spec_boolean ("ready-for-capture", "Ready for capture",
|
g_param_spec_boolean ("ready-for-capture", "Ready for capture",
|
||||||
"Informs this element is ready for starting another capture",
|
"Informs this element is ready for starting another capture",
|
||||||
TRUE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
TRUE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
|
@ -25,52 +25,6 @@
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
/* XXX find better place for property related enum/defaults */
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
ARG_0,
|
|
||||||
ARG_FILENAME,
|
|
||||||
ARG_MODE,
|
|
||||||
ARG_READY_FOR_CAPTURE,
|
|
||||||
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,
|
|
||||||
ARG_VIDEO_SOURCE_FILTER,
|
|
||||||
ARG_IMAGE_CAPTURE_SUPPORTED_CAPS,
|
|
||||||
ARG_VIEWFINDER_FILTER,
|
|
||||||
ARG_FLICKER_MODE,
|
|
||||||
ARG_FOCUS_MODE,
|
|
||||||
ARG_BLOCK_VIEWFINDER,
|
|
||||||
ARG_IMAGE_CAPTURE_WIDTH,
|
|
||||||
ARG_IMAGE_CAPTURE_HEIGHT,
|
|
||||||
ARG_VIDEO_CAPTURE_WIDTH,
|
|
||||||
ARG_VIDEO_CAPTURE_HEIGHT,
|
|
||||||
ARG_VIDEO_CAPTURE_FRAMERATE
|
|
||||||
};
|
|
||||||
|
|
||||||
#define DEFAULT_WIDTH 640
|
#define DEFAULT_WIDTH 640
|
||||||
#define DEFAULT_HEIGHT 480
|
#define DEFAULT_HEIGHT 480
|
||||||
#define DEFAULT_CAPTURE_WIDTH 800
|
#define DEFAULT_CAPTURE_WIDTH 800
|
||||||
|
|
|
@ -35,6 +35,14 @@
|
||||||
#include "camerabingeneral.h"
|
#include "camerabingeneral.h"
|
||||||
#include "gstcamerabin-enum.h"
|
#include "gstcamerabin-enum.h"
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_0,
|
||||||
|
PROP_FILTER_CAPS,
|
||||||
|
PROP_VIDEO_SRC,
|
||||||
|
PROP_VIDEO_SOURCE_FILTER
|
||||||
|
};
|
||||||
|
|
||||||
#define CAMERABIN_DEFAULT_VF_CAPS "video/x-raw-yuv,format=(fourcc)I420"
|
#define CAMERABIN_DEFAULT_VF_CAPS "video/x-raw-yuv,format=(fourcc)I420"
|
||||||
|
|
||||||
/* Using "bilinear" as default zoom method */
|
/* Using "bilinear" as default zoom method */
|
||||||
|
@ -68,14 +76,14 @@ gst_v4l2_camera_src_set_property (GObject * object,
|
||||||
GstV4l2CameraSrc *self = GST_V4L2_CAMERA_SRC (object);
|
GstV4l2CameraSrc *self = GST_V4L2_CAMERA_SRC (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_FILTER_CAPS:
|
case PROP_FILTER_CAPS:
|
||||||
GST_OBJECT_LOCK (self);
|
GST_OBJECT_LOCK (self);
|
||||||
gst_caps_replace (&self->view_finder_caps,
|
gst_caps_replace (&self->view_finder_caps,
|
||||||
(GstCaps *) gst_value_get_caps (value));
|
(GstCaps *) gst_value_get_caps (value));
|
||||||
GST_OBJECT_UNLOCK (self);
|
GST_OBJECT_UNLOCK (self);
|
||||||
configure_format (self, self->view_finder_caps);
|
configure_format (self, self->view_finder_caps);
|
||||||
break;
|
break;
|
||||||
case ARG_VIDEO_SOURCE_FILTER:
|
case PROP_VIDEO_SOURCE_FILTER:
|
||||||
if (GST_STATE (self) != GST_STATE_NULL) {
|
if (GST_STATE (self) != GST_STATE_NULL) {
|
||||||
GST_ELEMENT_ERROR (self, CORE, FAILED,
|
GST_ELEMENT_ERROR (self, CORE, FAILED,
|
||||||
("camerasrc must be in NULL state when setting the video filter element"),
|
("camerasrc must be in NULL state when setting the video filter element"),
|
||||||
|
@ -86,7 +94,7 @@ gst_v4l2_camera_src_set_property (GObject * object,
|
||||||
self->app_video_filter = g_value_dup_object (value);
|
self->app_video_filter = g_value_dup_object (value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ARG_VIDEO_SRC:
|
case PROP_VIDEO_SRC:
|
||||||
if (GST_STATE (self) != GST_STATE_NULL) {
|
if (GST_STATE (self) != GST_STATE_NULL) {
|
||||||
GST_ELEMENT_ERROR (self, CORE, FAILED,
|
GST_ELEMENT_ERROR (self, CORE, FAILED,
|
||||||
("camerasrc must be in NULL state when setting the video source element"),
|
("camerasrc must be in NULL state when setting the video source element"),
|
||||||
|
@ -111,13 +119,13 @@ gst_v4l2_camera_src_get_property (GObject * object,
|
||||||
GstV4l2CameraSrc *self = GST_V4L2_CAMERA_SRC (object);
|
GstV4l2CameraSrc *self = GST_V4L2_CAMERA_SRC (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_FILTER_CAPS:
|
case PROP_FILTER_CAPS:
|
||||||
gst_value_set_caps (value, self->view_finder_caps);
|
gst_value_set_caps (value, self->view_finder_caps);
|
||||||
break;
|
break;
|
||||||
case ARG_VIDEO_SOURCE_FILTER:
|
case PROP_VIDEO_SOURCE_FILTER:
|
||||||
g_value_set_object (value, self->app_video_filter);
|
g_value_set_object (value, self->app_video_filter);
|
||||||
break;
|
break;
|
||||||
case ARG_VIDEO_SRC:
|
case PROP_VIDEO_SRC:
|
||||||
if (self->src_vid_src)
|
if (self->src_vid_src)
|
||||||
g_value_set_object (value, self->src_vid_src);
|
g_value_set_object (value, self->src_vid_src);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue