[gst-devel] One more step on the road to gstreamer enlightenment

iain iain at prettypeople.org
Sat Aug 31 19:02:02 CEST 2002

Yes, me again, still fighting my way through GStreamer.

In my element, I need to convert a GstBuffer from ints to floats. The
code I'm using is

for (i = 0; i < GST_BUFFER_SIZE (buf); i++) {
	int16_t d = *((int16_t *)(GST_BUFFER_DATA (buf) + i));
	out_bufs[0][i] = ((float) d) / 32767.0;
/* 	g_print ("d: %d -> %f\n", d, out_bufs[0][i]); */

But I'm just getting garbage.
The GstBuffer just comes from a gst_pad_pull function. Do I need to do
something to tell the pad that I want the buffer as ints etc?

Attached is the code for the element. Please be kind to it...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: marlin-sample-element.c
Type: text/x-csrc
Size: 9069 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20020831/83734b5d/attachment.c>

More information about the gstreamer-devel mailing list