1 // SPDX-License-Identifier: GPL-2.0
3 // xfer.h - a header for receiver/transmiter of data frames.
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__H_
10 #define __ALSA_UTILS_AXFER_XFER__H_
17 XFER_TYPE_UNSUPPORTED = -1,
24 snd_pcm_stream_t direction;
26 const struct xfer_ops *ops;
32 enum xfer_type xfer_type_from_label(const char *label);
34 int xfer_context_init(struct xfer_context *xfer, enum xfer_type type,
35 snd_pcm_stream_t direction, int argc, char *const *argv);
36 void xfer_context_destroy(struct xfer_context *xfer);
37 int xfer_context_pre_process(struct xfer_context *xfer,
38 snd_pcm_format_t *format,
39 unsigned int *samples_per_frame,
40 unsigned int *frames_per_second,
41 snd_pcm_access_t *access,
42 snd_pcm_uframes_t *frames_per_buffer);
43 int xfer_context_process_frames(struct xfer_context *xfer,
44 struct mapper_context *mapper,
45 struct container_context *cntrs,
46 unsigned int *frame_count);
47 void xfer_context_pause(struct xfer_context *xfer, bool enable);
48 void xfer_context_post_process(struct xfer_context *xfer);
50 // For internal use in 'xfer' module.
53 int (*init)(struct xfer_context *xfer, snd_pcm_stream_t direction);
54 int (*parse_opt)(struct xfer_context *xfer, int key, const char *optarg);
55 int (*validate_opts)(struct xfer_context *xfer);
56 int (*pre_process)(struct xfer_context *xfer, snd_pcm_format_t *format,
57 unsigned int *samples_per_frame,
58 unsigned int *frames_per_second,
59 snd_pcm_access_t *access,
60 snd_pcm_uframes_t *frames_per_buffer);
61 int (*process_frames)(struct xfer_context *xfer,
62 unsigned int *frame_count,
63 struct mapper_context *mapper,
64 struct container_context *cntrs);
65 void (*post_process)(struct xfer_context *xfer);
66 void (*destroy)(struct xfer_context *xfer);
67 void (*pause)(struct xfer_context *xfer, bool enable);
72 const struct option *l_opts;
73 unsigned int l_opts_count;
75 unsigned int private_size;
78 extern const struct xfer_data xfer_alsa;