mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
Huge trailing whitespace cleanup. Let's keep the tree pure from here on,
mmmkay? git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1418 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
1a460ee40a
commit
521daf6f0a
283 changed files with 3742 additions and 3742 deletions
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -54,7 +54,7 @@ struct impl_libsamplerate {
|
|||
pa_memblock *buf1_block, *buf2_block, *buf3_block, *buf4_block;
|
||||
float* buf1, *buf2, *buf3, *buf4;
|
||||
unsigned buf1_samples, buf2_samples, buf3_samples, buf4_samples;
|
||||
|
||||
|
||||
pa_convert_to_float32ne_func_t to_float32ne_func;
|
||||
pa_convert_from_float32ne_func_t from_float32ne_func;
|
||||
SRC_STATE *src_state;
|
||||
|
|
@ -78,7 +78,7 @@ pa_resampler* pa_resampler_new(
|
|||
const pa_sample_spec *b,
|
||||
const pa_channel_map *bm,
|
||||
pa_resample_method_t resample_method) {
|
||||
|
||||
|
||||
pa_resampler *r = NULL;
|
||||
|
||||
assert(pool);
|
||||
|
|
@ -110,7 +110,7 @@ pa_resampler* pa_resampler_new(
|
|||
r->o_cm = *bm;
|
||||
else
|
||||
pa_channel_map_init_auto(&r->o_cm, r->o_ss.channels, PA_CHANNEL_MAP_DEFAULT);
|
||||
|
||||
|
||||
r->i_fz = pa_frame_size(a);
|
||||
r->o_fz = pa_frame_size(b);
|
||||
|
||||
|
|
@ -126,19 +126,19 @@ pa_resampler* pa_resampler_new(
|
|||
|
||||
if (libsamplerate_init(r) < 0)
|
||||
goto fail;
|
||||
|
||||
|
||||
} else {
|
||||
/* Use our own simple non-fp resampler for the trivial cases and when the user selects it */
|
||||
if (trivial_init(r) < 0)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
return r;
|
||||
|
||||
|
||||
fail:
|
||||
if (r)
|
||||
pa_xfree(r);
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ void pa_resampler_free(pa_resampler *r) {
|
|||
|
||||
if (r->impl_free)
|
||||
r->impl_free(r);
|
||||
|
||||
|
||||
pa_xfree(r);
|
||||
}
|
||||
|
||||
|
|
@ -157,9 +157,9 @@ void pa_resampler_set_input_rate(pa_resampler *r, uint32_t rate) {
|
|||
|
||||
if (r->i_ss.rate == rate)
|
||||
return;
|
||||
|
||||
|
||||
r->i_ss.rate = rate;
|
||||
|
||||
|
||||
if (r->impl_update_input_rate)
|
||||
r->impl_update_input_rate(r, rate);
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ void pa_resampler_run(pa_resampler *r, const pa_memchunk *in, pa_memchunk *out)
|
|||
|
||||
size_t pa_resampler_request(pa_resampler *r, size_t out_length) {
|
||||
assert(r);
|
||||
|
||||
|
||||
return (((out_length / r->o_fz)*r->i_ss.rate)/r->o_ss.rate) * r->i_fz;
|
||||
}
|
||||
|
||||
|
|
@ -200,7 +200,7 @@ const char *pa_resample_method_to_string(pa_resample_method_t m) {
|
|||
|
||||
pa_resample_method_t pa_parse_resample_method(const char *string) {
|
||||
pa_resample_method_t m;
|
||||
|
||||
|
||||
assert(string);
|
||||
|
||||
for (m = 0; m < PA_RESAMPLER_MAX; m++)
|
||||
|
|
@ -218,9 +218,9 @@ static void libsamplerate_free(pa_resampler *r) {
|
|||
|
||||
assert(r);
|
||||
assert(r->impl_data);
|
||||
|
||||
|
||||
u = r->impl_data;
|
||||
|
||||
|
||||
if (u->src_state)
|
||||
src_delete(u->src_state);
|
||||
|
||||
|
|
@ -251,16 +251,16 @@ static void calc_map_table(pa_resampler *r) {
|
|||
|
||||
for (ic = 0; ic < r->i_ss.channels; ic++) {
|
||||
pa_channel_position_t a, b;
|
||||
|
||||
|
||||
a = r->i_cm.map[ic];
|
||||
b = r->o_cm.map[oc];
|
||||
|
||||
|
||||
if (a == b ||
|
||||
(a == PA_CHANNEL_POSITION_MONO && b == PA_CHANNEL_POSITION_LEFT) ||
|
||||
(a == PA_CHANNEL_POSITION_MONO && b == PA_CHANNEL_POSITION_RIGHT) ||
|
||||
(a == PA_CHANNEL_POSITION_LEFT && b == PA_CHANNEL_POSITION_MONO) ||
|
||||
(a == PA_CHANNEL_POSITION_RIGHT && b == PA_CHANNEL_POSITION_MONO))
|
||||
|
||||
|
||||
u->map_table[oc][i++] = ic;
|
||||
}
|
||||
|
||||
|
|
@ -278,12 +278,12 @@ static float * convert_to_float(pa_resampler *r, void *input, unsigned n_frames)
|
|||
assert(input);
|
||||
assert(r->impl_data);
|
||||
u = r->impl_data;
|
||||
|
||||
|
||||
/* Convert the incoming sample into floats and place them in buf1 */
|
||||
|
||||
if (!u->to_float32ne_func)
|
||||
return input;
|
||||
|
||||
|
||||
n_samples = n_frames * r->i_ss.channels;
|
||||
|
||||
if (u->buf1_samples < n_samples) {
|
||||
|
|
@ -294,7 +294,7 @@ static float * convert_to_float(pa_resampler *r, void *input, unsigned n_frames)
|
|||
u->buf1_block = pa_memblock_new(r->mempool, sizeof(float) * n_samples);
|
||||
u->buf1 = u->buf1_block->data;
|
||||
}
|
||||
|
||||
|
||||
u->to_float32ne_func(n_samples, input, u->buf1);
|
||||
|
||||
return u->buf1;
|
||||
|
|
@ -305,14 +305,14 @@ static float *remap_channels(pa_resampler *r, float *input, unsigned n_frames) {
|
|||
unsigned n_samples;
|
||||
int i_skip, o_skip;
|
||||
unsigned oc;
|
||||
|
||||
|
||||
assert(r);
|
||||
assert(input);
|
||||
assert(r->impl_data);
|
||||
u = r->impl_data;
|
||||
|
||||
/* Remap channels and place the result int buf2 */
|
||||
|
||||
|
||||
if (!u->map_required)
|
||||
return input;
|
||||
|
||||
|
|
@ -331,7 +331,7 @@ static float *remap_channels(pa_resampler *r, float *input, unsigned n_frames) {
|
|||
|
||||
o_skip = sizeof(float) * r->o_ss.channels;
|
||||
i_skip = sizeof(float) * r->i_ss.channels;
|
||||
|
||||
|
||||
for (oc = 0; oc < r->o_ss.channels; oc++) {
|
||||
unsigned i;
|
||||
static const float one = 1.0;
|
||||
|
|
@ -361,7 +361,7 @@ static float *resample(pa_resampler *r, float *input, unsigned *n_frames) {
|
|||
u = r->impl_data;
|
||||
|
||||
/* Resample the data and place the result in buf3 */
|
||||
|
||||
|
||||
if (!u->src_state)
|
||||
return input;
|
||||
|
||||
|
|
@ -376,16 +376,16 @@ static float *resample(pa_resampler *r, float *input, unsigned *n_frames) {
|
|||
u->buf3_block = pa_memblock_new(r->mempool, sizeof(float) * out_n_samples);
|
||||
u->buf3 = u->buf3_block->data;
|
||||
}
|
||||
|
||||
|
||||
data.data_in = input;
|
||||
data.input_frames = *n_frames;
|
||||
|
||||
data.data_out = u->buf3;
|
||||
data.output_frames = out_n_frames;
|
||||
|
||||
|
||||
data.src_ratio = (double) r->o_ss.rate / r->i_ss.rate;
|
||||
data.end_of_input = 0;
|
||||
|
||||
|
||||
ret = src_process(u->src_state, &data);
|
||||
assert(ret == 0);
|
||||
assert((unsigned) data.input_frames_used == *n_frames);
|
||||
|
|
@ -398,17 +398,17 @@ static float *resample(pa_resampler *r, float *input, unsigned *n_frames) {
|
|||
static void *convert_from_float(pa_resampler *r, float *input, unsigned n_frames) {
|
||||
struct impl_libsamplerate *u;
|
||||
unsigned n_samples;
|
||||
|
||||
|
||||
assert(r);
|
||||
assert(input);
|
||||
assert(r->impl_data);
|
||||
u = r->impl_data;
|
||||
|
||||
|
||||
/* Convert the data into the correct sample type and place the result in buf4 */
|
||||
|
||||
if (!u->from_float32ne_func)
|
||||
return input;
|
||||
|
||||
|
||||
n_samples = n_frames * r->o_ss.channels;
|
||||
|
||||
if (u->buf4_samples < n_samples) {
|
||||
|
|
@ -419,7 +419,7 @@ static void *convert_from_float(pa_resampler *r, float *input, unsigned n_frames
|
|||
u->buf4_block = pa_memblock_new(r->mempool, sizeof(float) * n_samples);
|
||||
u->buf4 = u->buf4_block->data;
|
||||
}
|
||||
|
||||
|
||||
u->from_float32ne_func(n_samples, input, u->buf4);
|
||||
|
||||
return u->buf4;
|
||||
|
|
@ -438,13 +438,13 @@ static void libsamplerate_run(pa_resampler *r, const pa_memchunk *in, pa_memchun
|
|||
assert(in->memblock);
|
||||
assert(in->length % r->i_fz == 0);
|
||||
assert(r->impl_data);
|
||||
|
||||
|
||||
u = r->impl_data;
|
||||
|
||||
input = ((uint8_t*) in->memblock->data + in->index);
|
||||
n_frames = in->length / r->i_fz;
|
||||
assert(n_frames > 0);
|
||||
|
||||
|
||||
buf = convert_to_float(r, input, n_frames);
|
||||
buf = remap_channels(r, buf, n_frames);
|
||||
buf = resample(r, buf, &n_frames);
|
||||
|
|
@ -461,7 +461,7 @@ static void libsamplerate_run(pa_resampler *r, const pa_memchunk *in, pa_memchun
|
|||
out->length = n_frames * r->o_fz;
|
||||
out->index = 0;
|
||||
out->memblock = NULL;
|
||||
|
||||
|
||||
if (output == u->buf1) {
|
||||
u->buf1 = NULL;
|
||||
u->buf1_samples = 0;
|
||||
|
|
@ -494,7 +494,7 @@ static void libsamplerate_run(pa_resampler *r, const pa_memchunk *in, pa_memchun
|
|||
|
||||
static void libsamplerate_update_input_rate(pa_resampler *r, uint32_t rate) {
|
||||
struct impl_libsamplerate *u;
|
||||
|
||||
|
||||
assert(r);
|
||||
assert(rate > 0);
|
||||
assert(r->impl_data);
|
||||
|
|
@ -540,7 +540,7 @@ static int libsamplerate_init(pa_resampler *r) {
|
|||
r->impl_run = libsamplerate_run;
|
||||
|
||||
calc_map_table(r);
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
|
|
@ -559,7 +559,7 @@ static void trivial_run(pa_resampler *r, const pa_memchunk *in, pa_memchunk *out
|
|||
assert(in);
|
||||
assert(out);
|
||||
assert(r->impl_data);
|
||||
|
||||
|
||||
u = r->impl_data;
|
||||
|
||||
fz = r->i_fz;
|
||||
|
|
@ -578,34 +578,34 @@ static void trivial_run(pa_resampler *r, const pa_memchunk *in, pa_memchunk *out
|
|||
/* Do real resampling */
|
||||
size_t l;
|
||||
unsigned o_index;
|
||||
|
||||
|
||||
/* The length of the new memory block rounded up */
|
||||
l = ((((n_frames+1) * r->o_ss.rate) / r->i_ss.rate) + 1) * fz;
|
||||
|
||||
|
||||
out->index = 0;
|
||||
out->memblock = pa_memblock_new(r->mempool, l);
|
||||
|
||||
|
||||
for (o_index = 0;; o_index++, u->o_counter++) {
|
||||
unsigned j;
|
||||
|
||||
|
||||
j = (u->o_counter * r->i_ss.rate / r->o_ss.rate);
|
||||
j = j > u->i_counter ? j - u->i_counter : 0;
|
||||
|
||||
|
||||
if (j >= n_frames)
|
||||
break;
|
||||
|
||||
assert(o_index*fz < out->memblock->length);
|
||||
|
||||
|
||||
memcpy((uint8_t*) out->memblock->data + fz*o_index,
|
||||
(uint8_t*) in->memblock->data + in->index + fz*j, fz);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
out->length = o_index*fz;
|
||||
}
|
||||
|
||||
u->i_counter += n_frames;
|
||||
|
||||
|
||||
/* Normalize counters */
|
||||
while (u->i_counter >= r->i_ss.rate) {
|
||||
u->i_counter -= r->i_ss.rate;
|
||||
|
|
@ -616,7 +616,7 @@ static void trivial_run(pa_resampler *r, const pa_memchunk *in, pa_memchunk *out
|
|||
|
||||
static void trivial_free(pa_resampler *r) {
|
||||
assert(r);
|
||||
|
||||
|
||||
pa_xfree(r->impl_data);
|
||||
}
|
||||
|
||||
|
|
@ -634,7 +634,7 @@ static void trivial_update_input_rate(pa_resampler *r, uint32_t rate) {
|
|||
|
||||
static int trivial_init(pa_resampler*r) {
|
||||
struct impl_trivial *u;
|
||||
|
||||
|
||||
assert(r);
|
||||
assert(r->i_ss.format == r->o_ss.format);
|
||||
assert(r->i_ss.channels == r->o_ss.channels);
|
||||
|
|
@ -645,7 +645,7 @@ static int trivial_init(pa_resampler*r) {
|
|||
r->impl_run = trivial_run;
|
||||
r->impl_free = trivial_free;
|
||||
r->impl_update_input_rate = trivial_update_input_rate;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue