aboutsummaryrefslogtreecommitdiff
path: root/src/pcm/pcm_plug.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pcm/pcm_plug.c')
-rw-r--r--src/pcm/pcm_plug.c48
1 files changed, 16 insertions, 32 deletions
diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c
index fa84eaac..7a6c2b99 100644
--- a/src/pcm/pcm_plug.c
+++ b/src/pcm/pcm_plug.c
@@ -53,7 +53,7 @@ typedef struct {
const snd_config_t *rate_converter;
enum snd_pcm_plug_route_policy route_policy;
snd_pcm_route_ttable_entry_t *ttable;
- int ttable_ok, ttable_last;
+ int ttable_ok;
unsigned int tt_ssize, tt_cused, tt_sused;
} snd_pcm_plug_t;
@@ -380,7 +380,7 @@ static int snd_pcm_plug_change_channels(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm
snd_pcm_route_ttable_entry_t *ttable;
int err;
if (clt->channels == slv->channels &&
- (!plug->ttable || !plug->ttable_last))
+ (!plug->ttable || plug->ttable_ok))
return 0;
if (clt->rate != slv->rate &&
clt->channels > slv->channels)
@@ -485,13 +485,15 @@ static int snd_pcm_plug_change_format(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_p
/* No conversion is needed */
if (clt->format == slv->format &&
clt->rate == slv->rate &&
- clt->channels == slv->channels)
+ clt->channels == slv->channels &&
+ (!plug->ttable || plug->ttable_ok))
return 0;
if (snd_pcm_format_linear(slv->format)) {
/* Conversion is done in another plugin */
if (clt->rate != slv->rate ||
- clt->channels != slv->channels)
+ clt->channels != slv->channels ||
+ (plug->ttable && !plug->ttable_ok))
return 0;
cfmt = clt->format;
switch (clt->format) {
@@ -522,15 +524,14 @@ static int snd_pcm_plug_change_format(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_p
}
#ifdef BUILD_PCM_PLUGIN_LFLOAT
} else if (snd_pcm_format_float(slv->format)) {
- /* Conversion is done in another plugin */
- if (clt->format == slv->format &&
- clt->rate == slv->rate &&
- clt->channels == slv->channels)
- return 0;
- cfmt = clt->format;
- if (snd_pcm_format_linear(clt->format))
+ if (snd_pcm_format_linear(clt->format)) {
+ cfmt = clt->format;
f = snd_pcm_lfloat_open;
- else
+ } else if (clt->rate != slv->rate || clt->channels != slv->channels ||
+ (plug->ttable && !plug->ttable_ok)) {
+ cfmt = SND_PCM_FORMAT_S16;
+ f = snd_pcm_lfloat_open;
+ } else
return -EINVAL;
#endif
#ifdef BUILD_PCM_NONLINEAR
@@ -643,11 +644,12 @@ static int snd_pcm_plug_insert_plugins(snd_pcm_t *pcm,
};
snd_pcm_plug_params_t p = *slave;
unsigned int k = 0;
- plug->ttable_ok = plug->ttable_last = 0;
+ plug->ttable_ok = 0;
while (client->format != p.format ||
client->channels != p.channels ||
client->rate != p.rate ||
- client->access != p.access) {
+ client->access != p.access ||
+ (plug->ttable && !plug->ttable_ok)) {
snd_pcm_t *new;
int err;
if (k >= sizeof(funcs)/sizeof(*funcs))
@@ -662,24 +664,6 @@ static int snd_pcm_plug_insert_plugins(snd_pcm_t *pcm,
}
k++;
}
-#ifdef BUILD_PCM_PLUGIN_ROUTE
- /* it's exception, user specified ttable, but no reduction/expand */
- if (plug->ttable && !plug->ttable_ok) {
- snd_pcm_t *new;
- int err;
- plug->ttable_last = 1;
- err = snd_pcm_plug_change_channels(pcm, &new, client, &p);
- if (err < 0) {
- snd_pcm_plug_clear(pcm);
- return err;
- }
- assert(err);
- assert(plug->ttable_ok);
- plug->gen.slave = new;
- pcm->fast_ops = new->fast_ops;
- pcm->fast_op_arg = new->fast_op_arg;
- }
-#endif
return 0;
}