photography: add functions to set/get all settings with one call

This commit is contained in:
Lasse Laukkanen 2009-04-20 17:05:49 +03:00 committed by Stefan Kost
parent 53e6e4b0d5
commit 9dc5c1ffb2
2 changed files with 61 additions and 0 deletions

View file

@ -90,6 +90,8 @@ gst_photography_iface_init (GstPhotographyInterface * iface)
iface->get_capabilities = NULL;
iface->prepare_for_capture = NULL;
iface->set_autofocus = NULL;
iface->set_config = NULL;
iface->get_config = NULL;
}
#define GST_PHOTOGRAPHY_FUNC_TEMPLATE(function_name, param_type) \
@ -369,3 +371,53 @@ gst_photography_set_autofocus (GstPhotography * photo, gboolean on)
iface->set_autofocus (photo, on);
}
}
/**
* gst_photography_set_config:
* @photo: #GstPhotography interface of a #GstElement
* @config: #GstPhotoSettings containg the configuration
*
* Set all configuration settings at once.
*
* Returns: TRUE if configuration was set successfully, otherwise FALSE.
*/
gboolean
gst_photography_set_config (GstPhotography * photo, GstPhotoSettings *config)
{
GstPhotographyInterface *iface;
gboolean ret = FALSE;
g_return_val_if_fail (photo != NULL, FALSE);
iface = GST_PHOTOGRAPHY_GET_IFACE (photo);
if (iface->set_config) {
ret = iface->set_config (photo, config);
}
return ret;
}
/**
* gst_photography_get_config:
* @photo: #GstPhotography interface of a #GstElement
* @config: #GstPhotoSettings containg the configuration
*
* Get all configuration settings at once.
*
* Returns: TRUE if configuration was got successfully, otherwise FALSE.
*/
gboolean
gst_photography_get_config (GstPhotography * photo, GstPhotoSettings * config)
{
GstPhotographyInterface *iface;
gboolean ret = FALSE;
g_return_val_if_fail (photo != NULL, FALSE);
iface = GST_PHOTOGRAPHY_GET_IFACE (photo);
if (iface->get_config) {
ret = iface->get_config (photo, config);
}
return ret;
}

View file

@ -181,6 +181,8 @@ typedef void (*GstPhotoCapturePrepared) (gpointer data,
* @get_capabilities: vmethod to get supported capabilities of the interface
* @prepare_for_capture: vmethod to tell the element to prepare for capturing
* @set_autofocus: vmethod to set autofocus on/off
* @set_config: vmethod to set all configuration parameters at once
* @get_config: vmethod to get all configuration parameters at once
*
* #GstPhotographyInterface interface.
*/
@ -221,6 +223,8 @@ typedef struct _GstPhotographyInterface
gboolean (*prepare_for_capture) (GstPhotography * photo,
GstPhotoCapturePrepared func, GstCaps *capture_caps, gpointer user_data);
void (*set_autofocus) (GstPhotography * photo, gboolean on);
gboolean (*set_config) (GstPhotography * photo, GstPhotoSettings * config);
gboolean (*get_config) (GstPhotography * photo, GstPhotoSettings * config);
/*< private > */
gpointer _gst_reserved[GST_PADDING];
@ -270,6 +274,11 @@ gboolean gst_photography_prepare_for_capture (GstPhotography * photo,
void gst_photography_set_autofocus (GstPhotography * photo, gboolean on);
gboolean gst_photography_set_config (GstPhotography * photo,
GstPhotoSettings * config);
gboolean gst_photography_get_config (GstPhotography * photo,
GstPhotoSettings * config);
G_END_DECLS
#endif /* __GST_PHOTOGRAPHY_H__ */