From 9cc325828029d5d746c1d13a0ea729900a7d3ef4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 2 Jun 2005 10:03:23 +0000 Subject: gst/: Bufferalloc changes. Original commit message from CVS: * gst/effectv/gstquark.c: (gst_quarktv_chain): * gst/goom/gstgoom.c: (gst_goom_chain): * gst/videobox/Makefile.am: * gst/videobox/gstvideobox.c: (gst_video_box_class_init), (gst_video_box_init), (gst_video_box_sink_setcaps), (gst_video_box_chain): * gst/videofilter/gstvideofilter.c: (gst_videofilter_chain): * gst/videorate/gstvideorate.c: (gst_videorate_class_init), (gst_videorate_getcaps), (gst_videorate_setcaps), (gst_videorate_init), (gst_videorate_event), (gst_videorate_chain), (gst_videorate_change_state): Bufferalloc changes. --- gst/videofilter/gstvideofilter.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'gst/videofilter') diff --git a/gst/videofilter/gstvideofilter.c b/gst/videofilter/gstvideofilter.c index ccc995c1..d0033455 100644 --- a/gst/videofilter/gstvideofilter.c +++ b/gst/videofilter/gstvideofilter.c @@ -294,18 +294,12 @@ gst_videofilter_chain (GstPad * pad, GstBuffer * buf) guchar *data; gulong size; GstBuffer *outbuf; + GstFlowReturn ret; GST_DEBUG ("gst_videofilter_chain"); - g_return_val_if_fail (pad != NULL, GST_FLOW_ERROR); - g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR); - g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR); - videofilter = GST_VIDEOFILTER (GST_PAD_PARENT (pad)); - data = GST_BUFFER_DATA (buf); - size = GST_BUFFER_SIZE (buf); - if (videofilter->passthru) { return gst_pad_push (videofilter->srcpad, buf); } @@ -314,6 +308,9 @@ gst_videofilter_chain (GstPad * pad, GstBuffer * buf) return GST_FLOW_NOT_NEGOTIATED; } + data = GST_BUFFER_DATA (buf); + size = GST_BUFFER_SIZE (buf); + GST_DEBUG ("gst_videofilter_chain: got buffer of %ld bytes in '%s'", size, GST_OBJECT_NAME (videofilter)); @@ -330,8 +327,11 @@ gst_videofilter_chain (GstPad * pad, GstBuffer * buf) return GST_FLOW_ERROR; } - outbuf = gst_pad_alloc_buffer (videofilter->srcpad, GST_BUFFER_OFFSET_NONE, - videofilter->to_buf_size, GST_RPAD_CAPS (videofilter->srcpad)); + ret = gst_pad_alloc_buffer (videofilter->srcpad, GST_BUFFER_OFFSET_NONE, + videofilter->to_buf_size, GST_PAD_CAPS (videofilter->srcpad), &outbuf); + if (ret != GST_FLOW_OK) + goto no_buffer; + GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf); GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf); @@ -343,15 +343,19 @@ gst_videofilter_chain (GstPad * pad, GstBuffer * buf) videofilter->format->filter_func (videofilter, GST_BUFFER_DATA (outbuf), data); + gst_buffer_unref (buf); GST_DEBUG ("gst_videofilter_chain: pushing buffer of %d bytes in '%s'", GST_BUFFER_SIZE (outbuf), GST_OBJECT_NAME (videofilter)); - gst_pad_push (videofilter->srcpad, outbuf); + ret = gst_pad_push (videofilter->srcpad, outbuf); - gst_buffer_unref (buf); + return ret; - return GST_FLOW_OK; +no_buffer: + { + return ret; + } } static void -- cgit