Make the resampler argument const, and pass explicit remap
structure argument
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
static int libsamplerate_init(pa_resampler*r);
#endif
static int libsamplerate_init(pa_resampler*r);
#endif
-static void calc_map_table(pa_resampler *r);
+static void calc_map_table(const pa_resampler *r, pa_remap_t *m);
static int (* const init_table[])(pa_resampler*r) = {
#ifdef HAVE_LIBSAMPLERATE
static int (* const init_table[])(pa_resampler*r) = {
#ifdef HAVE_LIBSAMPLERATE
r->i_fz = pa_frame_size(a);
r->o_fz = pa_frame_size(b);
r->i_fz = pa_frame_size(a);
r->o_fz = pa_frame_size(b);
+ /* compute channel remap table if needed */
+ if ((r->map_required = (r->i_ss.channels != r->o_ss.channels || (!(r->flags & PA_RESAMPLER_NO_REMAP) &&
+ !pa_channel_map_equal(&r->i_cm, &r->o_cm)))))
+ calc_map_table(r, &r->remap);
r->work_format = pa_resampler_choose_work_format(method, a->format, b->format, r->map_required);
r->w_sz = pa_sample_size_of_format(r->work_format);
r->work_format = pa_resampler_choose_work_format(method, a->format, b->format, r->map_required);
r->w_sz = pa_sample_size_of_format(r->work_format);
-static void calc_map_table(pa_resampler *r) {
+static void calc_map_table(const pa_resampler *r, pa_remap_t *m) {
unsigned oc, ic;
unsigned n_oc, n_ic;
bool ic_connected[PA_CHANNELS_MAX];
bool remix;
pa_strbuf *s;
char *t;
unsigned oc, ic;
unsigned n_oc, n_ic;
bool ic_connected[PA_CHANNELS_MAX];
bool remix;
pa_strbuf *s;
char *t;
-
- if (!(r->map_required = (r->i_ss.channels != r->o_ss.channels || (!(r->flags & PA_RESAMPLER_NO_REMAP) && !pa_channel_map_equal(&r->i_cm, &r->o_cm)))))
- return;
-
- m = &r->remap;
n_oc = r->o_ss.channels;
n_ic = r->i_ss.channels;
n_oc = r->o_ss.channels;
n_ic = r->i_ss.channels;