/home/users/builder/rpm/BUILD/alsa-lib-1.0.13/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 
00063 /*
00064  * Protocol version
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 /* update poll_fd and mmap_rw */
00199 int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug);
00200 
00201 /* get a mmap area (for mmap_rw only) */
00202 const snd_pcm_channel_area_t *snd_pcm_ioplug_mmap_areas(snd_pcm_ioplug_t *ioplug);
00203 
00204 /* clear hw_parameter setting */
00205 void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *io);
00206 
00207 /* hw_parameter setting */
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 /* __ALSA_PCM_IOPLUG_H */

Generated on Sun Apr 1 18:36:42 2007 for ALSA project - the C library reference by  doxygen 1.5.1