[aravis] buffer: add a user data accessor
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis] buffer: add a user data accessor
- Date: Sun, 7 Sep 2014 15:02:28 +0000 (UTC)
commit 08dc2b45501867ed9d7d500676553bcddecc3810
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Sun Sep 7 16:59:53 2014 +0200
buffer: add a user data accessor
docs/reference/aravis/aravis-sections.txt | 1 +
src/arvbuffer.c | 19 +++++++++++++++++++
src/arvbuffer.h | 2 ++
tests/buffer.c | 6 ++++++
4 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/aravis/aravis-sections.txt b/docs/reference/aravis/aravis-sections.txt
index 3ceb3f3..d1711d8 100644
--- a/docs/reference/aravis/aravis-sections.txt
+++ b/docs/reference/aravis/aravis-sections.txt
@@ -85,6 +85,7 @@ ArvPixelFormat
arv_buffer_new
arv_buffer_new_full
arv_buffer_new_allocate
+arv_buffer_get_user_data
arv_buffer_get_data
arv_buffer_get_chunk_data
arv_buffer_get_image_height
diff --git a/src/arvbuffer.c b/src/arvbuffer.c
index 1b81d02..994aee9 100644
--- a/src/arvbuffer.c
+++ b/src/arvbuffer.c
@@ -217,6 +217,25 @@ arv_buffer_get_chunk_data (ArvBuffer *buffer, guint64 chunk_id, size_t *size)
}
/**
+ * arv_buffer_get_user_data:
+ * @buffer: a #ArvBuffer
+ *
+ * Gets a pointer to user data set by arv_buffer_new_full.
+ *
+ * Returns: user data, or NULL if not set.
+ *
+ * Since: 0.4.0
+ */
+
+const void *
+arv_buffer_get_user_data (ArvBuffer *buffer)
+{
+ g_return_val_if_fail (ARV_IS_BUFFER (buffer), NULL);
+
+ return buffer->priv->user_data;
+}
+
+/**
* arv_buffer_get_status:
* @buffer: a #ArvBuffer
*
diff --git a/src/arvbuffer.h b/src/arvbuffer.h
index 6129d96..d023540 100644
--- a/src/arvbuffer.h
+++ b/src/arvbuffer.h
@@ -110,6 +110,8 @@ ArvBuffer * arv_buffer_new_full (size_t size, void
*preallocated,
ArvBufferStatus arv_buffer_get_status (ArvBuffer *buffer);
+const void * arv_buffer_get_user_data (ArvBuffer *buffer);
+
ArvBufferPayloadType arv_buffer_get_payload_type (ArvBuffer *buffer);
guint64 arv_buffer_get_timestamp (ArvBuffer *buffer);
const void * arv_buffer_get_data (ArvBuffer *buffer, size_t *size);
diff --git a/tests/buffer.c b/tests/buffer.c
index 2dc6705..4388499 100644
--- a/tests/buffer.c
+++ b/tests/buffer.c
@@ -17,7 +17,9 @@ simple_buffer_test (void)
g_assert (data != NULL);
g_assert (size == 1024);
+ g_assert (arv_buffer_get_payload_type (buffer) == ARV_BUFFER_PAYLOAD_TYPE_UNKNOWN);
g_assert (arv_buffer_get_status (buffer) == ARV_BUFFER_STATUS_CLEARED);
+ g_assert (arv_buffer_get_user_data (buffer) == NULL);
g_object_unref (buffer);
}
@@ -33,7 +35,9 @@ preallocated_buffer_test (void)
g_assert (arv_buffer_get_data (buffer, NULL) == data);
+ g_assert (arv_buffer_get_payload_type (buffer) == ARV_BUFFER_PAYLOAD_TYPE_UNKNOWN);
g_assert (arv_buffer_get_status (buffer) == ARV_BUFFER_STATUS_CLEARED);
+ g_assert (arv_buffer_get_user_data (buffer) == NULL);
g_object_unref (buffer);
}
@@ -61,7 +65,9 @@ full_buffer_test (void)
g_assert (data != NULL);
g_assert (size == 1024);
+ g_assert (arv_buffer_get_payload_type (buffer) == ARV_BUFFER_PAYLOAD_TYPE_UNKNOWN);
g_assert (arv_buffer_get_status (buffer) == ARV_BUFFER_STATUS_CLEARED);
+ g_assert (arv_buffer_get_user_data (buffer) == &value);
g_object_unref (buffer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]