1 // SPDX-License-Identifier: GPL-2.0
3 // xfer-libasound.h - a header for receiver/transmitter of frames by alsa-lib.
5 // Copyright (c) 2018 Takashi Sakamoto <o-takashi@sakamocchi.jp>
7 // Licensed under the terms of the GNU General Public License, version 2.
9 #ifndef __ALSA_UTILS_AXFER_XFER_LIBASOUND__H_
10 #define __ALSA_UTILS_AXFER_XFER_LIBASOUND__H_
14 #define logging(state, ...) \
15 snd_output_printf(state->log, __VA_ARGS__)
17 struct xfer_libasound_ops;
19 struct libasound_state {
23 snd_pcm_hw_params_t *hw_params;
24 snd_pcm_sw_params_t *sw_params;
26 const struct xfer_libasound_ops *ops;
33 bool finish_at_xrun:1;
38 // For internal use in 'libasound' module.
40 struct xfer_libasound_ops {
41 int (*pre_process)(struct libasound_state *state);
42 int (*process_frames)(struct libasound_state *state,
43 unsigned int *frame_count,
44 struct mapper_context *mapper,
45 struct container_context *cntrs);
46 void (*post_process)(struct libasound_state *state);
47 unsigned int private_size;
50 extern const struct xfer_libasound_ops xfer_libasound_irq_rw_ops;
52 extern const struct xfer_libasound_ops xfer_libasound_irq_mmap_r_ops;
53 extern const struct xfer_libasound_ops xfer_libasound_irq_mmap_w_ops;