From 15e209d20e6c342065d93270e7915333d62275df Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Wed, 12 Mar 2008 12:39:13 +0000 Subject: [PATCH] gst-libs/gst/audio/gstringbuffer.*: Rename recently added buffer types to make more sense. Original commit message from CVS: * gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_parse_caps): * gst-libs/gst/audio/gstringbuffer.h: Rename recently added buffer types to make more sense. * ext/alsa/gstalsasink.c: (alsasink_parse_spec), (gst_alsasink_write): Adapt for above API changes. Fixes bug #520523. --- ChangeLog | 10 ++++++++++ ext/alsa/gstalsasink.c | 11 ++++------- gst-libs/gst/audio/gstringbuffer.c | 4 ++-- gst-libs/gst/audio/gstringbuffer.h | 12 +++++++++--- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ea4fc98b5..7f096befb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-03-12 Michael Smith + + * gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_parse_caps): + * gst-libs/gst/audio/gstringbuffer.h: + Rename recently added buffer types to make more sense. + * ext/alsa/gstalsasink.c: (alsasink_parse_spec), + (gst_alsasink_write): + Adapt for above API changes. + Fixes bug #520523. + 2008-03-11 Sebastian Dröge * win32/common/libgstnetbuffer.def: diff --git a/ext/alsa/gstalsasink.c b/ext/alsa/gstalsasink.c index 63c4e7fbd1..291fea78e4 100644 --- a/ext/alsa/gstalsasink.c +++ b/ext/alsa/gstalsasink.c @@ -645,12 +645,9 @@ alsasink_parse_spec (GstAlsaSink * alsa, GstRingBufferSpec * spec) case GST_BUFTYPE_MU_LAW: alsa->format = SND_PCM_FORMAT_MU_LAW; break; - case GST_BUFTYPE_NONLINEAR: + case GST_BUFTYPE_IEC958: alsa->format = SND_PCM_FORMAT_S16_BE; - if (G_LIKELY (spec->format == GST_IEC958)) - alsa->iec958 = TRUE; - else - goto error; + alsa->iec958 = TRUE; break; default: goto error; @@ -888,8 +885,8 @@ gst_alsasink_write (GstAudioSink * asink, gpointer data, guint length) guint i; GST_DEBUG_OBJECT (asink, "swapping bytes"); - for (i = 0; i < length; i += 2) { - ptr[i / 2] = GUINT16_SWAP_LE_BE (ptr[i / 2]); + for (i = 0; i < length / 2; i++) { + ptr[i] = GUINT16_SWAP_LE_BE (ptr[i]); } } diff --git a/gst-libs/gst/audio/gstringbuffer.c b/gst-libs/gst/audio/gstringbuffer.c index da0479b06e..caf9579f58 100644 --- a/gst-libs/gst/audio/gstringbuffer.c +++ b/gst-libs/gst/audio/gstringbuffer.c @@ -380,7 +380,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps) if (!(gst_structure_get_int (structure, "rate", &spec->rate))) goto parse_error; - spec->type = GST_BUFTYPE_NONLINEAR; + spec->type = GST_BUFTYPE_IEC958; spec->format = GST_IEC958; spec->width = 16; spec->depth = 16; @@ -390,7 +390,7 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps) if (!(gst_structure_get_int (structure, "rate", &spec->rate))) goto parse_error; - spec->type = GST_BUFTYPE_NONLINEAR; + spec->type = GST_BUFTYPE_AC3; spec->format = GST_AC3; spec->width = 16; spec->depth = 16; diff --git a/gst-libs/gst/audio/gstringbuffer.h b/gst-libs/gst/audio/gstringbuffer.h index a998de0341..fa6dc72be0 100644 --- a/gst-libs/gst/audio/gstringbuffer.h +++ b/gst-libs/gst/audio/gstringbuffer.h @@ -90,7 +90,10 @@ typedef enum { * @GST_BUFTYPE_IMA_ADPCM: samples in ima adpcm * @GST_BUFTYPE_MPEG: samples in mpeg audio format * @GST_BUFTYPE_GSM: samples in gsm format - * @GST_BUFTYPE_NONLINEAR: samples in non linear format (ac3, ec3, dts, ...) + * @GST_BUFTYPE_IEC958: samples in IEC958 frames (e.g. AC3) + * @GST_BUFTYPE_AC3: samples in AC3 format + * @GST_BUFTYPE_EAC3: samples in EAC3 format + * @GST_BUFTYPE_DTS: samples in DTS format * * The format of the samples in the ringbuffer. */ @@ -103,7 +106,10 @@ typedef enum GST_BUFTYPE_IMA_ADPCM, GST_BUFTYPE_MPEG, GST_BUFTYPE_GSM, - GST_BUFTYPE_NONLINEAR + GST_BUFTYPE_IEC958, + GST_BUFTYPE_AC3, + GST_BUFTYPE_EAC3, + GST_BUFTYPE_DTS } GstBufferFormatType; typedef enum @@ -154,7 +160,7 @@ typedef enum GST_GSM, GST_IEC958, GST_AC3, - GST_EC3, + GST_EAC3, GST_DTS } GstBufferFormat;