From 62c7339847e4bb7ea31a6c960322c42b7eaf67a9 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Sat, 8 Jan 2011 12:27:55 -0200 Subject: [PATCH] iterator: register as a boxed type https://bugzilla.gnome.org/show_bug.cgi?id=638987 --- gst/gstiterator.c | 17 +++++++++++++++++ gst/gstiterator.h | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/gst/gstiterator.c b/gst/gstiterator.c index bff8e2e4ba..7e13414499 100644 --- a/gst/gstiterator.c +++ b/gst/gstiterator.c @@ -71,6 +71,23 @@ #include "gst_private.h" #include +static GstIterator * +gst_iterator_copy (GstIterator * it) +{ + return g_slice_copy (it->size, it); +} + +GType +gst_iterator_get_type (void) +{ + static GType type = 0; + + if (G_UNLIKELY (type == 0)) + type = g_boxed_type_register_static ("GstIterator", + (GBoxedCopyFunc) gst_iterator_copy, (GBoxedFreeFunc) gst_iterator_free); + return type; +} + static void gst_iterator_init (GstIterator * it, guint size, diff --git a/gst/gstiterator.h b/gst/gstiterator.h index 874ae41d12..701c267be9 100644 --- a/gst/gstiterator.h +++ b/gst/gstiterator.h @@ -27,6 +27,8 @@ G_BEGIN_DECLS +#define GST_TYPE_ITERATOR (gst_iterator_get_type ()) + /** * GstIteratorResult: * @GST_ITERATOR_DONE: No more items in the iterator @@ -222,6 +224,8 @@ struct _GstIterator { gpointer _gst_reserved[GST_PADDING-1]; }; +GType gst_iterator_get_type (void); + /* creating iterators */ GstIterator* gst_iterator_new (guint size, GType type,