[pulseaudio-discuss] [PATCH RFCv3 34/51] sample: Make pa_sample_size_table public

Peter Meerwald pmeerw at pmeerw.net
Tue Nov 4 15:26:29 PST 2014


From: Peter Meerwald <p.meerwald at bct-electronic.com>

Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
---
 src/pulse/sample.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/pulse/sample.c b/src/pulse/sample.c
index 82c1b01..0d81a32 100644
--- a/src/pulse/sample.c
+++ b/src/pulse/sample.c
@@ -35,7 +35,7 @@
 
 #include "sample.h"
 
-static const size_t size_table[] = {
+const size_t pa_sample_size_table[] = {
     [PA_SAMPLE_U8] = 1,
     [PA_SAMPLE_ULAW] = 1,
     [PA_SAMPLE_ALAW] = 1,
@@ -54,7 +54,7 @@ static const size_t size_table[] = {
 size_t pa_sample_size_of_format(pa_sample_format_t f) {
     pa_assert(pa_sample_format_valid(f));
 
-    return size_table[f];
+    return pa_sample_size_table[f];
 }
 
 size_t pa_sample_size(const pa_sample_spec *spec) {
@@ -62,35 +62,35 @@ size_t pa_sample_size(const pa_sample_spec *spec) {
     pa_assert(spec);
     pa_return_val_if_fail(pa_sample_spec_valid(spec), 0);
 
-    return size_table[spec->format];
+    return pa_sample_size_table[spec->format];
 }
 
 size_t pa_frame_size(const pa_sample_spec *spec) {
     pa_assert(spec);
     pa_return_val_if_fail(pa_sample_spec_valid(spec), 0);
 
-    return size_table[spec->format] * spec->channels;
+    return pa_sample_size_table[spec->format] * spec->channels;
 }
 
 size_t pa_bytes_per_second(const pa_sample_spec *spec) {
     pa_assert(spec);
     pa_return_val_if_fail(pa_sample_spec_valid(spec), 0);
 
-    return spec->rate * size_table[spec->format] * spec->channels;
+    return spec->rate * pa_sample_size_table[spec->format] * spec->channels;
 }
 
 pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec) {
     pa_assert(spec);
     pa_return_val_if_fail(pa_sample_spec_valid(spec), 0);
 
-    return (((pa_usec_t) (length / (size_table[spec->format] * spec->channels)) * PA_USEC_PER_SEC) / spec->rate);
+    return (((pa_usec_t) (length / (pa_sample_size_table[spec->format] * spec->channels)) * PA_USEC_PER_SEC) / spec->rate);
 }
 
 size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec) {
     pa_assert(spec);
     pa_return_val_if_fail(pa_sample_spec_valid(spec), 0);
 
-    return (size_t) (((t * spec->rate) / PA_USEC_PER_SEC)) * (size_table[spec->format] * spec->channels);
+    return (size_t) (((t * spec->rate) / PA_USEC_PER_SEC)) * (pa_sample_size_table[spec->format] * spec->channels);
 }
 
 pa_sample_spec* pa_sample_spec_init(pa_sample_spec *spec) {
-- 
1.9.1



More information about the pulseaudio-discuss mailing list