mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-08 13:29:59 -05:00
add support for 32bit integer samples
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2037 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
3c17c7d442
commit
7e0f547f2f
12 changed files with 319 additions and 17 deletions
|
|
@ -44,7 +44,9 @@ size_t pa_sample_size(const pa_sample_spec *spec) {
|
|||
[PA_SAMPLE_S16LE] = 2,
|
||||
[PA_SAMPLE_S16BE] = 2,
|
||||
[PA_SAMPLE_FLOAT32LE] = 4,
|
||||
[PA_SAMPLE_FLOAT32BE] = 4
|
||||
[PA_SAMPLE_FLOAT32BE] = 4,
|
||||
[PA_SAMPLE_S32LE] = 4,
|
||||
[PA_SAMPLE_S32BE] = 4,
|
||||
};
|
||||
|
||||
pa_assert(spec);
|
||||
|
|
@ -107,6 +109,8 @@ const char *pa_sample_format_to_string(pa_sample_format_t f) {
|
|||
[PA_SAMPLE_S16BE] = "s16be",
|
||||
[PA_SAMPLE_FLOAT32LE] = "float32le",
|
||||
[PA_SAMPLE_FLOAT32BE] = "float32be",
|
||||
[PA_SAMPLE_S32LE] = "s32le",
|
||||
[PA_SAMPLE_S32BE] = "s32be",
|
||||
};
|
||||
|
||||
if (f < 0 || f >= PA_SAMPLE_MAX)
|
||||
|
|
@ -156,7 +160,7 @@ pa_sample_format_t pa_parse_sample_format(const char *format) {
|
|||
return PA_SAMPLE_S16RE;
|
||||
else if (strcasecmp(format, "u8") == 0 || strcasecmp(format, "8") == 0)
|
||||
return PA_SAMPLE_U8;
|
||||
else if (strcasecmp(format, "float32") == 0 || strcasecmp(format, "float32ne") == 0)
|
||||
else if (strcasecmp(format, "float32") == 0 || strcasecmp(format, "float32ne") == 0 || strcasecmp(format, "float") == 0)
|
||||
return PA_SAMPLE_FLOAT32NE;
|
||||
else if (strcasecmp(format, "float32re") == 0)
|
||||
return PA_SAMPLE_FLOAT32RE;
|
||||
|
|
@ -168,6 +172,14 @@ pa_sample_format_t pa_parse_sample_format(const char *format) {
|
|||
return PA_SAMPLE_ULAW;
|
||||
else if (strcasecmp(format, "alaw") == 0)
|
||||
return PA_SAMPLE_ALAW;
|
||||
else if (strcasecmp(format, "s32le") == 0)
|
||||
return PA_SAMPLE_S32LE;
|
||||
else if (strcasecmp(format, "s32be") == 0)
|
||||
return PA_SAMPLE_S32BE;
|
||||
else if (strcasecmp(format, "s32ne") == 0 || strcasecmp(format, "s32") == 0 || strcasecmp(format, "32") == 0)
|
||||
return PA_SAMPLE_S32NE;
|
||||
else if (strcasecmp(format, "s32re") == 0)
|
||||
return PA_SAMPLE_S32RE;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,13 +42,15 @@
|
|||
*
|
||||
* PulseAudio supports the following sample formats:
|
||||
*
|
||||
* \li PA_SAMPLE_U8 - Unsigned 8 bit PCM.
|
||||
* \li PA_SAMPLE_S16LE - Signed 16 bit PCM, little endian.
|
||||
* \li PA_SAMPLE_S16BE - Signed 16 bit PCM, big endian.
|
||||
* \li PA_SAMPLE_U8 - Unsigned 8 bit integer PCM.
|
||||
* \li PA_SAMPLE_S16LE - Signed 16 integer bit PCM, little endian.
|
||||
* \li PA_SAMPLE_S16BE - Signed 16 integer bit PCM, big endian.
|
||||
* \li PA_SAMPLE_FLOAT32LE - 32 bit IEEE floating point PCM, little endian.
|
||||
* \li PA_SAMPLE_FLOAT32BE - 32 bit IEEE floating point PCM, big endian.
|
||||
* \li PA_SAMPLE_ALAW - 8 bit a-Law.
|
||||
* \li PA_SAMPLE_ULAW - 8 bit mu-Law.
|
||||
* \li PA_SAMPLE_S32LE - Signed 32 bit integer PCM, little endian.
|
||||
* \li PA_SAMPLE_S32BE - Signed 32 bit integer PCM, big endian.
|
||||
*
|
||||
* The floating point sample formats have the range from -1 to 1.
|
||||
*
|
||||
|
|
@ -117,6 +119,8 @@ typedef enum pa_sample_format {
|
|||
PA_SAMPLE_S16BE, /**< Signed 16 Bit PCM, big endian */
|
||||
PA_SAMPLE_FLOAT32LE, /**< 32 Bit IEEE floating point, little endian, range -1 to 1 */
|
||||
PA_SAMPLE_FLOAT32BE, /**< 32 Bit IEEE floating point, big endian, range -1 to 1 */
|
||||
PA_SAMPLE_S32LE, /**< Signed 32 Bit PCM, little endian (PC) */
|
||||
PA_SAMPLE_S32BE, /**< Signed 32 Bit PCM, big endian (PC) */
|
||||
PA_SAMPLE_MAX, /**< Upper limit of valid sample types */
|
||||
PA_SAMPLE_INVALID = -1 /**< An invalid value */
|
||||
} pa_sample_format_t;
|
||||
|
|
@ -126,19 +130,27 @@ typedef enum pa_sample_format {
|
|||
#define PA_SAMPLE_S16NE PA_SAMPLE_S16BE
|
||||
/** 32 Bit IEEE floating point, native endian */
|
||||
#define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32BE
|
||||
/** Signed 32 Bit PCM, native endian */
|
||||
#define PA_SAMPLE_S32NE PA_SAMPLE_S32BE
|
||||
/** Signed 16 Bit PCM reverse endian */
|
||||
#define PA_SAMPLE_S16RE PA_SAMPLE_S16LE
|
||||
/** 32 Bit IEEE floating point, reverse endian */
|
||||
#define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32LE
|
||||
/** Signed 32 Bit PCM reverse endian */
|
||||
#define PA_SAMPLE_S32RE PA_SAMPLE_S32LE
|
||||
#else
|
||||
/** Signed 16 Bit PCM, native endian */
|
||||
#define PA_SAMPLE_S16NE PA_SAMPLE_S16LE
|
||||
/** 32 Bit IEEE floating point, native endian */
|
||||
#define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32LE
|
||||
/** Signed 32 Bit PCM, native endian */
|
||||
#define PA_SAMPLE_S32NE PA_SAMPLE_S32LE
|
||||
/** Signed 16 Bit PCM reverse endian */
|
||||
#define PA_SAMPLE_S16RE PA_SAMPLE_S16BE
|
||||
/** 32 Bit IEEE floating point, reverse endian */
|
||||
#define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32BE
|
||||
/** Signed 32 Bit PCM reverse endian */
|
||||
#define PA_SAMPLE_S32RE PA_SAMPLE_S32BE
|
||||
#endif
|
||||
|
||||
/** A Shortcut for PA_SAMPLE_FLOAT32NE */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue