improved stream linking and plugin code cleanups

- added link/unlink/link_fd fast_ops callbacks
- moved code from snd_pcm_link to pcm_hw.c
- moved "empty" routines pointing to slave to pcm_generic.c
- introduced snd_pcm_generic_t
This commit is contained in:
Jaroslav Kysela 2005-01-20 15:07:51 +00:00
parent 9501520606
commit 836987aa99
25 changed files with 767 additions and 957 deletions

View file

@ -401,7 +401,7 @@ static int snd_pcm_adpcm_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
snd_pcm_adpcm_hw_refine_cchange,
snd_pcm_adpcm_hw_refine_sprepare,
snd_pcm_adpcm_hw_refine_schange,
snd_pcm_plugin_hw_refine_slave);
snd_pcm_generic_hw_refine);
}
static int snd_pcm_adpcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
@ -412,7 +412,7 @@ static int snd_pcm_adpcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
snd_pcm_adpcm_hw_refine_cchange,
snd_pcm_adpcm_hw_refine_sprepare,
snd_pcm_adpcm_hw_refine_schange,
snd_pcm_plugin_hw_params_slave);
snd_pcm_generic_hw_params);
if (err < 0)
return err;
@ -438,7 +438,7 @@ static int snd_pcm_adpcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
}
}
assert(!adpcm->states);
adpcm->states = malloc(adpcm->plug.slave->channels * sizeof(*adpcm->states));
adpcm->states = malloc(adpcm->plug.gen.slave->channels * sizeof(*adpcm->states));
if (adpcm->states == NULL)
return -ENOMEM;
return 0;
@ -451,7 +451,7 @@ static int snd_pcm_adpcm_hw_free(snd_pcm_t *pcm)
free(adpcm->states);
adpcm->states = 0;
}
return snd_pcm_hw_free(adpcm->plug.slave);
return snd_pcm_hw_free(adpcm->plug.gen.slave);
}
static int snd_pcm_adpcm_init(snd_pcm_t *pcm)
@ -515,23 +515,23 @@ static void snd_pcm_adpcm_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_dump_setup(pcm, out);
}
snd_output_printf(out, "Slave: ");
snd_pcm_dump(adpcm->plug.slave, out);
snd_pcm_dump(adpcm->plug.gen.slave, out);
}
static snd_pcm_ops_t snd_pcm_adpcm_ops = {
.close = snd_pcm_plugin_close,
.info = snd_pcm_plugin_info,
.close = snd_pcm_generic_close,
.info = snd_pcm_generic_info,
.hw_refine = snd_pcm_adpcm_hw_refine,
.hw_params = snd_pcm_adpcm_hw_params,
.hw_free = snd_pcm_adpcm_hw_free,
.sw_params = snd_pcm_plugin_sw_params,
.channel_info = snd_pcm_plugin_channel_info,
.sw_params = snd_pcm_generic_sw_params,
.channel_info = snd_pcm_generic_channel_info,
.dump = snd_pcm_adpcm_dump,
.nonblock = snd_pcm_plugin_nonblock,
.async = snd_pcm_plugin_async,
.poll_revents = snd_pcm_plugin_poll_revents,
.mmap = snd_pcm_plugin_mmap,
.munmap = snd_pcm_plugin_munmap,
.nonblock = snd_pcm_generic_nonblock,
.async = snd_pcm_generic_async,
.poll_revents = snd_pcm_generic_poll_revents,
.mmap = snd_pcm_generic_mmap,
.munmap = snd_pcm_generic_munmap,
};
/**
@ -564,8 +564,8 @@ int snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfor
adpcm->plug.read = snd_pcm_adpcm_read_areas;
adpcm->plug.write = snd_pcm_adpcm_write_areas;
adpcm->plug.init = snd_pcm_adpcm_init;
adpcm->plug.slave = slave;
adpcm->plug.close_slave = close_slave;
adpcm->plug.gen.slave = slave;
adpcm->plug.gen.close_slave = close_slave;
err = snd_pcm_new(&pcm, SND_PCM_TYPE_ADPCM, name, slave->stream, slave->mode);
if (err < 0) {