jpayne@69: /** jpayne@69: * \file include/pcm_extplug.h jpayne@69: * \brief External Filter-Plugin SDK jpayne@69: * \author Takashi Iwai jpayne@69: * \date 2005 jpayne@69: * jpayne@69: * External Filter-Plugin SDK jpayne@69: */ jpayne@69: jpayne@69: /* jpayne@69: * ALSA external PCM plugin SDK (draft version) jpayne@69: * jpayne@69: * Copyright (c) 2005 Takashi Iwai jpayne@69: * jpayne@69: * This library is free software; you can redistribute it and/or modify jpayne@69: * it under the terms of the GNU Lesser General Public License as jpayne@69: * published by the Free Software Foundation; either version 2.1 of jpayne@69: * the License, or (at your option) any later version. jpayne@69: * jpayne@69: * This program is distributed in the hope that it will be useful, jpayne@69: * but WITHOUT ANY WARRANTY; without even the implied warranty of jpayne@69: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jpayne@69: * GNU Lesser General Public License for more details. jpayne@69: * jpayne@69: * You should have received a copy of the GNU Lesser General Public jpayne@69: * License along with this library; if not, write to the Free Software jpayne@69: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA jpayne@69: * jpayne@69: */ jpayne@69: jpayne@69: #ifndef __ALSA_PCM_EXTPLUG_H jpayne@69: #define __ALSA_PCM_EXTPLUG_H jpayne@69: jpayne@69: /** jpayne@69: * \defgroup PCM_ExtPlug External Filter plugin SDK jpayne@69: * \ingroup Plugin_SDK jpayne@69: * See the \ref pcm page for more details. jpayne@69: * \{ jpayne@69: */ jpayne@69: jpayne@69: /** hw constraints for extplug */ jpayne@69: enum { jpayne@69: SND_PCM_EXTPLUG_HW_FORMAT, /**< format */ jpayne@69: SND_PCM_EXTPLUG_HW_CHANNELS, /**< channels */ jpayne@69: SND_PCM_EXTPLUG_HW_PARAMS /**< max number of hw constraints */ jpayne@69: }; jpayne@69: jpayne@69: /** Handle of external filter plugin */ jpayne@69: typedef struct snd_pcm_extplug snd_pcm_extplug_t; jpayne@69: /** Callback table of extplug */ jpayne@69: typedef struct snd_pcm_extplug_callback snd_pcm_extplug_callback_t; jpayne@69: #ifdef DOC_HIDDEN jpayne@69: /* redefine typedefs for stupid doxygen */ jpayne@69: typedef snd_pcm_extplug snd_pcm_extplug_t; jpayne@69: typedef snd_pcm_extplug_callback snd_pcm_extplug_callback_t; jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Protocol version jpayne@69: */ jpayne@69: #define SND_PCM_EXTPLUG_VERSION_MAJOR 1 /**< Protocol major version */ jpayne@69: #define SND_PCM_EXTPLUG_VERSION_MINOR 0 /**< Protocol minor version */ jpayne@69: #define SND_PCM_EXTPLUG_VERSION_TINY 2 /**< Protocol tiny version */ jpayne@69: /** jpayne@69: * Filter-plugin protocol version jpayne@69: */ jpayne@69: #define SND_PCM_EXTPLUG_VERSION ((SND_PCM_EXTPLUG_VERSION_MAJOR<<16) |\ jpayne@69: (SND_PCM_EXTPLUG_VERSION_MINOR<<8) |\ jpayne@69: (SND_PCM_EXTPLUG_VERSION_TINY)) jpayne@69: jpayne@69: /** Handle of extplug */ jpayne@69: struct snd_pcm_extplug { jpayne@69: /** jpayne@69: * protocol version; #SND_PCM_EXTPLUG_VERSION must be filled here jpayne@69: * before calling #snd_pcm_extplug_create() jpayne@69: */ jpayne@69: unsigned int version; jpayne@69: /** jpayne@69: * name of this plugin; must be filled before calling #snd_pcm_extplug_create() jpayne@69: */ jpayne@69: const char *name; jpayne@69: /** jpayne@69: * callbacks of this plugin; must be filled before calling #snd_pcm_extplug_create() jpayne@69: */ jpayne@69: const snd_pcm_extplug_callback_t *callback; jpayne@69: /** jpayne@69: * private data, which can be used freely in the driver callbacks jpayne@69: */ jpayne@69: void *private_data; jpayne@69: /** jpayne@69: * PCM handle filled by #snd_pcm_extplug_create() jpayne@69: */ jpayne@69: snd_pcm_t *pcm; jpayne@69: /** jpayne@69: * stream direction; read-only status jpayne@69: */ jpayne@69: snd_pcm_stream_t stream; jpayne@69: /** jpayne@69: * format hw parameter; filled after hw_params is caled jpayne@69: */ jpayne@69: snd_pcm_format_t format; jpayne@69: /** jpayne@69: * subformat hw parameter; filled after hw_params is caled jpayne@69: */ jpayne@69: snd_pcm_subformat_t subformat; jpayne@69: /** jpayne@69: * channels hw parameter; filled after hw_params is caled jpayne@69: */ jpayne@69: unsigned int channels; jpayne@69: /** jpayne@69: * rate hw parameter; filled after hw_params is caled jpayne@69: */ jpayne@69: unsigned int rate; jpayne@69: /** jpayne@69: * slave_format hw parameter; filled after hw_params is caled jpayne@69: */ jpayne@69: snd_pcm_format_t slave_format; jpayne@69: /** jpayne@69: * slave_subformat hw parameter; filled after hw_params is caled jpayne@69: */ jpayne@69: snd_pcm_subformat_t slave_subformat; jpayne@69: /** jpayne@69: * slave_channels hw parameter; filled after hw_params is caled jpayne@69: */ jpayne@69: unsigned int slave_channels; jpayne@69: }; jpayne@69: jpayne@69: /** Callback table of extplug */ jpayne@69: struct snd_pcm_extplug_callback { jpayne@69: /** jpayne@69: * transfer between source and destination; this is a required callback jpayne@69: */ jpayne@69: snd_pcm_sframes_t (*transfer)(snd_pcm_extplug_t *ext, jpayne@69: const snd_pcm_channel_area_t *dst_areas, jpayne@69: snd_pcm_uframes_t dst_offset, jpayne@69: const snd_pcm_channel_area_t *src_areas, jpayne@69: snd_pcm_uframes_t src_offset, jpayne@69: snd_pcm_uframes_t size); jpayne@69: /** jpayne@69: * close the PCM; optional jpayne@69: */ jpayne@69: int (*close)(snd_pcm_extplug_t *ext); jpayne@69: /** jpayne@69: * hw_params; optional jpayne@69: */ jpayne@69: int (*hw_params)(snd_pcm_extplug_t *ext, snd_pcm_hw_params_t *params); jpayne@69: /** jpayne@69: * hw_free; optional jpayne@69: */ jpayne@69: int (*hw_free)(snd_pcm_extplug_t *ext); jpayne@69: /** jpayne@69: * dump; optional jpayne@69: */ jpayne@69: void (*dump)(snd_pcm_extplug_t *ext, snd_output_t *out); jpayne@69: /** jpayne@69: * init; optional initialization called at prepare or reset jpayne@69: */ jpayne@69: int (*init)(snd_pcm_extplug_t *ext); jpayne@69: /** jpayne@69: * query the channel maps; optional; since v1.0.2 jpayne@69: */ jpayne@69: snd_pcm_chmap_query_t **(*query_chmaps)(snd_pcm_extplug_t *ext); jpayne@69: /** jpayne@69: * get the channel map; optional; since v1.0.2 jpayne@69: */ jpayne@69: snd_pcm_chmap_t *(*get_chmap)(snd_pcm_extplug_t *ext); jpayne@69: /** jpayne@69: * set the channel map; optional; since v1.0.2 jpayne@69: */ jpayne@69: int (*set_chmap)(snd_pcm_extplug_t *ext, const snd_pcm_chmap_t *map); jpayne@69: }; jpayne@69: jpayne@69: jpayne@69: int snd_pcm_extplug_create(snd_pcm_extplug_t *ext, const char *name, jpayne@69: snd_config_t *root, snd_config_t *slave_conf, jpayne@69: snd_pcm_stream_t stream, int mode); jpayne@69: int snd_pcm_extplug_delete(snd_pcm_extplug_t *ext); jpayne@69: jpayne@69: /* clear hw_parameter setting */ jpayne@69: void snd_pcm_extplug_params_reset(snd_pcm_extplug_t *ext); jpayne@69: jpayne@69: /* hw_parameter setting */ jpayne@69: int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list); jpayne@69: int snd_pcm_extplug_set_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max); jpayne@69: int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list); jpayne@69: int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max); jpayne@69: int snd_pcm_extplug_set_param_link(snd_pcm_extplug_t *extplug, int type, jpayne@69: int keep_link); jpayne@69: jpayne@69: /** jpayne@69: * set the parameter constraint with a single value jpayne@69: */ jpayne@69: static __inline__ int snd_pcm_extplug_set_param(snd_pcm_extplug_t *extplug, int type, unsigned int val) jpayne@69: { jpayne@69: return snd_pcm_extplug_set_param_list(extplug, type, 1, &val); jpayne@69: } jpayne@69: jpayne@69: /** jpayne@69: * set the parameter constraint for slave PCM with a single value jpayne@69: */ jpayne@69: static __inline__ int snd_pcm_extplug_set_slave_param(snd_pcm_extplug_t *extplug, int type, unsigned int val) jpayne@69: { jpayne@69: return snd_pcm_extplug_set_slave_param_list(extplug, type, 1, &val); jpayne@69: } jpayne@69: jpayne@69: /** \} */ jpayne@69: jpayne@69: #endif /* __ALSA_PCM_EXTPLUG_H */