27 #include <sys/types.h>
28 #include <sys/param.h>
31 #include <pulse/cdecl.h>
114 #if !defined(WORDS_BIGENDIAN)
116 #if defined(__BYTE_ORDER)
117 #if __BYTE_ORDER == __BIG_ENDIAN
118 #define WORDS_BIGENDIAN
123 #if defined(__sparc__) && defined(_BIG_ENDIAN)
124 #define WORDS_BIGENDIAN
130 #define PA_CHANNELS_MAX 32U
133 #define PA_RATE_MAX (48000U*4U)
183 #ifdef WORDS_BIGENDIAN
185 #define PA_SAMPLE_S16NE PA_SAMPLE_S16BE
187 #define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32BE
189 #define PA_SAMPLE_S32NE PA_SAMPLE_S32BE
191 #define PA_SAMPLE_S24NE PA_SAMPLE_S24BE
193 #define PA_SAMPLE_S24_32NE PA_SAMPLE_S24_32BE
196 #define PA_SAMPLE_S16RE PA_SAMPLE_S16LE
198 #define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32LE
200 #define PA_SAMPLE_S32RE PA_SAMPLE_S32LE
202 #define PA_SAMPLE_S24RE PA_SAMPLE_S24LE
204 #define PA_SAMPLE_S24_32RE PA_SAMPLE_S24_32LE
207 #define PA_SAMPLE_S16NE PA_SAMPLE_S16LE
209 #define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32LE
211 #define PA_SAMPLE_S32NE PA_SAMPLE_S32LE
213 #define PA_SAMPLE_S24NE PA_SAMPLE_S24LE
215 #define PA_SAMPLE_S24_32NE PA_SAMPLE_S24_32LE
218 #define PA_SAMPLE_S16RE PA_SAMPLE_S16BE
220 #define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32BE
222 #define PA_SAMPLE_S32RE PA_SAMPLE_S32BE
224 #define PA_SAMPLE_S24RE PA_SAMPLE_S24BE
226 #define PA_SAMPLE_S24_32RE PA_SAMPLE_S24_32BE
230 #define PA_SAMPLE_FLOAT32 PA_SAMPLE_FLOAT32NE
234 #define PA_SAMPLE_U8 PA_SAMPLE_U8
235 #define PA_SAMPLE_ALAW PA_SAMPLE_ALAW
236 #define PA_SAMPLE_ULAW PA_SAMPLE_ULAW
237 #define PA_SAMPLE_S16LE PA_SAMPLE_S16LE
238 #define PA_SAMPLE_S16BE PA_SAMPLE_S16BE
239 #define PA_SAMPLE_FLOAT32LE PA_SAMPLE_FLOAT32LE
240 #define PA_SAMPLE_FLOAT32BE PA_SAMPLE_FLOAT32BE
241 #define PA_SAMPLE_S32LE PA_SAMPLE_S32LE
242 #define PA_SAMPLE_S32BE PA_SAMPLE_S32BE
243 #define PA_SAMPLE_S24LE PA_SAMPLE_S24LE
244 #define PA_SAMPLE_S24BE PA_SAMPLE_S24BE
245 #define PA_SAMPLE_S24_32LE PA_SAMPLE_S24_32LE
246 #define PA_SAMPLE_S24_32BE PA_SAMPLE_S24_32BE
319 #define PA_SAMPLE_SPEC_SNPRINT_MAX 32
329 #define PA_BYTES_SNPRINT_MAX 11
342 #ifdef WORDS_BIGENDIAN
343 #define pa_sample_format_is_ne(f) pa_sample_format_is_be(f)
344 #define pa_sample_format_is_re(f) pa_sample_format_is_le(f)
348 #define pa_sample_format_is_ne(f) pa_sample_format_is_le(f)
351 #define pa_sample_format_is_re(f) pa_sample_format_is_be(f)
const char * pa_sample_format_to_string(pa_sample_format_t f) PA_GCC_PURE
Return a descriptive string for the specified sample format.
A sample format and attribute specification.
Definition: sample.h:250
8 Bit a-Law
Definition: sample.h:140
int pa_sample_format_valid(unsigned format) PA_GCC_PURE
Return non-zero if the given integer is a valid sample format.
pa_sample_format_t pa_parse_sample_format(const char *format) PA_GCC_PURE
Parse a sample format text.
Signed 24 Bit PCM packed, little endian (PC).
Definition: sample.h:164
Signed 16 Bit PCM, big endian.
Definition: sample.h:149
pa_sample_format
Sample format.
Definition: sample.h:136
size_t pa_sample_size(const pa_sample_spec *spec) PA_GCC_PURE
Return the size of a sample with the specific sample type.
size_t pa_sample_size_of_format(pa_sample_format_t f) PA_GCC_PURE
Similar to pa_sample_size() but take a sample format instead of a full sample spec.
uint8_t channels
Audio channels.
Definition: sample.h:257
uint64_t pa_usec_t
Type for usec specifications (unsigned).
Definition: sample.h:262
enum pa_sample_format pa_sample_format_t
Sample format.
#define PA_GCC_PURE
This function's return value depends only the arguments list and global state.
Definition: gccmacro.h:75
int pa_channels_valid(uint8_t channels) PA_GCC_PURE
Return non-zero if the channel count is within the supported range.
uint32_t rate
The sample rate.
Definition: sample.h:254
Signed 24 Bit PCM in LSB of 32 Bit words, little endian (PC).
Definition: sample.h:170
int pa_sample_format_is_be(pa_sample_format_t f) PA_GCC_PURE
Return 1 when the specified format is big endian, return -1 when endianness does not apply to this fo...
int pa_sample_spec_equal(const pa_sample_spec *a, const pa_sample_spec *b) PA_GCC_PURE
Return non-zero when the two sample type specifications match.
int pa_sample_spec_valid(const pa_sample_spec *spec) PA_GCC_PURE
Return non-zero when the sample type specification is valid.
size_t pa_bytes_per_second(const pa_sample_spec *spec) PA_GCC_PURE
Return the amount of bytes playback of a second of audio with the specified sample type takes...
pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec) PA_GCC_PURE
Calculate the time the specified bytes take to play with the specified sample type.
An invalid value.
Definition: sample.h:179
Upper limit of valid sample types.
Definition: sample.h:176
8 Bit mu-Law
Definition: sample.h:143
32 Bit IEEE floating point, big endian, range -1.0 to 1.0
Definition: sample.h:155
Signed 16 Bit PCM, little endian (PC)
Definition: sample.h:146
pa_sample_spec * pa_sample_spec_init(pa_sample_spec *spec)
Initialize the specified sample spec and return a pointer to it.
Unsigned 8 Bit PCM.
Definition: sample.h:137
Signed 32 Bit PCM, little endian (PC)
Definition: sample.h:158
Signed 24 Bit PCM packed, big endian.
Definition: sample.h:167
Signed 24 Bit PCM in LSB of 32 Bit words, big endian.
Definition: sample.h:173
char * pa_bytes_snprint(char *s, size_t l, unsigned v)
Pretty print a byte size value (i.e. "2.5 MiB")
32 Bit IEEE floating point, little endian (PC), range -1.0 to 1.0
Definition: sample.h:152
int pa_sample_rate_valid(uint32_t rate) PA_GCC_PURE
Return non-zero if the rate is within the supported range.
size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec) PA_GCC_PURE
Calculates the number of bytes that are required for the specified time.
size_t pa_frame_size(const pa_sample_spec *spec) PA_GCC_PURE
Return the size of a frame with the specific sample type.
char * pa_sample_spec_snprint(char *s, size_t l, const pa_sample_spec *spec)
Pretty print a sample type specification to a string.
Signed 32 Bit PCM, big endian.
Definition: sample.h:161
pa_sample_format_t format
The sample format.
Definition: sample.h:251
struct pa_sample_spec pa_sample_spec
A sample format and attribute specification.
int pa_sample_format_is_le(pa_sample_format_t f) PA_GCC_PURE
Return 1 when the specified format is little endian, return -1 when endianness does not apply to this...