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 <math.h>
00031
00032 #include <pulse/cdecl.h>
00033
00103 PA_C_DECL_BEGIN
00104
00106 #define PA_CHANNELS_MAX 32
00107
00109 #define PA_RATE_MAX (48000*4)
00110
00112 typedef enum pa_sample_format {
00113 PA_SAMPLE_U8,
00114 PA_SAMPLE_ALAW,
00115 PA_SAMPLE_ULAW,
00116 PA_SAMPLE_S16LE,
00117 PA_SAMPLE_S16BE,
00118 PA_SAMPLE_FLOAT32LE,
00119 PA_SAMPLE_FLOAT32BE,
00120 PA_SAMPLE_MAX,
00121 PA_SAMPLE_INVALID = -1
00122 } pa_sample_format_t;
00123
00124 #ifdef WORDS_BIGENDIAN
00125
00126 #define PA_SAMPLE_S16NE PA_SAMPLE_S16BE
00127
00128 #define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32BE
00129
00130 #define PA_SAMPLE_S16RE PA_SAMPLE_S16LE
00131
00132 #define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32LE
00133 #else
00134
00135 #define PA_SAMPLE_S16NE PA_SAMPLE_S16LE
00136
00137 #define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32LE
00138
00139 #define PA_SAMPLE_S16RE PA_SAMPLE_S16BE
00140
00141 #define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32BE
00142 #endif
00143
00145 #define PA_SAMPLE_FLOAT32 PA_SAMPLE_FLOAT32NE
00146
00148 typedef struct pa_sample_spec {
00149 pa_sample_format_t format;
00150 uint32_t rate;
00151 uint8_t channels;
00152 } pa_sample_spec;
00153
00155 typedef uint64_t pa_usec_t;
00156
00158 size_t pa_bytes_per_second(const pa_sample_spec *spec);
00159
00161 size_t pa_frame_size(const pa_sample_spec *spec);
00162
00164 size_t pa_sample_size(const pa_sample_spec *spec);
00165
00167 pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec);
00168
00170 size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec);
00171
00173 int pa_sample_spec_valid(const pa_sample_spec *spec);
00174
00176 int pa_sample_spec_equal(const pa_sample_spec*a, const pa_sample_spec*b);
00177
00179 const char *pa_sample_format_to_string(pa_sample_format_t f);
00180
00182 pa_sample_format_t pa_parse_sample_format(const char *format);
00183
00185 #define PA_SAMPLE_SPEC_SNPRINT_MAX 32
00186
00188 char* pa_sample_spec_snprint(char *s, size_t l, const pa_sample_spec *spec);
00189
00191 char* pa_bytes_snprint(char *s, size_t l, unsigned v);
00192
00193 PA_C_DECL_END
00194
00195 #endif