Merge changes If11eceb4,I4067f381,I9ffe5baa 63/263/1
authorNashif, Anas <anas.nashif@intel.com>
Fri, 6 Jul 2012 09:35:06 +0000 (02:35 -0700)
committerGerrit Code Review <gerrit2@tzgerrit>
Fri, 6 Jul 2012 09:35:06 +0000 (02:35 -0700)
* changes:
  photography: Add GST_PHOTOGRAPHY_FOCUS_MODE_SPORT
  camerabin,photography: Add autofocus interface property
  GstPhotography: Added operation mode to photography API

gst-libs/gst/interfaces/photography.c
gst-libs/gst/interfaces/photography.h
gst/camerabin/gstcamerabin-enum.h

index 878b185..bd858b3 100644 (file)
@@ -104,6 +104,8 @@ gst_photography_iface_base_init (GstPhotographyInterface * iface)
   iface->set_autofocus = NULL;
   iface->set_config = NULL;
   iface->get_config = NULL;
+  iface->set_format = NULL;
+  iface->get_format = NULL;
 }
 
 #define GST_PHOTOGRAPHY_FUNC_TEMPLATE(function_name, param_type) \
@@ -498,6 +500,60 @@ gst_photography_get_config (GstPhotography * photo, GstPhotoSettings * config)
   return ret;
 }
 
+/**
+ * gst_photography_set_format:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @op_mode: #GstOperationMode operation mode to set
+ * @op_mode_caps: #GstCaps containing the op_mode caps
+ *
+ * Set caps for given operation mode
+ *
+ * Returns: TRUE if operation mode was set successfully, otherwise FALSE.
+ */
+gboolean
+gst_photography_set_format (GstPhotography * photo,
+    GstOperationMode op_mode, GstCaps * op_mode_caps)
+{
+  GstPhotographyInterface *iface;
+  gboolean ret = FALSE;
+
+  g_return_val_if_fail (photo != NULL, FALSE);
+
+  iface = GST_PHOTOGRAPHY_GET_IFACE (photo);
+  if (iface->set_format) {
+    ret = iface->set_format (photo, op_mode, op_mode_caps);
+  }
+
+  return ret;
+}
+
+/**
+ * gst_photography_get_format:
+ * @photo: #GstPhotography interface of a #GstElement
+ * @op_mode: #GstOperationMode operation mode of which caps to get
+ *
+ * Get given operation mode mode caps
+ *
+ * Returns: A pointer to #GstCaps
+ */
+GstCaps *
+gst_photography_get_format (GstPhotography * photo, GstOperationMode op_mode)
+{
+  GstPhotographyInterface *iface;
+  GstCaps *ret;
+
+  g_return_val_if_fail (photo != NULL, NULL);
+
+  iface = GST_PHOTOGRAPHY_GET_IFACE (photo);
+  if (iface->get_format) {
+    ret = iface->get_format (photo, op_mode);
+  } else {
+    ret = NULL;
+  }
+  return ret;
+}
+
+
 /* Photography class initialization stuff */
 static void
 gst_photography_iface_class_init (gpointer g_class)
@@ -621,4 +677,10 @@ gst_photography_iface_class_init (gpointer g_class)
           "Which noise reduction modes are enabled (0 = disabled)",
           GST_TYPE_PHOTOGRAPHY_NOISE_REDUCTION,
           0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /* Autofocus */
+  g_object_interface_install_property (g_class,
+      g_param_spec_boolean (GST_PHOTOGRAPHY_PROP_AUTOFOCUS, "autofocus",
+          "Set true to start autofocus sequence and false to interrupt it",
+          FALSE, G_PARAM_READWRITE));
 }
index 4852ea3..bc7c09f 100644 (file)
@@ -71,6 +71,7 @@ G_BEGIN_DECLS
 #define GST_PHOTOGRAPHY_PROP_FLICKER_MODE "flicker-mode"
 #define GST_PHOTOGRAPHY_PROP_FOCUS_MODE   "focus-mode"
 #define GST_PHOTOGRAPHY_PROP_ZOOM   "zoom"
+#define GST_PHOTOGRAPHY_PROP_AUTOFOCUS    "autofocus"
 
 /**
  * GstPhotography:
@@ -204,8 +205,15 @@ typedef enum {
     GST_PHOTOGRAPHY_FOCUS_MODE_EXTENDED,
     GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_NORMAL,
     GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_EXTENDED,
+    GST_PHOTOGRAPHY_FOCUS_MODE_SPORT
 } GstFocusMode;
 
+typedef enum {
+    GST_PHOTOGRAPHY_OPERATION_MODE_VIEWFINDER = 0,
+    GST_PHOTOGRAPHY_OPERATION_MODE_IMAGE_CAPTURE,
+    GST_PHOTOGRAPHY_OPERATION_MODE_PREVIEW,
+} GstOperationMode;
+
 typedef struct
 {
   GstWhiteBalanceMode wb_mode;
@@ -263,6 +271,8 @@ typedef void (*GstPhotoCapturePrepared) (gpointer data,
  * @set_config: vmethod to set all configuration parameters at once
  * @get_config: vmethod to get all configuration parameters at once
  * @get_image_capture_supported_caps: vmethod to get caps describing supported image capture formats
+ * @set_format: vmethod to set caps for given operation mode
+ * @get_format: vmethod to get current caps for given operation mode
  *
  * #GstPhotographyInterface interface.
  */
@@ -313,11 +323,13 @@ typedef struct _GstPhotographyInterface
   void (*set_autofocus) (GstPhotography * photo, gboolean on);
   gboolean (*set_config) (GstPhotography * photo, GstPhotoSettings * config);
   gboolean (*get_config) (GstPhotography * photo, GstPhotoSettings * config);
-
   gboolean (*get_noise_reduction) (GstPhotography * photo,
     GstPhotographyNoiseReduction * noise_reduction);
   gboolean (*set_noise_reduction) (GstPhotography * photo,
     GstPhotographyNoiseReduction noise_reduction);
+  gboolean (*set_format) (GstPhotography * photo,
+      GstOperationMode op_mode, GstCaps * op_mode_caps);
+  GstCaps * (*get_format) (GstPhotography * photo, GstOperationMode op_mode);
 
   /*< private > */
   gpointer _gst_reserved[GST_PADDING];
@@ -384,6 +396,11 @@ gboolean gst_photography_set_config (GstPhotography * photo,
 gboolean gst_photography_get_config (GstPhotography * photo,
     GstPhotoSettings * config);
 
+gboolean gst_photography_set_format (GstPhotography * photo,
+    GstOperationMode op_mode, GstCaps * op_mode_caps);
+GstCaps * gst_photography_get_format (GstPhotography * photo,
+    GstOperationMode op_mode);
+
 G_END_DECLS
 
 #endif /* __GST_PHOTOGRAPHY_H__ */
index b848047..7fbe6c8 100644 (file)
@@ -70,7 +70,8 @@ enum
   ARG_VIDEO_CAPTURE_FRAMERATE,
   ARG_PREVIEW_SOURCE_FILTER,
   ARG_READY_FOR_CAPTURE,
-  ARG_IDLE
+  ARG_IDLE,
+  ARG_AUTOFOCUS
 };
 
 /**