diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2008-01-31 17:18:46 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2008-01-31 17:18:46 +0000 |
commit | 930e3e5c4a8b2304ed3799424a52570dc24fc662 (patch) | |
tree | ca678801496071d9453d6a5c64171349ccd7a7cc /gst-libs | |
parent | b3595da577db884a554bdd372d4d45866987d19c (diff) | |
download | gst-plugins-bad-930e3e5c4a8b2304ed3799424a52570dc24fc662.tar.gz gst-plugins-bad-930e3e5c4a8b2304ed3799424a52570dc24fc662.tar.bz2 gst-plugins-bad-930e3e5c4a8b2304ed3799424a52570dc24fc662.zip |
gst-libs/gst/app/gstappsink.c: Really clean up the queue instead of just unreffing all buffers in it.
Original commit message from CVS:
* gst-libs/gst/app/gstappsink.c: (gst_app_sink_dispose):
Really clean up the queue instead of just unreffing all buffers
in it.
* gst-libs/gst/app/gstappsrc.c: (gst_app_src_base_init),
(gst_app_src_class_init), (gst_app_src_init),
(gst_app_src_dispose), (gst_app_src_finalize):
Fix dispose/finalize.
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/app/gstappsink.c | 6 | ||||
-rw-r--r-- | gst-libs/gst/app/gstappsrc.c | 44 |
2 files changed, 28 insertions, 22 deletions
diff --git a/gst-libs/gst/app/gstappsink.c b/gst-libs/gst/app/gstappsink.c index 579a7afd..d727efcf 100644 --- a/gst-libs/gst/app/gstappsink.c +++ b/gst-libs/gst/app/gstappsink.c @@ -232,6 +232,7 @@ static void gst_app_sink_dispose (GObject * obj) { GstAppSink *appsink = GST_APP_SINK (obj); + GstBuffer *buffer; if (appsink->caps) { gst_caps_unref (appsink->caps); @@ -241,7 +242,10 @@ gst_app_sink_dispose (GObject * obj) gst_buffer_unref (appsink->preroll); appsink->preroll = NULL; } - g_queue_foreach (appsink->queue, (GFunc) gst_mini_object_unref, NULL); + g_mutex_lock (appsink->mutex); + while ((buffer = g_queue_pop_head (appsink->queue))) + gst_buffer_unref (buffer); + g_mutex_unlock (appsink->mutex); G_OBJECT_CLASS (parent_class)->dispose (obj); } diff --git a/gst-libs/gst/app/gstappsrc.c b/gst-libs/gst/app/gstappsrc.c index 65e4c8c8..a3e52af4 100644 --- a/gst-libs/gst/app/gstappsrc.c +++ b/gst-libs/gst/app/gstappsrc.c @@ -48,11 +48,14 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); +static void gst_app_src_dispose (GObject * object); +static void gst_app_src_finalize (GObject * object); + static void gst_app_src_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_app_src_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static void gst_app_src_dispose (GObject * object); + static GstFlowReturn gst_app_src_create (GstPushSrc * psrc, GstBuffer ** buf); static gboolean gst_app_src_start (GstBaseSrc * psrc); static gboolean gst_app_src_stop (GstBaseSrc * psrc); @@ -65,15 +68,12 @@ gst_app_src_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - //GObjectClass *gobject_class = G_OBJECT_CLASS (g_class); - GST_DEBUG_CATEGORY_INIT (app_src_debug, "appsrc", 0, "appsrc element"); gst_element_class_set_details (element_class, &app_src_details); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&gst_app_src_template)); - } static void @@ -83,9 +83,11 @@ gst_app_src_class_init (GstAppSrcClass * klass) GstPushSrcClass *pushsrc_class = (GstPushSrcClass *) klass; GstBaseSrcClass *basesrc_class = (GstBaseSrcClass *) klass; + gobject_class->dispose = gst_app_src_dispose; + gobject_class->finalize = gst_app_src_finalize; + gobject_class->set_property = gst_app_src_set_property; gobject_class->get_property = gst_app_src_get_property; - gobject_class->dispose = gst_app_src_dispose; pushsrc_class->create = gst_app_src_create; basesrc_class->start = gst_app_src_start; @@ -94,6 +96,14 @@ gst_app_src_class_init (GstAppSrcClass * klass) } static void +gst_app_src_init (GstAppSrc * appsrc, GstAppSrcClass * klass) +{ + appsrc->mutex = g_mutex_new (); + appsrc->cond = g_cond_new (); + appsrc->queue = g_queue_new (); +} + +static void gst_app_src_dispose (GObject * obj) { GstAppSrc *appsrc = GST_APP_SRC (obj); @@ -102,28 +112,20 @@ gst_app_src_dispose (GObject * obj) gst_caps_unref (appsrc->caps); appsrc->caps = NULL; } - if (appsrc->mutex) { - g_mutex_free (appsrc->mutex); - appsrc->mutex = NULL; - } - if (appsrc->cond) { - g_cond_free (appsrc->cond); - appsrc->cond = NULL; - } - if (appsrc->queue) { - g_queue_free (appsrc->queue); - appsrc->queue = NULL; - } G_OBJECT_CLASS (parent_class)->dispose (obj); } static void -gst_app_src_init (GstAppSrc * appsrc, GstAppSrcClass * klass) +gst_app_src_finalize (GObject * obj) { - appsrc->mutex = g_mutex_new (); - appsrc->cond = g_cond_new (); - appsrc->queue = g_queue_new (); + GstAppSrc *appsrc = GST_APP_SRC (obj); + + g_mutex_free (appsrc->mutex); + g_cond_free (appsrc->cond); + g_queue_free (appsrc->queue); + + G_OBJECT_CLASS (parent_class)->finalize (obj); } static void |