mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-29 19:50:40 +00:00
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.
This commit is contained in:
parent
9a0f69623b
commit
fe592fc65b
3 changed files with 11 additions and 52 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2007-07-24 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
|
||||||
|
* 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 <ensonic@users.sf.net>
|
2007-07-23 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
* configure.ac:
|
* configure.ac:
|
||||||
|
|
|
@ -47,7 +47,7 @@ AM_PROG_LIBTOOL
|
||||||
|
|
||||||
dnl *** required versions of GStreamer stuff ***
|
dnl *** required versions of GStreamer stuff ***
|
||||||
GST_REQ=0.10.13
|
GST_REQ=0.10.13
|
||||||
GSTPB_REQ=0.10.13
|
GSTPB_REQ=0.10.13.1
|
||||||
|
|
||||||
dnl *** autotools stuff ****
|
dnl *** autotools stuff ****
|
||||||
|
|
||||||
|
|
|
@ -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
|
static GstFlowReturn
|
||||||
gst_mad_chain (GstPad * pad, GstBuffer * buffer)
|
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,
|
GST_LOG_OBJECT (mad,
|
||||||
"pushing buffer, off=%" G_GUINT64_FORMAT ", ts=%" GST_TIME_FORMAT,
|
"pushing buffer, off=%" G_GUINT64_FORMAT ", ts=%" GST_TIME_FORMAT,
|
||||||
GST_BUFFER_OFFSET (outbuffer),
|
GST_BUFFER_OFFSET (outbuffer),
|
||||||
|
@ -1620,11 +1576,7 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
goto_exit = TRUE;
|
goto_exit = TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GST_LOG_OBJECT (mad, "Dropping buffer"
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue