mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-05 13:30:00 -05:00
Better names for ALSA API. Added min_fragments, max_fragments.
This commit is contained in:
parent
4bb0a08bf9
commit
1a7f88d10e
26 changed files with 1938 additions and 1938 deletions
|
|
@ -45,8 +45,8 @@ typedef struct linear_private_data {
|
|||
} linear_t;
|
||||
|
||||
static void convert(snd_pcm_plugin_t *plugin,
|
||||
const snd_pcm_plugin_voice_t *src_voices,
|
||||
snd_pcm_plugin_voice_t *dst_voices,
|
||||
const snd_pcm_plugin_channel_t *src_channels,
|
||||
snd_pcm_plugin_channel_t *dst_channels,
|
||||
size_t frames)
|
||||
{
|
||||
#define CONV_LABELS
|
||||
|
|
@ -54,24 +54,24 @@ static void convert(snd_pcm_plugin_t *plugin,
|
|||
#undef CONV_LABELS
|
||||
linear_t *data = (linear_t *)plugin->extra_data;
|
||||
void *conv = conv_labels[data->conv];
|
||||
int voice;
|
||||
int nvoices = plugin->src_format.voices;
|
||||
for (voice = 0; voice < nvoices; ++voice) {
|
||||
int channel;
|
||||
int nchannels = plugin->src_format.channels;
|
||||
for (channel = 0; channel < nchannels; ++channel) {
|
||||
char *src;
|
||||
char *dst;
|
||||
int src_step, dst_step;
|
||||
size_t frames1;
|
||||
if (!src_voices[voice].enabled) {
|
||||
if (dst_voices[voice].wanted)
|
||||
snd_pcm_area_silence(&dst_voices[voice].area, 0, frames, plugin->dst_format.format);
|
||||
dst_voices[voice].enabled = 0;
|
||||
if (!src_channels[channel].enabled) {
|
||||
if (dst_channels[channel].wanted)
|
||||
snd_pcm_area_silence(&dst_channels[channel].area, 0, frames, plugin->dst_format.format);
|
||||
dst_channels[channel].enabled = 0;
|
||||
continue;
|
||||
}
|
||||
dst_voices[voice].enabled = 1;
|
||||
src = src_voices[voice].area.addr + src_voices[voice].area.first / 8;
|
||||
dst = dst_voices[voice].area.addr + dst_voices[voice].area.first / 8;
|
||||
src_step = src_voices[voice].area.step / 8;
|
||||
dst_step = dst_voices[voice].area.step / 8;
|
||||
dst_channels[channel].enabled = 1;
|
||||
src = src_channels[channel].area.addr + src_channels[channel].area.first / 8;
|
||||
dst = dst_channels[channel].area.addr + dst_channels[channel].area.first / 8;
|
||||
src_step = src_channels[channel].area.step / 8;
|
||||
dst_step = dst_channels[channel].area.step / 8;
|
||||
frames1 = frames;
|
||||
while (frames1-- > 0) {
|
||||
goto *conv;
|
||||
|
|
@ -86,27 +86,27 @@ static void convert(snd_pcm_plugin_t *plugin,
|
|||
}
|
||||
|
||||
static ssize_t linear_transfer(snd_pcm_plugin_t *plugin,
|
||||
const snd_pcm_plugin_voice_t *src_voices,
|
||||
snd_pcm_plugin_voice_t *dst_voices,
|
||||
const snd_pcm_plugin_channel_t *src_channels,
|
||||
snd_pcm_plugin_channel_t *dst_channels,
|
||||
size_t frames)
|
||||
{
|
||||
linear_t *data;
|
||||
unsigned int voice;
|
||||
unsigned int channel;
|
||||
|
||||
if (plugin == NULL || src_voices == NULL || dst_voices == NULL)
|
||||
if (plugin == NULL || src_channels == NULL || dst_channels == NULL)
|
||||
return -EFAULT;
|
||||
data = (linear_t *)plugin->extra_data;
|
||||
if (frames == 0)
|
||||
return 0;
|
||||
for (voice = 0; voice < plugin->src_format.voices; voice++) {
|
||||
if (src_voices[voice].area.first % 8 != 0 ||
|
||||
src_voices[voice].area.step % 8 != 0)
|
||||
for (channel = 0; channel < plugin->src_format.channels; channel++) {
|
||||
if (src_channels[channel].area.first % 8 != 0 ||
|
||||
src_channels[channel].area.step % 8 != 0)
|
||||
return -EINVAL;
|
||||
if (dst_voices[voice].area.first % 8 != 0 ||
|
||||
dst_voices[voice].area.step % 8 != 0)
|
||||
if (dst_channels[channel].area.first % 8 != 0 ||
|
||||
dst_channels[channel].area.step % 8 != 0)
|
||||
return -EINVAL;
|
||||
}
|
||||
convert(plugin, src_voices, dst_voices, frames);
|
||||
convert(plugin, src_channels, dst_channels, frames);
|
||||
return frames;
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ int conv_index(int src_format, int dst_format)
|
|||
}
|
||||
|
||||
int snd_pcm_plugin_build_linear(snd_pcm_plugin_handle_t *handle,
|
||||
int channel,
|
||||
int stream,
|
||||
snd_pcm_format_t *src_format,
|
||||
snd_pcm_format_t *dst_format,
|
||||
snd_pcm_plugin_t **r_plugin)
|
||||
|
|
@ -153,13 +153,13 @@ int snd_pcm_plugin_build_linear(snd_pcm_plugin_handle_t *handle,
|
|||
|
||||
if (src_format->rate != dst_format->rate)
|
||||
return -EINVAL;
|
||||
if (src_format->voices != dst_format->voices)
|
||||
if (src_format->channels != dst_format->channels)
|
||||
return -EINVAL;
|
||||
if (!(snd_pcm_format_linear(src_format->format) &&
|
||||
snd_pcm_format_linear(dst_format->format)))
|
||||
return -EINVAL;
|
||||
|
||||
err = snd_pcm_plugin_build(handle, channel,
|
||||
err = snd_pcm_plugin_build(handle, stream,
|
||||
"linear format conversion",
|
||||
src_format,
|
||||
dst_format,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue