Blame src/pcm/pcm_plugin.h

Packit Service db8eaa
/*
Packit Service db8eaa
 *  PCM - Common plugin code
Packit Service db8eaa
 *  Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
Packit Service db8eaa
 *
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
#include "pcm_generic.h"
Packit Service db8eaa
Packit Service db8eaa
typedef snd_pcm_uframes_t (*snd_pcm_slave_xfer_areas_func_t)
Packit Service db8eaa
     (snd_pcm_t *pcm, 
Packit Service db8eaa
      const snd_pcm_channel_area_t *areas,
Packit Service db8eaa
      snd_pcm_uframes_t offset, 
Packit Service db8eaa
      snd_pcm_uframes_t size,
Packit Service db8eaa
      const snd_pcm_channel_area_t *slave_areas,
Packit Service db8eaa
      snd_pcm_uframes_t slave_offset, 
Packit Service db8eaa
      snd_pcm_uframes_t *slave_sizep);
Packit Service db8eaa
Packit Service db8eaa
typedef snd_pcm_sframes_t (*snd_pcm_slave_xfer_areas_undo_func_t)
Packit Service db8eaa
     (snd_pcm_t *pcm,
Packit Service db8eaa
      const snd_pcm_channel_area_t *res_areas,	/* result areas */
Packit Service db8eaa
      snd_pcm_uframes_t res_offset,		/* offset of result areas */
Packit Service db8eaa
      snd_pcm_uframes_t res_size,		/* size of result areas */
Packit Service db8eaa
      snd_pcm_uframes_t slave_undo_size);
Packit Service db8eaa
Packit Service db8eaa
typedef struct {
Packit Service db8eaa
	snd_pcm_generic_t gen;
Packit Service db8eaa
	snd_pcm_slave_xfer_areas_func_t read;
Packit Service db8eaa
	snd_pcm_slave_xfer_areas_func_t write;
Packit Service db8eaa
	snd_pcm_slave_xfer_areas_undo_func_t undo_read;
Packit Service db8eaa
	snd_pcm_slave_xfer_areas_undo_func_t undo_write;
Packit Service db8eaa
	int (*init)(snd_pcm_t *pcm);
Packit Service db8eaa
	snd_pcm_uframes_t appl_ptr, hw_ptr;
Packit Service db8eaa
} snd_pcm_plugin_t;	
Packit Service db8eaa
Packit Service db8eaa
/* make local functions really local */
Packit Service db8eaa
#define snd_pcm_plugin_init \
Packit Service db8eaa
	snd1_pcm_plugin_init
Packit Service db8eaa
#define snd_pcm_plugin_may_wait_for_avail_min \
Packit Service db8eaa
	snd1_pcm_plugin_may_wait_for_avail_min
Packit Service db8eaa
#define snd_pcm_plugin_fast_ops \
Packit Service db8eaa
	snd1_pcm_plugin_fast_ops
Packit Service db8eaa
#define snd_pcm_plugin_undo_read_generic \
Packit Service db8eaa
	snd1_pcm_plugin_undo_read_generic
Packit Service db8eaa
#define snd_pcm_plugin_undo_write_generic \
Packit Service db8eaa
	snd1_pcm_plugin_undo_write_generic
Packit Service db8eaa
#define snd_pcm_plugin_rewind \
Packit Service db8eaa
	snd1_pcm_plugin_rewind
Packit Service db8eaa
#define snd_pcm_plugin_forward \
Packit Service db8eaa
	snd1_pcm_plugin_forward
Packit Service db8eaa
Packit Service db8eaa
void snd_pcm_plugin_init(snd_pcm_plugin_t *plugin);
Packit Service db8eaa
snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
Packit Service db8eaa
snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
Packit Service db8eaa
int snd_pcm_plugin_may_wait_for_avail_min(snd_pcm_t *pcm, snd_pcm_uframes_t avail);
Packit Service db8eaa
Packit Service db8eaa
extern const snd_pcm_fast_ops_t snd_pcm_plugin_fast_ops;
Packit Service db8eaa
Packit Service db8eaa
snd_pcm_sframes_t snd_pcm_plugin_undo_read_generic
Packit Service db8eaa
     (snd_pcm_t *pcm,
Packit Service db8eaa
      const snd_pcm_channel_area_t *res_areas,	/* result areas */
Packit Service db8eaa
      snd_pcm_uframes_t res_offset,		/* offset of result areas */
Packit Service db8eaa
      snd_pcm_uframes_t res_size,		/* size of result areas */
Packit Service db8eaa
      snd_pcm_uframes_t slave_undo_size);
