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
00027
00028 #include <inttypes.h>
00029 #include <sys/types.h>
00030 #include <sys/param.h>
00031 #include <math.h>
00032
00033 #include <pulse/cdecl.h>
00034
00106 PA_C_DECL_BEGIN
00107
00108 #if !defined(WORDS_BIGENDIAN)
00109 #if defined(__BYTE_ORDER)
00110 #if __BYTE_ORDER == __BIG_ENDIAN
00111 #define WORDS_BIGENDIAN
00112 #endif
00113 #endif
00114 #endif
00115
00117 #define PA_CHANNELS_MAX 32
00118
00120 #define PA_RATE_MAX (48000*4)
00121
00123 typedef enum pa_sample_format {
00124 PA_SAMPLE_U8,
00125 PA_SAMPLE_ALAW,
00126 PA_SAMPLE_ULAW,
00127 PA_SAMPLE_S16LE,
00128 PA_SAMPLE_S16BE,
00129 PA_SAMPLE_FLOAT32LE,
00130 PA_SAMPLE_FLOAT32BE,
00131 PA_SAMPLE_S32LE,
00132 PA_SAMPLE_S32BE,
00133 PA_SAMPLE_MAX,
00134 PA_SAMPLE_INVALID = -1
00135 } pa_sample_format_t;
00136
00137 #ifdef WORDS_BIGENDIAN
00138
00139 #define PA_SAMPLE_S16NE PA_SAMPLE_S16BE
00140
00141 #define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32BE
00142
00143 #define PA_SAMPLE_S32NE PA_SAMPLE_S32BE
00144
00145 #define PA_SAMPLE_S16RE PA_SAMPLE_S16LE
00146
00147 #define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32LE
00148
00149 #define PA_SAMPLE_S32RE PA_SAMPLE_S32LE
00150 #else
00151
00152 #define PA_SAMPLE_S16NE PA_SAMPLE_S16LE
00153
00154 #define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32LE
00155
00156 #define PA_SAMPLE_S32NE PA_SAMPLE_S32LE
00157
00158 #define PA_SAMPLE_S16RE PA_SAMPLE_S16BE
00159
00160 #define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32BE
00161
00162 #define PA_SAMPLE_S32RE PA_SAMPLE_S32BE
00163 #endif
00164
00166 #define PA_SAMPLE_FLOAT32 PA_SAMPLE_FLOAT32NE
00167
00169 typedef struct pa_sample_spec {
00170 pa_sample_format_t format;
00171 uint32_t rate;
00172 uint8_t channels;
00173 } pa_sample_spec;
00174
00176 typedef uint64_t pa_usec_t;
00177
00179 size_t pa_bytes_per_second(const pa_sample_spec *spec) PA_GCC_PURE;
00180
00182 size_t pa_frame_size(const pa_sample_spec *spec) PA_GCC_PURE;
00183
00185 size_t pa_sample_size(const pa_sample_spec *spec) PA_GCC_PURE;
00186
00188 pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec) PA_GCC_PURE;
00189
00191 size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec) PA_GCC_PURE;
00192
00194 int pa_sample_spec_valid(const pa_sample_spec *spec) PA_GCC_PURE;
00195
00197 int pa_sample_spec_equal(const pa_sample_spec*a, const pa_sample_spec*b) PA_GCC_PURE;
00198
00200 const char *pa_sample_format_to_string(pa_sample_format_t f) PA_GCC_PURE;
00201
00203 pa_sample_format_t pa_parse_sample_format(const char *format) PA_GCC_PURE;
00204
00206 #define PA_SAMPLE_SPEC_SNPRINT_MAX 32
00207
00209 char* pa_sample_spec_snprint(char *s, size_t l, const pa_sample_spec *spec);
00210
00212 char* pa_bytes_snprint(char *s, size_t l, unsigned v);
00213
00214 PA_C_DECL_END
00215
00216 #endif