From 66d392dd90c3c8eba67f7123158f612892cc7dcb Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Wed, 4 Mar 2020 15:51:35 +0900 Subject: [PATCH] [cameracontrol] Fix build warning and change interface style like colorbalance - build warning : return value: Missing (element-type) annotation [Version] 1.16.2-2 [Profile] Common [Issue Type] Update Change-Id: I6ca2dd1de71ec8c7e2062623f13c27cfb7b23ad6 Signed-off-by: Jeongmo Yang --- gst-libs/gst/video/Makefile.am | 2 +- gst-libs/gst/video/cameracontrol.c | 522 ++++++++++++++++++++++++------------- gst-libs/gst/video/cameracontrol.h | 30 +-- packaging/gst-plugins-base.spec | 2 +- 4 files changed, 358 insertions(+), 198 deletions(-) diff --git a/gst-libs/gst/video/Makefile.am b/gst-libs/gst/video/Makefile.am index 0d35cf8..75afdff 100644 --- a/gst-libs/gst/video/Makefile.am +++ b/gst-libs/gst/video/Makefile.am @@ -3,7 +3,7 @@ ORC_SOURCE=video-orc include $(top_srcdir)/common/orc.mak glib_enum_headers = video.h video-format.h video-color.h video-info.h video-dither.h \ - colorbalance.h navigation.h video-chroma.h video-tile.h video-converter.h \ + cameracontrol.h colorbalance.h navigation.h video-chroma.h video-tile.h video-converter.h \ video-resampler.h video-frame.h video-scaler.h video-anc.h \ video-overlay-composition.h glib_enum_define = GST_VIDEO diff --git a/gst-libs/gst/video/cameracontrol.c b/gst-libs/gst/video/cameracontrol.c index c2274bc..8001ab8 100644 --- a/gst-libs/gst/video/cameracontrol.c +++ b/gst-libs/gst/video/cameracontrol.c @@ -39,7 +39,6 @@ when who what, where, why #endif #include "cameracontrol.h" -//#include "interfaces-marshal.h" /** * SECTION:gstcameracontrol @@ -51,7 +50,7 @@ enum { CONTROL_LAST_SIGNAL }; -static void gst_camera_control_class_init(GstCameraControlClass *klass); +static void gst_camera_control_base_init(GstCameraControlInterface *iface); static guint gst_camera_control_signals[CONTROL_LAST_SIGNAL] = { 0 }; @@ -62,8 +61,8 @@ GType gst_camera_control_get_type(void) if (!gst_camera_control_type) { static const GTypeInfo gst_camera_control_info = { - sizeof(GstCameraControlClass), - (GBaseInitFunc)gst_camera_control_class_init, + sizeof(GstCameraControlInterface), + (GBaseInitFunc)gst_camera_control_base_init, NULL, NULL, NULL, @@ -74,79 +73,90 @@ GType gst_camera_control_get_type(void) }; gst_camera_control_type = g_type_register_static(G_TYPE_INTERFACE, - "GstCameraControl", - &gst_camera_control_info, - 0); - //g_type_interface_add_prerequisite(gst_camera_control_type, GST_TYPE_IMPLEMENTS_INTERFACE); + "GstCameraControl", &gst_camera_control_info, 0); } return gst_camera_control_type; } -static void gst_camera_control_class_init(GstCameraControlClass *klass) +static void gst_camera_control_base_init(GstCameraControlInterface *iface) { static gboolean initialized = FALSE; if (!initialized) { gst_camera_control_signals[CONTROL_VALUE_CHANGED] = g_signal_new("control-value-changed", - GST_TYPE_CAMERA_CONTROL, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(GstCameraControlClass, value_changed), - NULL, NULL, NULL, - //gst_interfaces_marshal_VOID__OBJECT_INT, - G_TYPE_NONE, 2, GST_TYPE_CAMERA_CONTROL_CHANNEL, G_TYPE_INT); + GST_TYPE_CAMERA_CONTROL, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(GstCameraControlInterface, value_changed), + NULL, NULL, NULL, + G_TYPE_NONE, 2, GST_TYPE_CAMERA_CONTROL_CHANNEL, G_TYPE_INT); initialized = TRUE; } // TODO : - klass->camera_control_type = 0; - - /* defauld virtual functions */ - klass->list_channels = NULL; - klass->set_exposure = NULL; - klass->get_exposure = NULL; - klass->set_capture_mode = NULL; - klass->get_capture_mode = NULL; - klass->set_strobe = NULL; - klass->get_strobe = NULL; - klass->set_detect = NULL; - klass->get_detect = NULL; - klass->set_value = NULL; - klass->get_value = NULL; - klass->set_zoom = NULL; - klass->get_zoom = NULL; - klass->set_focus = NULL; - klass->get_focus = NULL; - klass->start_auto_focus = NULL; - klass->stop_auto_focus = NULL; - klass->set_focus_level = NULL; - klass->get_focus_level = NULL; - klass->set_auto_focus_area = NULL; - klass->get_auto_focus_area = NULL; - klass->set_wdr = NULL; - klass->get_wdr = NULL; - klass->set_ahs = NULL; - klass->get_ahs = NULL; - klass->set_part_color = NULL; - klass->get_part_color = NULL; - klass->get_exif_info = NULL; - klass->set_capture_command = NULL; - klass->set_record_command = NULL; - klass->start_face_zoom = NULL; - klass->stop_face_zoom = NULL; - klass->set_ae_lock = NULL; - klass->get_ae_lock = NULL; - klass->set_awb_lock = NULL; - klass->get_awb_lock = NULL; -} - -const GList* gst_camera_control_list_channels(GstCameraControl *control) -{ - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); - - if (klass && klass->list_channels) { - return klass->list_channels(control); + iface->camera_control_type = 0; + + /* default virtual functions */ + iface->list_channels = NULL; + iface->set_exposure = NULL; + iface->get_exposure = NULL; + iface->set_capture_mode = NULL; + iface->get_capture_mode = NULL; + iface->set_strobe = NULL; + iface->get_strobe = NULL; + iface->set_detect = NULL; + iface->get_detect = NULL; + iface->set_value = NULL; + iface->get_value = NULL; + iface->set_zoom = NULL; + iface->get_zoom = NULL; + iface->set_focus = NULL; + iface->get_focus = NULL; + iface->start_auto_focus = NULL; + iface->stop_auto_focus = NULL; + iface->set_focus_level = NULL; + iface->get_focus_level = NULL; + iface->set_auto_focus_area = NULL; + iface->get_auto_focus_area = NULL; + iface->set_wdr = NULL; + iface->get_wdr = NULL; + iface->set_ahs = NULL; + iface->get_ahs = NULL; + iface->set_part_color = NULL; + iface->get_part_color = NULL; + iface->get_exif_info = NULL; + iface->set_capture_command = NULL; + iface->set_record_command = NULL; + iface->start_face_zoom = NULL; + iface->stop_face_zoom = NULL; + iface->set_ae_lock = NULL; + iface->get_ae_lock = NULL; + iface->set_awb_lock = NULL; + iface->get_awb_lock = NULL; +} + +/** + * gst_camera_control_list_channels: + * @control: A #GstCameraControl instance + * + * Retrieve a list of the available channels. + * + * Returns: (element-type GstCameraControlChannel) (transfer none): A + * GList containing pointers to #GstCameraControlChannel + * objects. The list is owned by the #GstCameraControl + * instance and must not be freed. + */ +const GList *gst_camera_control_list_channels(GstCameraControl *control) +{ + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), NULL); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->list_channels) { + return iface->list_channels(control); } return NULL; @@ -155,10 +165,14 @@ const GList* gst_camera_control_list_channels(GstCameraControl *control) gboolean gst_camera_control_set_value(GstCameraControl *control, GstCameraControlChannel *control_channel, gint value) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); - if (klass && klass->set_value) { - return klass->set_value(control, control_channel, value); + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->set_value) { + return iface->set_value(control, control_channel, value); } return FALSE; @@ -166,10 +180,14 @@ gboolean gst_camera_control_set_value(GstCameraControl *control, GstCameraContro gboolean gst_camera_control_get_value(GstCameraControl *control, GstCameraControlChannel *control_channel, gint *value) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); - if (klass && klass->get_value) { - return klass->get_value(control, control_channel, value); + if (iface->get_value) { + return iface->get_value(control, control_channel, value); } return FALSE; @@ -179,10 +197,14 @@ gboolean gst_camera_control_get_value(GstCameraControl *control, GstCameraContro gboolean gst_camera_control_set_exposure(GstCameraControl *control, gint type, gint value1, gint value2) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; - if (klass && klass->set_exposure) { - return klass->set_exposure(control, type, value1, value2); + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->set_exposure) { + return iface->set_exposure(control, type, value1, value2); } return FALSE; @@ -190,10 +212,14 @@ gboolean gst_camera_control_set_exposure(GstCameraControl *control, gint type, g gboolean gst_camera_control_get_exposure(GstCameraControl *control, gint type, gint *value1, gint *value2) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); - if (klass && klass->get_exposure) { - return klass->get_exposure(control, type, value1, value2); + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->get_exposure) { + return iface->get_exposure(control, type, value1, value2); } return FALSE; @@ -201,10 +227,14 @@ gboolean gst_camera_control_get_exposure(GstCameraControl *control, gint type, g gboolean gst_camera_control_set_capture_mode(GstCameraControl *control, gint type, gint value) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); - if (klass && klass->set_capture_mode) { - return klass->set_capture_mode(control, type, value); + if (iface->set_capture_mode) { + return iface->set_capture_mode(control, type, value); } return FALSE; @@ -212,10 +242,14 @@ gboolean gst_camera_control_set_capture_mode(GstCameraControl *control, gint typ gboolean gst_camera_control_get_capture_mode(GstCameraControl *control, gint type, gint *value) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); - if (klass && klass->get_capture_mode) { - return klass->get_capture_mode(control, type, value); + if (iface->get_capture_mode) { + return iface->get_capture_mode(control, type, value); } return FALSE; @@ -223,10 +257,14 @@ gboolean gst_camera_control_get_capture_mode(GstCameraControl *control, gint typ gboolean gst_camera_control_set_strobe(GstCameraControl *control, gint type, gint value) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; - if (klass && klass->set_strobe) { - return klass->set_strobe(control, type, value); + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->set_strobe) { + return iface->set_strobe(control, type, value); } return FALSE; @@ -234,10 +272,14 @@ gboolean gst_camera_control_set_strobe(GstCameraControl *control, gint type, gin gboolean gst_camera_control_get_strobe(GstCameraControl *control, gint type, gint *value) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); - if (klass && klass->get_strobe) { - return klass->get_strobe(control, type, value); + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->get_strobe) { + return iface->get_strobe(control, type, value); } return FALSE; @@ -245,10 +287,14 @@ gboolean gst_camera_control_get_strobe(GstCameraControl *control, gint type, gin gboolean gst_camera_control_set_detect(GstCameraControl *control, gint type, gint value) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); - if (klass && klass->set_detect) { - return klass->set_detect(control, type, value); + if (iface->set_detect) { + return iface->set_detect(control, type, value); } return FALSE; @@ -256,10 +302,14 @@ gboolean gst_camera_control_set_detect(GstCameraControl *control, gint type, gin gboolean gst_camera_control_get_detect(GstCameraControl *control, gint type, gint *value) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; - if (klass && klass->get_detect) { - return klass->get_detect(control, type, value); + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->get_detect) { + return iface->get_detect(control, type, value); } return FALSE; @@ -267,10 +317,14 @@ gboolean gst_camera_control_get_detect(GstCameraControl *control, gint type, gin gboolean gst_camera_control_set_zoom(GstCameraControl *control, gint type, gint value) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); - if (klass && klass->set_zoom) { - return klass->set_zoom(control, type, value); + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->set_zoom) { + return iface->set_zoom(control, type, value); } return FALSE; @@ -278,10 +332,14 @@ gboolean gst_camera_control_set_zoom(GstCameraControl *control, gint type, gint gboolean gst_camera_control_get_zoom(GstCameraControl *control, gint type, gint *value) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); - if (klass && klass->get_zoom) { - return klass->get_zoom(control, type, value); + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->get_zoom) { + return iface->get_zoom(control, type, value); } return FALSE; @@ -289,10 +347,14 @@ gboolean gst_camera_control_get_zoom(GstCameraControl *control, gint type, gint gboolean gst_camera_control_set_focus(GstCameraControl *control, gint mode, gint range) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); - if (klass && klass->set_focus) { - return klass->set_focus(control, mode, range); + if (iface->set_focus) { + return iface->set_focus(control, mode, range); } return FALSE; @@ -300,10 +362,14 @@ gboolean gst_camera_control_set_focus(GstCameraControl *control, gint mode, gint gboolean gst_camera_control_get_focus(GstCameraControl *control, gint *mode, gint *range) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; - if (klass && klass->get_focus) { - return klass->get_focus(control, mode, range); + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->get_focus) { + return iface->get_focus(control, mode, range); } return FALSE; @@ -311,10 +377,14 @@ gboolean gst_camera_control_get_focus(GstCameraControl *control, gint *mode, gin gboolean gst_camera_control_start_auto_focus(GstCameraControl *control) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); - if (klass && klass->start_auto_focus) { - return klass->start_auto_focus(control); + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->start_auto_focus) { + return iface->start_auto_focus(control); } return FALSE; @@ -322,10 +392,14 @@ gboolean gst_camera_control_start_auto_focus(GstCameraControl *control) gboolean gst_camera_control_stop_auto_focus(GstCameraControl *control) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); - if (klass && klass->stop_auto_focus) { - return klass->stop_auto_focus(control); + if (iface->stop_auto_focus) { + return iface->stop_auto_focus(control); } return FALSE; @@ -333,10 +407,14 @@ gboolean gst_camera_control_stop_auto_focus(GstCameraControl *control) gboolean gst_camera_control_set_focus_level(GstCameraControl *control, gint manual_level) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); - if (klass && klass->set_focus_level) { - return klass->set_focus_level(control, manual_level); + if (iface->set_focus_level) { + return iface->set_focus_level(control, manual_level); } return FALSE; @@ -344,10 +422,14 @@ gboolean gst_camera_control_set_focus_level(GstCameraControl *control, gint manu gboolean gst_camera_control_get_focus_level(GstCameraControl *control, gint *manual_level) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; - if (klass && klass->get_focus_level) { - return klass->get_focus_level(control, manual_level); + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->get_focus_level) { + return iface->get_focus_level(control, manual_level); } return FALSE; @@ -355,10 +437,14 @@ gboolean gst_camera_control_get_focus_level(GstCameraControl *control, gint *man gboolean gst_camera_control_set_auto_focus_area(GstCameraControl *control, GstCameraControlRectType rect) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); - if (klass && klass->set_auto_focus_area) { - return klass->set_auto_focus_area(control, rect); + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->set_auto_focus_area) { + return iface->set_auto_focus_area(control, rect); } return FALSE; @@ -366,10 +452,14 @@ gboolean gst_camera_control_set_auto_focus_area(GstCameraControl *control, GstCa gboolean gst_camera_control_get_auto_focus_area(GstCameraControl *control, GstCameraControlRectType *rect) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); - if (klass && klass->get_auto_focus_area) { - return klass->get_auto_focus_area(control, rect); + if (iface->get_auto_focus_area) { + return iface->get_auto_focus_area(control, rect); } return FALSE; @@ -377,10 +467,14 @@ gboolean gst_camera_control_get_auto_focus_area(GstCameraControl *control, GstCa gboolean gst_camera_control_set_wdr(GstCameraControl *control, gint value) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; - if (klass && klass->set_wdr) { - return klass->set_wdr(control, value); + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->set_wdr) { + return iface->set_wdr(control, value); } return FALSE; @@ -388,10 +482,14 @@ gboolean gst_camera_control_set_wdr(GstCameraControl *control, gint value) gboolean gst_camera_control_get_wdr(GstCameraControl *control, gint *value) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); - if (klass && klass->get_wdr) { - return klass->get_wdr(control, value); + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->get_wdr) { + return iface->get_wdr(control, value); } return FALSE; @@ -399,10 +497,14 @@ gboolean gst_camera_control_get_wdr(GstCameraControl *control, gint *value) gboolean gst_camera_control_set_ahs(GstCameraControl *control, gint value) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); - if (klass && klass->set_ahs) { - return klass->set_ahs(control, value); + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->set_ahs) { + return iface->set_ahs(control, value); } return FALSE; @@ -410,10 +512,14 @@ gboolean gst_camera_control_set_ahs(GstCameraControl *control, gint value) gboolean gst_camera_control_get_ahs(GstCameraControl *control, gint *value) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); - if (klass && klass->get_ahs) { - return klass->get_ahs(control, value); + if (iface->get_ahs) { + return iface->get_ahs(control, value); } return FALSE; @@ -421,10 +527,14 @@ gboolean gst_camera_control_get_ahs(GstCameraControl *control, gint *value) gboolean gst_camera_control_set_part_color(GstCameraControl *control, gint type, gint value) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; - if (klass && klass->set_part_color) { - return klass->set_part_color(control, type, value); + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->set_part_color) { + return iface->set_part_color(control, type, value); } return FALSE; @@ -432,10 +542,14 @@ gboolean gst_camera_control_set_part_color(GstCameraControl *control, gint type, gboolean gst_camera_control_get_part_color(GstCameraControl *control, gint type, gint *value) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); - if (klass && klass->get_part_color) { - return klass->get_part_color(control, type, value); + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->get_part_color) { + return iface->get_part_color(control, type, value); } return FALSE; @@ -444,10 +558,14 @@ gboolean gst_camera_control_get_part_color(GstCameraControl *control, gint type, gboolean gst_camera_control_get_exif_info(GstCameraControl *control, GstCameraControlExifInfo *info) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); - if (klass && klass->get_exif_info) { - return klass->get_exif_info(control, info); + if (iface->get_exif_info) { + return iface->get_exif_info(control, info); } return FALSE; @@ -456,10 +574,14 @@ gst_camera_control_get_exif_info(GstCameraControl *control, GstCameraControlExif gboolean gst_camera_control_get_basic_dev_info(GstCameraControl *control, gint dev_id, GstCameraControlCapsInfoType *info) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); - if (klass && klass->get_basic_dev_info) { - return klass->get_basic_dev_info(control, dev_id, info); + if (iface->get_basic_dev_info) { + return iface->get_basic_dev_info(control, dev_id, info); } return FALSE; @@ -467,10 +589,14 @@ gboolean gst_camera_control_get_basic_dev_info(GstCameraControl *control, gint d gboolean gst_camera_control_get_misc_dev_info(GstCameraControl *control, gint dev_id, GstCameraControlCtrlListInfoType *info) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control ); + GstCameraControlInterface *iface; - if (klass && klass->get_misc_dev_info) { - return klass->get_misc_dev_info( control, dev_id, info ); + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->get_misc_dev_info) { + return iface->get_misc_dev_info( control, dev_id, info ); } return FALSE; @@ -478,10 +604,14 @@ gboolean gst_camera_control_get_misc_dev_info(GstCameraControl *control, gint de gboolean gst_camera_control_get_extra_dev_info(GstCameraControl *control, gint dev_id, GstCameraControlExtraInfoType *info) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); - if (klass && klass->get_extra_dev_info) { - return klass->get_extra_dev_info(control, dev_id, info); + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->get_extra_dev_info) { + return iface->get_extra_dev_info(control, dev_id, info); } return FALSE; @@ -489,10 +619,14 @@ gboolean gst_camera_control_get_extra_dev_info(GstCameraControl *control, gint d void gst_camera_control_set_capture_command(GstCameraControl *control, GstCameraControlCaptureCommand cmd) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_if_fail(GST_IS_CAMERA_CONTROL(control)); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); - if (klass && klass->set_capture_command) { - klass->set_capture_command(control, cmd); + if (iface->set_capture_command) { + iface->set_capture_command(control, cmd); } return; @@ -500,10 +634,14 @@ void gst_camera_control_set_capture_command(GstCameraControl *control, GstCamera void gst_camera_control_set_record_command(GstCameraControl *control, GstCameraControlRecordCommand cmd) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; - if (klass && klass->set_record_command) { - klass->set_record_command(control, cmd); + g_return_if_fail(GST_IS_CAMERA_CONTROL(control)); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->set_record_command) { + iface->set_record_command(control, cmd); } return; @@ -511,10 +649,14 @@ void gst_camera_control_set_record_command(GstCameraControl *control, GstCameraC gboolean gst_camera_control_start_face_zoom(GstCameraControl *control, gint x, gint y, gint zoom_level) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); - if (klass && klass->start_face_zoom) { - return klass->start_face_zoom(control, x, y, zoom_level); + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->start_face_zoom) { + return iface->start_face_zoom(control, x, y, zoom_level); } return FALSE; @@ -522,10 +664,14 @@ gboolean gst_camera_control_start_face_zoom(GstCameraControl *control, gint x, g gboolean gst_camera_control_stop_face_zoom(GstCameraControl *control) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); - if (klass && klass->stop_face_zoom) { - return klass->stop_face_zoom(control); + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->stop_face_zoom) { + return iface->stop_face_zoom(control); } return FALSE; @@ -533,10 +679,14 @@ gboolean gst_camera_control_stop_face_zoom(GstCameraControl *control) gboolean gst_camera_control_set_ae_lock(GstCameraControl *control, gboolean lock) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); - if (klass && klass->set_ae_lock) { - return klass->set_ae_lock(control, lock); + if (iface->set_ae_lock) { + return iface->set_ae_lock(control, lock); } return FALSE; @@ -544,10 +694,14 @@ gboolean gst_camera_control_set_ae_lock(GstCameraControl *control, gboolean lock gboolean gst_camera_control_get_ae_lock(GstCameraControl *control, gboolean *lock) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; - if (klass && klass->get_ae_lock) { - return klass->get_ae_lock(control, lock); + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->get_ae_lock) { + return iface->get_ae_lock(control, lock); } return FALSE; @@ -555,10 +709,14 @@ gboolean gst_camera_control_get_ae_lock(GstCameraControl *control, gboolean *loc gboolean gst_camera_control_set_awb_lock(GstCameraControl *control, gboolean lock) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); - if (klass && klass->set_awb_lock) { - return klass->set_awb_lock(control, lock); + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); + + if (iface->set_awb_lock) { + return iface->set_awb_lock(control, lock); } return FALSE; @@ -566,10 +724,14 @@ gboolean gst_camera_control_set_awb_lock(GstCameraControl *control, gboolean loc gboolean gst_camera_control_get_awb_lock(GstCameraControl *control, gboolean *lock) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); - if (klass && klass->get_awb_lock) { - return klass->get_awb_lock(control, lock); + if (iface->get_awb_lock) { + return iface->get_awb_lock(control, lock); } return FALSE; @@ -577,10 +739,14 @@ gboolean gst_camera_control_get_awb_lock(GstCameraControl *control, gboolean *lo gboolean gst_camera_control_set_user_buffer_fd(GstCameraControl *control, int *fds, int number) { - GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS(control); + GstCameraControlInterface *iface; + + g_return_val_if_fail(GST_IS_CAMERA_CONTROL(control), FALSE); + + iface = GST_CAMERA_CONTROL_GET_INTERFACE(control); - if (klass && klass->set_user_buffer_fd) { - return klass->set_user_buffer_fd(control, fds, number); + if (iface->set_user_buffer_fd) { + return iface->set_user_buffer_fd(control, fds, number); } return FALSE; diff --git a/gst-libs/gst/video/cameracontrol.h b/gst-libs/gst/video/cameracontrol.h index 0b57ff3..231055f 100644 --- a/gst-libs/gst/video/cameracontrol.h +++ b/gst-libs/gst/video/cameracontrol.h @@ -37,32 +37,26 @@ when who what, where, why #define __GST_CAMERA_CONTROL_H__ #include -#include #include -//#include G_BEGIN_DECLS #define GST_TYPE_CAMERA_CONTROL \ (gst_camera_control_get_type()) #define GST_CAMERA_CONTROL(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_CAMERA_CONTROL, GstCameraControl)) -#define GST_CAMERA_CONTROL_GET_CLASS(inst) \ - (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_CAMERA_CONTROL, GstCameraControlClass)) -#define GST_CAMERA_CONTROL_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_CAMERA_CONTROL, GstCameraControlClass)) + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_CAMERA_CONTROL, GstCameraControl)) #define GST_IS_CAMERA_CONTROL(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_CAMERA_CONTROL)) -#define GST_IS_CAMERA_CONTROL_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_CAMERA_CONTROL)) -#define GST_CAMERA_CONTROL_TYPE(klass) (klass->camera_control_type) + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_CAMERA_CONTROL)) +#define GST_CAMERA_CONTROL_GET_INTERFACE(inst) \ + (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_CAMERA_CONTROL, GstCameraControlInterface)) +#define GST_CAMERA_CONTROL_TYPE(iface) (iface->camera_control_type) typedef struct _GstCameraControl GstCameraControl; +typedef struct _GstCameraControlInterface GstCameraControlInterface; typedef enum { - // TODO : V4L2 Extend GST_CAMERA_CONTROL_HARDWARE, GST_CAMERA_CONTROL_SOFTWARE } GstCameraControlType; @@ -334,13 +328,13 @@ typedef struct _GstCameraControlExifInfo { gint max_lens_aperture_in_APEX; /* Max aperture value in APEX standard */ } GstCameraControlExifInfo; -/* structure for camera control class */ -typedef struct _GstCameraControlClass { - GTypeInterface klass; +/* structure for camera control interface */ +struct _GstCameraControlInterface { + GTypeInterface iface; GstCameraControlType camera_control_type; /* virtual functions */ - const GList* (*list_channels) (GstCameraControl *control); + const GList *(*list_channels) (GstCameraControl *control); gboolean (*set_value) (GstCameraControl *control, GstCameraControlChannel *control_channel, gint value); gboolean (*get_value) (GstCameraControl *control, GstCameraControlChannel *control_channel, gint *value); gboolean (*set_exposure) (GstCameraControl *control, gint type, gint value1, gint value2); @@ -383,13 +377,13 @@ typedef struct _GstCameraControlClass { /* signals */ void (* value_changed) (GstCameraControl *control, GstCameraControlChannel *channel, gint value); -} GstCameraControlClass; +}; GST_VIDEO_API GType gst_camera_control_get_type(void); GST_VIDEO_API -const GList* gst_camera_control_list_channels (GstCameraControl *control); +const GList *gst_camera_control_list_channels (GstCameraControl *control); GST_VIDEO_API gboolean gst_camera_control_set_value (GstCameraControl *control, GstCameraControlChannel *control_channel, gint value); diff --git a/packaging/gst-plugins-base.spec b/packaging/gst-plugins-base.spec index ee23afd..5495060 100644 --- a/packaging/gst-plugins-base.spec +++ b/packaging/gst-plugins-base.spec @@ -5,7 +5,7 @@ Name: gst-plugins-base Version: 1.16.2 -Release: 1 +Release: 2 License: LGPL-2.0+ Summary: GStreamer Streaming-Media Framework Plug-Ins Url: http://gstreamer.freedesktop.org/ -- 2.7.4