mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-04 13:30:08 -05:00
Query the supported rate ranges from rate plugins
Extend the PCM-rate plugin protocol to allow the host to query the supported sample rates. The protocol version is bumped to 0x010002, and the version number negotiaion is slightly changed. Now the plugin is supposed to fill the version it supports in return. The old versioned plugins are still supported, but they may spew version-mismatch warning prints. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
29841e67e9
commit
1929c55d2e
3 changed files with 93 additions and 15 deletions
|
|
@ -405,6 +405,19 @@ static void linear_close(void *obj)
|
|||
free(obj);
|
||||
}
|
||||
|
||||
static int get_supported_rates(void *rate, unsigned int *rate_min,
|
||||
unsigned int *rate_max)
|
||||
{
|
||||
*rate_min = SND_PCM_PLUGIN_RATE_MIN;
|
||||
*rate_max = SND_PCM_PLUGIN_RATE_MAX;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void linear_dump(void *rate, snd_output_t *out)
|
||||
{
|
||||
snd_output_printf(out, "Converter: linear-interpolation\n");
|
||||
}
|
||||
|
||||
static const snd_pcm_rate_ops_t linear_ops = {
|
||||
.close = linear_close,
|
||||
.init = linear_init,
|
||||
|
|
@ -414,17 +427,15 @@ static const snd_pcm_rate_ops_t linear_ops = {
|
|||
.convert = linear_convert,
|
||||
.input_frames = input_frames,
|
||||
.output_frames = output_frames,
|
||||
.version = SND_PCM_RATE_PLUGIN_VERSION,
|
||||
.get_supported_rates = get_supported_rates,
|
||||
.dump = linear_dump,
|
||||
};
|
||||
|
||||
int SND_PCM_RATE_PLUGIN_ENTRY(linear) (unsigned int version, void **objp, snd_pcm_rate_ops_t *ops)
|
||||
{
|
||||
struct rate_linear *rate;
|
||||
|
||||
if (version != SND_PCM_RATE_PLUGIN_VERSION) {
|
||||
SNDERR("Invalid plugin version %x\n", version);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rate = calloc(1, sizeof(*rate));
|
||||
if (! rate)
|
||||
return -ENOMEM;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue