ALSA project - the C library reference
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 
42 enum {
51 };
52 
54 typedef 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 
116  int nonblock;
120  unsigned int channels;
121  unsigned int rate;
124 };
125 
131  int (*start)(snd_pcm_ioplug_t *io);
135  int (*stop)(snd_pcm_ioplug_t *io);
147  const snd_pcm_channel_area_t *areas,
148  snd_pcm_uframes_t offset,
149  snd_pcm_uframes_t size);
153  int (*close)(snd_pcm_ioplug_t *io);
173  int (*drain)(snd_pcm_ioplug_t *io);
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);
197  void (*dump)(snd_pcm_ioplug_t *io, snd_output_t *out);
205  snd_pcm_chmap_query_t **(*query_chmaps)(snd_pcm_ioplug_t *io);
209  snd_pcm_chmap_t *(*get_chmap)(snd_pcm_ioplug_t *io);
213  int (*set_chmap)(snd_pcm_ioplug_t *io, const snd_pcm_chmap_t *map);
214 };
215 
216 
217 int 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 */
231 int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *io, int type, unsigned int min, unsigned int max);
232 int 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);
241 
244 #endif /* __ALSA_PCM_IOPLUG_H */