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
00058
00059
00060
00061 #define SND_PCM_IOPLUG_FLAG_LISTED (1<<0)
00062 #define SND_PCM_IOPLUG_FLAG_MONOTONIC (1<<1)
00064
00065
00066
00067 #define SND_PCM_IOPLUG_VERSION_MAJOR 1
00068 #define SND_PCM_IOPLUG_VERSION_MINOR 0
00069 #define SND_PCM_IOPLUG_VERSION_TINY 1
00073 #define SND_PCM_IOPLUG_VERSION ((SND_PCM_IOPLUG_VERSION_MAJOR<<16) |\
00074 (SND_PCM_IOPLUG_VERSION_MINOR<<8) |\
00075 (SND_PCM_IOPLUG_VERSION_TINY))
00076
00078 struct snd_pcm_ioplug {
00083 unsigned int version;
00087 const char *name;
00088 unsigned int flags;
00089 int poll_fd;
00090 unsigned int poll_events;
00091 unsigned int mmap_rw;
00095 const snd_pcm_ioplug_callback_t *callback;
00099 void *private_data;
00103 snd_pcm_t *pcm;
00104
00105 snd_pcm_stream_t stream;
00106 snd_pcm_state_t state;
00107 volatile snd_pcm_uframes_t appl_ptr;
00108 volatile snd_pcm_uframes_t hw_ptr;
00109 int nonblock;
00111 snd_pcm_access_t access;
00112 snd_pcm_format_t format;
00113 unsigned int channels;
00114 unsigned int rate;
00115 snd_pcm_uframes_t period_size;
00116 snd_pcm_uframes_t buffer_size;
00117 };
00118
00120 struct snd_pcm_ioplug_callback {
00124 int (*start)(snd_pcm_ioplug_t *io);
00128 int (*stop)(snd_pcm_ioplug_t *io);
00132 snd_pcm_sframes_t (*pointer)(snd_pcm_ioplug_t *io);
00136 snd_pcm_sframes_t (*transfer)(snd_pcm_ioplug_t *io,
00137 const snd_pcm_channel_area_t *areas,
00138 snd_pcm_uframes_t offset,
00139 snd_pcm_uframes_t size);
00143 int (*close)(snd_pcm_ioplug_t *io);
00147 int (*hw_params)(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params);
00151 int (*hw_free)(snd_pcm_ioplug_t *io);
00155 int (*sw_params)(snd_pcm_ioplug_t *io, snd_pcm_sw_params_t *params);
00159 int (*prepare)(snd_pcm_ioplug_t *io);
00163 int (*drain)(snd_pcm_ioplug_t *io);
00167 int (*pause)(snd_pcm_ioplug_t *io, int enable);
00171 int (*resume)(snd_pcm_ioplug_t *io);
00175 int (*poll_descriptors_count)(snd_pcm_ioplug_t *io);
00179 int (*poll_descriptors)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int space);
00183 int (*poll_revents)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int nfds, unsigned short *revents);
00187 void (*dump)(snd_pcm_ioplug_t *io, snd_output_t *out);
00191 int (*delay)(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp);
00192 };
00193
00194
00195 int snd_pcm_ioplug_create(snd_pcm_ioplug_t *io, const char *name,
00196 snd_pcm_stream_t stream, int mode);
00197 int snd_pcm_ioplug_delete(snd_pcm_ioplug_t *io);
00198
00199
00200 int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug);
00201
00202
00203 const snd_pcm_channel_area_t *snd_pcm_ioplug_mmap_areas(snd_pcm_ioplug_t *ioplug);
00204
00205
00206 void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *io);
00207
00208
00209 int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *io, int type, unsigned int min, unsigned int max);
00210 int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *io, int type, unsigned int num_list, const unsigned int *list);
00211
00212
00213 int snd_pcm_ioplug_set_state(snd_pcm_ioplug_t *ioplug, snd_pcm_state_t state);
00214
00217 #endif