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