ALSA project - the C library reference
/usr/src/RPM/BUILD/libalsa-1.0.27/include/pcm_extplug.h
Go to the documentation of this file.
00001 
00010 /*
00011  * ALSA external PCM plugin SDK (draft version)
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_EXTPLUG_H
00032 #define __ALSA_PCM_EXTPLUG_H
00033 
00042 enum {
00043         SND_PCM_EXTPLUG_HW_FORMAT,      
00044         SND_PCM_EXTPLUG_HW_CHANNELS,    
00045         SND_PCM_EXTPLUG_HW_PARAMS       
00046 };
00047         
00049 typedef struct snd_pcm_extplug snd_pcm_extplug_t;
00051 typedef struct snd_pcm_extplug_callback snd_pcm_extplug_callback_t;
00052 #ifdef DOC_HIDDEN
00053 /* redefine typedefs for stupid doxygen */
00054 typedef snd_pcm_extplug snd_pcm_extplug_t;
00055 typedef snd_pcm_extplug_callback snd_pcm_extplug_callback_t;
00056 #endif
00057 
00058 /*
00059  * Protocol version
00060  */
00061 #define SND_PCM_EXTPLUG_VERSION_MAJOR   1       
00062 #define SND_PCM_EXTPLUG_VERSION_MINOR   0       
00063 #define SND_PCM_EXTPLUG_VERSION_TINY    2       
00067 #define SND_PCM_EXTPLUG_VERSION         ((SND_PCM_EXTPLUG_VERSION_MAJOR<<16) |\
00068                                          (SND_PCM_EXTPLUG_VERSION_MINOR<<8) |\
00069                                          (SND_PCM_EXTPLUG_VERSION_TINY))
00070 
00072 struct snd_pcm_extplug {
00077         unsigned int version;
00081         const char *name;
00085         const snd_pcm_extplug_callback_t *callback;
00089         void *private_data;
00093         snd_pcm_t *pcm;
00097         snd_pcm_stream_t stream;
00101         snd_pcm_format_t format;
00105         snd_pcm_subformat_t subformat;
00109         unsigned int channels;
00113         unsigned int rate;
00117         snd_pcm_format_t slave_format;
00121         snd_pcm_subformat_t slave_subformat;
00125         unsigned int slave_channels;
00126 };
00127 
00129 struct snd_pcm_extplug_callback {
00133         snd_pcm_sframes_t (*transfer)(snd_pcm_extplug_t *ext,
00134                                       const snd_pcm_channel_area_t *dst_areas,
00135                                       snd_pcm_uframes_t dst_offset,
00136                                       const snd_pcm_channel_area_t *src_areas,
00137                                       snd_pcm_uframes_t src_offset,
00138                                       snd_pcm_uframes_t size);
00142         int (*close)(snd_pcm_extplug_t *ext);
00146         int (*hw_params)(snd_pcm_extplug_t *ext, snd_pcm_hw_params_t *params);
00150         int (*hw_free)(snd_pcm_extplug_t *ext);
00154         void (*dump)(snd_pcm_extplug_t *ext, snd_output_t *out);
00158         int (*init)(snd_pcm_extplug_t *ext);
00162         snd_pcm_chmap_query_t **(*query_chmaps)(snd_pcm_extplug_t *ext);
00166         snd_pcm_chmap_t *(*get_chmap)(snd_pcm_extplug_t *ext);
00170         int (*set_chmap)(snd_pcm_extplug_t *ext, const snd_pcm_chmap_t *map);
00171 };
00172 
00173 
00174 int snd_pcm_extplug_create(snd_pcm_extplug_t *ext, const char *name,
00175                            snd_config_t *root, snd_config_t *slave_conf,
00176                            snd_pcm_stream_t stream, int mode);
00177 int snd_pcm_extplug_delete(snd_pcm_extplug_t *ext);
00178 
00179 /* clear hw_parameter setting */
00180 void snd_pcm_extplug_params_reset(snd_pcm_extplug_t *ext);
00181 
00182 /* hw_parameter setting */
00183 int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list);
00184 int snd_pcm_extplug_set_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max);
00185 int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list);
00186 int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max);
00187 
00191 static __inline__ int snd_pcm_extplug_set_param(snd_pcm_extplug_t *extplug, int type, unsigned int val)
00192 {
00193         return snd_pcm_extplug_set_param_list(extplug, type, 1, &val);
00194 }
00195 
00199 static __inline__ int snd_pcm_extplug_set_slave_param(snd_pcm_extplug_t *extplug, int type, unsigned int val)
00200 {
00201         return snd_pcm_extplug_set_slave_param_list(extplug, type, 1, &val);
00202 }
00203 
00206 #endif /* __ALSA_PCM_EXTPLUG_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines