Lines Matching refs:plugin
49 static int snd_pcm_plugin_alloc(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t frames) in snd_pcm_plugin_alloc() argument
57 if (plugin->stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_pcm_plugin_alloc()
58 format = &plugin->src_format; in snd_pcm_plugin_alloc()
60 format = &plugin->dst_format; in snd_pcm_plugin_alloc()
72 if (plugin->buf_frames < frames) { in snd_pcm_plugin_alloc()
73 kvfree(plugin->buf); in snd_pcm_plugin_alloc()
74 plugin->buf = kvzalloc(size, GFP_KERNEL); in snd_pcm_plugin_alloc()
75 plugin->buf_frames = frames; in snd_pcm_plugin_alloc()
77 if (!plugin->buf) { in snd_pcm_plugin_alloc()
78 plugin->buf_frames = 0; in snd_pcm_plugin_alloc()
81 c = plugin->buf_channels; in snd_pcm_plugin_alloc()
82 if (plugin->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED) { in snd_pcm_plugin_alloc()
87 c->area.addr = plugin->buf; in snd_pcm_plugin_alloc()
91 } else if (plugin->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) { in snd_pcm_plugin_alloc()
99 c->area.addr = plugin->buf + (channel * size); in snd_pcm_plugin_alloc()
114 struct snd_pcm_plugin *plugin = snd_pcm_plug_first(plug); in snd_pcm_plug_alloc() local
115 while (plugin->next) { in snd_pcm_plug_alloc()
116 if (plugin->dst_frames) in snd_pcm_plug_alloc()
117 frames = plugin->dst_frames(plugin, frames); in snd_pcm_plug_alloc()
120 plugin = plugin->next; in snd_pcm_plug_alloc()
121 err = snd_pcm_plugin_alloc(plugin, frames); in snd_pcm_plug_alloc()
126 struct snd_pcm_plugin *plugin = snd_pcm_plug_last(plug); in snd_pcm_plug_alloc() local
127 while (plugin->prev) { in snd_pcm_plug_alloc()
128 if (plugin->src_frames) in snd_pcm_plug_alloc()
129 frames = plugin->src_frames(plugin, frames); in snd_pcm_plug_alloc()
132 plugin = plugin->prev; in snd_pcm_plug_alloc()
133 err = snd_pcm_plugin_alloc(plugin, frames); in snd_pcm_plug_alloc()
142 snd_pcm_sframes_t snd_pcm_plugin_client_channels(struct snd_pcm_plugin *plugin, in snd_pcm_plugin_client_channels() argument
146 *channels = plugin->buf_channels; in snd_pcm_plugin_client_channels()
157 struct snd_pcm_plugin *plugin; in snd_pcm_plugin_build() local
164 plugin = kzalloc(sizeof(*plugin) + extra, GFP_KERNEL); in snd_pcm_plugin_build()
165 if (plugin == NULL) in snd_pcm_plugin_build()
167 plugin->name = name; in snd_pcm_plugin_build()
168 plugin->plug = plug; in snd_pcm_plugin_build()
169 plugin->stream = snd_pcm_plug_stream(plug); in snd_pcm_plugin_build()
170 plugin->access = SNDRV_PCM_ACCESS_RW_INTERLEAVED; in snd_pcm_plugin_build()
171 plugin->src_format = *src_format; in snd_pcm_plugin_build()
172 plugin->src_width = snd_pcm_format_physical_width(src_format->format); in snd_pcm_plugin_build()
173 snd_BUG_ON(plugin->src_width <= 0); in snd_pcm_plugin_build()
174 plugin->dst_format = *dst_format; in snd_pcm_plugin_build()
175 plugin->dst_width = snd_pcm_format_physical_width(dst_format->format); in snd_pcm_plugin_build()
176 snd_BUG_ON(plugin->dst_width <= 0); in snd_pcm_plugin_build()
177 if (plugin->stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_pcm_plugin_build()
181 plugin->buf_channels = kcalloc(channels, sizeof(*plugin->buf_channels), GFP_KERNEL); in snd_pcm_plugin_build()
182 if (plugin->buf_channels == NULL) { in snd_pcm_plugin_build()
183 snd_pcm_plugin_free(plugin); in snd_pcm_plugin_build()
186 plugin->client_channels = snd_pcm_plugin_client_channels; in snd_pcm_plugin_build()
187 *ret = plugin; in snd_pcm_plugin_build()
191 int snd_pcm_plugin_free(struct snd_pcm_plugin *plugin) in snd_pcm_plugin_free() argument
193 if (! plugin) in snd_pcm_plugin_free()
195 if (plugin->private_free) in snd_pcm_plugin_free()
196 plugin->private_free(plugin); in snd_pcm_plugin_free()
197 kfree(plugin->buf_channels); in snd_pcm_plugin_free()
198 kvfree(plugin->buf); in snd_pcm_plugin_free()
199 kfree(plugin); in snd_pcm_plugin_free()
207 struct snd_pcm_plugin *plugin, *plugin_next; in calc_dst_frames() local
209 plugin = snd_pcm_plug_first(plug); in calc_dst_frames()
210 while (plugin && frames > 0) { in calc_dst_frames()
211 plugin_next = plugin->next; in calc_dst_frames()
212 if (check_size && plugin->buf_frames && in calc_dst_frames()
213 frames > plugin->buf_frames) in calc_dst_frames()
214 frames = plugin->buf_frames; in calc_dst_frames()
215 if (plugin->dst_frames) { in calc_dst_frames()
216 frames = plugin->dst_frames(plugin, frames); in calc_dst_frames()
220 plugin = plugin_next; in calc_dst_frames()
229 struct snd_pcm_plugin *plugin, *plugin_prev; in calc_src_frames() local
231 plugin = snd_pcm_plug_last(plug); in calc_src_frames()
232 while (plugin && frames > 0) { in calc_src_frames()
233 plugin_prev = plugin->prev; in calc_src_frames()
234 if (plugin->src_frames) { in calc_src_frames()
235 frames = plugin->src_frames(plugin, frames); in calc_src_frames()
239 if (check_size && plugin->buf_frames && in calc_src_frames()
240 frames > plugin->buf_frames) in calc_src_frames()
241 frames = plugin->buf_frames; in calc_src_frames()
242 plugin = plugin_prev; in calc_src_frames()
379 struct snd_pcm_plugin *plugin = NULL; in snd_pcm_plug_format_plugins() local
431 &plugin); in snd_pcm_plug_format_plugins()
434 err = snd_pcm_plugin_append(plugin); in snd_pcm_plug_format_plugins()
436 snd_pcm_plugin_free(plugin); in snd_pcm_plug_format_plugins()
446 err = snd_pcm_plugin_build_route(plug, &srcformat, &tmpformat, &plugin); in snd_pcm_plug_format_plugins()
450 err = snd_pcm_plugin_append(plugin); in snd_pcm_plug_format_plugins()
452 snd_pcm_plugin_free(plugin); in snd_pcm_plug_format_plugins()
466 &plugin); in snd_pcm_plug_format_plugins()
469 err = snd_pcm_plugin_append(plugin); in snd_pcm_plug_format_plugins()
471 snd_pcm_plugin_free(plugin); in snd_pcm_plug_format_plugins()
480 &plugin); in snd_pcm_plug_format_plugins()
484 err = snd_pcm_plugin_append(plugin); in snd_pcm_plug_format_plugins()
486 snd_pcm_plugin_free(plugin); in snd_pcm_plug_format_plugins()
500 &plugin); in snd_pcm_plug_format_plugins()
506 &plugin); in snd_pcm_plug_format_plugins()
513 err = snd_pcm_plugin_append(plugin); in snd_pcm_plug_format_plugins()
515 snd_pcm_plugin_free(plugin); in snd_pcm_plug_format_plugins()
525 err = snd_pcm_plugin_build_route(plug, &srcformat, &tmpformat, &plugin); in snd_pcm_plug_format_plugins()
529 err = snd_pcm_plugin_append(plugin); in snd_pcm_plug_format_plugins()
531 snd_pcm_plugin_free(plugin); in snd_pcm_plug_format_plugins()
543 &plugin); in snd_pcm_plug_format_plugins()
547 err = snd_pcm_plugin_append(plugin); in snd_pcm_plug_format_plugins()
549 snd_pcm_plugin_free(plugin); in snd_pcm_plug_format_plugins()
562 struct snd_pcm_plugin *plugin; in snd_pcm_plug_client_channels_buf() local
571 plugin = snd_pcm_plug_first(plug); in snd_pcm_plug_client_channels_buf()
572 format = &plugin->src_format; in snd_pcm_plug_client_channels_buf()
574 plugin = snd_pcm_plug_last(plug); in snd_pcm_plug_client_channels_buf()
575 format = &plugin->dst_format; in snd_pcm_plug_client_channels_buf()
577 v = plugin->buf_channels; in snd_pcm_plug_client_channels_buf()
583 if (snd_BUG_ON(plugin->access != SNDRV_PCM_ACCESS_RW_INTERLEAVED && in snd_pcm_plug_client_channels_buf()
599 struct snd_pcm_plugin *plugin, *next; in snd_pcm_plug_write_transfer() local
604 plugin = snd_pcm_plug_first(plug); in snd_pcm_plug_write_transfer()
605 while (plugin) { in snd_pcm_plug_write_transfer()
608 next = plugin->next; in snd_pcm_plug_write_transfer()
611 if (plugin->dst_frames) { in snd_pcm_plug_write_transfer()
612 frames1 = plugin->dst_frames(plugin, frames); in snd_pcm_plug_write_transfer()
621 if (plugin->src_frames) { in snd_pcm_plug_write_transfer()
622 frames = plugin->src_frames(plugin, frames1); in snd_pcm_plug_write_transfer()
629 pdprintf("write plugin: %s, %li\n", plugin->name, frames); in snd_pcm_plug_write_transfer()
630 frames = plugin->transfer(plugin, src_channels, dst_channels, frames); in snd_pcm_plug_write_transfer()
634 plugin = next; in snd_pcm_plug_write_transfer()
641 struct snd_pcm_plugin *plugin, *next; in snd_pcm_plug_read_transfer() local
651 plugin = snd_pcm_plug_first(plug); in snd_pcm_plug_read_transfer()
652 while (plugin && frames > 0) { in snd_pcm_plug_read_transfer()
653 next = plugin->next; in snd_pcm_plug_read_transfer()
655 err = plugin->client_channels(plugin, frames, &dst_channels); in snd_pcm_plug_read_transfer()
662 pdprintf("read plugin: %s, %li\n", plugin->name, frames); in snd_pcm_plug_read_transfer()
663 frames = plugin->transfer(plugin, src_channels, dst_channels, frames); in snd_pcm_plug_read_transfer()
666 plugin = next; in snd_pcm_plug_read_transfer()