From 0d9a29465920184a2f1ae1d21be9d8598dd33b93 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sun, 21 Dec 2003 22:11:46 +0000 Subject: Remove bufferpools (but keep implementations) Original commit message from CVS: Remove bufferpools (but keep implementations) --- gst/chart/gstchart.c | 2 -- gst/passthrough/gstpassthrough.c | 16 ---------------- gst/passthrough/gstpassthrough.h | 1 - gst/playondemand/Makefile.am | 2 +- gst/playondemand/filter.func | 2 +- gst/playondemand/gstplayondemand.c | 16 ---------------- gst/playondemand/gstplayondemand.h | 1 - gst/speed/filter.func | 13 ++++--------- gst/speed/gstspeed.c | 15 --------------- gst/speed/gstspeed.h | 1 - sys/glsink/gstglsink.c | 27 ++------------------------- sys/v4l2/gstv4l2src.c | 31 +++++++------------------------ sys/v4l2/gstv4l2src.h | 3 --- 13 files changed, 15 insertions(+), 115 deletions(-) diff --git a/gst/chart/gstchart.c b/gst/chart/gstchart.c index c3c672288..8bdb8d2a8 100644 --- a/gst/chart/gstchart.c +++ b/gst/chart/gstchart.c @@ -38,7 +38,6 @@ struct _GstChart { /* pads */ GstPad *sinkpad,*srcpad; - GstBufferPool *peerpool; /* the timestamp of the next frame */ guint64 next_time; @@ -184,7 +183,6 @@ gst_chart_init (GstChart *chart) gst_pad_set_link_function (chart->sinkpad, gst_chart_srcconnect); chart->next_time = 0; - chart->peerpool = NULL; /* reset the initial video state */ chart->bpp = 16; diff --git a/gst/passthrough/gstpassthrough.c b/gst/passthrough/gstpassthrough.c index 9e1e6fa5b..2bcb5d0ec 100644 --- a/gst/passthrough/gstpassthrough.c +++ b/gst/passthrough/gstpassthrough.c @@ -88,16 +88,6 @@ static void inline passthrough_fast_8bit_chain (gint8* data, guint numsamples); static GstElementClass *parent_class = NULL; -static GstBufferPool* -passthrough_get_bufferpool (GstPad *pad) -{ - GstPassthrough *filter; - - filter = GST_PASSTHROUGH (gst_pad_get_parent (pad)); - - return gst_pad_get_bufferpool (filter->srcpad); -} - static GstPadLinkReturn passthrough_connect_sink (GstPad *pad, const GstCaps2 *caps) { @@ -207,7 +197,6 @@ passthrough_init (GstPassthrough *filter) gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad); gst_pad_set_link_function (filter->sinkpad, passthrough_connect_sink); - gst_pad_set_bufferpool_function (filter->sinkpad, passthrough_get_bufferpool); gst_pad_set_chain_function (filter->sinkpad, passthrough_chain); filter->silent = FALSE; @@ -229,11 +218,6 @@ passthrough_chain (GstPad *pad, GstData *_data) g_return_if_fail (filter != NULL); g_return_if_fail (GST_IS_PASSTHROUGH (filter)); - filter->bufpool = gst_pad_get_bufferpool (filter->srcpad); - if (filter->bufpool == NULL) { - filter->bufpool = gst_buffer_pool_get_default (PASSTHRU_BUF_SIZE, PASSTHRU_NUM_BUFS); - } - switch (filter->format) { case GST_PASSTHROUGH_FORMAT_INT: int_data = (gint16 *) GST_BUFFER_DATA (buf); diff --git a/gst/passthrough/gstpassthrough.h b/gst/passthrough/gstpassthrough.h index 7d0119b24..0b6f9d589 100644 --- a/gst/passthrough/gstpassthrough.h +++ b/gst/passthrough/gstpassthrough.h @@ -50,7 +50,6 @@ struct _GstPassthrough { GstElement element; GstPad *sinkpad, *srcpad; - GstBufferPool *bufpool; gboolean silent; diff --git a/gst/playondemand/Makefile.am b/gst/playondemand/Makefile.am index a9894c4b3..1cfbe7666 100644 --- a/gst/playondemand/Makefile.am +++ b/gst/playondemand/Makefile.am @@ -15,5 +15,5 @@ endif demo_mp3_SOURCES = demo-mp3.c gstplayondemand.h ## putting GTK_CFLAGS first fixes a weird compilation error with GTK and XML demo_mp3_CFLAGS = $(GTK_CFLAGS) $(GST_CFLAGS) -demo_mp3_LDFLAGS = $(GST_LIBS) $(GTK_LIBS) libgstplayondemand.la +demo_mp3_LDFLAGS = $(GST_LIBS) $(GTK_LIBS) demo_mp3_DEPENDENCIES = libgstplayondemand.la diff --git a/gst/playondemand/filter.func b/gst/playondemand/filter.func index 3f2755a0b..cded073e0 100644 --- a/gst/playondemand/filter.func +++ b/gst/playondemand/filter.func @@ -46,7 +46,7 @@ do { out = GST_BUFFER (in); } else { - out = gst_buffer_new_from_pool(filter->bufpool, 0, 0); + out = gst_buffer_new_and_alloc (GST_POD_BUFPOOL_SIZE); } in = NULL; diff --git a/gst/playondemand/gstplayondemand.c b/gst/playondemand/gstplayondemand.c index 3f01165a9..0dec38355 100644 --- a/gst/playondemand/gstplayondemand.c +++ b/gst/playondemand/gstplayondemand.c @@ -81,7 +81,6 @@ static void play_on_demand_get_property (GObject *object, guint prop_id, GValue static void play_on_demand_dispose (GObject *object); /* GStreamer functionality */ -static GstBufferPool* play_on_demand_get_bufferpool (GstPad *pad); static GstPadLinkReturn play_on_demand_pad_link (GstPad *pad, const GstCaps2 *caps); static void play_on_demand_loop (GstElement *elem); static void play_on_demand_set_clock (GstElement *elem, GstClock *clock); @@ -236,7 +235,6 @@ play_on_demand_init (GstPlayOnDemand *filter) filter->sinkpad = gst_pad_new_from_template( gst_static_pad_template_get(&play_on_demand_sink_template), "sink"); - gst_pad_set_bufferpool_function(filter->sinkpad, play_on_demand_get_bufferpool); gst_pad_set_link_function(filter->sinkpad, play_on_demand_pad_link); gst_element_add_pad(GST_ELEMENT(filter), filter->sinkpad); @@ -366,14 +364,6 @@ play_on_demand_dispose (GObject *object) g_free (filter->buffer); } -static GstBufferPool* -play_on_demand_get_bufferpool (GstPad *pad) -{ - GstPlayOnDemand *filter; - filter = GST_PLAYONDEMAND(gst_pad_get_parent(pad)); - return gst_pad_get_bufferpool(filter->srcpad); -} - static GstPadLinkReturn play_on_demand_pad_link (GstPad *pad, const GstCaps2 *caps) { @@ -433,12 +423,6 @@ play_on_demand_loop (GstElement *elem) g_return_if_fail(filter != NULL); g_return_if_fail(GST_IS_PLAYONDEMAND(filter)); - filter->bufpool = gst_pad_get_bufferpool(filter->srcpad); - - if (filter->bufpool == NULL) - filter->bufpool = gst_buffer_pool_get_default(GST_POD_BUFPOOL_SIZE, - GST_POD_BUFPOOL_NUM); - in = (in == NULL && ! filter->eos) ? gst_pad_pull(filter->sinkpad) : NULL; if (filter->format == GST_PLAYONDEMAND_FORMAT_INT) { diff --git a/gst/playondemand/gstplayondemand.h b/gst/playondemand/gstplayondemand.h index 8c7fa2123..c99c81650 100644 --- a/gst/playondemand/gstplayondemand.h +++ b/gst/playondemand/gstplayondemand.h @@ -53,7 +53,6 @@ enum _GstPlayOnDemandFormat { struct _GstPlayOnDemand { GstElement element; - GstBufferPool *bufpool; GstPad *sinkpad, *srcpad; GstClock *clock; diff --git a/gst/speed/filter.func b/gst/speed/filter.func index 7bd5227c9..6802b20c5 100644 --- a/gst/speed/filter.func +++ b/gst/speed/filter.func @@ -13,15 +13,10 @@ do { speed = filter->speed; /* update this, it might have changed */ - if (filter->srcpool) { - out = gst_buffer_new_from_pool(filter->srcpool, 0, 0); - out_data = (_FORMAT*) GST_BUFFER_DATA(out); - } else { - out = gst_buffer_new(); - GST_BUFFER_DATA(out) = (gchar*) g_new(_FORMAT,SPEED_BUFSIZE/sizeof(_FORMAT)); - GST_BUFFER_SIZE(out) = SPEED_BUFSIZE; - out_data = (_FORMAT*) GST_BUFFER_DATA(out); - } + out = gst_buffer_new(); + GST_BUFFER_DATA(out) = (gchar*) g_new(_FORMAT,SPEED_BUFSIZE/sizeof(_FORMAT)); + GST_BUFFER_SIZE(out) = SPEED_BUFSIZE; + out_data = (_FORMAT*) GST_BUFFER_DATA(out); nout = GST_BUFFER_SIZE(out) / sizeof(_FORMAT); GST_BUFFER_TIMESTAMP (out) = timestamp; offset += nout; diff --git a/gst/speed/gstspeed.c b/gst/speed/gstspeed.c index 1b7bcf690..c3d4d7b71 100644 --- a/gst/speed/gstspeed.c +++ b/gst/speed/gstspeed.c @@ -77,16 +77,6 @@ GST_STATIC_PAD_TEMPLATE ( ) ); -static GstBufferPool* -speed_sink_get_bufferpool (GstPad *pad) -{ - GstSpeed *filter; - - filter = GST_SPEED (gst_pad_get_parent(pad)); - - return filter->sinkpool; -} - static void speed_base_init (gpointer g_class); static void speed_class_init (GstSpeedClass *klass); static void speed_init (GstSpeed *filter); @@ -205,7 +195,6 @@ speed_init (GstSpeed *filter) gst_static_pad_template_get (&gst_speed_sink_template), "sink"); gst_pad_set_link_function(filter->sinkpad, speed_link); gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad); - gst_pad_set_bufferpool_function (filter->sinkpad, speed_sink_get_bufferpool); filter->srcpad = gst_pad_new_from_template( gst_static_pad_template_get (&gst_speed_src_template), "src"); @@ -213,8 +202,6 @@ speed_init (GstSpeed *filter) gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad); gst_element_set_loop_function(GST_ELEMENT(filter),speed_loop); - - filter->sinkpool = gst_buffer_pool_get_default(SPEED_BUFSIZE, SPEED_NUMBUF); } static void @@ -228,8 +215,6 @@ speed_loop (GstElement *element) g_return_if_fail(filter != NULL); g_return_if_fail(GST_IS_SPEED(filter)); - filter->srcpool = gst_pad_get_bufferpool(filter->srcpad); - i = j = 0; speed = filter->speed; diff --git a/gst/speed/gstspeed.h b/gst/speed/gstspeed.h index 103ecdb8c..2bbb0e6c7 100644 --- a/gst/speed/gstspeed.h +++ b/gst/speed/gstspeed.h @@ -50,7 +50,6 @@ struct _GstSpeed { GstElement element; GstPad *sinkpad, *srcpad; - GstBufferPool *sinkpool, *srcpool; gfloat speed; diff --git a/sys/glsink/gstglsink.c b/sys/glsink/gstglsink.c index 15e8926e5..3e1e56cee 100644 --- a/sys/glsink/gstglsink.c +++ b/sys/glsink/gstglsink.c @@ -107,8 +107,6 @@ struct _GstGLSink { GstClock *clock; - /* bufferpool stuff */ - GstBufferPool *bufferpool; GMutex *cache_lock; GList *cache; @@ -139,7 +137,6 @@ static void gst_glsink_set_clock (GstElement *element, GstClock *clock); static GstElementStateReturn gst_glsink_change_state (GstElement *element); static GstPadLinkReturn gst_glsink_sinkconnect (GstPad *pad, GstCaps *caps); static GstCaps * gst_glsink_getcaps (GstPad *pad, GstCaps *caps); -static GstBufferPool* gst_glsink_get_bufferpool (GstPad *pad); static void gst_glsink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); @@ -149,13 +146,6 @@ static void gst_glsink_get_property (GObject *object, guint prop_id, static void gst_glsink_release_conn (GstGLSink *sink); static void gst_glsink_append_cache (GstGLSink *sink, GstImageData *image); static gboolean gst_glsink_set_caps (GstGLSink *sink, GstCaps *caps); -/* bufferpool stuff */ -static GstBuffer* gst_glsink_buffer_new (GstBufferPool *pool, - gint64 location, - guint size, gpointer user_data); -static void gst_glsink_buffer_free (GstBufferPool *pool, - GstBuffer *buffer, - gpointer user_data); /* prototypes from plugins */ extern GstImagePlugin* get_gl_rgbimage_plugin (void); @@ -278,13 +268,6 @@ gst_glsink_init (GstGLSink *sink) /* create bufferpool and image cache */ GST_DEBUG ("glsink: creating bufferpool"); - sink->bufferpool = gst_buffer_pool_new ( - NULL, - NULL, - (GstBufferPoolBufferNewFunction)gst_glsink_buffer_new, - NULL, - (GstBufferPoolBufferFreeFunction)gst_glsink_buffer_free, - sink); sink->cache_lock = g_mutex_new(); sink->cache = NULL; @@ -332,6 +315,7 @@ gst_glsink_append_cache (GstGLSink *sink, GstImageData *image) g_mutex_unlock (sink->cache_lock); } +#if 0 /* Create a new buffer to hand up the chain. This allows the plugins to make its own decoding buffers @@ -380,14 +364,7 @@ gst_glsink_buffer_free (GstBufferPool *pool, GstBuffer *buffer, gpointer user_da gst_buffer_default_free (buffer); } - -static GstBufferPool* -gst_glsink_get_bufferpool (GstPad *pad) -{ - GstGLSink *sink = GST_GLSINK (gst_pad_get_parent (pad)); - - return sink->bufferpool; -} +#endif /* Set the caps that the application desires. diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index 76d8a0d20..35da20782 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -92,16 +92,6 @@ static void gst_v4l2src_set_clock (GstElement *element, GstClock *clock); -/* bufferpool functions */ -static GstBuffer * gst_v4l2src_buffer_new (GstBufferPool *pool, - guint64 offset, - guint size, - gpointer user_data); -static void gst_v4l2src_buffer_free (GstBufferPool *pool, - GstBuffer *buf, - gpointer user_data); - - static GstPadTemplate *src_template; static GstElementClass *parent_class = NULL; @@ -222,12 +212,6 @@ gst_v4l2src_init (GstV4l2Src *v4l2src) gst_pad_set_convert_function (v4l2src->srcpad, gst_v4l2src_srcconvert); gst_pad_set_getcaps_function (v4l2src->srcpad, gst_v4l2src_getcaps); - v4l2src->bufferpool = gst_buffer_pool_new(NULL, NULL, - gst_v4l2src_buffer_new, - NULL, - gst_v4l2src_buffer_free, - v4l2src); - v4l2src->breq.count = 0; v4l2src->formats = NULL; @@ -761,13 +745,6 @@ gst_v4l2src_get (GstPad *pad) (fps = gst_v4l2src_get_fps(v4l2src)) == 0) return NULL; - buf = gst_buffer_new_from_pool(v4l2src->bufferpool, 0, 0); - if (!buf) { - gst_element_error(GST_ELEMENT(v4l2src), - "Failed to create a new GstBuffer"); - return NULL; - } - if (v4l2src->need_writes > 0) { /* use last frame */ num = v4l2src->last_frame; @@ -842,8 +819,10 @@ gst_v4l2src_get (GstPad *pad) v4l2src->use_num_times[num] = 1; } + buf = gst_buffer_new (); GST_BUFFER_DATA(buf) = gst_v4l2src_get_buffer(v4l2src, num); GST_BUFFER_SIZE(buf) = v4l2src->bufsettings.bytesused; + GST_BUFFER_FLAG_SET(buf, GST_BUFFER_READONLY); if (v4l2src->use_fixed_fps) GST_BUFFER_TIMESTAMP(buf) = v4l2src->handled * GST_SECOND / fps; else /* calculate time based on our own clock */ @@ -987,6 +966,7 @@ gst_v4l2src_set_clock (GstElement *element, } +#if 0 static GstBuffer* gst_v4l2src_buffer_new (GstBufferPool *pool, guint64 offset, @@ -1010,8 +990,9 @@ gst_v4l2src_buffer_new (GstBufferPool *pool, return buffer; } +#endif - +#if 0 static void gst_v4l2src_buffer_free (GstBufferPool *pool, GstBuffer *buf, @@ -1039,3 +1020,5 @@ gst_v4l2src_buffer_free (GstBufferPool *pool, /* free the buffer itself */ gst_buffer_default_free(buf); } +#endif + diff --git a/sys/v4l2/gstv4l2src.h b/sys/v4l2/gstv4l2src.h index 1b4ab095c..bae60900a 100644 --- a/sys/v4l2/gstv4l2src.h +++ b/sys/v4l2/gstv4l2src.h @@ -80,9 +80,6 @@ struct _GstV4l2Src { /* how are we going to push buffers? */ gboolean use_fixed_fps; - - /* bufferpool for the buffers we're gonna use */ - GstBufferPool *bufferpool; }; struct _GstV4l2SrcClass { -- cgit v1.2.1