diff options
author | Lennart Poettering <lennart@poettering.net> | 2008-05-15 23:34:41 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2008-05-15 23:34:41 +0000 |
commit | 045c1d602dcba57868845ba3270510593c39480f (patch) | |
tree | b3d61f180e6fa40f97a80aa3e46d7c910ed7c2a6 /src/pulse/sample.c | |
parent | 91f092eadcc5e9075e04ae42df11de28ef5047a8 (diff) |
merge glitch-free branch back into trunk
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2445 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulse/sample.c')
-rw-r--r-- | src/pulse/sample.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/pulse/sample.c b/src/pulse/sample.c index 27c0df03..43340f20 100644 --- a/src/pulse/sample.c +++ b/src/pulse/sample.c @@ -32,6 +32,7 @@ #include <pulsecore/core-util.h> #include <pulsecore/macro.h> +#include <pulse/timeval.h> #include "sample.h" @@ -70,13 +71,13 @@ size_t pa_bytes_per_second(const pa_sample_spec *spec) { pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec) { pa_assert(spec); - return (pa_usec_t) (((double) length/pa_frame_size(spec)*1000000)/spec->rate); + return (((pa_usec_t) (length / pa_frame_size(spec)) * PA_USEC_PER_SEC) / spec->rate); } size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec) { pa_assert(spec); - return (size_t) (((double) t * spec->rate / 1000000))*pa_frame_size(spec); + return (size_t) (((t * spec->rate) / PA_USEC_PER_SEC)) * pa_frame_size(spec); } int pa_sample_spec_valid(const pa_sample_spec *spec) { @@ -97,7 +98,10 @@ int pa_sample_spec_equal(const pa_sample_spec*a, const pa_sample_spec*b) { pa_assert(a); pa_assert(b); - return (a->format == b->format) && (a->rate == b->rate) && (a->channels == b->channels); + return + (a->format == b->format) && + (a->rate == b->rate) && + (a->channels == b->channels); } const char *pa_sample_format_to_string(pa_sample_format_t f) { |