From fe592fc65bd8d44fc530f8982752e598fe6cd13b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 24 Jul 2007 05:05:29 +0000 Subject: [PATCH] Use the new buffer clipping function from gstaudio here and require gst-plugins-base CVS. Original commit message from CVS: * configure.ac: * ext/mad/gstmad.c: (gst_mad_chain): Use the new buffer clipping function from gstaudio here and require gst-plugins-base CVS. --- ChangeLog | 7 +++++++ configure.ac | 2 +- ext/mad/gstmad.c | 54 +++--------------------------------------------------- 3 files changed, 11 insertions(+), 52 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6363abc..920c495 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-07-24 Sebastian Dröge + + * configure.ac: + * ext/mad/gstmad.c: (gst_mad_chain): + Use the new buffer clipping function from gstaudio here and + require gst-plugins-base CVS. + 2007-07-23 Stefan Kost * configure.ac: diff --git a/configure.ac b/configure.ac index 9f8ae93..65bfd19 100644 --- a/configure.ac +++ b/configure.ac @@ -47,7 +47,7 @@ AM_PROG_LIBTOOL dnl *** required versions of GStreamer stuff *** GST_REQ=0.10.13 -GSTPB_REQ=0.10.13 +GSTPB_REQ=0.10.13.1 dnl *** autotools stuff **** diff --git a/ext/mad/gstmad.c b/ext/mad/gstmad.c index c323abf..7f69a50 100644 --- a/ext/mad/gstmad.c +++ b/ext/mad/gstmad.c @@ -1223,51 +1223,6 @@ gst_mad_check_caps_reset (GstMad * mad) } } -/* - clips buffer to currently configured segment. Returns FALSE if the buffer - has to be dropped. -*/ -static gboolean -clip_outgoing_buffer (GstMad * mad, GstBuffer * buffer) -{ - gint64 start, stop, cstart, cstop, diff; - gboolean res = TRUE; - - if (mad->segment.format != GST_FORMAT_TIME) - goto beach; - - start = GST_BUFFER_TIMESTAMP (buffer); - stop = start + GST_BUFFER_DURATION (buffer); - - if (gst_segment_clip (&mad->segment, GST_FORMAT_TIME, - start, stop, &cstart, &cstop)) { - diff = cstart - start; - if (diff > 0) { - GST_BUFFER_TIMESTAMP (buffer) = cstart; - GST_BUFFER_DURATION (buffer) -= diff; - - /* time->frames->bytes */ - diff = 4 * mad->channels * GST_CLOCK_TIME_TO_FRAMES (diff, mad->rate); - GST_BUFFER_DATA (buffer) += diff; - GST_BUFFER_SIZE (buffer) -= diff; - } - diff = stop - cstop; - if (diff > 0) { - GST_BUFFER_DURATION (buffer) -= diff; - /* time->frames->bytes */ - diff = 4 * mad->channels * GST_CLOCK_TIME_TO_FRAMES (diff, mad->rate); - /* update size */ - GST_BUFFER_SIZE (buffer) -= diff; - } - } else { - GST_DEBUG_OBJECT (mad, "buffer is outside configured segment"); - res = FALSE; - } - -beach: - return res; -} - static GstFlowReturn gst_mad_chain (GstPad * pad, GstBuffer * buffer) { @@ -1608,7 +1563,8 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer) } } - if (clip_outgoing_buffer (mad, outbuffer)) { + if ((outbuffer = gst_audio_buffer_clip (outbuffer, &mad->segment, + mad->rate, 4 * mad->channels))) { GST_LOG_OBJECT (mad, "pushing buffer, off=%" G_GUINT64_FORMAT ", ts=%" GST_TIME_FORMAT, GST_BUFFER_OFFSET (outbuffer), @@ -1620,11 +1576,7 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer) goto_exit = TRUE; } } else { - GST_LOG_OBJECT (mad, "Dropping buffer" - ", off=%" G_GUINT64_FORMAT ", ts=%" GST_TIME_FORMAT, - GST_BUFFER_OFFSET (outbuffer), - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuffer))); - gst_buffer_unref (outbuffer); + GST_LOG_OBJECT (mad, "Dropping buffer"); } } -- 2.7.4