00001 #ifndef foosamplehfoo
00002 #define foosamplehfoo
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <inttypes.h>
00027 #include <sys/types.h>
00028 #include <sys/param.h>
00029 #include <math.h>
00030
00031 #include <pulse/gccmacro.h>
00032 #include <pulse/cdecl.h>
00033
00105 PA_C_DECL_BEGIN
00106
00107 #if !defined(WORDS_BIGENDIAN)
00108 #if defined(__BYTE_ORDER)
00109 #if __BYTE_ORDER == __BIG_ENDIAN
00110 #define WORDS_BIGENDIAN
00111 #endif
00112 #endif
00113 #endif
00114
00116 #define PA_CHANNELS_MAX 32U
00117
00119 #define PA_RATE_MAX (48000U*4U)
00120
00122 typedef enum pa_sample_format {
00123 PA_SAMPLE_U8,
00124 PA_SAMPLE_ALAW,
00125 PA_SAMPLE_ULAW,
00126 PA_SAMPLE_S16LE,
00127 PA_SAMPLE_S16BE,
00128 PA_SAMPLE_FLOAT32LE,
00129 PA_SAMPLE_FLOAT32BE,
00130 PA_SAMPLE_S32LE,
00131 PA_SAMPLE_S32BE,
00132 PA_SAMPLE_MAX,
00133 PA_SAMPLE_INVALID = -1
00134 } pa_sample_format_t;
00135
00136 #ifdef WORDS_BIGENDIAN
00137
00138 #define PA_SAMPLE_S16NE PA_SAMPLE_S16BE
00139
00140 #define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32BE
00141
00142 #define PA_SAMPLE_S32NE PA_SAMPLE_S32BE
00143
00144 #define PA_SAMPLE_S16RE PA_SAMPLE_S16LE
00145
00146 #define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32LE
00147
00148 #define PA_SAMPLE_S32RE PA_SAMPLE_S32LE
00149 #else
00150
00151 #define PA_SAMPLE_S16NE PA_SAMPLE_S16LE
00152
00153 #define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32LE
00154
00155 #define PA_SAMPLE_S32NE PA_SAMPLE_S32LE
00156
00157 #define PA_SAMPLE_S16RE PA_SAMPLE_S16BE
00158
00159 #define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32BE
00160
00161 #define PA_SAMPLE_S32RE PA_SAMPLE_S32BE
00162 #endif
00163
00165 #define PA_SAMPLE_FLOAT32 PA_SAMPLE_FLOAT32NE
00166
00168 typedef struct pa_sample_spec {
00169 pa_sample_format_t format;
00170 uint32_t rate;
00171 uint8_t channels;
00172 } pa_sample_spec;
00173
00175 typedef uint64_t pa_usec_t;
00176
00178 size_t pa_bytes_per_second(const pa_sample_spec *spec) PA_GCC_PURE;
00179
00181 size_t pa_frame_size(const pa_sample_spec *spec) PA_GCC_PURE;
00182
00184 size_t pa_sample_size(const pa_sample_spec *spec) PA_GCC_PURE;
00185
00187 pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec) PA_GCC_PURE;
00188
00190 size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec) PA_GCC_PURE;
00191
00193 int pa_sample_spec_valid(const pa_sample_spec *spec) PA_GCC_PURE;
00194
00196 int pa_sample_spec_equal(const pa_sample_spec*a, const pa_sample_spec*b) PA_GCC_PURE;
00197
00199 const char *pa_sample_format_to_string(pa_sample_format_t f) PA_GCC_PURE;
00200
00202 pa_sample_format_t pa_parse_sample_format(const char *format) PA_GCC_PURE;
00203
00205 #define PA_SAMPLE_SPEC_SNPRINT_MAX 32
00206
00208 char* pa_sample_spec_snprint(char *s, size_t l, const pa_sample_spec *spec);
00209
00211 char* pa_bytes_snprint(char *s, size_t l, unsigned v);
00212
00213 PA_C_DECL_END
00214
00215 #endif