diff options
author | Johan Dahlin <johan@gnome.org> | 2004-09-20 09:58:35 +0000 |
---|---|---|
committer | Johan Dahlin <johan@gnome.org> | 2004-09-20 09:58:35 +0000 |
commit | 5af4bfcabd842318887a4cab2374e66e57ba2ad2 (patch) | |
tree | f7adb8ee1f9878f39fb1d7f053cd795a1f03b5ed /ext/jpeg | |
parent | e3beb3a1d5437100d6a52c1145d279f44e9aae45 (diff) |
ext/jpeg/gstjpegdec.c (gst_jpegdec_chain): Allocate the buffer after setting caps. Fixes mysterious segfault. Blessed...
Original commit message from CVS:
* ext/jpeg/gstjpegdec.c (gst_jpegdec_chain): Allocate the buffer
after setting caps. Fixes mysterious segfault. Blessed by Wim.
Diffstat (limited to 'ext/jpeg')
-rw-r--r-- | ext/jpeg/gstjpegdec.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c index 1f15f0de..03b9d651 100644 --- a/ext/jpeg/gstjpegdec.c +++ b/ext/jpeg/gstjpegdec.c @@ -406,18 +406,6 @@ gst_jpegdec_chain (GstPad * pad, GstData * _data) width = jpegdec->cinfo.output_width; height = jpegdec->cinfo.output_height; - /* FIXME: someone needs to do the work to figure out how to correctly - * calculate an output size that takes into account everything libjpeg - * needs, like padding for DCT size and so on. */ - outsize = width * height + width * height / 2; - outbuf = gst_pad_alloc_buffer (jpegdec->srcpad, GST_BUFFER_OFFSET_NONE, - outsize); - outdata = GST_BUFFER_DATA (outbuf); - GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf); - GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf); - GST_LOG_OBJECT (jpegdec, "width %d, height %d, buffer size %d", width, - height, outsize); - if (jpegdec->height != height || jpegdec->line[0] == NULL) { GstCaps *caps; @@ -437,6 +425,18 @@ gst_jpegdec_chain (GstPad * pad, GstData * _data) gst_caps_free (caps); } + /* FIXME: someone needs to do the work to figure out how to correctly + * calculate an output size that takes into account everything libjpeg + * needs, like padding for DCT size and so on. */ + outsize = width * height + width * height / 2; + outbuf = gst_pad_alloc_buffer (jpegdec->srcpad, GST_BUFFER_OFFSET_NONE, + outsize); + outdata = GST_BUFFER_DATA (outbuf); + GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf); + GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf); + GST_LOG_OBJECT (jpegdec, "width %d, height %d, buffer size %d", width, + height, outsize); + /* mind the swap, jpeglib outputs blue chroma first */ /* FIXME: this needs stride love */ base[0] = outdata; |