summaryrefslogtreecommitdiffstats
path: root/gst/auparse/gstauparse.c
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2006-02-01 11:01:04 +0000
committerTim-Philipp Müller <tim@centricular.net>2006-02-01 11:01:04 +0000
commit638225aebb76fe08d53a2094b02544838994b369 (patch)
tree1c31fdb5bb3737ba1fb71c099d511b9e3ad6cdfe /gst/auparse/gstauparse.c
parent1e661e8ff3b60f17b3e0b7ffd6e8c99a5e26dab5 (diff)
gst/auparse/gstauparse.c: Don't push buffers into the adapter that we are going to push downstream again without fram...
Original commit message from CVS: * gst/auparse/gstauparse.c: (gst_au_parse_chain): Don't push buffers into the adapter that we are going to push downstream again without framing anyway. Also, the adaptor takes ownership of buffers put into it (fixes auparse pushing invalid buffers for .au files with ADPCM contents). Finally, set caps on all outgoing buffers.
Diffstat (limited to 'gst/auparse/gstauparse.c')
-rw-r--r--gst/auparse/gstauparse.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/gst/auparse/gstauparse.c b/gst/auparse/gstauparse.c
index e1e83d3b..071cb37d 100644
--- a/gst/auparse/gstauparse.c
+++ b/gst/auparse/gstauparse.c
@@ -153,7 +153,7 @@ gst_au_parse_chain (GstPad * pad, GstBuffer * buf)
GstCaps *tempcaps;
gint law = 0, depth = 0, ieee = 0;
gchar layout[7];
- GstBuffer *subbuf;
+ GstBuffer *databuf;
GstEvent *event;
layout[0] = 0;
@@ -325,28 +325,32 @@ Samples :
auparse->sample_size = auparse->channels * depth / 8;
}
- gst_pad_set_active (auparse->srcpad, TRUE);
+ gst_pad_use_fixed_caps (auparse->srcpad);
gst_pad_set_caps (auparse->srcpad, tempcaps);
+ gst_pad_set_active (auparse->srcpad, TRUE);
event = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_DEFAULT,
0, GST_CLOCK_TIME_NONE, 0);
gst_pad_push_event (auparse->srcpad, event);
- subbuf = gst_buffer_create_sub (buf, auparse->offset,
+ databuf = gst_buffer_create_sub (buf, auparse->offset,
size - auparse->offset);
gst_buffer_unref (buf);
-
- gst_adapter_push (auparse->adapter, subbuf);
+ buf = NULL;
} else {
- gst_adapter_push (auparse->adapter, buf);
+ databuf = buf;
+ buf = NULL;
}
if (auparse->sample_size) {
- /* Ensure we push a buffer that's a multiple of the frame size downstream */
- int avail = gst_adapter_available (auparse->adapter);
+ int avail;
+ gst_adapter_push (auparse->adapter, databuf);
+
+ /* Ensure we push a buffer that's a multiple of the frame size downstream */
+ avail = gst_adapter_available (auparse->adapter);
avail -= avail % auparse->sample_size;
if (avail > 0) {
@@ -365,12 +369,14 @@ Samples :
ret = gst_pad_push (auparse->srcpad, newbuf);
}
- } else
+ } else {
ret = GST_FLOW_OK;
+ }
} else {
/* It's something non-trivial (such as ADPCM), we don't understand it, so
* just push downstream and assume this will know what to do with it */
- ret = gst_pad_push (auparse->srcpad, buf);
+ gst_buffer_set_caps (databuf, GST_PAD_CAPS (auparse->srcpad));
+ ret = gst_pad_push (auparse->srcpad, databuf);
}
gst_object_unref (auparse);