ALSA project - the C library reference
|
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 00053 /* 00054 * Protocol version 00055 */ 00056 #define SND_PCM_EXTPLUG_VERSION_MAJOR 1 00057 #define SND_PCM_EXTPLUG_VERSION_MINOR 0 00058 #define SND_PCM_EXTPLUG_VERSION_TINY 1 00062 #define SND_PCM_EXTPLUG_VERSION ((SND_PCM_EXTPLUG_VERSION_MAJOR<<16) |\ 00063 (SND_PCM_EXTPLUG_VERSION_MINOR<<8) |\ 00064 (SND_PCM_EXTPLUG_VERSION_TINY)) 00065 00067 struct snd_pcm_extplug { 00072 unsigned int version; 00076 const char *name; 00080 const snd_pcm_extplug_callback_t *callback; 00084 void *private_data; 00088 snd_pcm_t *pcm; 00092 snd_pcm_stream_t stream; 00096 snd_pcm_format_t format; 00100 snd_pcm_subformat_t subformat; 00104 unsigned int channels; 00108 unsigned int rate; 00112 snd_pcm_format_t slave_format; 00116 snd_pcm_subformat_t slave_subformat; 00120 unsigned int slave_channels; 00121 }; 00122 00124 struct snd_pcm_extplug_callback { 00128 snd_pcm_sframes_t (*transfer)(snd_pcm_extplug_t *ext, 00129 const snd_pcm_channel_area_t *dst_areas, 00130 snd_pcm_uframes_t dst_offset, 00131 const snd_pcm_channel_area_t *src_areas, 00132 snd_pcm_uframes_t src_offset, 00133 snd_pcm_uframes_t size); 00137 int (*close)(snd_pcm_extplug_t *ext); 00141 int (*hw_params)(snd_pcm_extplug_t *ext, snd_pcm_hw_params_t *params); 00145 int (*hw_free)(snd_pcm_extplug_t *ext); 00149 void (*dump)(snd_pcm_extplug_t *ext, snd_output_t *out); 00153 int (*init)(snd_pcm_extplug_t *ext); 00154 }; 00155 00156 00157 int snd_pcm_extplug_create(snd_pcm_extplug_t *ext, const char *name, 00158 snd_config_t *root, snd_config_t *slave_conf, 00159 snd_pcm_stream_t stream, int mode); 00160 int snd_pcm_extplug_delete(snd_pcm_extplug_t *ext); 00161 00162 /* clear hw_parameter setting */ 00163 void snd_pcm_extplug_params_reset(snd_pcm_extplug_t *ext); 00164 00165 /* hw_parameter setting */ 00166 int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list); 00167 int snd_pcm_extplug_set_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max); 00168 int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list); 00169 int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max); 00170 00174 static inline int snd_pcm_extplug_set_param(snd_pcm_extplug_t *extplug, int type, unsigned int val) 00175 { 00176 return snd_pcm_extplug_set_param_list(extplug, type, 1, &val); 00177 } 00178 00182 static inline int snd_pcm_extplug_set_slave_param(snd_pcm_extplug_t *extplug, int type, unsigned int val) 00183 { 00184 return snd_pcm_extplug_set_slave_param_list(extplug, type, 1, &val); 00185 } 00186 00189 #endif /* __ALSA_PCM_EXTPLUG_H */