/home/users/builder/rpm/BUILD/alsa-lib-1.0.16/include/pcm_ioplug.h

Go to the documentation of this file.
00001 
00010 /*
00011  * ALSA external PCM plugin SDK
00012  *
00013  * Copyright (c) 2005 Takashi Iwai <tiwai@suse.de>
00014  *
00015  *   This library is free software; you can redistribute it and/or modify
00016  *   it under the terms of the GNU Lesser General Public License as
00017  *   published by the Free Software Foundation; either version 2.1 of
00018  *   the License, or (at your option) any later version.
00019  *
00020  *   This program is distributed in the hope that it will be useful,
00021  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  *   GNU Lesser General Public License for more details.
00024  *
00025  *   You should have received a copy of the GNU Lesser General Public
00026  *   License along with this library; if not, write to the Free Software
00027  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
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)          /* list up this PCM */
00062 #define SND_PCM_IOPLUG_FLAG_MONOTONIC   (1<<1)          /* monotonic timestamps */
00063 
00064 /*
00065  * Protocol version
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 /* update poll_fd and mmap_rw */
00200 int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug);
00201 
00202 /* get a mmap area (for mmap_rw only) */
00203 const snd_pcm_channel_area_t *snd_pcm_ioplug_mmap_areas(snd_pcm_ioplug_t *ioplug);
00204 
00205 /* clear hw_parameter setting */
00206 void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *io);
00207 
00208 /* hw_parameter setting */
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 /* change PCM status */
00213 int snd_pcm_ioplug_set_state(snd_pcm_ioplug_t *ioplug, snd_pcm_state_t state);
00214 
00217 #endif /* __ALSA_PCM_IOPLUG_H */

Generated on Sun Apr 27 21:11:25 2008 for ALSA project - the C library reference by  doxygen 1.5.1