From 4c9d07cf22ba7375ad363dbe4d08e9554114bd56 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Thu, 19 May 2005 19:41:12 +0000 Subject: [PATCH] gst/gstminiobject.*: Add GValue set/get functions. Original commit message from CVS: * gst/gstminiobject.c: (gst_value_set_mini_object), (gst_value_take_mini_object), (gst_value_get_mini_object): * gst/gstminiobject.h: Add GValue set/get functions. --- ChangeLog | 6 ++++++ gst/gstminiobject.c | 29 +++++++++++++++++++++++++++++ gst/gstminiobject.h | 7 +++++++ 3 files changed, 42 insertions(+) diff --git a/ChangeLog b/ChangeLog index befe3cf8ad..b451477af1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-05-19 David Schleef + + * gst/gstminiobject.c: (gst_value_set_mini_object), + (gst_value_take_mini_object), (gst_value_get_mini_object): + * gst/gstminiobject.h: Add GValue set/get functions. + 2005-05-19 Wim Taymans * gst/gstbuffer.c: (gst_buffer_init), (gst_subbuffer_get_type), diff --git a/gst/gstminiobject.c b/gst/gstminiobject.c index 23cf591fb9..4dd8b2535f 100644 --- a/gst/gstminiobject.c +++ b/gst/gstminiobject.c @@ -270,6 +270,35 @@ gst_value_mini_object_lcopy (const GValue * value, guint n_collect_values, return NULL; } +void +gst_value_set_mini_object (GValue * value, GstMiniObject * mini_object) +{ + g_return_if_fail (GST_VALUE_HOLDS_MINI_OBJECT (value)); + g_return_if_fail (mini_object == NULL || GST_IS_MINI_OBJECT (mini_object)); + + gst_mini_object_replace ((GstMiniObject **) & value->data[0].v_pointer, + mini_object); +} + +void +gst_value_take_mini_object (GValue * value, GstMiniObject * mini_object) +{ + g_return_if_fail (GST_VALUE_HOLDS_MINI_OBJECT (value)); + g_return_if_fail (mini_object == NULL || GST_IS_MINI_OBJECT (mini_object)); + + gst_mini_object_replace ((GstMiniObject **) & value->data[0].v_pointer, + mini_object); + gst_mini_object_unref (mini_object); +} + +GstMiniObject * +gst_value_get_mini_object (const GValue * value) +{ + g_return_val_if_fail (GST_VALUE_HOLDS_MINI_OBJECT (value), NULL); + + return value->data[0].v_pointer; +} + /* param spec */ static GType gst_param_spec_mini_object_get_type (void); diff --git a/gst/gstminiobject.h b/gst/gstminiobject.h index c055c402fe..27766b0c25 100644 --- a/gst/gstminiobject.h +++ b/gst/gstminiobject.h @@ -46,6 +46,8 @@ typedef void (*GstMiniObjectFinalizeFunction) (GstMiniObject *); #define GST_MINI_OBJECT_FLAG_SET(obj,flag) (GST_MINI_OBJECT_FLAGS (obj) |= (flag)) #define GST_MINI_OBJECT_FLAG_UNSET(obj,flag) (GST_MINI_OBJECT_FLAGS (obj) &= ~(flag)) +#define GST_VALUE_HOLDS_MINI_OBJECT(value) (G_VALUE_HOLDS(value, GST_TYPE_MINI_OBJECT)) + typedef enum { GST_MINI_OBJECT_FLAG_READONLY = (1<<0), @@ -86,6 +88,11 @@ void gst_mini_object_replace (GstMiniObject **olddata, GstMiniObject *newdata); GParamSpec * gst_param_spec_mini_object (const char *name, const char *nick, const char *blurb, GType object_type, GParamFlags flags); +void gst_value_set_mini_object (GValue *value, GstMiniObject *mini_object); +void gst_value_take_mini_object (GValue *value, GstMiniObject *mini_object); +GstMiniObject * gst_value_get_mini_object (const GValue *value); + + G_END_DECLS #endif