summaryrefslogtreecommitdiff
path: root/gst/dvdlpcmdec
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@mad.scientist.com>2005-02-20 15:26:04 +0000
committerJan Schmidt <thaytan@mad.scientist.com>2005-02-20 15:26:04 +0000
commit4cba588b1d8cccf6ec0ee7fd2dcd499fabf6f9f0 (patch)
treef52001c8f2d6b574c290fde1b935c3b8f768e3c4 /gst/dvdlpcmdec
parent3e0d9912cf93db982f6829e8daf1055b7c517354 (diff)
gst/dvdlpcmdec/gstdvdlpcmdec.c: Make sure we only write to writable buffers
Original commit message from CVS: * gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_chain): Make sure we only write to writable buffers
Diffstat (limited to 'gst/dvdlpcmdec')
-rw-r--r--gst/dvdlpcmdec/gstdvdlpcmdec.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gst/dvdlpcmdec/gstdvdlpcmdec.c b/gst/dvdlpcmdec/gstdvdlpcmdec.c
index 2062d14d..19b02251 100644
--- a/gst/dvdlpcmdec/gstdvdlpcmdec.c
+++ b/gst/dvdlpcmdec/gstdvdlpcmdec.c
@@ -229,7 +229,6 @@ gst_dvdlpcmdec_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstDvdLpcmDec *dvdlpcmdec;
- guchar *data;
gint64 size;
g_return_if_fail (pad != NULL);
@@ -238,7 +237,6 @@ gst_dvdlpcmdec_chain (GstPad * pad, GstData * _data)
dvdlpcmdec = GST_DVDLPCMDEC (gst_pad_get_parent (pad));
- data = GST_BUFFER_DATA (buf);
size = GST_BUFFER_SIZE (buf);
GST_LOG_OBJECT (dvdlpcmdec, "got buffer %p of size %" G_GINT64_FORMAT, buf,
@@ -290,7 +288,7 @@ gst_dvdlpcmdec_chain (GstPad * pad, GstData * _data)
}
gst_buffer_stamp (outbuf, buf);
- src = data;
+ src = GST_BUFFER_DATA (buf);;
dest = GST_BUFFER_DATA (outbuf);
/* Copy 20-bit LPCM format to 24-bit buffers, with 0x00 in the lowest
@@ -324,7 +322,11 @@ gst_dvdlpcmdec_chain (GstPad * pad, GstData * _data)
* and last byte are already correct */
gint64 count = size / 12;
gint64 i;
- guchar *src = data;
+ guchar *src;
+
+ /* Ensure our output buffer is writable */
+ buf = gst_buffer_copy_on_write (buf);
+ src = GST_BUFFER_DATA (buf);
for (i = 0; i < count; i++) {
guchar temp[9];