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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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;
56 typedef struct snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t;
57 
58 /*
59  * bit flags for additional conditions
60  */
61 #define SND_PCM_IOPLUG_FLAG_LISTED (1<<0)
62 #define SND_PCM_IOPLUG_FLAG_MONOTONIC (1<<1)
64 /*
65  * Protocol version
66  */
67 #define SND_PCM_IOPLUG_VERSION_MAJOR 1
68 #define SND_PCM_IOPLUG_VERSION_MINOR 0
69 #define SND_PCM_IOPLUG_VERSION_TINY 1
73 #define SND_PCM_IOPLUG_VERSION ((SND_PCM_IOPLUG_VERSION_MAJOR<<16) |\
74  (SND_PCM_IOPLUG_VERSION_MINOR<<8) |\
75  (SND_PCM_IOPLUG_VERSION_TINY))
76 
83  unsigned int version;
87  const char *name;
88  unsigned int flags;
89  int poll_fd;
90  unsigned int poll_events;
91  unsigned int mmap_rw;
95  const snd_pcm_ioplug_callback_t *callback;
99  void *private_data;
104 
109  int nonblock;
113  unsigned int channels;
114  unsigned int rate;
117 };
118 
124  int (*start)(snd_pcm_ioplug_t *io);
128  int (*stop)(snd_pcm_ioplug_t *io);
132  snd_pcm_sframes_t (*pointer)(snd_pcm_ioplug_t *io);
136  snd_pcm_sframes_t (*transfer)(snd_pcm_ioplug_t *io,
137  const snd_pcm_channel_area_t *areas,
138  snd_pcm_uframes_t offset,
139  snd_pcm_uframes_t size);
143  int (*close)(snd_pcm_ioplug_t *io);
147  int (*hw_params)(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params);
151  int (*hw_free)(snd_pcm_ioplug_t *io);
155  int (*sw_params)(snd_pcm_ioplug_t *io, snd_pcm_sw_params_t *params);
159  int (*prepare)(snd_pcm_ioplug_t *io);
163  int (*drain)(snd_pcm_ioplug_t *io);
167  int (*pause)(snd_pcm_ioplug_t *io, int enable);
171  int (*resume)(snd_pcm_ioplug_t *io);
175  int (*poll_descriptors_count)(snd_pcm_ioplug_t *io);
179  int (*poll_descriptors)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int space);
183  int (*poll_revents)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int nfds, unsigned short *revents);
187  void (*dump)(snd_pcm_ioplug_t *io, snd_output_t *out);
191  int (*delay)(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp);
192 };
193 
194 
195 int snd_pcm_ioplug_create(snd_pcm_ioplug_t *io, const char *name,
196  snd_pcm_stream_t stream, int mode);
197 int snd_pcm_ioplug_delete(snd_pcm_ioplug_t *io);
198 
199 /* update poll_fd and mmap_rw */
200 int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug);
201 
202 /* get a mmap area (for mmap_rw only) */
203 const snd_pcm_channel_area_t *snd_pcm_ioplug_mmap_areas(snd_pcm_ioplug_t *ioplug);
204 
205 /* clear hw_parameter setting */
206 void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *io);
207 
208 /* hw_parameter setting */
209 int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *io, int type, unsigned int min, unsigned int max);
210 int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *io, int type, unsigned int num_list, const unsigned int *list);
211 
212 /* change PCM status */
213 int snd_pcm_ioplug_set_state(snd_pcm_ioplug_t *ioplug, snd_pcm_state_t state);
214 
217 #endif /* __ALSA_PCM_IOPLUG_H */
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:985
void(* dump)(snd_pcm_ioplug_t *io, snd_output_t *out)
Definition: pcm_ioplug.h:187
struct _snd_pcm_sw_params snd_pcm_sw_params_t
Definition: pcm.h:65
volatile snd_pcm_uframes_t appl_ptr
Definition: pcm_ioplug.h:107
Definition: pcm_ioplug.h:44
snd_pcm_state_t
Definition: pcm.h:255
Definition: pcm_ioplug.h:43
int(* hw_params)(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params)
Definition: pcm_ioplug.h:147
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:1068
unsigned int poll_events
Definition: pcm_ioplug.h:90
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:1051
int snd_pcm_ioplug_delete(snd_pcm_ioplug_t *io)
Delete the ioplug instance.
Definition: pcm_ioplug.c:956
int(* poll_descriptors_count)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:175
Definition: pcm.h:401
struct _snd_pcm_hw_params snd_pcm_hw_params_t
Definition: pcm.h:62
int(* pause)(snd_pcm_ioplug_t *io, int enable)
Definition: pcm_ioplug.h:167
const snd_pcm_ioplug_callback_t * callback
Definition: pcm_ioplug.h:95
int(* stop)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:128
int(* resume)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:171
int(* drain)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:163
int(* poll_revents)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int nfds, unsigned short *revents)
Definition: pcm_ioplug.h:183
int(* hw_free)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:151
void * private_data
Definition: pcm_ioplug.h:99
Definition: pcm_ioplug.h:49
int nonblock
Definition: pcm_ioplug.h:109
int poll_fd
Definition: pcm_ioplug.h:89
Definition: pcm_ioplug.h:78
snd_pcm_format_t
Definition: pcm.h:123
long snd_pcm_sframes_t
Definition: pcm.h:311
Definition: pcm_ioplug.h:50
snd_pcm_uframes_t buffer_size
Definition: pcm_ioplug.h:116
Definition: pcm_ioplug.h:120
snd_pcm_uframes_t period_size
Definition: pcm_ioplug.h:115
unsigned int version
Definition: pcm_ioplug.h:83
int(* poll_descriptors)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int space)
Definition: pcm_ioplug.h:179
struct _snd_output snd_output_t
Internal structure for an output object.
Definition: output.h:54
int(* sw_params)(snd_pcm_ioplug_t *io, snd_pcm_sw_params_t *params)
Definition: pcm_ioplug.h:155
snd_pcm_state_t state
Definition: pcm_ioplug.h:106
const char * name
Definition: pcm_ioplug.h:87
unsigned int rate
Definition: pcm_ioplug.h:114
snd_pcm_format_t format
Definition: pcm_ioplug.h:112
Definition: pcm_ioplug.h:48
int(* start)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:124
snd_pcm_sframes_t(* pointer)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:132
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:1009
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:136
int(* delay)(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp)
Definition: pcm_ioplug.h:191
unsigned int flags
Definition: pcm_ioplug.h:88
snd_pcm_access_t access
Definition: pcm_ioplug.h:111
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:905
int(* close)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:143
void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *io)
Reset ioplug parameters.
Definition: pcm_ioplug.c:968
Definition: pcm_ioplug.h:45
Definition: pcm_ioplug.h:47
unsigned int channels
Definition: pcm_ioplug.h:113
snd_pcm_stream_t stream
Definition: pcm_ioplug.h:105
int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug)
Reinitialize the poll and mmap status.
Definition: pcm_ioplug.c:1034
unsigned long snd_pcm_uframes_t
Definition: pcm.h:309
snd_pcm_stream_t
Definition: pcm.h:99
snd_pcm_t * pcm
Definition: pcm_ioplug.h:103
int(* prepare)(snd_pcm_ioplug_t *io)
Definition: pcm_ioplug.h:159
Definition: pcm_ioplug.h:46
struct _snd_pcm snd_pcm_t
Definition: pcm.h:327
unsigned int mmap_rw
Definition: pcm_ioplug.h:91
volatile snd_pcm_uframes_t hw_ptr
Definition: pcm_ioplug.h:108
snd_pcm_access_t
Definition: pcm.h:108