123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354 |
- #ifndef foosamplehfoo
- #define foosamplehfoo
- #include <inttypes.h>
- #include <sys/types.h>
- #include <sys/param.h>
- #include <pulse/gccmacro.h>
- #include <pulse/cdecl.h>
- #include <pulse/version.h>
- PA_C_DECL_BEGIN
- #if !defined(WORDS_BIGENDIAN)
- #if defined(__BYTE_ORDER)
- #if __BYTE_ORDER == __BIG_ENDIAN
- #define WORDS_BIGENDIAN
- #endif
- #endif
- #if defined(__sparc__) && defined(_BIG_ENDIAN)
- #define WORDS_BIGENDIAN
- #endif
- #endif
- #define PA_CHANNELS_MAX 32U
- #define PA_RATE_MAX (48000U*8U)
- typedef enum pa_sample_format {
- PA_SAMPLE_U8,
-
- PA_SAMPLE_ALAW,
-
- PA_SAMPLE_ULAW,
-
- PA_SAMPLE_S16LE,
-
- PA_SAMPLE_S16BE,
-
- PA_SAMPLE_FLOAT32LE,
-
- PA_SAMPLE_FLOAT32BE,
-
- PA_SAMPLE_S32LE,
-
- PA_SAMPLE_S32BE,
-
- PA_SAMPLE_S24LE,
-
- PA_SAMPLE_S24BE,
-
- PA_SAMPLE_S24_32LE,
-
- PA_SAMPLE_S24_32BE,
-
- PA_SAMPLE_MAX,
-
- PA_SAMPLE_INVALID = -1
-
- } pa_sample_format_t;
- #ifdef WORDS_BIGENDIAN
- #define PA_SAMPLE_S16NE PA_SAMPLE_S16BE
- #define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32BE
- #define PA_SAMPLE_S32NE PA_SAMPLE_S32BE
- #define PA_SAMPLE_S24NE PA_SAMPLE_S24BE
- #define PA_SAMPLE_S24_32NE PA_SAMPLE_S24_32BE
- #define PA_SAMPLE_S16RE PA_SAMPLE_S16LE
- #define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32LE
- #define PA_SAMPLE_S32RE PA_SAMPLE_S32LE
- #define PA_SAMPLE_S24RE PA_SAMPLE_S24LE
- #define PA_SAMPLE_S24_32RE PA_SAMPLE_S24_32LE
- #else
- #define PA_SAMPLE_S16NE PA_SAMPLE_S16LE
- #define PA_SAMPLE_FLOAT32NE PA_SAMPLE_FLOAT32LE
- #define PA_SAMPLE_S32NE PA_SAMPLE_S32LE
- #define PA_SAMPLE_S24NE PA_SAMPLE_S24LE
- #define PA_SAMPLE_S24_32NE PA_SAMPLE_S24_32LE
- #define PA_SAMPLE_S16RE PA_SAMPLE_S16BE
- #define PA_SAMPLE_FLOAT32RE PA_SAMPLE_FLOAT32BE
- #define PA_SAMPLE_S32RE PA_SAMPLE_S32BE
- #define PA_SAMPLE_S24RE PA_SAMPLE_S24BE
- #define PA_SAMPLE_S24_32RE PA_SAMPLE_S24_32BE
- #endif
- #define PA_SAMPLE_FLOAT32 PA_SAMPLE_FLOAT32NE
- #define PA_SAMPLE_U8 PA_SAMPLE_U8
- #define PA_SAMPLE_ALAW PA_SAMPLE_ALAW
- #define PA_SAMPLE_ULAW PA_SAMPLE_ULAW
- #define PA_SAMPLE_S16LE PA_SAMPLE_S16LE
- #define PA_SAMPLE_S16BE PA_SAMPLE_S16BE
- #define PA_SAMPLE_FLOAT32LE PA_SAMPLE_FLOAT32LE
- #define PA_SAMPLE_FLOAT32BE PA_SAMPLE_FLOAT32BE
- #define PA_SAMPLE_S32LE PA_SAMPLE_S32LE
- #define PA_SAMPLE_S32BE PA_SAMPLE_S32BE
- #define PA_SAMPLE_S24LE PA_SAMPLE_S24LE
- #define PA_SAMPLE_S24BE PA_SAMPLE_S24BE
- #define PA_SAMPLE_S24_32LE PA_SAMPLE_S24_32LE
- #define PA_SAMPLE_S24_32BE PA_SAMPLE_S24_32BE
- typedef struct pa_sample_spec {
- pa_sample_format_t format;
-
- uint32_t rate;
-
- uint8_t channels;
-
- } pa_sample_spec;
- typedef uint64_t pa_usec_t;
- size_t pa_bytes_per_second(const pa_sample_spec *spec) PA_GCC_PURE;
- size_t pa_frame_size(const pa_sample_spec *spec) PA_GCC_PURE;
- size_t pa_sample_size(const pa_sample_spec *spec) PA_GCC_PURE;
- size_t pa_sample_size_of_format(pa_sample_format_t f) PA_GCC_PURE;
- pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec) PA_GCC_PURE;
- size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec) PA_GCC_PURE;
- pa_sample_spec* pa_sample_spec_init(pa_sample_spec *spec);
- int pa_sample_format_valid(unsigned format) PA_GCC_PURE;
- int pa_sample_rate_valid(uint32_t rate) PA_GCC_PURE;
- int pa_channels_valid(uint8_t channels) PA_GCC_PURE;
- int pa_sample_spec_valid(const pa_sample_spec *spec) PA_GCC_PURE;
- int pa_sample_spec_equal(const pa_sample_spec*a, const pa_sample_spec*b) PA_GCC_PURE;
- const char *pa_sample_format_to_string(pa_sample_format_t f) PA_GCC_PURE;
- pa_sample_format_t pa_parse_sample_format(const char *format) PA_GCC_PURE;
- #define PA_SAMPLE_SPEC_SNPRINT_MAX 32
- char* pa_sample_spec_snprint(char *s, size_t l, const pa_sample_spec *spec);
- #define PA_BYTES_SNPRINT_MAX 11
- char* pa_bytes_snprint(char *s, size_t l, unsigned v);
- int pa_sample_format_is_le(pa_sample_format_t f) PA_GCC_PURE;
- int pa_sample_format_is_be(pa_sample_format_t f) PA_GCC_PURE;
- #ifdef WORDS_BIGENDIAN
- #define pa_sample_format_is_ne(f) pa_sample_format_is_be(f)
- #define pa_sample_format_is_re(f) pa_sample_format_is_le(f)
- #else
- #define pa_sample_format_is_ne(f) pa_sample_format_is_le(f)
- #define pa_sample_format_is_re(f) pa_sample_format_is_be(f)
- #endif
- PA_C_DECL_END
- #endif
|