Camera control interface skeleton.
authorMarko Ollonen <marko.ollonen@ixonos.com>
Tue, 7 Aug 2012 10:30:17 +0000 (13:30 +0300)
committerMarko Ollonen <marko.ollonen@ixonos.com>
Tue, 7 Aug 2012 10:49:43 +0000 (13:49 +0300)
Change-Id: Ic3e7f88b201636c88d9bf9f57c01d08a8227e04f

gst-libs/gst/camera/Makefile.am
gst-libs/gst/camera/gstmfldcameracontroliface.c [new file with mode: 0644]
gst-libs/gst/camera/gstmfldcameracontroliface.h [new file with mode: 0644]
gst-libs/gst/camera/gstmfldcamerasrc.c
gst-libs/gst/camera/gstmfldcamerasrc.h
packaging/mfldv4l2camsrc.spec

index 7598f08..687b43a 100644 (file)
@@ -4,10 +4,12 @@ libgstmfldcamera_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJOR
 
 libgstmfldcamera_@GST_MAJORMINOR@_la_SOURCES = gstmfldcamerasrc.c \
                                           gstmfldcameracolorbalance.c \
-                                          gstmfldcameraphotoiface.c
+                                          gstmfldcameraphotoiface.c \
+                                          gstmfldcameracontroliface.c
 
 libgstmfldcamera_@GST_MAJORMINOR@include_HEADERS = gstmfldcamerasrc.h \
-                                              gstmfldcameracolorbalance.h
+                                              gstmfldcameracolorbalance.h \
+                                              gstmfldcameracontroliface.h
 
 libgstmfldcamera_@GST_MAJORMINOR@_la_CFLAGS = $(GST_CFLAGS) -DGST_USE_UNSTABLE_API \
                                          $(GST_PLUGINS_BASE_CFLAGS)
