diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-07-03 23:35:12 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-07-03 23:35:12 +0000 |
commit | e61c2dddb7bc392ab4073d5691870615ada82922 (patch) | |
tree | b7e98c4232ca855c7bac6ba88e47b7ff45a9cbe1 /src/sample.c | |
parent | a8a5ab1c79c0b6567ecc98343ff1ae944f2285b9 (diff) |
add pa_ prefix to all identifiers.
fix downsampling/resampling
add support for U8 samples
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@49 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/sample.c')
-rw-r--r-- | src/sample.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/sample.c b/src/sample.c index 706880e4..20142a23 100644 --- a/src/sample.c +++ b/src/sample.c @@ -1,3 +1,4 @@ +#include <stdio.h> #include <assert.h> #include "sample.h" @@ -44,7 +45,7 @@ int pa_sample_spec_valid(const struct pa_sample_spec *spec) { if (!spec->rate || !spec->channels) return 0; - if (spec->format <= 0 || spec->format >= PA_SAMPLE_MAX) + if (spec->format >= PA_SAMPLE_MAX) return 0; return 1; @@ -55,3 +56,17 @@ int pa_sample_spec_equal(const struct pa_sample_spec*a, const struct pa_sample_s return (a->format == b->format) && (a->rate == b->rate) && (a->channels == b->channels); } + +void pa_sample_snprint(char *s, size_t l, const struct pa_sample_spec *spec) { + static const char* const table[]= { + [PA_SAMPLE_U8] = "U8", + [PA_SAMPLE_ALAW] = "ALAW", + [PA_SAMPLE_ULAW] = "ULAW", + [PA_SAMPLE_S16LE] = "S16LE", + [PA_SAMPLE_S16BE] = "S16BE", + [PA_SAMPLE_FLOAT32] = "FLOAT32", + }; + + assert(pa_sample_spec_valid(spec)); + snprintf(s, l, "%s %uch %uHz", table[spec->format], spec->channels, spec->rate); +} |