Packit Service db8eaa
Packit Service db8eaa
snd_pcm_sframes_t snd_pcm_plugin_undo_write_generic
Packit Service db8eaa
     (snd_pcm_t *pcm,
Packit Service db8eaa
      const snd_pcm_channel_area_t *res_areas,	/* result areas */
Packit Service db8eaa
      snd_pcm_uframes_t res_offset,		/* offset of result areas */
Packit Service db8eaa
      snd_pcm_uframes_t res_size,		/* size of result areas */
Packit Service db8eaa
      snd_pcm_uframes_t slave_undo_size);
Packit Service db8eaa
Packit Service db8eaa
/* make local functions really local */
Packit Service db8eaa
#define snd_pcm_linear_get_index	snd1_pcm_linear_get_index
Packit Service db8eaa
#define snd_pcm_linear_put_index	snd1_pcm_linear_put_index
Packit Service db8eaa
#define snd_pcm_linear_convert_index	snd1_pcm_linear_convert_index
Packit Service db8eaa
#define snd_pcm_linear_convert	snd1_pcm_linear_convert
Packit Service db8eaa
#define snd_pcm_linear_getput	snd1_pcm_linear_getput
Packit Service db8eaa
#define snd_pcm_alaw_decode	snd1_pcm_alaw_decode
Packit Service db8eaa
#define snd_pcm_alaw_encode	snd1_pcm_alaw_encode
Packit Service db8eaa
#define snd_pcm_mulaw_decode	snd1_pcm_mulaw_decode
Packit Service db8eaa
#define snd_pcm_mulaw_encode	snd1_pcm_mulaw_encode
Packit Service db8eaa
#define snd_pcm_adpcm_decode	snd1_pcm_adpcm_decode
Packit Service db8eaa
#define snd_pcm_adpcm_encode	snd1_pcm_adpcm_encode
Packit Service db8eaa
Packit Service db8eaa
int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
Packit Service db8eaa
int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
Packit Service db8eaa
int snd_pcm_linear_convert_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
Packit Service db8eaa
Packit Service db8eaa
void snd_pcm_linear_convert(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
Packit Service db8eaa
			    const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
Packit Service db8eaa
			    unsigned int channels, snd_pcm_uframes_t frames,
Packit Service db8eaa
			    unsigned int convidx);
Packit Service db8eaa
void snd_pcm_linear_getput(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
Packit Service db8eaa
			   const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
Packit Service db8eaa
			   unsigned int channels, snd_pcm_uframes_t frames,
Packit Service db8eaa
			   unsigned int get_idx, unsigned int put_idx);
Packit Service db8eaa
void snd_pcm_alaw_decode(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
			 unsigned int channels, snd_pcm_uframes_t frames,
Packit Service db8eaa
			 unsigned int putidx);
Packit Service db8eaa
void snd_pcm_alaw_encode(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
			 unsigned int channels, snd_pcm_uframes_t frames,
Packit Service db8eaa
			 unsigned int getidx);
Packit Service db8eaa
void snd_pcm_mulaw_decode(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
			  unsigned int channels, snd_pcm_uframes_t frames,
Packit Service db8eaa
			  unsigned int putidx);
Packit Service db8eaa
void snd_pcm_mulaw_encode(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
			  unsigned int channels, snd_pcm_uframes_t frames,
Packit Service db8eaa
			  unsigned int getidx);
Packit Service db8eaa
Packit Service db8eaa
typedef struct _snd_pcm_adpcm_state {
Packit Service db8eaa
	int pred_val;		/* Calculated predicted value */
Packit Service db8eaa
	int step_idx;		/* Previous StepSize lookup index */
Packit Service db8eaa
} snd_pcm_adpcm_state_t;
Packit Service db8eaa
Packit Service db8eaa
void snd_pcm_adpcm_decode(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
			  unsigned int channels, snd_pcm_uframes_t frames,
Packit Service db8eaa
			  unsigned int putidx,
Packit Service db8eaa
			  snd_pcm_adpcm_state_t *states);
Packit Service db8eaa
void snd_pcm_adpcm_encode(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
			  unsigned int channels, snd_pcm_uframes_t frames,
Packit Service db8eaa
			  unsigned int getidx,
Packit Service db8eaa
			  snd_pcm_adpcm_state_t *states);