ALSA project - the C library reference
pcm_ioplug.h
Go to the documentation of this file.
1
10/*
11 * ALSA external PCM plugin SDK
12 *
13 * Copyright (c) 2005 Takashi Iwai <tiwai@suse.de>
14 *
15 * This library is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License as
17 * published by the Free Software Foundation; either version 2.1 of
18 * the License, or (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28 *
29 */
30
31#ifndef __ALSA_PCM_IOPLUG_H
32#define __ALSA_PCM_IOPLUG_H
33
42enum {
51};
52
54typedef struct snd_pcm_ioplug snd_pcm_ioplug_t;
57#ifdef DOC_HIDDEN
58/* redefine typedefs for stupid doxygen */
61#endif
62
63/*
64 * bit flags for additional conditions
65 */
66#define SND_PCM_IOPLUG_FLAG_LISTED (1<<0)
67#define SND_PCM_IOPLUG_FLAG_MONOTONIC (1<<1)
69#define SND_PCM_IOPLUG_FLAG_BOUNDARY_WA (1<<2)
70
71/*
72 * Protocol version
73 */
74#define SND_PCM_IOPLUG_VERSION_MAJOR 1
75#define SND_PCM_IOPLUG_VERSION_MINOR 0
76#define SND_PCM_IOPLUG_VERSION_TINY 2
80#define SND_PCM_IOPLUG_VERSION ((SND_PCM_IOPLUG_VERSION_MAJOR<<16) |\
81 (SND_PCM_IOPLUG_VERSION_MINOR<<8) |\
82 (SND_PCM_IOPLUG_VERSION_TINY))
83
90 unsigned int version;
94 const char *name;
95 unsigned int flags;
96 int poll_fd;
97 unsigned int poll_events;
98 unsigned int mmap_rw;
111
120 unsigned int channels;
121 unsigned int rate;
124};
125
147 const snd_pcm_channel_area_t *areas,
148 snd_pcm_uframes_t offset,
149 snd_pcm_uframes_t size);
177 int (*pause)(snd_pcm_ioplug_t *io, int enable);
189 int (*poll_descriptors)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int space);
193 int (*poll_revents)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int nfds, unsigned short *revents);
214};
215
216
217int snd_pcm_ioplug_create(snd_pcm_ioplug_t *io, const char *name,
218 snd_pcm_stream_t stream, int mode);
220
221/* update poll_fd and mmap_rw */
223
224/* get a mmap area (for mmap_rw only) */
226
227/* clear hw_parameter setting */
229
230/* hw_parameter setting */
231int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *io, int type, unsigned int min, unsigned int max);
232int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *io, int type, unsigned int num_list, const unsigned int *list);
233
234/* change PCM status */
236
237/* calucalte the available frames */
239 const snd_pcm_uframes_t hw_ptr,
240 const snd_pcm_uframes_t appl_ptr);
242 const snd_pcm_uframes_t hw_ptr,
243 const snd_pcm_uframes_t appl_ptr);
244
247#endif /* __ALSA_PCM_IOPLUG_H */
struct _snd_output snd_output_t
Internal structure for an output object.
Definition: output.h:56
snd_pcm_ioplug snd_pcm_ioplug_t
Definition: pcm_ioplug.h:59
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
int snd_pcm_ioplug_delete(snd_pcm_ioplug_t *io)
Delete the ioplug instance.
Definition: pcm_ioplug.c:1126
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_set_param_list(snd_pcm_ioplug_t *io, int type, unsigned int num_list, const unsigned int *list)
Set parameter as the list.
Definition: pcm_ioplug.c:1155
int snd_pcm_ioplug_create(snd_pcm_ioplug_t *io, const char *name, snd_pcm_stream_t stream, int mode)
Create an ioplug instance.
Definition: pcm_ioplug.c:1074
snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t
Definition: pcm_ioplug.h:60
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_minmax(snd_pcm_ioplug_t *io, int type, unsigned int min, unsigned int max)
Set parameter as the min/max values.
Definition: pcm_ioplug.c:1179
void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *io)
Reset ioplug parameters.
Definition: pcm_ioplug.c:1138
@ SND_PCM_IOPLUG_HW_BUFFER_BYTES
Definition: pcm_ioplug.h:48
@ SND_PCM_IOPLUG_HW_PERIODS
Definition: pcm_ioplug.h:49
@ SND_PCM_IOPLUG_HW_RATE
Definition: pcm_ioplug.h:46
@ SND_PCM_IOPLUG_HW_CHANNELS
Definition: pcm_ioplug.h:45
@ SND_PCM_IOPLUG_HW_FORMAT
Definition: pcm_ioplug.h:44
@ SND_PCM_IOPLUG_HW_PERIOD_BYTES
Definition: pcm_ioplug.h:47
@ SND_PCM_IOPLUG_HW_PARAMS
Definition: pcm_ioplug.h:50
@ SND_PCM_IOPLUG_HW_ACCESS
Definition: pcm_ioplug.h:43
snd_pcm_state_t
Definition: pcm.h:291
struct _snd_pcm_hw_params snd_pcm_hw_params_t
Definition: pcm.h:64
snd_pcm_access_t
Definition: pcm.h:110
long snd_pcm_sframes_t
Definition: pcm.h:390
struct _snd_pcm_sw_params snd_pcm_sw_params_t
Definition: pcm.h:67
struct _snd_pcm snd_pcm_t
Definition: pcm.h:408
snd_pcm_format_t
Definition: pcm.h:125
unsigned long snd_pcm_uframes_t
Definition: pcm.h:388
snd_pcm_stream_t
Definition: pcm.h:101
Definition: pcm.h:482
Definition: pcm.h:628
Definition: pcm.h:622
Definition: pcm_ioplug.h:127
int(* prepare)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:169
int(* resume)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:181
int(* close)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:153
snd_pcm_sframes_t(* pointer)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:142
int(* delay)(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp)
Definition: pcm_ioplug.h:201
int(* hw_params)(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params)
Definition: pcm_ioplug.h:157
int(* drain)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:173
int(* poll_descriptors_count)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:185
int(* poll_descriptors)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int space)
Definition: pcm_ioplug.h:189
int(* pause)(snd_pcm_ioplug_t *io, int enable)
Definition: pcm_ioplug.h:177
int(* start)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:131
int(* poll_revents)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int nfds, unsigned short *revents)
Definition: pcm_ioplug.h:193
void(* dump)(snd_pcm_ioplug_t *io, snd_output_t *out)
Definition: pcm_ioplug.h:197
int(* sw_params)(snd_pcm_ioplug_t *io, snd_pcm_sw_params_t *params)
Definition: pcm_ioplug.h:165
int(* set_chmap)(snd_pcm_ioplug_t *io, const snd_pcm_chmap_t *map)
Definition: pcm_ioplug.h:213
int(* hw_free)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:161
int(* stop)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:135
snd_pcm_sframes_t(* transfer)(snd_pcm_ioplug_t *io, const snd_pcm_channel_area_t *areas, snd_pcm_uframes_t offset, snd_pcm_uframes_t size)
Definition: pcm_ioplug.h:146
Definition: pcm_ioplug.h:85
snd_pcm_format_t format
Definition: pcm_ioplug.h:119
const char * name
Definition: pcm_ioplug.h:94
const snd_pcm_ioplug_callback_t * callback
Definition: pcm_ioplug.h:102
int nonblock
Definition: pcm_ioplug.h:116
snd_pcm_uframes_t buffer_size
Definition: pcm_ioplug.h:123
volatile snd_pcm_uframes_t appl_ptr
Definition: pcm_ioplug.h:114
unsigned int version
Definition: pcm_ioplug.h:90
snd_pcm_stream_t stream
Definition: pcm_ioplug.h:112
snd_pcm_t * pcm
Definition: pcm_ioplug.h:110
snd_pcm_state_t state
Definition: pcm_ioplug.h:113
volatile snd_pcm_uframes_t hw_ptr
Definition: pcm_ioplug.h:115
unsigned int poll_events
Definition: pcm_ioplug.h:97
int poll_fd
Definition: pcm_ioplug.h:96
unsigned int rate
Definition: pcm_ioplug.h:121
void * private_data
Definition: pcm_ioplug.h:106
snd_pcm_access_t access
Definition: pcm_ioplug.h:118
unsigned int channels
Definition: pcm_ioplug.h:120
unsigned int mmap_rw
Definition: pcm_ioplug.h:98
snd_pcm_uframes_t period_size
Definition: pcm_ioplug.h:122
unsigned int flags
Definition: pcm_ioplug.h:95