From 4bd11406304a8010f51baa2a40f18d82ccacc9b7 Mon Sep 17 00:00:00 2001 From: René Stadler Date: Mon, 21 May 2007 09:32:26 +0000 Subject: Use audioconvert for converting from non-native endianness floats in auparse instead of doing it ourself. Fixes #424527. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message from CVS: Patch by: René Stadler * configure.ac: * gst/auparse/gstauparse.c: (gst_au_parse_reset), (gst_au_parse_parse_header), (gst_au_parse_chain): * gst/auparse/gstauparse.h: Use audioconvert for converting from non-native endianness floats in auparse instead of doing it ourself. Fixes #424527. This needs the audioconvert from plugins-base CVS. --- gst/auparse/gstauparse.c | 39 ++------------------------------------- gst/auparse/gstauparse.h | 4 ---- 2 files changed, 2 insertions(+), 41 deletions(-) (limited to 'gst/auparse') diff --git a/gst/auparse/gstauparse.c b/gst/auparse/gstauparse.c index d2658e40..1f0dccc0 100644 --- a/gst/auparse/gstauparse.c +++ b/gst/auparse/gstauparse.c @@ -158,7 +158,6 @@ gst_au_parse_reset (GstAuParse * auparse) auparse->encoding = 0; auparse->samplerate = 0; auparse->channels = 0; - auparse->float_swap = 0; gst_adapter_clear (auparse->adapter); @@ -289,8 +288,6 @@ gst_au_parse_parse_header (GstAuParse * auparse) * http://www.tsp.ece.mcgill.ca/MMSP/Documents/AudioFormats/AU/Samples.html */ - auparse->float_swap = 0; - switch (auparse->encoding) { case 1: /* 8-bit ISDN mu-law G.711 */ law = 1; @@ -369,13 +366,9 @@ gst_au_parse_parse_header (GstAuParse * auparse) tempcaps = gst_caps_new_simple ("audio/x-raw-float", "rate", G_TYPE_INT, auparse->samplerate, "channels", G_TYPE_INT, auparse->channels, - "endianness", G_TYPE_INT, G_BYTE_ORDER, + "endianness", G_TYPE_INT, auparse->endianness, "width", G_TYPE_INT, depth, NULL); auparse->sample_size = auparse->channels * depth / 8; - if (auparse->endianness != G_BYTE_ORDER) { - GST_DEBUG_OBJECT (auparse, "need to swap float byte order ourselves!"); - auparse->float_swap = depth; - } } else if (layout[0]) { tempcaps = gst_caps_new_simple ("audio/x-adpcm", "layout", G_TYPE_STRING, layout, NULL); @@ -493,35 +486,7 @@ gst_au_parse_chain (GstPad * pad, GstBuffer * buf) } data = gst_adapter_peek (auparse->adapter, sendnow); - - /* audioconvert only handles floats in native endianness ... */ - switch (auparse->float_swap) { - case 32:{ - guint32 *indata = (guint32 *) data; - guint32 *outdata = (guint32 *) GST_BUFFER_DATA (outbuf); - gint i; - - for (i = 0; i < (sendnow / sizeof (guint32)); ++i) { - outdata[i] = GUINT32_SWAP_LE_BE (indata[i]); - } - break; - } - case 64:{ - guint64 *indata = (guint64 *) data; - guint64 *outdata = (guint64 *) GST_BUFFER_DATA (outbuf); - gint i; - - for (i = 0; i < (sendnow / sizeof (guint64)); ++i) { - outdata[i] = GUINT64_SWAP_LE_BE (indata[i]); - } - break; - } - default:{ - memcpy (GST_BUFFER_DATA (outbuf), data, sendnow); - break; - } - } - + memcpy (GST_BUFFER_DATA (outbuf), data, sendnow); gst_adapter_flush (auparse->adapter, sendnow); auparse->buffer_offset += sendnow; diff --git a/gst/auparse/gstauparse.h b/gst/auparse/gstauparse.h index a74d6818..55d13e21 100644 --- a/gst/auparse/gstauparse.h +++ b/gst/auparse/gstauparse.h @@ -62,10 +62,6 @@ struct _GstAuParse { guint samplerate; guint endianness; guint channels; - - /* audioconvert only handles float in native endianness, - * so we need to swap endianness here ourselves for now */ - guint float_swap; /* 0, 32 or 64 */ }; struct _GstAuParseClass { -- cgit