00001
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef __ALSA_PCM_IOPLUG_H
00032 #define __ALSA_PCM_IOPLUG_H
00033
00042 enum {
00043 SND_PCM_IOPLUG_HW_ACCESS = 0,
00044 SND_PCM_IOPLUG_HW_FORMAT,
00045 SND_PCM_IOPLUG_HW_CHANNELS,
00046 SND_PCM_IOPLUG_HW_RATE,
00047 SND_PCM_IOPLUG_HW_PERIOD_BYTES,
00048 SND_PCM_IOPLUG_HW_BUFFER_BYTES,
00049 SND_PCM_IOPLUG_HW_PERIODS,
00050 SND_PCM_IOPLUG_HW_PARAMS
00051 };
00052
00054 typedef struct snd_pcm_ioplug snd_pcm_ioplug_t;
00056 typedef struct snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t;
00057
00061 #define SND_PCM_IOPLUG_FLAG_LISTED (1<<0)
00062
00063
00064
00065
00066 #define SND_PCM_IOPLUG_VERSION_MAJOR 1
00067 #define SND_PCM_IOPLUG_VERSION_MINOR 0
00068 #define SND_PCM_IOPLUG_VERSION_TINY 1
00072 #define SND_PCM_IOPLUG_VERSION ((SND_PCM_IOPLUG_VERSION_MAJOR<<16) |\
00073 (SND_PCM_IOPLUG_VERSION_MINOR<<8) |\
00074 (SND_PCM_IOPLUG_VERSION_TINY))
00075
00077 struct snd_pcm_ioplug {
00082 unsigned int version;
00086 const char *name;
00087 unsigned int flags;
00088 int poll_fd;
00089 unsigned int poll_events;
00090 unsigned int mmap_rw;
00094 const snd_pcm_ioplug_callback_t *callback;
00098 void *private_data;
00102 snd_pcm_t *pcm;
00103
00104 snd_pcm_stream_t stream;
00105 snd_pcm_state_t state;
00106 volatile snd_pcm_uframes_t appl_ptr;
00107 volatile snd_pcm_uframes_t hw_ptr;
00108 int nonblock;
00110 snd_pcm_access_t access;
00111 snd_pcm_format_t format;
00112 unsigned int channels;
00113 unsigned int rate;
00114 snd_pcm_uframes_t period_size;
00115 snd_pcm_uframes_t buffer_size;
00116 };
00117
00119 struct snd_pcm_ioplug_callback {
00123 int (*start)(snd_pcm_ioplug_t *io);
00127 int (*stop)(snd_pcm_ioplug_t *io);
00131 snd_pcm_sframes_t (*pointer)(snd_pcm_ioplug_t *io);
00135 snd_pcm_sframes_t (*transfer)(snd_pcm_ioplug_t *io,
00136 const snd_pcm_channel_area_t *areas,
00137 snd_pcm_uframes_t offset,
00138 snd_pcm_uframes_t size);
00142 int (*close)(snd_pcm_ioplug_t *io);
00146 int (*hw_params)(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params);
00150 int (*hw_free)(snd_pcm_ioplug_t *io);
00154 int (*sw_params)(snd_pcm_ioplug_t *io, snd_pcm_sw_params_t *params);
00158 int (*prepare)(snd_pcm_ioplug_t *io);
00162 int (*drain)(snd_pcm_ioplug_t *io);
00166 int (*pause)(snd_pcm_ioplug_t *io, int enable);
00170 int (*resume)(snd_pcm_ioplug_t *io);
00174 int (*poll_descriptors_count)(snd_pcm_ioplug_t *io);
00178 int (*poll_descriptors)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int space);
00182 int (*poll_revents)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int nfds, unsigned short *revents);
00186 void (*dump)(snd_pcm_ioplug_t *io, snd_output_t *out);
00190 int (*delay)(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp);
00191 };
00192
00193
00194 int snd_pcm_ioplug_create(snd_pcm_ioplug_t *io, const char *name,
00195 snd_pcm_stream_t stream, int mode);
00196 int snd_pcm_ioplug_delete(snd_pcm_ioplug_t *io);
00197
00198
00199 int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug);
00200
00201
00202 const snd_pcm_channel_area_t *snd_pcm_ioplug_mmap_areas(snd_pcm_ioplug_t *ioplug);
00203
00204
00205 void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *io);
00206
00207
00208 int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *io, int type, unsigned int min, unsigned int max);
00209 int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *io, int type, unsigned int num_list, const unsigned int *list);
00210
00213 #endif