PulseAudio
4.0-186-ga89ca
Main Page
Related Pages
Data Structures
Files
Examples
File List
Globals
sample.h
Go to the documentation of this file.
1
#ifndef foosamplehfoo
2
#define foosamplehfoo
3
4
/***
5
This file is part of PulseAudio.
6
7
Copyright 2004-2006 Lennart Poettering
8
Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
9
10
PulseAudio is free software; you can redistribute it and/or modify
11
it under the terms of the GNU Lesser General Public License as published
12
by the Free Software Foundation; either version 2.1 of the License,
13
or (at your option) any later version.
14
15
PulseAudio is distributed in the hope that it will be useful, but
16
WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
General Public License for more details.
19
20
You should have received a copy of the GNU Lesser General Public License
21
along with PulseAudio; if not, write to the Free Software
22
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23
USA.
24
***/
25
26
#include <inttypes.h>
27
#include <sys/types.h>
28
#include <sys/param.h>
29
30
#include <
pulse/gccmacro.h
>
31
#include <pulse/cdecl.h>
32
#include <
pulse/version.h
>
33
112
PA_C_DECL_BEGIN
113
114
#if !defined(WORDS_BIGENDIAN)
115
116
#if defined(__BYTE_ORDER)
117
#if __BYTE_ORDER == __BIG_ENDIAN
118
#define WORDS_BIGENDIAN
119
#endif
120
#endif
121
122
/* On Sparc, WORDS_BIGENDIAN needs to be set if _BIG_ENDIAN is defined. */
123
#if defined(__sparc__) && defined(_BIG_ENDIAN)
124
#define WORDS_BIGENDIAN
125
#endif
126
127
#endif
128
130
#define PA_CHANNELS_MAX 32U
131
133
#define PA_RATE_MAX (48000U*4U)
134
136
typedef
enum
pa_sample_format
{
137
PA_SAMPLE_U8
,
140
PA_SAMPLE_ALAW
,
143
PA_SAMPLE_ULAW
,
146
PA_SAMPLE_S16LE
,
149
PA_SAMPLE_S16BE
,
152
PA_SAMPLE_FLOAT32LE
,
155
PA_SAMPLE_FLOAT32BE
,
158
PA_SAMPLE_S32LE
,
161
PA_SAMPLE_S32BE
,
164
PA_SAMPLE_S24LE
,
167
PA_SAMPLE_S24BE
,
170
PA_SAMPLE_S24_32LE
,
173
PA_SAMPLE_S24_32BE
,
176
PA_SAMPLE_MAX
,
179
PA_SAMPLE_INVALID
= -1
181
}
pa_sample_format_t
;
182
183
#ifdef WORDS_BIGENDIAN
184
185
#define PA_SAMPLE_S16NE PA_SAMPLE_S16BE
186
187
#define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32BE
188
189
#define PA_SAMPLE_S32NE PA_SAMPLE_S32BE
190
191
#define PA_SAMPLE_S24NE PA_SAMPLE_S24BE
192
193
#define PA_SAMPLE_S24_32NE PA_SAMPLE_S24_32BE
194
196
#define PA_SAMPLE_S16RE PA_SAMPLE_S16LE
197
198
#define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32LE
199
200
#define PA_SAMPLE_S32RE PA_SAMPLE_S32LE
201
202
#define PA_SAMPLE_S24RE PA_SAMPLE_S24LE
203
204
#define PA_SAMPLE_S24_32RE PA_SAMPLE_S24_32LE
205
#else
206
207
#define PA_SAMPLE_S16NE PA_SAMPLE_S16LE
208
209
#define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32LE
210
211
#define PA_SAMPLE_S32NE PA_SAMPLE_S32LE
212
213
#define PA_SAMPLE_S24NE PA_SAMPLE_S24LE
214
215
#define PA_SAMPLE_S24_32NE PA_SAMPLE_S24_32LE
216
218
#define PA_SAMPLE_S16RE PA_SAMPLE_S16BE
219
220
#define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32BE
221
222
#define PA_SAMPLE_S32RE PA_SAMPLE_S32BE
223
224
#define PA_SAMPLE_S24RE PA_SAMPLE_S24BE
225
226
#define PA_SAMPLE_S24_32RE PA_SAMPLE_S24_32BE
227
#endif
228
230
#define PA_SAMPLE_FLOAT32 PA_SAMPLE_FLOAT32NE
231
233
/* Allow clients to check with #ifdef for these sample formats */
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
247
250
typedef
struct
pa_sample_spec
{
251
pa_sample_format_t
format
;
254
uint32_t
rate
;
257
uint8_t
channels
;
259
}
pa_sample_spec
;
260
262
typedef
uint64_t
pa_usec_t
;
263
265
size_t
pa_bytes_per_second
(
const
pa_sample_spec
*spec)
PA_GCC_PURE
;
266
268
size_t
pa_frame_size
(
const
pa_sample_spec
*spec)
PA_GCC_PURE
;
269
271
size_t
pa_sample_size
(
const
pa_sample_spec
*spec)
PA_GCC_PURE
;
272
275
size_t
pa_sample_size_of_format
(
pa_sample_format_t
f)
PA_GCC_PURE
;
276
280
pa_usec_t
pa_bytes_to_usec
(uint64_t length,
const
pa_sample_spec
*spec)
PA_GCC_PURE
;
281
285
size_t
pa_usec_to_bytes
(
pa_usec_t
t,
const
pa_sample_spec
*spec)
PA_GCC_PURE
;
286
290
pa_sample_spec
*
pa_sample_spec_init
(
pa_sample_spec
*spec);
291
293
int
pa_sample_spec_valid
(
const
pa_sample_spec
*spec)
PA_GCC_PURE
;
294
296
int
pa_sample_spec_equal
(
const
pa_sample_spec
*a,
const
pa_sample_spec
*b)
PA_GCC_PURE
;
297
299
const
char
*
pa_sample_format_to_string
(
pa_sample_format_t
f)
PA_GCC_PURE
;
300
302
pa_sample_format_t
pa_parse_sample_format
(
const
char
*format)
PA_GCC_PURE
;
303
309
#define PA_SAMPLE_SPEC_SNPRINT_MAX 32
310
312
char
*
pa_sample_spec_snprint
(
char
*s,
size_t
l,
const
pa_sample_spec
*spec);
313
319
#define PA_BYTES_SNPRINT_MAX 11
320
322
char
*
pa_bytes_snprint
(
char
*s,
size_t
l,
unsigned
v);
323
326
int
pa_sample_format_is_le
(
pa_sample_format_t
f)
PA_GCC_PURE
;
327
330
int
pa_sample_format_is_be
(
pa_sample_format_t
f)
PA_GCC_PURE
;
331
332
#ifdef WORDS_BIGENDIAN
333
#define pa_sample_format_is_ne(f) pa_sample_format_is_be(f)
334
#define pa_sample_format_is_re(f) pa_sample_format_is_le(f)
335
#else
336
338
#define pa_sample_format_is_ne(f) pa_sample_format_is_le(f)
339
341
#define pa_sample_format_is_re(f) pa_sample_format_is_be(f)
342
#endif
343
344
PA_C_DECL_END
345
346
#endif
src
pulse
sample.h
Generated by
1.8.4