Search
SailfishOS Open Build Service
>
Projects
>
home:msameer
:
gst-nokia-videosrc2
>
gst-plugins-bad-free
> 0009-GstPhotography-Added-operation-mode-to-photography-A.patch
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File 0009-GstPhotography-Added-operation-mode-to-photography-A.patch of Package gst-plugins-bad-free
From c2c1e203b81701594c84da4424bf385de7627a56 Mon Sep 17 00:00:00 2001 From: Lauri Lehtinen <ext-lauri.1.lehtinen@nokia.com> Date: Fri, 5 Mar 2010 10:21:10 +0200 Subject: [PATCH 09/23] GstPhotography: Added operation mode to photography API --- gst-libs/gst/interfaces/photography.c | 56 +++++++++++++++++++++++++++++++++ gst-libs/gst/interfaces/photography.h | 17 +++++++++- 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/interfaces/photography.c b/gst-libs/gst/interfaces/photography.c index 878b185..d8a9b50 100644 --- a/gst-libs/gst/interfaces/photography.c +++ b/gst-libs/gst/interfaces/photography.c @@ -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) diff --git a/gst-libs/gst/interfaces/photography.h b/gst-libs/gst/interfaces/photography.h index 4852ea3..82a9843 100644 --- a/gst-libs/gst/interfaces/photography.h +++ b/gst-libs/gst/interfaces/photography.h @@ -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__ */ -- 1.7.10.4