31#if !defined(__ALSA_PCM_EXTERNAL_H) && !defined(ALSA_LIBRARY_BUILD)
32#warning "use #include <alsa/pcm_external.h>, <alsa/pcm_ioplug.h> should not be used directly"
33#include <alsa/pcm_external.h>
36#ifndef __ALSA_PCM_IOPLUG_H
37#define __ALSA_PCM_IOPLUG_H
48 SND_PCM_IOPLUG_HW_ACCESS = 0,
49 SND_PCM_IOPLUG_HW_FORMAT,
50 SND_PCM_IOPLUG_HW_CHANNELS,
51 SND_PCM_IOPLUG_HW_RATE,
52 SND_PCM_IOPLUG_HW_PERIOD_BYTES,
53 SND_PCM_IOPLUG_HW_BUFFER_BYTES,
54 SND_PCM_IOPLUG_HW_PERIODS,
55 SND_PCM_IOPLUG_HW_PARAMS
59typedef struct snd_pcm_ioplug snd_pcm_ioplug_t;
61typedef struct snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t;
64typedef snd_pcm_ioplug snd_pcm_ioplug_t;
65typedef snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t;
71#define SND_PCM_IOPLUG_FLAG_LISTED (1<<0)
72#define SND_PCM_IOPLUG_FLAG_MONOTONIC (1<<1)
74#define SND_PCM_IOPLUG_FLAG_BOUNDARY_WA (1<<2)
79#define SND_PCM_IOPLUG_VERSION_MAJOR 1
80#define SND_PCM_IOPLUG_VERSION_MINOR 0
81#define SND_PCM_IOPLUG_VERSION_TINY 2
85#define SND_PCM_IOPLUG_VERSION ((SND_PCM_IOPLUG_VERSION_MAJOR<<16) |\
86 (SND_PCM_IOPLUG_VERSION_MINOR<<8) |\
87 (SND_PCM_IOPLUG_VERSION_TINY))
90struct snd_pcm_ioplug {
102 unsigned int poll_events;
103 unsigned int mmap_rw;
107 const snd_pcm_ioplug_callback_t *callback;
117 snd_pcm_stream_t stream;
118 snd_pcm_state_t state;
119 volatile snd_pcm_uframes_t appl_ptr;
120 volatile snd_pcm_uframes_t hw_ptr;
123 snd_pcm_access_t access;
124 snd_pcm_format_t format;
125 unsigned int channels;
127 snd_pcm_uframes_t period_size;
128 snd_pcm_uframes_t buffer_size;
132struct snd_pcm_ioplug_callback {
136 int (*start)(snd_pcm_ioplug_t *io);
140 int (*stop)(snd_pcm_ioplug_t *io);
147 snd_pcm_sframes_t (*pointer)(snd_pcm_ioplug_t *io);
151 snd_pcm_sframes_t (*transfer)(snd_pcm_ioplug_t *io,
152 const snd_pcm_channel_area_t *areas,
153 snd_pcm_uframes_t offset,
154 snd_pcm_uframes_t size);
158 int (*close)(snd_pcm_ioplug_t *io);
162 int (*hw_params)(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params);
166 int (*hw_free)(snd_pcm_ioplug_t *io);
170 int (*sw_params)(snd_pcm_ioplug_t *io, snd_pcm_sw_params_t *params);
174 int (*prepare)(snd_pcm_ioplug_t *io);
178 int (*drain)(snd_pcm_ioplug_t *io);
182 int (*pause)(snd_pcm_ioplug_t *io,
int enable);
186 int (*resume)(snd_pcm_ioplug_t *io);
190 int (*poll_descriptors_count)(snd_pcm_ioplug_t *io);
194 int (*poll_descriptors)(snd_pcm_ioplug_t *io,
struct pollfd *pfd,
unsigned int space);
198 int (*poll_revents)(snd_pcm_ioplug_t *io,
struct pollfd *pfd,
unsigned int nfds,
unsigned short *revents);
202 void (*dump)(snd_pcm_ioplug_t *io, snd_output_t *out);
206 int (*delay)(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp);
210 snd_pcm_chmap_query_t **(*query_chmaps)(snd_pcm_ioplug_t *io);
214 snd_pcm_chmap_t *(*get_chmap)(snd_pcm_ioplug_t *io);
218 int (*set_chmap)(snd_pcm_ioplug_t *io,
const snd_pcm_chmap_t *map);
223 snd_pcm_stream_t stream,
int mode);
244 const snd_pcm_uframes_t hw_ptr,
245 const snd_pcm_uframes_t appl_ptr);
247 const snd_pcm_uframes_t hw_ptr,
248 const snd_pcm_uframes_t appl_ptr);
void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *ioplug)
Reset ioplug parameters.
Definition pcm_ioplug.c:1138
snd_pcm_uframes_t snd_pcm_ioplug_avail(const snd_pcm_ioplug_t *const ioplug, const snd_pcm_uframes_t hw_ptr, const snd_pcm_uframes_t appl_ptr)
Get the available frames. This function can be used to calculate the the available frames before call...
Definition pcm_ioplug.c:1255
const snd_pcm_channel_area_t * snd_pcm_ioplug_mmap_areas(snd_pcm_ioplug_t *ioplug)
Get mmap area of ioplug.
Definition pcm_ioplug.c:1224
snd_pcm_uframes_t snd_pcm_ioplug_hw_avail(const snd_pcm_ioplug_t *const ioplug, const snd_pcm_uframes_t hw_ptr, const snd_pcm_uframes_t appl_ptr)
Get the available frames. This function can be used to calculate the the available frames before call...
Definition pcm_ioplug.c:1270
int snd_pcm_ioplug_set_state(snd_pcm_ioplug_t *ioplug, snd_pcm_state_t state)
Change the ioplug PCM status.
Definition pcm_ioplug.c:1241
int snd_pcm_ioplug_create(snd_pcm_ioplug_t *ioplug, const char *name, snd_pcm_stream_t stream, int mode)
Create an ioplug instance.
Definition pcm_ioplug.c:1074
int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *ioplug, int type, unsigned int min, unsigned int max)
Set parameter as the min/max values.
Definition pcm_ioplug.c:1179
int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug)
Reinitialize the poll and mmap status.
Definition pcm_ioplug.c:1204
int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *ioplug, int type, unsigned int num_list, const unsigned int *list)
Set parameter as the list.
Definition pcm_ioplug.c:1155
int snd_pcm_ioplug_delete(snd_pcm_ioplug_t *ioplug)
Delete the ioplug instance.
Definition pcm_ioplug.c:1126