From 33196cdd2cec82d8fc0546a957bb069208453505 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 6 Sep 2011 12:06:39 +0200 Subject: [PATCH] audio: change audio format syntax a little Remove the _ in front of the endianness prefix. Remove the _3 postfix for the 24 bits formats. Add a _32 postfix after the formats that occupy extra space beyond their natural size. The result is that the GST_AUDIO_NE() macro can simply append the endianness after all formats and that we only specify a different sample width when it is different from the natural size of the sample. This makes things more consistent and follows the pulseaudio conventions instead of the alsa ones. --- ext/alsa/gstalsasink.c | 56 +++++----- ext/alsa/gstalsasrc.c | 56 +++++----- ext/ogg/gstoggstream.c | 20 ++-- ext/vorbis/gstvorbisdeclib.h | 14 +-- gst-libs/gst/audio/audio.c | 84 +++++++-------- gst-libs/gst/audio/audio.h | 194 +++++++++++++++++------------------ gst-libs/gst/cdda/gstcddabasesrc.c | 8 +- gst-libs/gst/riff/riff-media.c | 10 +- gst/adder/gstadder.c | 7 +- gst/audiorate/gstaudiorate.c | 55 +--------- gst/audioresample/gstaudioresample.c | 4 +- gst/audiotestsrc/gstaudiotestsrc.c | 8 +- gst/volume/gstvolume.c | 6 +- 13 files changed, 232 insertions(+), 290 deletions(-) diff --git a/ext/alsa/gstalsasink.c b/ext/alsa/gstalsasink.c index 298e5a8..8b1e627 100644 --- a/ext/alsa/gstalsasink.c +++ b/ext/alsa/gstalsasink.c @@ -602,88 +602,88 @@ alsasink_parse_spec (GstAlsaSink * alsa, GstRingBufferSpec * spec) case GST_AUDIO_FORMAT_S8: alsa->format = SND_PCM_FORMAT_S8; break; - case GST_AUDIO_FORMAT_S16_LE: + case GST_AUDIO_FORMAT_S16LE: alsa->format = SND_PCM_FORMAT_S16_LE; break; - case GST_AUDIO_FORMAT_S16_BE: + case GST_AUDIO_FORMAT_S16BE: alsa->format = SND_PCM_FORMAT_S16_BE; break; - case GST_AUDIO_FORMAT_U16_LE: + case GST_AUDIO_FORMAT_U16LE: alsa->format = SND_PCM_FORMAT_U16_LE; break; - case GST_AUDIO_FORMAT_U16_BE: + case GST_AUDIO_FORMAT_U16BE: alsa->format = SND_PCM_FORMAT_U16_BE; break; - case GST_AUDIO_FORMAT_S24_LE: + case GST_AUDIO_FORMAT_S24_32LE: alsa->format = SND_PCM_FORMAT_S24_LE; break; - case GST_AUDIO_FORMAT_S24_BE: + case GST_AUDIO_FORMAT_S24_32BE: alsa->format = SND_PCM_FORMAT_S24_BE; break; - case GST_AUDIO_FORMAT_U24_LE: + case GST_AUDIO_FORMAT_U24_32LE: alsa->format = SND_PCM_FORMAT_U24_LE; break; - case GST_AUDIO_FORMAT_U24_BE: + case GST_AUDIO_FORMAT_U24_32BE: alsa->format = SND_PCM_FORMAT_U24_BE; break; - case GST_AUDIO_FORMAT_S32_LE: + case GST_AUDIO_FORMAT_S32LE: alsa->format = SND_PCM_FORMAT_S32_LE; break; - case GST_AUDIO_FORMAT_S32_BE: + case GST_AUDIO_FORMAT_S32BE: alsa->format = SND_PCM_FORMAT_S32_BE; break; - case GST_AUDIO_FORMAT_U32_LE: + case GST_AUDIO_FORMAT_U32LE: alsa->format = SND_PCM_FORMAT_U32_LE; break; - case GST_AUDIO_FORMAT_U32_BE: + case GST_AUDIO_FORMAT_U32BE: alsa->format = SND_PCM_FORMAT_U32_BE; break; - case GST_AUDIO_FORMAT_S24_3LE: + case GST_AUDIO_FORMAT_S24LE: alsa->format = SND_PCM_FORMAT_S24_3LE; break; - case GST_AUDIO_FORMAT_S24_3BE: + case GST_AUDIO_FORMAT_S24BE: alsa->format = SND_PCM_FORMAT_S24_3BE; break; - case GST_AUDIO_FORMAT_U24_3LE: + case GST_AUDIO_FORMAT_U24LE: alsa->format = SND_PCM_FORMAT_U24_3LE; break; - case GST_AUDIO_FORMAT_U24_3BE: + case GST_AUDIO_FORMAT_U24BE: alsa->format = SND_PCM_FORMAT_U24_3BE; break; - case GST_AUDIO_FORMAT_S20_3LE: + case GST_AUDIO_FORMAT_S20LE: alsa->format = SND_PCM_FORMAT_S20_3LE; break; - case GST_AUDIO_FORMAT_S20_3BE: + case GST_AUDIO_FORMAT_S20BE: alsa->format = SND_PCM_FORMAT_S20_3BE; break; - case GST_AUDIO_FORMAT_U20_3LE: + case GST_AUDIO_FORMAT_U20LE: alsa->format = SND_PCM_FORMAT_U20_3LE; break; - case GST_AUDIO_FORMAT_U20_3BE: + case GST_AUDIO_FORMAT_U20BE: alsa->format = SND_PCM_FORMAT_U20_3BE; break; - case GST_AUDIO_FORMAT_S18_3LE: + case GST_AUDIO_FORMAT_S18LE: alsa->format = SND_PCM_FORMAT_S18_3LE; break; - case GST_AUDIO_FORMAT_S18_3BE: + case GST_AUDIO_FORMAT_S18BE: alsa->format = SND_PCM_FORMAT_S18_3BE; break; - case GST_AUDIO_FORMAT_U18_3LE: + case GST_AUDIO_FORMAT_U18LE: alsa->format = SND_PCM_FORMAT_U18_3LE; break; - case GST_AUDIO_FORMAT_U18_3BE: + case GST_AUDIO_FORMAT_U18BE: alsa->format = SND_PCM_FORMAT_U18_3BE; break; - case GST_AUDIO_FORMAT_F32_LE: + case GST_AUDIO_FORMAT_F32LE: alsa->format = SND_PCM_FORMAT_FLOAT_LE; break; - case GST_AUDIO_FORMAT_F32_BE: + case GST_AUDIO_FORMAT_F32BE: alsa->format = SND_PCM_FORMAT_FLOAT_BE; break; - case GST_AUDIO_FORMAT_F64_LE: + case GST_AUDIO_FORMAT_F64LE: alsa->format = SND_PCM_FORMAT_FLOAT64_LE; break; - case GST_AUDIO_FORMAT_F64_BE: + case GST_AUDIO_FORMAT_F64BE: alsa->format = SND_PCM_FORMAT_FLOAT64_BE; break; default: diff --git a/ext/alsa/gstalsasrc.c b/ext/alsa/gstalsasrc.c index 425dc7f..cba9504 100644 --- a/ext/alsa/gstalsasrc.c +++ b/ext/alsa/gstalsasrc.c @@ -637,88 +637,88 @@ alsasrc_parse_spec (GstAlsaSrc * alsa, GstRingBufferSpec * spec) case GST_AUDIO_FORMAT_S8: alsa->format = SND_PCM_FORMAT_S8; break; - case GST_AUDIO_FORMAT_S16_LE: + case GST_AUDIO_FORMAT_S16LE: alsa->format = SND_PCM_FORMAT_S16_LE; break; - case GST_AUDIO_FORMAT_S16_BE: + case GST_AUDIO_FORMAT_S16BE: alsa->format = SND_PCM_FORMAT_S16_BE; break; - case GST_AUDIO_FORMAT_U16_LE: + case GST_AUDIO_FORMAT_U16LE: alsa->format = SND_PCM_FORMAT_U16_LE; break; - case GST_AUDIO_FORMAT_U16_BE: + case GST_AUDIO_FORMAT_U16BE: alsa->format = SND_PCM_FORMAT_U16_BE; break; - case GST_AUDIO_FORMAT_S24_LE: + case GST_AUDIO_FORMAT_S24_32LE: alsa->format = SND_PCM_FORMAT_S24_LE; break; - case GST_AUDIO_FORMAT_S24_BE: + case GST_AUDIO_FORMAT_S24_32BE: alsa->format = SND_PCM_FORMAT_S24_BE; break; - case GST_AUDIO_FORMAT_U24_LE: + case GST_AUDIO_FORMAT_U24_32LE: alsa->format = SND_PCM_FORMAT_U24_LE; break; - case GST_AUDIO_FORMAT_U24_BE: + case GST_AUDIO_FORMAT_U24_32BE: alsa->format = SND_PCM_FORMAT_U24_BE; break; - case GST_AUDIO_FORMAT_S32_LE: + case GST_AUDIO_FORMAT_S32LE: alsa->format = SND_PCM_FORMAT_S32_LE; break; - case GST_AUDIO_FORMAT_S32_BE: + case GST_AUDIO_FORMAT_S32BE: alsa->format = SND_PCM_FORMAT_S32_BE; break; - case GST_AUDIO_FORMAT_U32_LE: + case GST_AUDIO_FORMAT_U32LE: alsa->format = SND_PCM_FORMAT_U32_LE; break; - case GST_AUDIO_FORMAT_U32_BE: + case GST_AUDIO_FORMAT_U32BE: alsa->format = SND_PCM_FORMAT_U32_BE; break; - case GST_AUDIO_FORMAT_S24_3LE: + case GST_AUDIO_FORMAT_S24LE: alsa->format = SND_PCM_FORMAT_S24_3LE; break; - case GST_AUDIO_FORMAT_S24_3BE: + case GST_AUDIO_FORMAT_S24BE: alsa->format = SND_PCM_FORMAT_S24_3BE; break; - case GST_AUDIO_FORMAT_U24_3LE: + case GST_AUDIO_FORMAT_U24LE: alsa->format = SND_PCM_FORMAT_U24_3LE; break; - case GST_AUDIO_FORMAT_U24_3BE: + case GST_AUDIO_FORMAT_U24BE: alsa->format = SND_PCM_FORMAT_U24_3BE; break; - case GST_AUDIO_FORMAT_S20_3LE: + case GST_AUDIO_FORMAT_S20LE: alsa->format = SND_PCM_FORMAT_S20_3LE; break; - case GST_AUDIO_FORMAT_S20_3BE: + case GST_AUDIO_FORMAT_S20BE: alsa->format = SND_PCM_FORMAT_S20_3BE; break; - case GST_AUDIO_FORMAT_U20_3LE: + case GST_AUDIO_FORMAT_U20LE: alsa->format = SND_PCM_FORMAT_U20_3LE; break; - case GST_AUDIO_FORMAT_U20_3BE: + case GST_AUDIO_FORMAT_U20BE: alsa->format = SND_PCM_FORMAT_U20_3BE; break; - case GST_AUDIO_FORMAT_S18_3LE: + case GST_AUDIO_FORMAT_S18LE: alsa->format = SND_PCM_FORMAT_S18_3LE; break; - case GST_AUDIO_FORMAT_S18_3BE: + case GST_AUDIO_FORMAT_S18BE: alsa->format = SND_PCM_FORMAT_S18_3BE; break; - case GST_AUDIO_FORMAT_U18_3LE: + case GST_AUDIO_FORMAT_U18LE: alsa->format = SND_PCM_FORMAT_U18_3LE; break; - case GST_AUDIO_FORMAT_U18_3BE: + case GST_AUDIO_FORMAT_U18BE: alsa->format = SND_PCM_FORMAT_U18_3BE; break; - case GST_AUDIO_FORMAT_F32_LE: + case GST_AUDIO_FORMAT_F32LE: alsa->format = SND_PCM_FORMAT_FLOAT_LE; break; - case GST_AUDIO_FORMAT_F32_BE: + case GST_AUDIO_FORMAT_F32BE: alsa->format = SND_PCM_FORMAT_FLOAT_BE; break; - case GST_AUDIO_FORMAT_F64_LE: + case GST_AUDIO_FORMAT_F64LE: alsa->format = SND_PCM_FORMAT_FLOAT64_LE; break; - case GST_AUDIO_FORMAT_F64_BE: + case GST_AUDIO_FORMAT_F64BE: alsa->format = SND_PCM_FORMAT_FLOAT64_BE; break; default: diff --git a/ext/ogg/gstoggstream.c b/ext/ogg/gstoggstream.c index 317237d..912b3e3 100644 --- a/ext/ogg/gstoggstream.c +++ b/ext/ogg/gstoggstream.c @@ -1588,27 +1588,27 @@ setup_pcm_mapper (GstOggStream * pad, ogg_packet * packet) break; case OGGPCM_FMT_S16_LE: caps = gst_caps_new_simple ("audio/x-raw", - "format", G_TYPE_STRING, "S16_LE", NULL); + "format", G_TYPE_STRING, "S16LE", NULL); break; case OGGPCM_FMT_S16_BE: caps = gst_caps_new_simple ("audio/x-raw", - "format", G_TYPE_STRING, "S16_BE", NULL); + "format", G_TYPE_STRING, "S16BE", NULL); break; case OGGPCM_FMT_S24_LE: caps = gst_caps_new_simple ("audio/x-raw", - "format", G_TYPE_STRING, "S24_3LE", NULL); + "format", G_TYPE_STRING, "S24LE", NULL); break; case OGGPCM_FMT_S24_BE: caps = gst_caps_new_simple ("audio/x-raw", - "format", G_TYPE_STRING, "S24_3BE", NULL); + "format", G_TYPE_STRING, "S24BE", NULL); break; case OGGPCM_FMT_S32_LE: caps = gst_caps_new_simple ("audio/x-raw", - "format", G_TYPE_STRING, "S32_LE", NULL); + "format", G_TYPE_STRING, "S32LE", NULL); break; case OGGPCM_FMT_S32_BE: caps = gst_caps_new_simple ("audio/x-raw", - "format", G_TYPE_STRING, "S32_BE", NULL); + "format", G_TYPE_STRING, "S32BE", NULL); break; case OGGPCM_FMT_ULAW: caps = gst_caps_new_simple ("audio/x-mulaw", NULL); @@ -1618,19 +1618,19 @@ setup_pcm_mapper (GstOggStream * pad, ogg_packet * packet) break; case OGGPCM_FMT_FLT32_LE: caps = gst_caps_new_simple ("audio/x-raw", - "format", G_TYPE_STRING, "F32_LE", NULL); + "format", G_TYPE_STRING, "F32LE", NULL); break; case OGGPCM_FMT_FLT32_BE: caps = gst_caps_new_simple ("audio/x-raw", - "format", G_TYPE_STRING, "F32_BE", NULL); + "format", G_TYPE_STRING, "F32BE", NULL); break; case OGGPCM_FMT_FLT64_LE: caps = gst_caps_new_simple ("audio/x-raw", - "format", G_TYPE_STRING, "F64_LE", NULL); + "format", G_TYPE_STRING, "F64LE", NULL); break; case OGGPCM_FMT_FLT64_BE: caps = gst_caps_new_simple ("audio/x-raw", - "format", G_TYPE_STRING, "F64_BE", NULL); + "format", G_TYPE_STRING, "F64BE", NULL); break; default: return FALSE; diff --git a/ext/vorbis/gstvorbisdeclib.h b/ext/vorbis/gstvorbisdeclib.h index fd41643..564ffce 100644 --- a/ext/vorbis/gstvorbisdeclib.h +++ b/ext/vorbis/gstvorbisdeclib.h @@ -38,12 +38,7 @@ typedef ogg_packet ogg_packet_wrapper; #define GST_VORBIS_DEC_DESCRIPTION "decode raw vorbis streams to float audio" #define GST_VORBIS_AUDIO_FORMAT GST_AUDIO_FORMAT_F32 - -#if G_BYTE_ORDER == G_BIG_ENDIAN -#define GST_VORBIS_AUDIO_FORMAT_STR "F32_BE" -#else -#define GST_VORBIS_AUDIO_FORMAT_STR "F32_LE" -#endif +#define GST_VORBIS_AUDIO_FORMAT_STR GST_AUDIO_NE (F32) #define GST_VORBIS_DEC_SRC_CAPS \ GST_STATIC_CAPS ("audio/x-raw, " \ @@ -110,12 +105,7 @@ struct _ogg_packet_wrapper { #define GST_VORBIS_DEC_DESCRIPTION "decode raw vorbis streams to integer audio" #define GST_VORBIS_AUDIO_FORMAT GST_AUDIO_FORMAT_S16 - -#if G_BYTE_ORDER == G_BIG_ENDIAN -#define GST_VORBIS_AUDIO_FORMAT_STR "S16_BE" -#else -#define GST_VORBIS_AUDIO_FORMAT_STR "S16_LE" -#endif +#define GST_VORBIS_AUDIO_FORMAT_STR GST_AUDIO_NE (S16) #define GST_VORBIS_DEC_SRC_CAPS \ GST_STATIC_CAPS ("audio/x-raw, " \ diff --git a/gst-libs/gst/audio/audio.c b/gst-libs/gst/audio/audio.c index 7da5cf1..aedc792 100644 --- a/gst-libs/gst/audio/audio.c +++ b/gst-libs/gst/audio/audio.c @@ -40,20 +40,20 @@ #define MAKE_FORMAT(str,flags,end,width,depth,silent) \ { GST_AUDIO_FORMAT_ ##str, G_STRINGIFY(str), flags, end, width, depth, silent } -#define SILENT_0 { 0, 0, 0, 0, 0, 0, 0, 0 } -#define SILENT_U8 { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 } -#define SILENT_U16_LE { 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80 } -#define SILENT_U16_BE { 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00 } -#define SILENT_U24_LE { 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00 } -#define SILENT_U24_BE { 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00 } -#define SILENT_U32_LE { 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80 } -#define SILENT_U32_BE { 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00 } -#define SILENT_U24_3LE { 0x00, 0x00, 0x80, 0x00, 0x00, 0x80 } -#define SILENT_U24_3BE { 0x80, 0x00, 0x00, 0x80, 0x00, 0x00 } -#define SILENT_U20_3LE { 0x00, 0x00, 0x08, 0x00, 0x00, 0x08 } -#define SILENT_U20_3BE { 0x08, 0x00, 0x00, 0x08, 0x00, 0x00 } -#define SILENT_U18_3LE { 0x00, 0x00, 0x02, 0x00, 0x00, 0x02 } -#define SILENT_U18_3BE { 0x02, 0x00, 0x00, 0x02, 0x00, 0x00 } +#define SILENT_0 { 0, 0, 0, 0, 0, 0, 0, 0 } +#define SILENT_U8 { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 } +#define SILENT_U16LE { 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80 } +#define SILENT_U16BE { 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00 } +#define SILENT_U24_32LE { 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00 } +#define SILENT_U24_32BE { 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00 } +#define SILENT_U32LE { 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80 } +#define SILENT_U32BE { 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00 } +#define SILENT_U24LE { 0x00, 0x00, 0x80, 0x00, 0x00, 0x80 } +#define SILENT_U24BE { 0x80, 0x00, 0x00, 0x80, 0x00, 0x00 } +#define SILENT_U20LE { 0x00, 0x00, 0x08, 0x00, 0x00, 0x08 } +#define SILENT_U20BE { 0x08, 0x00, 0x00, 0x08, 0x00, 0x00 } +#define SILENT_U18LE { 0x00, 0x00, 0x02, 0x00, 0x00, 0x02 } +#define SILENT_U18BE { 0x02, 0x00, 0x00, 0x02, 0x00, 0x00 } static GstAudioFormatInfo formats[] = { {GST_AUDIO_FORMAT_UNKNOWN, "UNKNOWN", 0, 0, 0, 0}, @@ -61,43 +61,43 @@ static GstAudioFormatInfo formats[] = { MAKE_FORMAT (S8, SINT, 0, 8, 8, SILENT_0), MAKE_FORMAT (U8, UINT, 0, 8, 8, SILENT_U8), /* 16 bit */ - MAKE_FORMAT (S16_LE, SINT, G_LITTLE_ENDIAN, 16, 16, SILENT_0), - MAKE_FORMAT (S16_BE, SINT, G_BIG_ENDIAN, 16, 16, SILENT_0), - MAKE_FORMAT (U16_LE, UINT, G_LITTLE_ENDIAN, 16, 16, SILENT_U16_LE), - MAKE_FORMAT (U16_BE, UINT, G_BIG_ENDIAN, 16, 16, SILENT_U16_BE), + MAKE_FORMAT (S16LE, SINT, G_LITTLE_ENDIAN, 16, 16, SILENT_0), + MAKE_FORMAT (S16BE, SINT, G_BIG_ENDIAN, 16, 16, SILENT_0), + MAKE_FORMAT (U16LE, UINT, G_LITTLE_ENDIAN, 16, 16, SILENT_U16LE), + MAKE_FORMAT (U16BE, UINT, G_BIG_ENDIAN, 16, 16, SILENT_U16BE), /* 24 bit in low 3 bytes of 32 bits */ - MAKE_FORMAT (S24_LE, SINT, G_LITTLE_ENDIAN, 32, 24, SILENT_0), - MAKE_FORMAT (S24_BE, SINT, G_BIG_ENDIAN, 32, 24, SILENT_0), - MAKE_FORMAT (U24_LE, UINT, G_LITTLE_ENDIAN, 32, 24, SILENT_U24_LE), - MAKE_FORMAT (U24_BE, UINT, G_BIG_ENDIAN, 32, 24, SILENT_U24_BE), + MAKE_FORMAT (S24_32LE, SINT, G_LITTLE_ENDIAN, 32, 24, SILENT_0), + MAKE_FORMAT (S24_32BE, SINT, G_BIG_ENDIAN, 32, 24, SILENT_0), + MAKE_FORMAT (U24_32LE, UINT, G_LITTLE_ENDIAN, 32, 24, SILENT_U24_32LE), + MAKE_FORMAT (U24_32BE, UINT, G_BIG_ENDIAN, 32, 24, SILENT_U24_32BE), /* 32 bit */ - MAKE_FORMAT (S32_LE, SINT, G_LITTLE_ENDIAN, 32, 32, SILENT_0), - MAKE_FORMAT (S32_BE, SINT, G_BIG_ENDIAN, 32, 32, SILENT_0), - MAKE_FORMAT (U32_LE, UINT, G_LITTLE_ENDIAN, 32, 32, SILENT_U32_LE), - MAKE_FORMAT (U32_BE, UINT, G_BIG_ENDIAN, 32, 32, SILENT_U32_BE), + MAKE_FORMAT (S32LE, SINT, G_LITTLE_ENDIAN, 32, 32, SILENT_0), + MAKE_FORMAT (S32BE, SINT, G_BIG_ENDIAN, 32, 32, SILENT_0), + MAKE_FORMAT (U32LE, UINT, G_LITTLE_ENDIAN, 32, 32, SILENT_U32LE), + MAKE_FORMAT (U32BE, UINT, G_BIG_ENDIAN, 32, 32, SILENT_U32BE), /* 24 bit in 3 bytes */ - MAKE_FORMAT (S24_3LE, SINT, G_LITTLE_ENDIAN, 24, 24, SILENT_0), - MAKE_FORMAT (S24_3BE, SINT, G_BIG_ENDIAN, 24, 24, SILENT_0), - MAKE_FORMAT (U24_3LE, UINT, G_LITTLE_ENDIAN, 24, 24, SILENT_U24_3LE), - MAKE_FORMAT (U24_3BE, UINT, G_BIG_ENDIAN, 24, 24, SILENT_U24_3BE), + MAKE_FORMAT (S24LE, SINT, G_LITTLE_ENDIAN, 24, 24, SILENT_0), + MAKE_FORMAT (S24BE, SINT, G_BIG_ENDIAN, 24, 24, SILENT_0), + MAKE_FORMAT (U24LE, UINT, G_LITTLE_ENDIAN, 24, 24, SILENT_U24LE), + MAKE_FORMAT (U24BE, UINT, G_BIG_ENDIAN, 24, 24, SILENT_U24BE), /* 20 bit in 3 bytes */ - MAKE_FORMAT (S20_3LE, SINT, G_LITTLE_ENDIAN, 24, 20, SILENT_0), - MAKE_FORMAT (S20_3BE, SINT, G_BIG_ENDIAN, 24, 20, SILENT_0), - MAKE_FORMAT (U20_3LE, UINT, G_LITTLE_ENDIAN, 24, 20, SILENT_U20_3LE), - MAKE_FORMAT (U20_3BE, UINT, G_BIG_ENDIAN, 24, 20, SILENT_U20_3BE), + MAKE_FORMAT (S20LE, SINT, G_LITTLE_ENDIAN, 24, 20, SILENT_0), + MAKE_FORMAT (S20BE, SINT, G_BIG_ENDIAN, 24, 20, SILENT_0), + MAKE_FORMAT (U20LE, UINT, G_LITTLE_ENDIAN, 24, 20, SILENT_U20LE), + MAKE_FORMAT (U20BE, UINT, G_BIG_ENDIAN, 24, 20, SILENT_U20BE), /* 18 bit in 3 bytes */ - MAKE_FORMAT (S18_3LE, SINT, G_LITTLE_ENDIAN, 24, 18, SILENT_0), - MAKE_FORMAT (S18_3BE, SINT, G_BIG_ENDIAN, 24, 18, SILENT_0), - MAKE_FORMAT (U18_3LE, UINT, G_LITTLE_ENDIAN, 24, 18, SILENT_U18_3LE), - MAKE_FORMAT (U18_3BE, UINT, G_BIG_ENDIAN, 24, 18, SILENT_U18_3BE), + MAKE_FORMAT (S18LE, SINT, G_LITTLE_ENDIAN, 24, 18, SILENT_0), + MAKE_FORMAT (S18BE, SINT, G_BIG_ENDIAN, 24, 18, SILENT_0), + MAKE_FORMAT (U18LE, UINT, G_LITTLE_ENDIAN, 24, 18, SILENT_U18LE), + MAKE_FORMAT (U18BE, UINT, G_BIG_ENDIAN, 24, 18, SILENT_U18BE), /* float */ - MAKE_FORMAT (F32_LE, GST_AUDIO_FORMAT_FLAG_FLOAT, G_LITTLE_ENDIAN, 32, 32, + MAKE_FORMAT (F32LE, GST_AUDIO_FORMAT_FLAG_FLOAT, G_LITTLE_ENDIAN, 32, 32, SILENT_0), - MAKE_FORMAT (F32_BE, GST_AUDIO_FORMAT_FLAG_FLOAT, G_BIG_ENDIAN, 32, 32, + MAKE_FORMAT (F32BE, GST_AUDIO_FORMAT_FLAG_FLOAT, G_BIG_ENDIAN, 32, 32, SILENT_0), - MAKE_FORMAT (F64_LE, GST_AUDIO_FORMAT_FLAG_FLOAT, G_LITTLE_ENDIAN, 64, 64, + MAKE_FORMAT (F64LE, GST_AUDIO_FORMAT_FLAG_FLOAT, G_LITTLE_ENDIAN, 64, 64, SILENT_0), - MAKE_FORMAT (F64_BE, GST_AUDIO_FORMAT_FLAG_FLOAT, G_BIG_ENDIAN, 64, 64, + MAKE_FORMAT (F64BE, GST_AUDIO_FORMAT_FLAG_FLOAT, G_BIG_ENDIAN, 64, 64, SILENT_0) }; diff --git a/gst-libs/gst/audio/audio.h b/gst-libs/gst/audio/audio.h index 9bff91d..bf8f63f 100644 --- a/gst-libs/gst/audio/audio.h +++ b/gst-libs/gst/audio/audio.h @@ -33,34 +33,34 @@ G_BEGIN_DECLS * @GST_AUDIO_FORMAT_UNKNOWN: unknown audio format * @GST_AUDIO_FORMAT_S8: sample * @GST_AUDIO_FORMAT_U8: sample - * @GST_AUDIO_FORMAT_S16_LE: sample - * @GST_AUDIO_FORMAT_S16_BE: sample - * @GST_AUDIO_FORMAT_U16_LE: sample - * @GST_AUDIO_FORMAT_U16_BE: sample - * @GST_AUDIO_FORMAT_S24_LE: sample - * @GST_AUDIO_FORMAT_S24_BE: sample - * @GST_AUDIO_FORMAT_U24_LE: sample - * @GST_AUDIO_FORMAT_U24_BE: sample - * @GST_AUDIO_FORMAT_S32_LE: sample - * @GST_AUDIO_FORMAT_S32_BE: sample - * @GST_AUDIO_FORMAT_U32_LE: sample - * @GST_AUDIO_FORMAT_U32_BE: sample - * @GST_AUDIO_FORMAT_S24_3LE: sample - * @GST_AUDIO_FORMAT_S24_3BE: sample - * @GST_AUDIO_FORMAT_U24_3LE: sample - * @GST_AUDIO_FORMAT_U24_3BE: sample - * @GST_AUDIO_FORMAT_S20_3LE: sample - * @GST_AUDIO_FORMAT_S20_3BE: sample - * @GST_AUDIO_FORMAT_U20_3LE: sample - * @GST_AUDIO_FORMAT_U20_3BE: sample - * @GST_AUDIO_FORMAT_S18_3LE: sample - * @GST_AUDIO_FORMAT_S18_3BE: sample - * @GST_AUDIO_FORMAT_U18_3LE: sample - * @GST_AUDIO_FORMAT_U18_3BE: sample - * @GST_AUDIO_FORMAT_F32_LE: sample - * @GST_AUDIO_FORMAT_F32_BE: sample - * @GST_AUDIO_FORMAT_F64_LE: sample - * @GST_AUDIO_FORMAT_F64_BE: sample + * @GST_AUDIO_FORMAT_S16LE: sample + * @GST_AUDIO_FORMAT_S16BE: sample + * @GST_AUDIO_FORMAT_U16LE: sample + * @GST_AUDIO_FORMAT_U16BE: sample + * @GST_AUDIO_FORMAT_S24_32LE: sample + * @GST_AUDIO_FORMAT_S24_32BE: sample + * @GST_AUDIO_FORMAT_U24_32LE: sample + * @GST_AUDIO_FORMAT_U24_32BE: sample + * @GST_AUDIO_FORMAT_S32LE: sample + * @GST_AUDIO_FORMAT_S32BE: sample + * @GST_AUDIO_FORMAT_U32LE: sample + * @GST_AUDIO_FORMAT_U32BE: sample + * @GST_AUDIO_FORMAT_S24LE: sample + * @GST_AUDIO_FORMAT_S24BE: sample + * @GST_AUDIO_FORMAT_U24LE: sample + * @GST_AUDIO_FORMAT_U24BE: sample + * @GST_AUDIO_FORMAT_S20LE: sample + * @GST_AUDIO_FORMAT_S20BE: sample + * @GST_AUDIO_FORMAT_U20LE: sample + * @GST_AUDIO_FORMAT_U20BE: sample + * @GST_AUDIO_FORMAT_S18LE: sample + * @GST_AUDIO_FORMAT_S18BE: sample + * @GST_AUDIO_FORMAT_U18LE: sample + * @GST_AUDIO_FORMAT_U18BE: sample + * @GST_AUDIO_FORMAT_F32LE: sample + * @GST_AUDIO_FORMAT_F32BE: sample + * @GST_AUDIO_FORMAT_F64LE: sample + * @GST_AUDIO_FORMAT_F64BE: sample * * Enum value describing the most common audio formats. */ @@ -70,70 +70,70 @@ typedef enum { GST_AUDIO_FORMAT_S8, GST_AUDIO_FORMAT_U8, /* 16 bit */ - GST_AUDIO_FORMAT_S16_LE, - GST_AUDIO_FORMAT_S16_BE, - GST_AUDIO_FORMAT_U16_LE, - GST_AUDIO_FORMAT_U16_BE, + GST_AUDIO_FORMAT_S16LE, + GST_AUDIO_FORMAT_S16BE, + GST_AUDIO_FORMAT_U16LE, + GST_AUDIO_FORMAT_U16BE, /* 24 bit in low 3 bytes of 32 bits*/ - GST_AUDIO_FORMAT_S24_LE, - GST_AUDIO_FORMAT_S24_BE, - GST_AUDIO_FORMAT_U24_LE, - GST_AUDIO_FORMAT_U24_BE, + GST_AUDIO_FORMAT_S24_32LE, + GST_AUDIO_FORMAT_S24_32BE, + GST_AUDIO_FORMAT_U24_32LE, + GST_AUDIO_FORMAT_U24_32BE, /* 32 bit */ - GST_AUDIO_FORMAT_S32_LE, - GST_AUDIO_FORMAT_S32_BE, - GST_AUDIO_FORMAT_U32_LE, - GST_AUDIO_FORMAT_U32_BE, + GST_AUDIO_FORMAT_S32LE, + GST_AUDIO_FORMAT_S32BE, + GST_AUDIO_FORMAT_U32LE, + GST_AUDIO_FORMAT_U32BE, /* 24 bit in 3 bytes*/ - GST_AUDIO_FORMAT_S24_3LE, - GST_AUDIO_FORMAT_S24_3BE, - GST_AUDIO_FORMAT_U24_3LE, - GST_AUDIO_FORMAT_U24_3BE, + GST_AUDIO_FORMAT_S24LE, + GST_AUDIO_FORMAT_S24BE, + GST_AUDIO_FORMAT_U24LE, + GST_AUDIO_FORMAT_U24BE, /* 20 bit in 3 bytes*/ - GST_AUDIO_FORMAT_S20_3LE, - GST_AUDIO_FORMAT_S20_3BE, - GST_AUDIO_FORMAT_U20_3LE, - GST_AUDIO_FORMAT_U20_3BE, + GST_AUDIO_FORMAT_S20LE, + GST_AUDIO_FORMAT_S20BE, + GST_AUDIO_FORMAT_U20LE, + GST_AUDIO_FORMAT_U20BE, /* 18 bit in 3 bytes*/ - GST_AUDIO_FORMAT_S18_3LE, - GST_AUDIO_FORMAT_S18_3BE, - GST_AUDIO_FORMAT_U18_3LE, - GST_AUDIO_FORMAT_U18_3BE, + GST_AUDIO_FORMAT_S18LE, + GST_AUDIO_FORMAT_S18BE, + GST_AUDIO_FORMAT_U18LE, + GST_AUDIO_FORMAT_U18BE, /* float */ - GST_AUDIO_FORMAT_F32_LE, - GST_AUDIO_FORMAT_F32_BE, - GST_AUDIO_FORMAT_F64_LE, - GST_AUDIO_FORMAT_F64_BE, + GST_AUDIO_FORMAT_F32LE, + GST_AUDIO_FORMAT_F32BE, + GST_AUDIO_FORMAT_F64LE, + GST_AUDIO_FORMAT_F64BE, #if G_BYTE_ORDER == G_BIG_ENDIAN - GST_AUDIO_FORMAT_S16 = GST_AUDIO_FORMAT_S16_BE, - GST_AUDIO_FORMAT_U16 = GST_AUDIO_FORMAT_U16_BE, - GST_AUDIO_FORMAT_S24 = GST_AUDIO_FORMAT_S24_BE, - GST_AUDIO_FORMAT_U24 = GST_AUDIO_FORMAT_U24_BE, - GST_AUDIO_FORMAT_S32 = GST_AUDIO_FORMAT_S32_BE, - GST_AUDIO_FORMAT_U32 = GST_AUDIO_FORMAT_U32_BE, - GST_AUDIO_FORMAT_S24_3 = GST_AUDIO_FORMAT_S24_3BE, - GST_AUDIO_FORMAT_U24_3 = GST_AUDIO_FORMAT_U24_3BE, - GST_AUDIO_FORMAT_S20_3 = GST_AUDIO_FORMAT_S20_3BE, - GST_AUDIO_FORMAT_U20_3 = GST_AUDIO_FORMAT_U20_3BE, - GST_AUDIO_FORMAT_S18_3 = GST_AUDIO_FORMAT_S18_3BE, - GST_AUDIO_FORMAT_U18_3 = GST_AUDIO_FORMAT_U18_3BE, - GST_AUDIO_FORMAT_F32 = GST_AUDIO_FORMAT_F32_BE, - GST_AUDIO_FORMAT_F64 = GST_AUDIO_FORMAT_F64_BE + GST_AUDIO_FORMAT_S16 = GST_AUDIO_FORMAT_S16BE, + GST_AUDIO_FORMAT_U16 = GST_AUDIO_FORMAT_U16BE, + GST_AUDIO_FORMAT_S24_32 = GST_AUDIO_FORMAT_S24_32BE, + GST_AUDIO_FORMAT_U24_32 = GST_AUDIO_FORMAT_U24_32BE, + GST_AUDIO_FORMAT_S32 = GST_AUDIO_FORMAT_S32BE, + GST_AUDIO_FORMAT_U32 = GST_AUDIO_FORMAT_U32BE, + GST_AUDIO_FORMAT_S24 = GST_AUDIO_FORMAT_S24BE, + GST_AUDIO_FORMAT_U24 = GST_AUDIO_FORMAT_U24BE, + GST_AUDIO_FORMAT_S20 = GST_AUDIO_FORMAT_S20BE, + GST_AUDIO_FORMAT_U20 = GST_AUDIO_FORMAT_U20BE, + GST_AUDIO_FORMAT_S18 = GST_AUDIO_FORMAT_S18BE, + GST_AUDIO_FORMAT_U18 = GST_AUDIO_FORMAT_U18BE, + GST_AUDIO_FORMAT_F32 = GST_AUDIO_FORMAT_F32BE, + GST_AUDIO_FORMAT_F64 = GST_AUDIO_FORMAT_F64BE #elif G_BYTE_ORDER == G_LITTLE_ENDIAN - GST_AUDIO_FORMAT_S16 = GST_AUDIO_FORMAT_S16_LE, - GST_AUDIO_FORMAT_U16 = GST_AUDIO_FORMAT_U16_LE, - GST_AUDIO_FORMAT_S24 = GST_AUDIO_FORMAT_S24_LE, - GST_AUDIO_FORMAT_U24 = GST_AUDIO_FORMAT_U24_LE, - GST_AUDIO_FORMAT_S32 = GST_AUDIO_FORMAT_S32_LE, - GST_AUDIO_FORMAT_U32 = GST_AUDIO_FORMAT_U32_LE, - GST_AUDIO_FORMAT_S24_3 = GST_AUDIO_FORMAT_S24_3LE, - GST_AUDIO_FORMAT_U24_3 = GST_AUDIO_FORMAT_U24_3LE, - GST_AUDIO_FORMAT_S20_3 = GST_AUDIO_FORMAT_S20_3LE, - GST_AUDIO_FORMAT_U20_3 = GST_AUDIO_FORMAT_U20_3LE, - GST_AUDIO_FORMAT_S18_3 = GST_AUDIO_FORMAT_S18_3LE, - GST_AUDIO_FORMAT_U18_3 = GST_AUDIO_FORMAT_U18_3LE, - GST_AUDIO_FORMAT_F32 = GST_AUDIO_FORMAT_F32_LE, - GST_AUDIO_FORMAT_F64 = GST_AUDIO_FORMAT_F64_LE + GST_AUDIO_FORMAT_S16 = GST_AUDIO_FORMAT_S16LE, + GST_AUDIO_FORMAT_U16 = GST_AUDIO_FORMAT_U16LE, + GST_AUDIO_FORMAT_S24_32 = GST_AUDIO_FORMAT_S24_32LE, + GST_AUDIO_FORMAT_U24_32 = GST_AUDIO_FORMAT_U24_32LE, + GST_AUDIO_FORMAT_S32 = GST_AUDIO_FORMAT_S32LE, + GST_AUDIO_FORMAT_U32 = GST_AUDIO_FORMAT_U32LE, + GST_AUDIO_FORMAT_S24 = GST_AUDIO_FORMAT_S24LE, + GST_AUDIO_FORMAT_U24 = GST_AUDIO_FORMAT_U24LE, + GST_AUDIO_FORMAT_S20 = GST_AUDIO_FORMAT_S20LE, + GST_AUDIO_FORMAT_U20 = GST_AUDIO_FORMAT_U20LE, + GST_AUDIO_FORMAT_S18 = GST_AUDIO_FORMAT_S18LE, + GST_AUDIO_FORMAT_U18 = GST_AUDIO_FORMAT_U18LE, + GST_AUDIO_FORMAT_F32 = GST_AUDIO_FORMAT_F32LE, + GST_AUDIO_FORMAT_F64 = GST_AUDIO_FORMAT_F64LE #endif } GstAudioFormat; @@ -308,26 +308,26 @@ gboolean gst_audio_info_convert (GstAudioInfo * info, #define GST_AUDIO_CHANNELS_RANGE "(int) [ 1, max ]" #if G_BYTE_ORDER == G_LITTLE_ENDIAN -# define GST_AUDIO_NE(s) G_STRINGIFY(s)"_LE" -# define GST_AUDIO_OE(s) G_STRINGIFY(s)"_BE" +# define GST_AUDIO_NE(s) G_STRINGIFY(s)"LE" +# define GST_AUDIO_OE(s) G_STRINGIFY(s)"BE" #else -# define GST_AUDIO_NE(s) G_STRINGIFY(s)"_BE" -# define GST_AUDIO_OE(s) G_STRINGIFY(s)"_LE" +# define GST_AUDIO_NE(s) G_STRINGIFY(s)"BE" +# define GST_AUDIO_OE(s) G_STRINGIFY(s)"LE" #endif #define GST_AUDIO_FORMATS_ALL " { S8, U8, " \ - "S16_LE, S16_BE, U16_LE, U16_BE, " \ - "S24_LE, S24_BE, U24_LE, U24_BE, " \ - "S32_LE, S32_BE, U32_LE, U32_BE, " \ - "S24_3LE, S24_3BE, U24_3LE, U24_3BE, " \ - "S20_3LE, S20_3BE, U20_3LE, U20_3BE, " \ - "S18_3LE, S18_3BE, U18_3LE, U18_3BE, " \ - "F32_LE, F32_BE, F64_LE, F64_BE }" + "S16LE, S16BE, U16LE, U16BE, " \ + "S24_32LE, S24_32BE, U24_32LE, U24_32BE, " \ + "S32LE, S32BE, U32LE, U32BE, " \ + "S24LE, S24BE, U24LE, U24BE, " \ + "S20LE, S20BE, U20LE, U20BE, " \ + "S18LE, S18BE, U18LE, U18BE, " \ + "F32LE, F32BE, F64LE, F64BE }" /** * GST_AUDIO_CAPS_MAKE: * @format: string format that describes the pixel layout, as string - * (e.g. "S16_LE", "S8", etc.) + * (e.g. "S16LE", "S8", etc.) * * Generic caps string for audio, for use in pad templates. */ @@ -354,7 +354,7 @@ gboolean gst_audio_info_convert (GstAudioInfo * info, * * Standard format used in consumer audio. */ -#define GST_AUDIO_DEF_FORMAT "S16_LE" +#define GST_AUDIO_DEF_FORMAT "S16LE" /* conversion macros */ /** diff --git a/gst-libs/gst/cdda/gstcddabasesrc.c b/gst-libs/gst/cdda/gstcddabasesrc.c index 47c82ee..e308bbe 100644 --- a/gst-libs/gst/cdda/gstcddabasesrc.c +++ b/gst-libs/gst/cdda/gstcddabasesrc.c @@ -88,6 +88,7 @@ #include #include /* for strtol */ +#include #include "gstcddabasesrc.h" #include "gst/gst-i18n-plugin.h" @@ -142,11 +143,8 @@ G_DEFINE_TYPE_WITH_CODE (GstCddaBaseSrc, gst_cdda_base_src, GST_TYPE_PUSH_SRC, gst_cdda_base_src_uri_handler_init)); #define SRC_CAPS \ - "audio/x-raw-int, " \ - "endianness = (int) BYTE_ORDER, " \ - "signed = (boolean) true, " \ - "width = (int) 16, " \ - "depth = (int) 16, " \ + "audio/x-raw, " \ + "format = (string) " GST_AUDIO_NE(S16) ", " \ "rate = (int) 44100, " \ "channels = (int) 2" \ diff --git a/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c index f33e4b5..90e7392 100644 --- a/gst-libs/gst/riff/riff-media.c +++ b/gst-libs/gst/riff/riff-media.c @@ -1158,8 +1158,8 @@ gst_riff_create_audio_caps (guint16 codec_id, } else { /* FIXME: this is pretty useless - we need fixed caps */ caps = gst_caps_from_string ("audio/x-raw, " - "format = (string) { S8, U8, S16_LE, U16_LE, S24_LE, " - "U24_LE, S32_LE, U32_LE }"); + "format = (string) { S8, U8, S16LE, U16LE, S24LE, " + "U24LE, S32LE, U32LE }"); } if (codec_name && strf) *codec_name = g_strdup_printf ("Uncompressed %d-bit PCM audio", @@ -1184,7 +1184,7 @@ gst_riff_create_audio_caps (guint16 codec_id, gint wd = ba * 8 / ch; caps = gst_caps_new_simple ("audio/x-raw", - "format", G_TYPE_STRING, wd == 64 ? "F64_LE" : "F32_LE", + "format", G_TYPE_STRING, wd == 64 ? "F64LE" : "F32LE", "channels", G_TYPE_INT, ch, NULL); /* Add default channel layout. In theory this should be done @@ -1202,7 +1202,7 @@ gst_riff_create_audio_caps (guint16 codec_id, } else { /* FIXME: this is pretty useless - we need fixed caps */ caps = gst_caps_from_string ("audio/x-raw, " - "format = (string) { F32_LE, F64_LE }"); + "format = (string) { F32LE, F64LE }"); } if (codec_name && strf) *codec_name = g_strdup_printf ("Uncompressed %d-bit IEEE float audio", @@ -1536,7 +1536,7 @@ gst_riff_create_audio_caps (guint16 codec_id, gint wd = ba * 8 / strf->channels; caps = gst_caps_new_simple ("audio/x-raw", - "format", G_TYPE_STRING, wd == 32 ? "F32_LE" : "F64_LE", + "format", G_TYPE_STRING, wd == 32 ? "F32LE" : "F64LE", "channels", G_TYPE_INT, strf->channels, "rate", G_TYPE_INT, strf->rate, NULL); diff --git a/gst/adder/gstadder.c b/gst/adder/gstadder.c index 296170a..7ed48cd 100644 --- a/gst/adder/gstadder.c +++ b/gst/adder/gstadder.c @@ -73,8 +73,13 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); /* elementfactory information */ +#if G_BYTE_ORDER == G_LITTLE_ENDIAN #define CAPS \ - GST_AUDIO_CAPS_MAKE ("{ S32, U32, S16, U16, S8, U8, F32, F64 }") + GST_AUDIO_CAPS_MAKE ("{ S32LE, U32LE, S16LE, U16LE, S8, U8, F32LE, F64LE }") +#else +#define CAPS \ + GST_AUDIO_CAPS_MAKE ("{ S32BE, U32BE, S16BE, U16BE, S8, U8, F32BE, F64BE }") +#endif static GstStaticPadTemplate gst_adder_src_template = GST_STATIC_PAD_TEMPLATE ("src", diff --git a/gst/audiorate/gstaudiorate.c b/gst/audiorate/gstaudiorate.c index 8661c24..743933c 100644 --- a/gst/audiorate/gstaudiorate.c +++ b/gst/audiorate/gstaudiorate.c @@ -368,59 +368,8 @@ static gboolean gst_audio_rate_convert (GstAudioRate * audiorate, GstFormat src_fmt, guint64 src_val, GstFormat dest_fmt, guint64 * dest_val) { - gint rate, bpf; - - if (src_fmt == dest_fmt) { - *dest_val = src_val; - return TRUE; - } - - rate = GST_AUDIO_INFO_RATE (&audiorate->info); - bpf = GST_AUDIO_INFO_BPF (&audiorate->info); - - switch (src_fmt) { - case GST_FORMAT_DEFAULT: - switch (dest_fmt) { - case GST_FORMAT_BYTES: - *dest_val = src_val * bpf; - break; - case GST_FORMAT_TIME: - *dest_val = gst_util_uint64_scale_int (src_val, GST_SECOND, rate); - break; - default: - return FALSE;; - } - break; - case GST_FORMAT_BYTES: - switch (dest_fmt) { - case GST_FORMAT_DEFAULT: - *dest_val = src_val / bpf; - break; - case GST_FORMAT_TIME: - *dest_val = gst_util_uint64_scale_int (src_val, GST_SECOND, - rate * bpf); - break; - default: - return FALSE;; - } - break; - case GST_FORMAT_TIME: - switch (dest_fmt) { - case GST_FORMAT_BYTES: - *dest_val = gst_util_uint64_scale_int (src_val, - rate * bpf, GST_SECOND); - break; - case GST_FORMAT_DEFAULT: - *dest_val = gst_util_uint64_scale_int (src_val, rate, GST_SECOND); - break; - default: - return FALSE; - } - break; - default: - return FALSE; - } - return TRUE; + return gst_audio_info_convert (&audiorate->info, src_fmt, src_val, dest_fmt, + (gint64 *) dest_val); } diff --git a/gst/audioresample/gstaudioresample.c b/gst/audioresample/gstaudioresample.c index 29464b0..358061e 100644 --- a/gst/audioresample/gstaudioresample.c +++ b/gst/audioresample/gstaudioresample.c @@ -67,10 +67,10 @@ enum #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define SUPPORTED_CAPS \ - GST_AUDIO_CAPS_MAKE ("{ F32_LE, F64_LE, S32_LE, S24_3LE, S16_LE, S8 }") + GST_AUDIO_CAPS_MAKE ("{ F32LE, F64LE, S32LE, S24LE, S16LE, S8 }") #else #define SUPPORTED_CAPS \ - GST_AUDIO_CAPS_MAKE ("{ F32_BE, F64_BE, S32_BE, S24_3BE, S16_BE, S8 }") + GST_AUDIO_CAPS_MAKE ("{ F32BE, F64BE, S32BE, S24BE, S16BE, S8 }") #endif /* If TRUE integer arithmetic resampling is faster and will be used if appropiate */ diff --git a/gst/audiotestsrc/gstaudiotestsrc.c b/gst/audiotestsrc/gstaudiotestsrc.c index 983d9e7..01b7d8a 100644 --- a/gst/audiotestsrc/gstaudiotestsrc.c +++ b/gst/audiotestsrc/gstaudiotestsrc.c @@ -77,11 +77,11 @@ enum }; #if G_BYTE_ORDER == G_LITTLE_ENDIAN -#define FORMAT_STR "{ S16_LE, S32_LE, F32_LE, F64_LE }" -#define DEFAULT_FORMAT_STR "S16_LE" +#define FORMAT_STR "{ S16LE, S32LE, F32LE, F64LE }" +#define DEFAULT_FORMAT_STR "S16LE" #else -#define FORMAT_STR "{ S16_BE, S32_BE, F32_BE, F64_BE }" -#define DEFAULT_FORMAT_STR "S16_BE" +#define FORMAT_STR "{ S16BE, S32BE, F32BE, F64BE }" +#define DEFAULT_FORMAT_STR "S16BE" #endif static GstStaticPadTemplate gst_audio_test_src_src_template = diff --git a/gst/volume/gstvolume.c b/gst/volume/gstvolume.c index 3e792f5..9910da4 100644 --- a/gst/volume/gstvolume.c +++ b/gst/volume/gstvolume.c @@ -106,10 +106,10 @@ enum #if G_BYTE_ORDER == G_LITTLE_ENDIAN #define ALLOWED_CAPS \ - GST_AUDIO_CAPS_MAKE ("{ F32_LE, F64_LE, S8, S16_LE, S24_3LE, S32_LE }") + GST_AUDIO_CAPS_MAKE ("{ F32LE, F64LE, S8, S16LE, S24LE, S32LE }") #else #define ALLOWED_CAPS \ - GST_AUDIO_CAPS_MAKE ("{ F32_BE, F64_BE, S8, S16_BE, S24_3BE, S32_BE }") + GST_AUDIO_CAPS_MAKE ("{ F32BE, F64BE, S8, S16BE, S24BE, S32BE }") #endif static void gst_volume_mixer_init (GstMixerClass * iface); @@ -193,7 +193,7 @@ volume_choose_func (GstVolume * self) } self->process_controlled = volume_process_controlled_int32_clamp; break; - case GST_AUDIO_FORMAT_S24_3: + case GST_AUDIO_FORMAT_S24: /* only clamp if the gain is greater than 1.0 */ if (self->current_vol_i24 > VOLUME_UNITY_INT24) { self->process = volume_process_int24_clamp; -- 2.7.4