configure.ac: Require CVS of core for new API in collectpads.

Original commit message from CVS:
* configure.ac:
Require CVS of core for new API in collectpads.
* gst/adder/gstadder.c:
Use new API to make adder sparse stream aware.
This commit is contained in:
Stefan Kost 2008-02-18 13:51:34 +00:00
parent 5fc67f8bd3
commit 054842ca82
3 changed files with 49 additions and 18 deletions

View file

@ -1,3 +1,11 @@
2008-02-18 Stefan Kost <ensonic@users.sf.net>
* configure.ac:
Require CVS of core for new API in collectpads.
* gst/adder/gstadder.c:
Use new API to make adder sparse stream aware.
2008-02-18 Wim Taymans <wim.taymans@collabora.co.uk> 2008-02-18 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/playback/gstplaybin2.c: (pad_added_cb), (pad_removed_cb), * gst/playback/gstplaybin2.c: (pad_added_cb), (pad_removed_cb),

View file

@ -54,7 +54,7 @@ dnl AS_LIBTOOL_TAGS
AM_PROG_LIBTOOL AM_PROG_LIBTOOL
dnl *** required versions of GStreamer stuff *** dnl *** required versions of GStreamer stuff ***
GST_REQ=0.10.15.1 GST_REQ=0.10.17.1
dnl *** autotools stuff **** dnl *** autotools stuff ****

View file

@ -701,6 +701,7 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
GstBuffer *outbuf; GstBuffer *outbuf;
GstFlowReturn ret; GstFlowReturn ret;
gpointer outbytes; gpointer outbytes;
gboolean empty = TRUE;
adder = GST_ADDER (user_data); adder = GST_ADDER (user_data);
@ -724,18 +725,22 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
GstCollectData *data; GstCollectData *data;
guint8 *bytes; guint8 *bytes;
guint len; guint len;
GstBuffer *inbuf;
data = (GstCollectData *) collected->data; data = (GstCollectData *) collected->data;
/* get pointer to copy size bytes */ /* get a subbuffer of size bytes */
len = gst_collect_pads_read (pads, data, &bytes, size); inbuf = gst_collect_pads_take_buffer (pads, data, size);
/* length 0 means EOS or an empty buffer so we still need to flush in /* NULL means EOS or an empty buffer so we still need to flush in
* case of an empty buffer. */ * case of an empty buffer. */
if (len == 0) { if (inbuf == NULL) {
GST_LOG_OBJECT (adder, "channel %p: no bytes available", data); GST_LOG_OBJECT (adder, "channel %p: no bytes available", data);
goto next; goto next;
} }
bytes = GST_BUFFER_DATA (inbuf);
len = GST_BUFFER_SIZE (inbuf);
if (outbuf == NULL) { if (outbuf == NULL) {
GST_LOG_OBJECT (adder, "channel %p: making output buffer of %d bytes", GST_LOG_OBJECT (adder, "channel %p: making output buffer of %d bytes",
data, size); data, size);
@ -746,23 +751,37 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
outbytes = GST_BUFFER_DATA (outbuf); outbytes = GST_BUFFER_DATA (outbuf);
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (adder->srcpad)); gst_buffer_set_caps (outbuf, GST_PAD_CAPS (adder->srcpad));
/* clear if we are only going to fill a partial buffer */ if (!GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP)) {
if (G_UNLIKELY (size > len)) /* clear if we are only going to fill a partial buffer */
if (G_UNLIKELY (size > len))
memset (outbytes, 0, size);
GST_LOG_OBJECT (adder, "channel %p: copying %d bytes from data %p",
data, len, bytes);
/* and copy the data into it */
memcpy (outbytes, bytes, len);
empty = FALSE;
} else {
GST_LOG_OBJECT (adder, "channel %p: zeroing %d bytes from data %p",
data, len, bytes);
memset (outbytes, 0, size); memset (outbytes, 0, size);
}
GST_LOG_OBJECT (adder, "channel %p: copying %d bytes from data %p",
data, len, bytes);
/* and copy the data into it */
memcpy (outbytes, bytes, len);
} else { } else {
GST_LOG_OBJECT (adder, "channel %p: mixing %d bytes from data %p", if (!GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP)) {
data, len, bytes); GST_LOG_OBJECT (adder, "channel %p: mixing %d bytes from data %p",
/* other buffers, need to add them */ data, len, bytes);
adder->func ((gpointer) outbytes, (gpointer) bytes, len); /* other buffers, need to add them */
adder->func ((gpointer) outbytes, (gpointer) bytes, len);
empty = FALSE;
} else {
GST_LOG_OBJECT (adder, "channel %p: skipping %d bytes from data %p",
data, len, bytes);
}
} }
next: next:
gst_collect_pads_flush (pads, data, len); if (inbuf)
gst_buffer_unref (inbuf);
} }
/* can only happen when no pads to collect or all EOS */ /* can only happen when no pads to collect or all EOS */
@ -810,6 +829,10 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
GST_BUFFER_DURATION (outbuf) = adder->timestamp - GST_BUFFER_DURATION (outbuf) = adder->timestamp -
GST_BUFFER_TIMESTAMP (outbuf); GST_BUFFER_TIMESTAMP (outbuf);
/* if we only processed silence, mark output again as silence */
if (empty)
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP);
/* send it out */ /* send it out */
GST_LOG_OBJECT (adder, "pushing outbuf, timestamp %" GST_TIME_FORMAT, GST_LOG_OBJECT (adder, "pushing outbuf, timestamp %" GST_TIME_FORMAT,
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf))); GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)));