diff --git a/gst-libs/gst/camera/gstmfldcameracontroliface.c b/gst-libs/gst/camera/gstmfldcameracontroliface.c
new file mode 100644 (file)
index 0000000..4784605
--- /dev/null
@@ -0,0 +1,305 @@
+/* GStreamer
+ *
+ * @author: Marko Ollonen <marko.ollonen@ixonos.com>
+ *
+ * gstmfldcameracontroliface.c: Camera control interface implementation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <gst/gst.h>
+#include "gstmfldcameracontroliface.h"
+#include "gstmfldcamerasrc.h"
+
+#include <stdio.h>
+
+GST_DEBUG_CATEGORY_EXTERN (gst_camerasrc_debug);
+#define GST_CAT_DEFAULT gst_camerasrc_debug
+
+
+GST_BOILERPLATE (GstCameraSrcCameraControlChannel,
+    gst_camerasrc_camera_control_channel,
+    GstCameraControlChannel, GST_TYPE_CAMERA_CONTROL_CHANNEL);
+
+static void
+gst_camerasrc_camera_control_channel_base_init (gpointer g_class)
+{
+
+}
+
+static void
+gst_camerasrc_camera_control_channel_class_init
+    (GstCameraSrcCameraControlChannelClass * klass)
+{
+
+}
+
+static void
+gst_camerasrc_camera_control_channel_init (GstCameraSrcCameraControlChannel *
+    channel, GstCameraSrcCameraControlChannelClass * klass)
+{
+  channel->id = (guint32) - 1;
+
+}
+
+static G_GNUC_UNUSED gboolean
+gst_camerasrc_camera_control_contains_channel (GstCameraSrc * camerasrc,
+    GstCameraSrcCameraControlChannelClass * channel)
+{
+  const GList *item;
+
+
+  for (item = camerasrc->camera_controls; item != NULL; item = item->next)
+    if (item->data == channel)
+      return TRUE;
+
+  return FALSE;
+}
+const GList *
+gst_camerasrc_camera_control_list_channels (GstCameraSrc * camerasrc)
+{
+  return camerasrc->camera_controls;
+}
+
+gboolean
+gst_camerasrc_camera_control_set_value( GstCameraSrc * camerasrc,
+    GstCameraControlChannel *control_channel )
+{
+  GstCameraSrcClass *bclass;
+  gboolean opened;
+
+  GstCameraSrcCameraControlChannel *camchannel =
+      GST_CAMERA_SRC_CAMERA_CONTROL_CHANNEL(control_channel);
+
+  bclass = GST_CAMERA_SRC_GET_CLASS (camerasrc);
+  opened = bclass->is_open (camerasrc);
+
+/* assert that we're opened and that we're using a known item */
+  g_return_if_fail (opened);
+
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_get_value( GstCameraSrc * camerasrc,
+    GstCameraControlChannel *control_channel )
+{
+  GstCameraSrcClass *bclass;
+  gboolean opened;
+
+  GstCameraSrcCameraControlChannel *camchannel =
+      GST_CAMERA_SRC_CAMERA_CONTROL_CHANNEL(control_channel);
+  gint value;
+  bclass = GST_CAMERA_SRC_GET_CLASS (camerasrc);
+  opened = bclass->is_open (camerasrc);
+
+  return FALSE;
+}
+gboolean
+gst_camerasrc_camera_control_set_exposure(  GstCameraSrc * camerasrc,
+    gint type, gint value1, gint value2 )
+{
+
+  return FALSE;
+}
+gboolean
+gst_camerasrc_camera_control_get_exposure( GstCameraSrc* camerasrc,
+    gint type, gint* value1, gint* value2 )
+{
+  return FALSE;
+}
+gboolean
+gst_camerasrc_camera_control_set_capture_mode( GstCameraSrc* camerasrc,
+    gint type, gint value )
+{
+  return FALSE;
+}
+gboolean
+gst_camerasrc_camera_control_get_capture_mode( GstCameraSrc* camerasrc,
+    gint type, gint* value )
+{
+  return FALSE;
+}
+gboolean
+gst_camerasrc_camera_control_set_strobe( GstCameraSrc* camerasrc,
+    gint type, gint value )
+{
+  return FALSE;
+}
+gboolean
+gst_camerasrc_camera_control_get_strobe( GstCameraSrc* camerasrc,
+    gint type, gint *value )
+{
+  return FALSE;
+}
+
+gboolean 
+gst_camerasrc_camera_control_set_detect( GstCameraSrc* camerasrc,
+    gint type, gint value )
+{
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_get_detect( GstCameraSrc* camerasrc,
+    gint type, gint* value )
+{
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_set_zoom( GstCameraSrc* camerasrc,
+    gint type, gint value )
+{
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_get_zoom( GstCameraSrc* camerasrc,
+    gint type, gint* value )
+{
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_set_focus( GstCameraSrc* camerasrc,
+    gint mode, gint range )
+{
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_get_focus( GstCameraSrc* camerasrc,
+    gint* mode, gint* range )
+{
+  return FALSE;
+}
+
+gboolean 
+gst_camerasrc_camera_control_start_auto_focus( GstCameraSrc* camerasrc)
+{
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_stop_auto_focus( GstCameraSrc* camerasrc)
+{
+  return FALSE;
+}
+gboolean
+gst_camerasrc_camera_control_set_focus_level( GstCameraSrc* camerasrc,
+    gint manual_level )
+{
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_get_focus_level( GstCameraSrc* camerasrc,
+    gint* manual_level )
+{
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_set_auto_focus_area( GstCameraSrc* camerasrc,
+    GstCameraControlRectType rect )
+{
+  return FALSE;;
+}
+
+gboolean
+gst_camerasrc_camera_control_get_auto_focus_area( GstCameraSrc* camerasrc,
+    GstCameraControlRectType* rect )
+{
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_set_wdr( GstCameraSrc* camerasrc, gint value)
+{
+  return FALSE;
+}
+
+gboolean 
+gst_camerasrc_camera_control_get_wdr( GstCameraSrc* camerasrc, gint* value)
+{
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_set_ahs( GstCameraSrc* camerasrc, gint value)
+{
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_get_ahs( GstCameraSrc* camerasrc, gint* value)
+{
+  return FALSE;
+}
+
+gboolean 
+gst_camerasrc_camera_control_set_part_color( GstCameraSrc* camerasrc,
+    gint type, gint value)
+{
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_get_part_color( GstCameraSrc* camerasrc,
+    gint type, gint* value)
+{
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_get_exif_info( GstCameraSrc* camerasrc,
+    GstCameraControlExifInfo* info)
+{
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_get_basic_dev_info( GstCameraSrc* camerasrc,
+    gint dev_id, GstCameraControlCapsInfoType* info)
+{
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_get_misc_dev_info( GstCameraSrc* camerasrc,
+    gint dev_id, GstCameraControlCtrlListInfoType* info)
+{
+  return FALSE;
+}
+
+gboolean
+gst_camerasrc_camera_control_get_extra_dev_info( GstCameraSrc* camerasrc,
+    gint dev_id, GstCameraControlExtraInfoType* info)
+{
+  return FALSE;
+}
+
+void
+gst_camerasrc_camera_control_set_capture_command( GstCameraSrc* camerasrc,
+    GstCameraControlCaptureCommand cmd )
+{
+  return FALSE;
+}
diff --git a/gst-libs/gst/camera/gstmfldcameracontroliface.h b/gst-libs/gst/camera/gstmfldcameracontroliface.h
new file mode 100644 (file)
index 0000000..7abf48f
--- /dev/null
@@ -0,0 +1,425 @@
+/* GStreamer
+ *
+ * @author: Marko Ollonen <marko.ollonen@ixonos.com>
+ *
+ * gstmfldcameracontroliface.h: Camera control interface implementation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef __GST_CAMERA_SRC_CAMERA_CONTROL_H__
+#define __GST_CAMERA_SRC_CAMERA_CONTROL_H__
+
+#include <gst/gst.h>
+#include <gst/interfaces/cameracontrol.h>
+
+#include "gstmfldcamerasrc.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_CAMERA_SRC_CAMERA_CONTROL_CHANNEL \
+  (gst_camerasrc_camera_control_channel_get_type ())
+#define GST_CAMERA_SRC_CAMERA_CONTROL_CHANNEL(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_CAMERA_SRC_CAMERA_CONTROL_CHANNEL, \
+             GstCameraSrcCameraControlChannel))
+#define GST_CAMERA_SRC_CAMERA_CONTROL_CHANNEL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_CAMERA_SRC_CAMERA_CONTROL_CHANNEL, \
+             GstCameraSrcCameraControlChannelClass))
+#define GST_IS_CAMERA_SRC_CAMERA_CONTROL_CHANNEL(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_CAMERA_SRC_CAMERA_CONTROL_CHANNEL))
+#define GST_IS_CAMERA_SRC_CAMERA_CONTROL_CHANNEL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_CAMERA_SRC_CAMERA_CONTROL_CHANNEL))
+
+typedef struct _GstCameraSrcCameraControlChannel {
+  GstCameraControlChannel parent;
+
+  guint32 id;
+} GstCameraSrcCameraControlChannel;
+
+/**
+ * GstCameraSrcCameraControlChannelClass:
+ * @parent: Element parent class
+ *
+ * #GstCameraSrcCameraControlChannelClass class object.
+ */
+typedef struct _GstCameraSrcCameraControlChannelClass {
+  GstCameraControlChannelClass parent;
+} GstCameraSrcCameraControlChannelClass;
+
+GType gst_camerasrc_camera_control_channel_get_type (void);
+
+const GList *
+gst_camerasrc_camera_control_list_channels (GstCameraSrc * camerasrc);
+
+gboolean
+gst_camerasrc_camera_control_set_value(GstCameraSrc * camerasrc,
+                             GstCameraControlChannel * control_channel );
+
+gboolean
+gst_camerasrc_camera_control_get_value(GstCameraSrc * camerasrc,
+                             GstCameraControlChannel* control_channel );
+
+gboolean
+gst_camerasrc_camera_control_set_exposure(GstCameraSrc * camerasrc,
+                                  gint type, gint value1, gint value2 );
+
+gboolean
+gst_camerasrc_camera_control_get_exposure(GstCameraSrc* control,
+                                gint type, gint* value1, gint* value2 );
+
+gboolean
+gst_camerasrc_camera_control_set_capture_mode(GstCameraSrc* control,
+                                              gint type, gint value );
+gboolean
+gst_camerasrc_camera_control_get_capture_mode(GstCameraSrc* control,
+                                              gint type, gint* value );
+
+gboolean
+gst_camerasrc_camera_control_set_strobe(GstCameraSrc* camerasrc,
+                                        gint type, gint value );
+
+gboolean
+gst_camerasrc_camera_control_get_strobe(GstCameraSrc* camerasrc,
+                                        gint type, gint *value );
+
+gboolean
+gst_camerasrc_camera_control_set_detect(GstCameraSrc* camerasrc,
+                                        gint type, gint value );
+
+gboolean
+gst_camerasrc_camera_control_get_detect(GstCameraSrc* camerasrc,
+                                        gint type, gint* value );
+
+gboolean
+gst_camerasrc_camera_control_set_zoom(GstCameraSrc* camerasrc,
+                                      gint type, gint value );
+gboolean
+gst_camerasrc_camera_control_get_zoom(GstCameraSrc* camerasrc,
+                                      gint type, gint* value );
+gboolean
+gst_camerasrc_camera_control_set_focus(GstCameraSrc* camerasrc,
+                                       gint mode, gint range );
+
+gboolean
+gst_camerasrc_camera_control_get_focus(GstCameraSrc* camerasrc,
+                                       gint* mode, gint* range );
+
+gboolean
+gst_camerasrc_camera_control_start_auto_focus(GstCameraSrc* camerasrc);
+
+gboolean
+gst_camerasrc_camera_control_stop_auto_focus(GstCameraSrc* camerasrc);
+
+gboolean
+gst_camerasrc_camera_control_set_focus_level(GstCameraSrc* camerasrc,
+                                             gint manual_level );
+gboolean
+gst_camerasrc_camera_control_get_focus_level(GstCameraSrc* camerasrc,
+                                             gint* manual_level );
+
+gboolean
+gst_camerasrc_camera_control_set_auto_focus_area(GstCameraSrc* camerasrc,
+                                        GstCameraControlRectType rect );
+
+gboolean
+gst_camerasrc_camera_control_get_auto_focus_area(GstCameraSrc* camerasrc,
+                                       GstCameraControlRectType* rect );
+
+gboolean
+gst_camerasrc_camera_control_set_wdr(GstCameraSrc* camerasrc, gint value);
+
+gboolean
+gst_camerasrc_camera_control_get_wdr(GstCameraSrc* camerasrc, gint* value);
+
+gboolean
+gst_camerasrc_camera_control_set_ahs(GstCameraSrc* camerasrc, gint value);
+
+gboolean
+gst_camerasrc_camera_control_get_ahs(GstCameraSrc* camerasrc, gint* value);
+
+gboolean
+gst_camerasrc_camera_control_set_part_color(GstCameraSrc* camerasrc,
+                                            gint type, gint value);
+
+gboolean
+gst_camerasrc_camera_control_get_part_color(GstCameraSrc* camerasrc,
+                                            gint type, gint* value);
+
+gboolean
+gst_camerasrc_camera_control_get_exif_info(GstCameraSrc* camerasrc,
+                                        GstCameraControlExifInfo* info);
+
+gboolean
+gst_camerasrc_camera_control_get_basic_dev_info(GstCameraSrc* camerasrc,
+                                    gint dev_id,
+                                    GstCameraControlCapsInfoType* info);
+
+gboolean
+gst_camerasrc_camera_control_get_misc_dev_info(GstCameraSrc* camerasrc,
+                                gint dev_id,
+                                GstCameraControlCtrlListInfoType* info);
+
+gboolean
+gst_camerasrc_camera_control_get_extra_dev_info(GstCameraSrc* camerasrc,
+                                   gint dev_id,
+                                   GstCameraControlExtraInfoType* info);
+
+void
+gst_camerasrc_camera_control_set_capture_command(GstCameraSrc* camerasrc,
+                                   GstCameraControlCaptureCommand cmd );
+
+
+#define GST_IMPLEMENT_CAMERA_SRC_CAMERA_CONTROL_METHODS(Type, interface_as_function)         \
+                                                                                             \
+static const GList *                                                                        \
+interface_as_function ## _camera_control_list_channels (GstCameraControl * control)          \
+{                                                                                            \
+  Type *this = (Type*) control;                                                              \
+  return gst_camerasrc_camera_control_list_channels(this);                                  \
+}                                                                                            \
+                                                                                             \
+static gint                                                                                 \
+interface_as_function ## _camera_control_get_value (GstCameraControl *control,               \
+                                                    GstCameraControlChannel *control_channel ) \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_get_value(this, control_channel);                      \
+}                                                                                             \
+                                                                                              \
+static gboolean                                                                              \
+interface_as_function ## _camera_control_set_value( GstCameraControl *control,                \
+                                                    GstCameraControlChannel *control_channel ) \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_set_value(this, control_channel);                      \
+}                                                                                             \
+                                                                                              \
+static gboolean                                                                              \
+interface_as_function ## _camera_control_set_exposure( GstCameraControl* control,             \
+                                                       gint type, gint value1, gint value2 )  \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_set_exposure(this, type, value1, value2);              \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_get_exposure( GstCameraControl* control,              \
+                                                      gint type, gint* value1, gint* value2 ) \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_get_exposure(this, type, value1,value2);               \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_set_capture_mode( GstCameraControl* control,          \
+                                                         gint type, gint value )              \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_set_capture_mode(this, type, value);                   \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_get_capture_mode( GstCameraControl* control,          \
+                                                         gint type, gint* value )             \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_get_capture_mode(this, type, value);                   \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_set_strobe( GstCameraControl* control                 \
+                                                    , gint type, gint value )                 \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_set_strobe(this, type, value);                         \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_get_strobe( GstCameraControl* control,                \
+                                                     gint type, gint *value )                 \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_get_strobe(this, type, value);                         \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_set_detect( GstCameraControl* control,                \
+                                                    gint type, gint value )                   \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_set_detect(this, type, value);                         \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_get_detect( GstCameraControl* control,                \
+                                                    gint type, gint* value )                  \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_get_detect(this, type, value);                         \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_set_zoom( GstCameraControl* control,                  \
+                                                  gint type, gint value )                     \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_set_zoom(this, type, value);                           \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_get_zoom( GstCameraControl* control,                  \
+                                                   gint type, gint* value )                   \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_get_zoom(this, type, value);                           \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_set_focus( GstCameraControl* control,                 \
+                                                   gint mode, gint range )                    \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_set_focus(this, mode, range);                          \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_get_focus( GstCameraControl* control,                 \
+                                                     gint* mode, gint* range )                \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_get_focus(this, mode, range);                          \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_start_auto_focus( GstCameraControl* control)          \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_start_auto_focus(this);                                \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_stop_auto_focus( GstCameraControl* control)           \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_stop_auto_focus(this);                                 \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_set_focus_level( GstCameraControl* control,           \
+                                                         gint manual_level )                  \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_set_focus_level(this, manual_level);                   \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_get_focus_level( GstCameraControl* control,           \
+                                                          gint* manual_level )                \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_get_focus_level(this, manual_level);                   \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_set_auto_focus_area( GstCameraControl* control,       \
+                                                             GstCameraControlRectType rect )  \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_set_auto_focus_area(this, rect);                       \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_get_auto_focus_area( GstCameraControl* control,       \
+                                                             GstCameraControlRectType* rect ) \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_get_auto_focus_area(this, rect);                       \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_set_wdr( GstCameraControl* control, gint value)       \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_set_wdr(this, value);                                  \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_get_wdr( GstCameraControl* control, gint* value)      \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_get_wdr(this, value);                                  \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_set_ahs( GstCameraControl* control, gint value)       \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_set_ahs(this,value);                                   \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_get_ahs( GstCameraControl* control, gint* value)      \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_get_ahs(this,value);                                   \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_set_part_color( GstCameraControl* control,            \
+                                                        gint type, gint value)                \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_set_part_color(this, type, value);                     \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_get_part_color( GstCameraControl* control,            \
+                                                                 gint type, gint* value)      \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_get_part_color(this, type, value);                     \
+}                                                                                             \
+static gboolean                                                                              \
+interface_as_function ##_camera_control_get_exif_info( GstCameraControl* control,             \
+                                                       GstCameraControlExifInfo* info)        \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_get_exif_info(this, info);                             \
+}                                                                                             \
+static void                                                                                  \
+interface_as_function ##_camera_control_set_capture_command( GstCameraControl* control,       \
+                                                             GstCameraControlCaptureCommand cmd ) \
+{                                                                                             \
+  Type *this = (Type*) control;                                                               \
+  return gst_camerasrc_camera_control_set_capture_command(this, cmd);                        \
+}                                                                                             \
+                                                                                              \
+void                                                                                          \
+interface_as_function ## _camera_control_interface_init (GstCameraControlClass * klass)       \
+{                                                                                             \
+                                                                                              \
+  GST_CAMERA_CONTROL_TYPE (klass) = GST_CAMERA_CONTROL_HARDWARE;                              \
+                                                                                              \
+  klass->list_channels         = interface_as_function ## _camera_control_list_channels;         \
+  klass->set_exposure                  = interface_as_function ##_camera_control_set_exposure;       \
+  klass->get_exposure                  = interface_as_function ##_camera_control_get_exposure;       \
+  klass->set_capture_mode              = interface_as_function ##_camera_control_set_capture_mode;   \
+  klass->get_capture_mode              = interface_as_function ##_camera_control_get_capture_mode;   \
+  klass->set_strobe                    = interface_as_function ##_camera_control_set_strobe;             \
+  klass->get_strobe                    = interface_as_function ##_camera_control_get_strobe;             \
+  klass->set_detect                    = interface_as_function ##_camera_control_set_detect;             \
+  klass->get_detect                    = interface_as_function ##_camera_control_get_detect;             \
+  klass->set_value                     = interface_as_function ## _camera_control_set_value;             \
+  klass->get_value                     = interface_as_function ## _camera_control_get_value;             \
+  klass->set_zoom                              = interface_as_function ##_camera_control_set_zoom;           \
+  klass->get_zoom                              = interface_as_function ##_camera_control_get_zoom;           \
+  klass->set_focus                     = interface_as_function ##_camera_control_set_focus;              \
+  klass->get_focus                     = interface_as_function ##_camera_control_get_focus;              \
+  klass->start_auto_focus              = interface_as_function ##_camera_control_start_auto_focus;   \
+  klass->stop_auto_focus               = interface_as_function ##_camera_control_stop_auto_focus;    \
+  klass->set_focus_level               = interface_as_function ##_camera_control_set_focus_level;    \
+  klass->get_focus_level               = interface_as_function ##_camera_control_get_focus_level;    \
+  klass->set_auto_focus_area   = interface_as_function ##_camera_control_set_auto_focus_area; \
+  klass->get_auto_focus_area   = interface_as_function ##_camera_control_get_auto_focus_area; \
+  klass->set_wdr                               = interface_as_function ##_camera_control_set_wdr;            \
+  klass->get_wdr                               = interface_as_function ##_camera_control_get_wdr;            \
+  klass->set_ahs                               = interface_as_function ##_camera_control_set_ahs;            \
+  klass->get_ahs                               = interface_as_function ##_camera_control_get_ahs;            \
+  klass->set_part_color                = interface_as_function ##_camera_control_set_part_color;         \
+  klass->get_part_color                = interface_as_function ##_camera_control_get_part_color;         \
+  klass->get_exif_info        = interface_as_function ##_camera_control_get_exif_info;        \
+  klass->set_capture_command   = interface_as_function ##_camera_control_set_capture_command; \
+}                                                                                             \
+
+#endif /* __GST_CAMERA_SRC_CAMERA_CONTROL_H__ */
index 6e05495..c8e0255 100644 (file)
 
 #include "gstmfldcameracolorbalance.h"
 #include "gstmfldcameraphotoiface.h"
+#include "gstmfldcameracontroliface.h"
 #include "videodev.h"
 #include <linux/videodev2.h>
 
@@ -166,6 +167,7 @@ GST_DEBUG_CATEGORY (gst_camerasrc_debug);
 
 GST_IMPLEMENT_CAMERA_SRC_COLOR_BALANCE_METHODS (GstCameraSrc, gst_camsrc);
 GST_IMPLEMENT_CAMERA_SRC_PHOTO_METHODS (GstCameraSrc, gst_camsrc);
+GST_IMPLEMENT_CAMERA_SRC_CAMERA_CONTROL_METHODS (GstCameraSrc, gst_camsrc);
 
 static gboolean
 gst_camerasrc_iface_supported (GstImplementsInterface * iface, GType iface_type)
@@ -177,7 +179,7 @@ gst_camerasrc_iface_supported (GstImplementsInterface * iface, GType iface_type)
   bclass = GST_CAMERA_SRC_GET_CLASS (camsrc);
 
   g_assert (iface_type == GST_TYPE_PHOTOGRAPHY ||
-      iface_type == GST_TYPE_COLOR_BALANCE);
+      iface_type == GST_TYPE_COLOR_BALANCE  || iface_type == GST_TYPE_CAMERA_CONTROL );
 
   /* We implement GstPhotography in NULL state as well */
   if (iface_type == GST_TYPE_PHOTOGRAPHY)
@@ -217,11 +219,19 @@ gst_camerasrc_init_interfaces (GType type)
     NULL,
   };
 
+  static const GInterfaceInfo camsrc_cameracontrol_info = {
+    (GInterfaceInitFunc) gst_camsrc_camera_control_interface_init,
+    NULL,
+    NULL,
+  };
+
   g_type_add_interface_static (type,
       GST_TYPE_IMPLEMENTS_INTERFACE, &camsrc_iface_info);
   g_type_add_interface_static (type, GST_TYPE_PHOTOGRAPHY, &camsrc_photo_info);
   g_type_add_interface_static (type,
       GST_TYPE_COLOR_BALANCE, &camsrc_colorbalance_info);
+  g_type_add_interface_static (type,
+      GST_TYPE_CAMERA_CONTROL, &camsrc_cameracontrol_info);
 }
 
 
@@ -472,6 +482,8 @@ gst_camerasrc_dispose (GObject * object)
   }
   gst_camerasrc_clear_color_channels (camerasrc);
 
+  gst_camerasrc_clear_cameracontrol_channels (camerasrc);
+
   G_OBJECT_CLASS (parent_class)->dispose (object);
 }
 
@@ -1729,6 +1741,34 @@ gst_camerasrc_clear_color_channels (GstCameraSrc * camsrc)
   camsrc->colors = NULL;
 }
 
+/**
+ * gst_camerasrc_add_cameracontrol_channel:
+ * @camsrc: #GstCameraSrc object.
+ * @channel: #GstColorBalanceChannel object.
+ *
+ * Add a new cameracontrol channel to list.
+ */
+void
+gst_camerasrc_add_cameracontrol_channel (GstCameraSrc * camsrc,
+    GstCameraControlChannel * channel)
+{
+  camsrc->camera_controls = g_list_append (camsrc->camera_controls, (gpointer) channel);
+}
+
+/**
+ * gst_camerasrc_clear_cameracontrol_channels:
+ * @camsrc: #GstCameraSrc object.
+ *
+ * Delete all cameracontrol channels.
+ */
+
+void
+gst_camerasrc_clear_cameracontrol_channels (GstCameraSrc * camsrc)
+{
+  g_list_foreach (camsrc->camera_controls, (GFunc) g_object_unref, NULL);
+  g_list_free (camsrc->camera_controls);
+  camsrc->camera_controls = NULL;
+}
 
 /**
  * gst_camerasrc_send_capture_start_message:
index e499fcf..c6b385f 100644 (file)
@@ -33,6 +33,7 @@
 #include <gst/base/gstpushsrc.h>
 #include <gst/interfaces/photography.h>
 #include <gst/interfaces/colorbalance.h>
+#include <gst/interfaces/cameracontrol.h>
 
 /**
  * GST_CAMERA_SRC_MAX_SIZE:
@@ -168,6 +169,7 @@ struct _GstCameraSrc {
   /*< private >*/
   GstCaps *vf_caps;
   GList *colors;
