Blame include/pcm_extplug.h

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