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.
This commit is contained in:
Tim-Philipp Müller 2006-02-01 11:01:04 +00:00
parent 1e661e8ff3
commit 638225aebb
2 changed files with 25 additions and 10 deletions

View file

@ -1,3 +1,12 @@
2006-02-01 Tim-Philipp Müller <tim at centricular dot net>
* 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.
2006-01-31 Jan Schmidt <thaytan@mad.scientist.com>
* gst/id3demux/gstid3demux.c: (gst_id3demux_chain),

View file

@ -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);