+  GList *camera_controls;
 
   /* TRUE if outgoing buffer should be always duplicated */
   gboolean always_copy;
@@ -382,6 +384,12 @@ void gst_camerasrc_add_color_channel (GstCameraSrc *camsrc,
 
 void gst_camerasrc_clear_color_channels (GstCameraSrc *camsrc);
 
+
+void gst_camerasrc_add_cameracontrol_channel (GstCameraSrc *camsrc,
+                                      GstCameraControlChannel *channel);
+
+void gst_camerasrc_clear_cameracontrol_channels (GstCameraSrc *camsrc);
+
 void gst_camerasrc_send_capture_start_message (GstCameraSrc *camsrc);
 
 void gst_camerasrc_send_capture_stop_message (GstCameraSrc *camsrc);
index 4161676..8e18f07 100644 (file)
@@ -50,6 +50,7 @@ rm -rf %{buildroot}
 %exclude %{_includedir}/ci_adv_pub.h
 %exclude %{_includedir}/gstreamer-0.10/gst/camera/gstmfldcameracolorbalance.h
 %exclude %{_includedir}/gstreamer-0.10/gst/camera/gstmfldcamerasrc.h
+%exclude %{_includedir}/gstreamer-0.10/gst/camera/gstmfldcameracontroliface.h
 %exclude %{_includedir}/gstv4l2mfldadvci.h
 %exclude %{_includedir}/mfld_cam.h
 %exclude %{_includedir}/mfld_cam_defs.h