[aravis] Add arv_camera_get_available_pixel_formats_as_display_names.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis] Add arv_camera_get_available_pixel_formats_as_display_names.
- Date: Tue, 10 Jul 2012 16:17:15 +0000 (UTC)
commit f606d1cdaba24688f2239e7406a7300b5607f696
Author: Jure Varlec <jure varlec ad-vega si>
Date: Tue Jul 10 18:02:57 2012 +0200
Add arv_camera_get_available_pixel_formats_as_display_names.
Signed-off-by: Emmanuel Pacaud <emmanuel gnome org>
src/arvcamera.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
src/arvcamera.h | 1 +
2 files changed, 54 insertions(+), 0 deletions(-)
---
diff --git a/src/arvcamera.c b/src/arvcamera.c
index ec50b97..c3fa165 100644
--- a/src/arvcamera.c
+++ b/src/arvcamera.c
@@ -409,6 +409,59 @@ arv_camera_get_available_pixel_formats_as_strings (ArvCamera *camera, guint *n_p
return arv_device_get_available_enumeration_feature_values_as_strings (camera->priv->device, "PixelFormat", n_pixel_formats);
}
+/**
+ * arv_camera_get_available_pixel_formats_as_display_names:
+ * @camera: a #ArvCamera
+ * @n_pixel_formats: (out): number of different pixel formats
+ *
+ * Retrieves the list of all available pixel formats as display names.
+ * In general, these human-readable strings cannot be used as settings.
+ *
+ * Returns: (array length=n_pixel_formats) (transfer container): a newly allocated array of string constants.
+ */
+
+const char **
+arv_camera_get_available_pixel_formats_as_display_names (ArvCamera *camera, guint *n_pixel_formats)
+{
+ ArvGcNode *node;
+ const GSList *entries, *iter;
+ const char **strings;
+ const char *string = NULL;
+ gboolean is_available, is_implemented;
+ int i;
+
+ g_return_val_if_fail (n_pixel_formats != NULL, NULL);
+ *n_pixel_formats = 0;
+
+ g_return_val_if_fail (ARV_IS_CAMERA (camera), NULL);
+ node = arv_device_get_feature (camera->priv->device, "PixelFormat");
+
+ if (ARV_IS_GC_ENUMERATION (node))
+ entries = arv_gc_enumeration_get_entries (ARV_GC_ENUMERATION (node));
+ else
+ return NULL;
+
+ strings = g_new (const char *, g_slist_length ((GSList*)entries));
+ i = 0;
+ for (iter = entries; iter != NULL; iter = iter->next) {
+ is_available = arv_gc_feature_node_is_available (iter->data, NULL);
+ is_implemented = arv_gc_feature_node_is_implemented (iter->data, NULL);
+ if (is_available && is_implemented) {
+ string = arv_gc_feature_node_get_display_name (iter->data, NULL);
+ if (string == NULL)
+ string = arv_gc_feature_node_get_name (iter->data);
+ if (string == NULL) {
+ g_free (strings);
+ return NULL;
+ }
+ strings[i++] = string;
+ }
+ }
+
+ *n_pixel_formats = i;
+ return strings;
+}
+
/* Acquisition control */
/**
diff --git a/src/arvcamera.h b/src/arvcamera.h
index 20afebb..9cf0d76 100644
--- a/src/arvcamera.h
+++ b/src/arvcamera.h
@@ -77,6 +77,7 @@ ArvPixelFormat arv_camera_get_pixel_format (ArvCamera *camera);
const char * arv_camera_get_pixel_format_as_string (ArvCamera *camera);
gint64 * arv_camera_get_available_pixel_formats (ArvCamera *camera, guint *n_pixel_formats);
const char ** arv_camera_get_available_pixel_formats_as_strings (ArvCamera *camera, guint *n_pixel_formats);
+const char ** arv_camera_get_available_pixel_formats_as_display_names (ArvCamera *camera, guint *n_pixel_formats);
/* Acquisition control */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]