Path: blob/master/thirdparty/linuxbsd_headers/alsa/pcm_extplug.h
9898 views
/**1* \file include/pcm_extplug.h2* \brief External Filter-Plugin SDK3* \author Takashi Iwai <[email protected]>4* \date 20055*6* External Filter-Plugin SDK7*/89/*10* ALSA external PCM plugin SDK (draft version)11*12* Copyright (c) 2005 Takashi Iwai <[email protected]>13*14* This library is free software; you can redistribute it and/or modify15* it under the terms of the GNU Lesser General Public License as16* published by the Free Software Foundation; either version 2.1 of17* the License, or (at your option) any later version.18*19* This program is distributed in the hope that it will be useful,20* but WITHOUT ANY WARRANTY; without even the implied warranty of21* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the22* GNU Lesser General Public License for more details.23*24* You should have received a copy of the GNU Lesser General Public25* License along with this library; if not, write to the Free Software26* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA27*28*/2930#ifndef __ALSA_PCM_EXTPLUG_H31#define __ALSA_PCM_EXTPLUG_H3233/**34* \defgroup PCM_ExtPlug External Filter plugin SDK35* \ingroup Plugin_SDK36* See the \ref pcm page for more details.37* \{38*/3940/** hw constraints for extplug */41enum {42SND_PCM_EXTPLUG_HW_FORMAT, /**< format */43SND_PCM_EXTPLUG_HW_CHANNELS, /**< channels */44SND_PCM_EXTPLUG_HW_PARAMS /**< max number of hw constraints */45};4647/** Handle of external filter plugin */48typedef struct snd_pcm_extplug snd_pcm_extplug_t;49/** Callback table of extplug */50typedef struct snd_pcm_extplug_callback snd_pcm_extplug_callback_t;51#ifdef DOC_HIDDEN52/* redefine typedefs for stupid doxygen */53typedef snd_pcm_extplug snd_pcm_extplug_t;54typedef snd_pcm_extplug_callback snd_pcm_extplug_callback_t;55#endif5657/*58* Protocol version59*/60#define SND_PCM_EXTPLUG_VERSION_MAJOR 1 /**< Protocol major version */61#define SND_PCM_EXTPLUG_VERSION_MINOR 0 /**< Protocol minor version */62#define SND_PCM_EXTPLUG_VERSION_TINY 2 /**< Protocol tiny version */63/**64* Filter-plugin protocol version65*/66#define SND_PCM_EXTPLUG_VERSION ((SND_PCM_EXTPLUG_VERSION_MAJOR<<16) |\67(SND_PCM_EXTPLUG_VERSION_MINOR<<8) |\68(SND_PCM_EXTPLUG_VERSION_TINY))6970/** Handle of extplug */71struct snd_pcm_extplug {72/**73* protocol version; #SND_PCM_EXTPLUG_VERSION must be filled here74* before calling #snd_pcm_extplug_create()75*/76unsigned int version;77/**78* name of this plugin; must be filled before calling #snd_pcm_extplug_create()79*/80const char *name;81/**82* callbacks of this plugin; must be filled before calling #snd_pcm_extplug_create()83*/84const snd_pcm_extplug_callback_t *callback;85/**86* private data, which can be used freely in the driver callbacks87*/88void *private_data;89/**90* PCM handle filled by #snd_pcm_extplug_create()91*/92snd_pcm_t *pcm;93/**94* stream direction; read-only status95*/96snd_pcm_stream_t stream;97/**98* format hw parameter; filled after hw_params is caled99*/100snd_pcm_format_t format;101/**102* subformat hw parameter; filled after hw_params is caled103*/104snd_pcm_subformat_t subformat;105/**106* channels hw parameter; filled after hw_params is caled107*/108unsigned int channels;109/**110* rate hw parameter; filled after hw_params is caled111*/112unsigned int rate;113/**114* slave_format hw parameter; filled after hw_params is caled115*/116snd_pcm_format_t slave_format;117/**118* slave_subformat hw parameter; filled after hw_params is caled119*/120snd_pcm_subformat_t slave_subformat;121/**122* slave_channels hw parameter; filled after hw_params is caled123*/124unsigned int slave_channels;125};126127/** Callback table of extplug */128struct snd_pcm_extplug_callback {129/**130* transfer between source and destination; this is a required callback131*/132snd_pcm_sframes_t (*transfer)(snd_pcm_extplug_t *ext,133const snd_pcm_channel_area_t *dst_areas,134snd_pcm_uframes_t dst_offset,135const snd_pcm_channel_area_t *src_areas,136snd_pcm_uframes_t src_offset,137snd_pcm_uframes_t size);138/**139* close the PCM; optional140*/141int (*close)(snd_pcm_extplug_t *ext);142/**143* hw_params; optional144*/145int (*hw_params)(snd_pcm_extplug_t *ext, snd_pcm_hw_params_t *params);146/**147* hw_free; optional148*/149int (*hw_free)(snd_pcm_extplug_t *ext);150/**151* dump; optional152*/153void (*dump)(snd_pcm_extplug_t *ext, snd_output_t *out);154/**155* init; optional initialization called at prepare or reset156*/157int (*init)(snd_pcm_extplug_t *ext);158/**159* query the channel maps; optional; since v1.0.2160*/161snd_pcm_chmap_query_t **(*query_chmaps)(snd_pcm_extplug_t *ext);162/**163* get the channel map; optional; since v1.0.2164*/165snd_pcm_chmap_t *(*get_chmap)(snd_pcm_extplug_t *ext);166/**167* set the channel map; optional; since v1.0.2168*/169int (*set_chmap)(snd_pcm_extplug_t *ext, const snd_pcm_chmap_t *map);170};171172173int snd_pcm_extplug_create(snd_pcm_extplug_t *ext, const char *name,174snd_config_t *root, snd_config_t *slave_conf,175snd_pcm_stream_t stream, int mode);176int snd_pcm_extplug_delete(snd_pcm_extplug_t *ext);177178/* clear hw_parameter setting */179void snd_pcm_extplug_params_reset(snd_pcm_extplug_t *ext);180181/* hw_parameter setting */182int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list);183int snd_pcm_extplug_set_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max);184int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list);185int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max);186187/**188* set the parameter constraint with a single value189*/190static __inline__ int snd_pcm_extplug_set_param(snd_pcm_extplug_t *extplug, int type, unsigned int val)191{192return snd_pcm_extplug_set_param_list(extplug, type, 1, &val);193}194195/**196* set the parameter constraint for slave PCM with a single value197*/198static __inline__ int snd_pcm_extplug_set_slave_param(snd_pcm_extplug_t *extplug, int type, unsigned int val)199{200return snd_pcm_extplug_set_slave_param_list(extplug, type, 1, &val);201}202203/** \} */204205#endif /* __ALSA_PCM_EXTPLUG_H */206207208