GstPhotography: Added operation mode to photography API 60/260/1
authorLauri Lehtinen <ext-lauri.1.lehtinen@nokia.com>
Fri, 5 Mar 2010 08:21:10 +0000 (10:21 +0200)
committerJussi Saavalainen <jussi.saavalainen@ixonos.com>
Thu, 28 Jun 2012 12:52:46 +0000 (15:52 +0300)
gst-libs/gst/interfaces/photography.c
gst-libs/gst/interfaces/photography.h

index 878b185..d8a9b50 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)
index 4852ea3..82a9843 100644 (file)
@@ -206,6 +206,12 @@ typedef enum {
     GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_EXTENDED,
 } 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 +269,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 +321,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 +394,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__ */