From 4031c2f252b2416273e31acc2998bb950ea19ccf Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 13 Jan 2002 12:59:23 +0000 Subject: [PATCH] Added EOS to the cache. Original commit message from CVS: Added EOS to the cache. --- gst/autoplug/gstautoplugcache.c | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/gst/autoplug/gstautoplugcache.c b/gst/autoplug/gstautoplugcache.c index 326310caad..e3d182206f 100644 --- a/gst/autoplug/gstautoplugcache.c +++ b/gst/autoplug/gstautoplugcache.c @@ -92,8 +92,6 @@ static void gst_autoplugcache_get_property (GObject *object, guint prop_id, static void gst_autoplugcache_loop (GstElement *element); -static GstPadNegotiateReturn gst_autoplugcache_nego_src (GstPad *pad, GstCaps **caps, gpointer *data); -static GstPadNegotiateReturn gst_autoplugcache_nego_sink (GstPad *pad, GstCaps **caps, gpointer *data); static GstElementStateReturn gst_autoplugcache_change_state (GstElement *element); @@ -207,6 +205,10 @@ gst_autoplugcache_loop (GstElement *element) if (cache->current_playout == NULL) { /* get a buffer */ buf = gst_pad_pull (cache->sinkpad); + if (GST_IS_EVENT (buf)) { + gst_pad_event_default (cache->sinkpad, GST_EVENT (buf)); + return; + } /* add it to the cache, though cache == NULL */ gst_buffer_ref (buf); @@ -240,6 +242,10 @@ gst_autoplugcache_loop (GstElement *element) /* get a buffer */ buf = gst_pad_pull (cache->sinkpad); + if (GST_IS_EVENT (buf)) { + gst_pad_event_default (cache->sinkpad, GST_EVENT (buf)); + return; + } /* add it to the front of the cache */ gst_buffer_ref (buf); @@ -268,23 +274,6 @@ gst_autoplugcache_loop (GstElement *element) } } -static GstPadNegotiateReturn -gst_autoplugcache_nego_src (GstPad *pad, GstCaps **caps, gpointer *data) -{ - GstAutoplugCache *cache = GST_AUTOPLUGCACHE (GST_PAD_PARENT (pad)); - - return gst_pad_negotiate_proxy (pad, cache->sinkpad, caps); -} - -static GstPadNegotiateReturn -gst_autoplugcache_nego_sink (GstPad *pad, GstCaps **caps, gpointer *data) -{ - GstAutoplugCache *cache = GST_AUTOPLUGCACHE (GST_PAD_PARENT (pad)); - - return gst_pad_negotiate_proxy (pad, cache->srcpad, caps); -} - - static GstElementStateReturn gst_autoplugcache_change_state (GstElement *element) { @@ -307,11 +296,7 @@ gst_autoplugcache_set_property (GObject *object, guint prop_id, const GValue *va cache->caps_proxy = g_value_get_boolean (value); GST_DEBUG(0,"caps_proxy is %d\n",cache->caps_proxy); if (cache->caps_proxy) { - gst_pad_set_negotiate_function (cache->sinkpad, GST_DEBUG_FUNCPTR(gst_autoplugcache_nego_sink)); - gst_pad_set_negotiate_function (cache->srcpad, GST_DEBUG_FUNCPTR(gst_autoplugcache_nego_src)); } else { - gst_pad_set_negotiate_function (cache->sinkpad, NULL); - gst_pad_set_negotiate_function (cache->srcpad, NULL); } break; case ARG_RESET: