Path: blob/master/thirdparty/linuxbsd_headers/alsa/pcm_rate.h
9903 views
/**1* \file include/pcm_rate.h2* \brief External Rate-Converter-Plugin SDK3* \author Takashi Iwai <[email protected]>4* \date 20065*6* External Rate-Converter-Plugin SDK7*/89/*10* ALSA external PCM rate-converter plugin SDK (draft version)11*12* Copyright (c) 2006 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_RATE_H31#define __ALSA_PCM_RATE_H3233#ifdef __cplusplus34extern "C" {35#endif3637/**38* Protocol version39*/40#define SND_PCM_RATE_PLUGIN_VERSION 0x0100024142/** hw_params information for a single side */43typedef struct snd_pcm_rate_side_info {44snd_pcm_format_t format;45unsigned int rate;46snd_pcm_uframes_t buffer_size;47snd_pcm_uframes_t period_size;48} snd_pcm_rate_side_info_t;4950/** hw_params information */51typedef struct snd_pcm_rate_info {52struct snd_pcm_rate_side_info in;53struct snd_pcm_rate_side_info out;54unsigned int channels;55} snd_pcm_rate_info_t;5657/** Callback table of rate-converter */58typedef struct snd_pcm_rate_ops {59/**60* close the converter; optional61*/62void (*close)(void *obj);63/**64* initialize the converter, called at hw_params65*/66int (*init)(void *obj, snd_pcm_rate_info_t *info);67/**68* free the converter; optional69*/70void (*free)(void *obj);71/**72* reset the converter, called at prepare; optional73*/74void (*reset)(void *obj);75/**76* adjust the pitch, called at sw_params; optional77*/78int (*adjust_pitch)(void *obj, snd_pcm_rate_info_t *info);79/**80* convert the data81*/82void (*convert)(void *obj,83const snd_pcm_channel_area_t *dst_areas,84snd_pcm_uframes_t dst_offset, unsigned int dst_frames,85const snd_pcm_channel_area_t *src_areas,86snd_pcm_uframes_t src_offset, unsigned int src_frames);87/**88* convert an s16 interleaved-data array; exclusive with convert89*/90void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames,91const int16_t *src, unsigned int src_frames);92/**93* compute the frame size for input94*/95snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames);96/**97* compute the frame size for output98*/99snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames);100/**101* the protocol version the plugin supports;102* new field since version 0x010002103*/104unsigned int version;105/**106* return the supported min / max sample rates;107* new ops since version 0x010002108*/109int (*get_supported_rates)(void *obj, unsigned int *rate_min,110unsigned int *rate_max);111/**112* show some status messages for verbose mode;113* new ops since version 0x010002114*/115void (*dump)(void *obj, snd_output_t *out);116} snd_pcm_rate_ops_t;117118/** open function type */119typedef int (*snd_pcm_rate_open_func_t)(unsigned int version, void **objp,120snd_pcm_rate_ops_t *opsp);121122/**123* Define the object entry for external PCM rate-converter plugins124*/125#define SND_PCM_RATE_PLUGIN_ENTRY(name) _snd_pcm_rate_##name##_open126127128#ifndef DOC_HIDDEN129/* old rate_ops for protocol version 0x010001 */130typedef struct snd_pcm_rate_old_ops {131void (*close)(void *obj);132int (*init)(void *obj, snd_pcm_rate_info_t *info);133void (*free)(void *obj);134void (*reset)(void *obj);135int (*adjust_pitch)(void *obj, snd_pcm_rate_info_t *info);136void (*convert)(void *obj,137const snd_pcm_channel_area_t *dst_areas,138snd_pcm_uframes_t dst_offset, unsigned int dst_frames,139const snd_pcm_channel_area_t *src_areas,140snd_pcm_uframes_t src_offset, unsigned int src_frames);141void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames,142const int16_t *src, unsigned int src_frames);143snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames);144snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames);145} snd_pcm_rate_old_ops_t;146#endif147148#ifdef __cplusplus149}150#endif151152#endif /* __ALSA_PCM_RATE_H */153154155