Removed card type from devices info. Added card number to devices info. Completed encapsulation of PCM API. Removed snd_pcm_card(). All copy functions now have the form copy(dst, src).

This commit is contained in:
Abramo Bagnara 2001-01-31 17:26:56 +00:00
parent 8e9a23acb5
commit de19407578
58 changed files with 560 additions and 382 deletions

View file

@ -34,7 +34,6 @@
#include <netdb.h>
#include <limits.h>
#include "asoundlib.h"
#include "aserver.h"
#include "list.h"
@ -373,9 +372,6 @@ int pcm_shm_cmd(client_t *client)
ctrl->cmd = 0;
pcm = client->device.pcm.handle;
switch (cmd) {
case SND_PCM_IOCTL_CARD:
ctrl->result = snd_pcm_card(pcm);
break;
case SND_PCM_IOCTL_ASYNC:
ctrl->result = snd_pcm_async(pcm, ctrl->u.async.sig, ctrl->u.async.pid);
break;
@ -630,9 +626,6 @@ int ctl_shm_cmd(client_t *client)
case SND_CTL_IOCTL_CLOSE:
client->ops->close(client);
break;
case SND_CTL_IOCTL_CARD:
ctrl->result = snd_ctl_card(ctl);
break;
case SND_CTL_IOCTL_POLL_DESCRIPTOR:
ctrl->result = 0;
return shm_ack_fd(client, snd_ctl_poll_descriptor(ctl));

View file

@ -18,10 +18,8 @@
*
*/
#include "../src/pcm/pcm_local.h"
#define SND_PCM_IOCTL_CARD _IO ('A', 0xf0)
#define SND_PCM_IOCTL_STATE _IO ('A', 0xf1)
#define SND_PCM_IOCTL_MMAP _IO ('A', 0xf2)
#define SND_PCM_IOCTL_MUNMAP _IO ('A', 0xf3)
@ -68,7 +66,6 @@ typedef struct {
#define PCM_SHM_SIZE sizeof(snd_pcm_shm_ctrl_t)
#define SND_CTL_IOCTL_CARD _IO ('U', 0xf0)
#define SND_CTL_IOCTL_READ _IOR('U', 0xf1, snd_ctl_event_t)
#define SND_CTL_IOCTL_CLOSE _IO ('U', 0xf2)
#define SND_CTL_IOCTL_POLL_DESCRIPTOR _IO ('U', 0xf3)

View file

@ -19,6 +19,8 @@
*
*/
#include "asoundlib.h"
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
#define ERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, 0, __VA_ARGS__)
#define SYSERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, errno, __VA_ARGS__)

View file

@ -22,12 +22,10 @@ typedef sndrv_pcm_uframes_t snd_pcm_uframes_t;
typedef sndrv_pcm_sframes_t snd_pcm_sframes_t;
typedef struct timeval snd_timestamp_t;
typedef struct sndrv_interval snd_interval_t;
typedef struct sndrv_pcm_info snd_pcm_info_t;
typedef struct sndrv_pcm_hw_params snd_pcm_hw_params_t;
typedef struct sndrv_pcm_sw_params snd_pcm_sw_params_t;
typedef struct sndrv_pcm_hw_channel_info snd_pcm_hw_channel_info_t;
typedef struct sndrv_pcm_status snd_pcm_status_t;
typedef struct _snd_pcm_info snd_pcm_info_t;
typedef struct _snd_pcm_hw_params snd_pcm_hw_params_t;
typedef struct _snd_pcm_sw_params snd_pcm_sw_params_t;
typedef struct _snd_pcm_status snd_pcm_status_t;
#define SND_PCM_CLASS_GENERIC SNDRV_PCM_CLASS_GENERIC
#define SND_PCM_CLASS_MULTI SNDRV_PCM_CLASS_MULTI
#define SND_PCM_CLASS_MODEM SNDRV_PCM_CLASS_MODEM
@ -153,6 +151,7 @@ typedef struct sndrv_pcm_status snd_pcm_status_t;
#define SND_PCM_NONBLOCK 0x0001
#define SND_PCM_ASYNC 0x0002
typedef struct _snd_mask snd_mask_t;
typedef struct _snd_pcm snd_pcm_t;
typedef enum _snd_pcm_type {
@ -198,7 +197,6 @@ snd_pcm_sframes_t snd_pcm_readv(snd_pcm_t *pcm, const struct iovec *vector, int
snd_pcm_type_t snd_pcm_type(snd_pcm_t *pcm);
int snd_pcm_close(snd_pcm_t *pcm);
int snd_pcm_card(snd_pcm_t *pcm);
int snd_pcm_poll_descriptor(snd_pcm_t *pcm);
int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock);
int snd_pcm_async(snd_pcm_t *pcm, int sig, pid_t pid);
@ -207,9 +205,9 @@ int snd_pcm_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
int snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
int snd_pcm_hw_free(snd_pcm_t *pcm);
int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
int snd_pcm_status(snd_pcm_t *pcm, snd_pcm_status_t *status);
int snd_pcm_prepare(snd_pcm_t *pcm);
int snd_pcm_reset(snd_pcm_t *pcm);
int snd_pcm_status(snd_pcm_t *pcm, snd_pcm_status_t *status);
int snd_pcm_start(snd_pcm_t *pcm);
int snd_pcm_drop(snd_pcm_t *pcm);
int snd_pcm_drain(snd_pcm_t *pcm);
@ -226,7 +224,6 @@ int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, snd_output_t *out);
int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, snd_output_t *out);
int snd_pcm_dump_setup(snd_pcm_t *pcm, snd_output_t *out);
int snd_pcm_dump(snd_pcm_t *pcm, snd_output_t *out);
int snd_pcm_status_dump(snd_pcm_status_t *status, snd_output_t *out);
int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2);
int snd_pcm_unlink(snd_pcm_t *pcm);
@ -234,20 +231,24 @@ int snd_pcm_wait(snd_pcm_t *pcm, int timeout);
snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm);
int snd_pcm_set_avail_min(snd_pcm_t *pcm, snd_pcm_uframes_t size);
typedef struct _snd_mask snd_mask_t;
/* Mask */
size_t snd_mask_sizeof();
#define snd_mask_alloca(maskp) ({(*maskp) = alloca(snd_mask_sizeof()); 0;})
int snd_mask_malloc(snd_mask_t **maskp);
void snd_mask_free(snd_mask_t *mask);
void snd_mask_none(snd_mask_t *mask);
void snd_mask_any(snd_mask_t *mask);
void snd_mask_load(snd_mask_t *mask, unsigned int msk);
int snd_mask_empty(const snd_mask_t *mask);
void snd_mask_set(snd_mask_t *mask, unsigned int val);
void snd_mask_reset(snd_mask_t *mask, unsigned int val);
void snd_mask_copy(snd_mask_t *mask, const snd_mask_t *v);
int snd_mask_test(const snd_mask_t *mask, unsigned int val);
void snd_mask_intersect(snd_mask_t *mask, const snd_mask_t *v);
void snd_mask_union(snd_mask_t *mask, const snd_mask_t *v);
int snd_mask_eq(const snd_mask_t *a, const snd_mask_t *b);
int snd_mask_single(const snd_mask_t *mask);
void snd_mask_copy(snd_mask_t *dst, const snd_mask_t *src);
/* HW params */
size_t snd_pcm_hw_params_sizeof();
#define snd_pcm_hw_params_alloca(paramsp) ({(*paramsp) = alloca(snd_pcm_hw_params_sizeof()); 0;})
int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **paramsp);
int snd_pcm_hw_params_free(snd_pcm_hw_params_t *params);
void snd_pcm_hw_params_copy(snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *src);
int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
int snd_pcm_hw_param_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
@ -288,14 +289,10 @@ int snd_pcm_hw_param_minmax_try(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
unsigned int *max, int *maxdir);
int snd_pcm_hw_param_set_try(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, unsigned int val, int dir);
int snd_pcm_hw_param_snd_mask_try(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
int snd_pcm_hw_param_mask_try(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, const snd_mask_t *mask);
int snd_pcm_hw_param_value(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, int *dir);
const snd_mask_t *snd_pcm_hw_param_value_mask(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var);
const snd_interval_t *snd_pcm_hw_param_value_interval(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var);
unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, int *dir);
unsigned int snd_pcm_hw_param_value_max(const snd_pcm_hw_params_t *params,
@ -341,6 +338,7 @@ int snd_pcm_hw_strategy_simple_choices(snd_pcm_hw_strategy_t *strategy, int orde
unsigned int count,
snd_pcm_hw_strategy_simple_choices_list_t *choices);
/* SW params */
typedef enum _snd_pcm_sw_param {
SND_PCM_SW_PARAM_START_MODE,
SND_PCM_SW_PARAM_XRUN_MODE,
@ -354,12 +352,56 @@ typedef enum _snd_pcm_sw_param {
SND_PCM_SW_PARAM_LAST = SND_PCM_SW_PARAM_SILENCE_SIZE,
} snd_pcm_sw_param_t;
size_t snd_pcm_sw_params_sizeof();
#define snd_pcm_sw_params_alloca(paramsp) ({(*paramsp) = alloca(snd_pcm_sw_params_sizeof()); 0;})
int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **paramsp);
int snd_pcm_sw_params_free(snd_pcm_sw_params_t *params);
void snd_pcm_sw_params_copy(snd_pcm_sw_params_t *dst, const snd_pcm_sw_params_t *src);
int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
int snd_pcm_sw_param_set(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_sw_param_t var, unsigned int val);
int snd_pcm_sw_param_near(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_sw_param_t var, unsigned int val);
int snd_pcm_sw_param_value(snd_pcm_sw_params_t *params, snd_pcm_sw_param_t var);
int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, snd_output_t *out);
/* Info */
size_t snd_pcm_info_sizeof();
#define snd_pcm_info_alloca(infop) ({(*infop) = alloca(snd_pcm_info_sizeof()); 0;})
int snd_pcm_info_malloc(snd_pcm_info_t **infop);
int snd_pcm_info_free(snd_pcm_info_t *info);
void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src);
void snd_pcm_info_set_device(snd_pcm_info_t *info, unsigned int device);
void snd_pcm_info_set_subdevice(snd_pcm_info_t *info, unsigned int subdevice);
void snd_pcm_info_set_stream(snd_pcm_info_t *info, snd_pcm_stream_t stream);
int snd_pcm_info_card(snd_pcm_info_t *info);
unsigned int snd_pcm_info_device(snd_pcm_info_t *info);
unsigned int snd_pcm_info_subdevice(snd_pcm_info_t *info);
snd_pcm_stream_t snd_pcm_info_stream(snd_pcm_info_t *info);
const char *snd_pcm_info_device_id(snd_pcm_info_t *info);
const char *snd_pcm_info_device_name(snd_pcm_info_t *info);
const char *snd_pcm_info_subdevice_name(snd_pcm_info_t *info);
snd_pcm_class_t snd_pcm_info_device_class(snd_pcm_info_t *info);
snd_pcm_subclass_t snd_pcm_info_device_subclass(snd_pcm_info_t *info);
unsigned int snd_pcm_info_subdevices_count(snd_pcm_info_t *info);
unsigned int snd_pcm_info_subdevices_avail(snd_pcm_info_t *info);
/* Status */
size_t snd_pcm_status_sizeof();
#define snd_pcm_status_alloca(statusp) ({(*statusp) = alloca(snd_pcm_status_sizeof()); 0;})
int snd_pcm_status_malloc(snd_pcm_status_t **statusp);
int snd_pcm_status_free(snd_pcm_status_t *status);
void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src);
snd_pcm_state_t snd_pcm_status_state(snd_pcm_status_t *status);
int snd_pcm_status_delay(snd_pcm_status_t *status);
int snd_pcm_status_avail(snd_pcm_status_t *status);
int snd_pcm_status_avail_max(snd_pcm_status_t *status);
void snd_pcm_status_tstamp(snd_pcm_status_t *status,
snd_timestamp_t *tstamp);
void snd_pcm_status_trigger_tstamp(snd_pcm_status_t *status,
snd_timestamp_t *tstamp);
int snd_pcm_status_dump(snd_pcm_status_t *status, snd_output_t *out);
/* mmap */
const snd_pcm_channel_area_t *snd_pcm_mmap_areas(snd_pcm_t *pcm);
const snd_pcm_channel_area_t *snd_pcm_mmap_running_areas(snd_pcm_t *pcm);
@ -389,11 +431,11 @@ int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_channel, snd_pcm_ufra
unsigned int samples, int format);
int snd_pcm_areas_silence(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset,
unsigned int channels, snd_pcm_uframes_t frames, int format);
int snd_pcm_area_copy(const snd_pcm_channel_area_t *src_channel, snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset,
int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_channel, snd_pcm_uframes_t src_offset,
unsigned int samples, int format);
int snd_pcm_areas_copy(const snd_pcm_channel_area_t *src_channels, snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset,
int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_channels, snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int format);
snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes);

View file

@ -23,7 +23,6 @@
#include <errno.h>
#include <stdarg.h>
#include <sys/stat.h>
#include "asoundlib.h"
#include "local.h"
#include "list.h"

View file

@ -29,7 +29,6 @@
#include <assert.h>
#define __USE_GNU
#include <search.h>
#include "asoundlib.h"
#include "control_local.h"
int snd_ctl_hbag_create(void **bag)

View file

@ -28,7 +28,6 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include "control_local.h"
#include "asoundlib.h"
#define SND_FILE_CONTROL "/dev/snd/controlC%i"
#define SND_FILE_LOAD "/dev/aloadC%i"

View file

@ -28,7 +28,6 @@
#include <fcntl.h>
#include <assert.h>
#include <dlfcn.h>
#include "asoundlib.h"
#include "control_local.h"
snd_ctl_type_t snd_ctl_type(snd_ctl_t *ctl)
@ -45,12 +44,6 @@ int snd_ctl_close(snd_ctl_t *ctl)
return res;
}
int snd_ctl_card(snd_ctl_t *ctl)
{
assert(ctl);
return ctl->ops->card(ctl);
}
int snd_ctl_poll_descriptor(snd_ctl_t *ctl)
{
assert(ctl);

View file

@ -28,7 +28,6 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <assert.h>
#include "asoundlib.h"
#include "control_local.h"
#define SNDRV_FILE_CONTROL "/dev/snd/controlC%i"
@ -48,12 +47,6 @@ static int snd_ctl_hw_close(snd_ctl_t *handle)
return res;
}
static int snd_ctl_hw_card(snd_ctl_t *handle)
{
snd_ctl_hw_t *hw = handle->private;
return hw->card;
}
static int snd_ctl_hw_poll_descriptor(snd_ctl_t *handle)
{
snd_ctl_hw_t *hw = handle->private;
@ -172,7 +165,6 @@ static int snd_ctl_hw_read(snd_ctl_t *handle, snd_ctl_event_t *event)
snd_ctl_ops_t snd_ctl_hw_ops = {
close: snd_ctl_hw_close,
card: snd_ctl_hw_card,
poll_descriptor: snd_ctl_hw_poll_descriptor,
hw_info: snd_ctl_hw_hw_info,
clist: snd_ctl_hw_clist,

View file

@ -20,13 +20,11 @@
*/
#include <assert.h>
#include "asoundlib.h"
#include "local.h"
#include "list.h"
typedef struct {
int (*close)(snd_ctl_t *handle);
int (*card)(snd_ctl_t *handle);
int (*poll_descriptor)(snd_ctl_t *handle);
int (*hw_info)(snd_ctl_t *handle, snd_ctl_hw_info_t *info);
int (*clist)(snd_ctl_t *handle, snd_control_list_t *list);

View file

@ -34,8 +34,8 @@
#include <sys/mman.h>
#include <netinet/in.h>
#include <netdb.h>
#include "control_local.h"
#include "aserver.h"
#include "control_local.h"
typedef struct {
int socket;
@ -95,14 +95,6 @@ static int snd_ctl_shm_close(snd_ctl_t *ctl)
return result;
}
static int snd_ctl_shm_card(snd_ctl_t *ctl)
{
snd_ctl_shm_t *shm = ctl->private;
volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
ctrl->cmd = SND_CTL_IOCTL_CARD;
return snd_ctl_shm_action(ctl);
}
static int snd_ctl_shm_poll_descriptor(snd_ctl_t *ctl)
{
snd_ctl_shm_t *shm = ctl->private;
@ -318,7 +310,6 @@ static int snd_ctl_shm_read(snd_ctl_t *ctl, snd_ctl_event_t *event)
snd_ctl_ops_t snd_ctl_shm_ops = {
close: snd_ctl_shm_close,
card: snd_ctl_shm_card,
poll_descriptor: snd_ctl_shm_poll_descriptor,
hw_info: snd_ctl_shm_hw_info,
clist: snd_ctl_shm_clist,

View file

@ -29,7 +29,6 @@
#include <assert.h>
#define __USE_GNU
#include <search.h>
#include "asoundlib.h"
#include "control_local.h"
static void snd_ctl_hfree1(snd_hcontrol_t *hcontrol);

View file

@ -22,7 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "asoundlib.h"
#include "local.h"
static int defaults_card(const char *env)
{

View file

@ -25,7 +25,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "asoundlib.h"
#include "local.h"
static const char *snd_error_codes[] =
{

View file

@ -26,7 +26,7 @@
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "asoundlib.h"
#include "local.h"
#define SNDRV_FILE_HWDEP "/dev/snd/hwC%iD%i"
#define SNDRV_HWDEP_VERSION_MAX SNDRV_PROTOCOL_VERSION(1, 0, 0)

View file

@ -26,7 +26,6 @@
#include <unistd.h>
#include <errno.h>
#include "local.h"
#include "asoundlib.h"
typedef struct _snd_input_ops {
int (*close)(snd_input_t *input);

View file

@ -24,7 +24,7 @@
#include <errno.h>
#include <sys/stat.h>
#include <stdio.h>
#include "asoundlib.h"
#include "local.h"
#include <asm/byteorder.h>
#include <linux/ainstr_fm.h>

View file

@ -25,7 +25,7 @@
#include <errno.h>
#include <sys/stat.h>
#include <stdio.h>
#include "asoundlib.h"
#include "local.h"
#include <linux/ainstr_iw.h>
/*

View file

@ -25,7 +25,7 @@
#include <errno.h>
#include <sys/stat.h>
#include <stdio.h>
#include "asoundlib.h"
#include "local.h"
#include <asm/byteorder.h>
#include <linux/ainstr_simple.h>

View file

@ -26,7 +26,6 @@
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "asoundlib.h"
#include "mixer_local.h"
static void snd_mixer_simple_read_rebuild(snd_ctl_t *ctl_handle, void *private_data);

View file

@ -20,7 +20,7 @@
*/
#include <assert.h>
#include "asoundlib.h"
#include "local.h"
#include "list.h"
typedef struct _mixer_simple mixer_simple_t;

View file

@ -26,7 +26,6 @@
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "asoundlib.h"
#include "mixer_local.h"
static struct mixer_name_table {

View file

@ -26,7 +26,6 @@
#include <unistd.h>
#include <errno.h>
#include "local.h"
#include "asoundlib.h"
typedef struct _snd_output_ops {
int (*close)(snd_output_t *output);

View file

@ -26,8 +26,7 @@
#include <limits.h>
#include <errno.h>
#include <assert.h>
#include "asoundlib.h"
#include "interval.h"
#include "pcm_local.h"
static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)
{

View file

@ -19,7 +19,7 @@
*
*/
#include <stdio.h>
typedef struct _snd_interval snd_interval_t;
#ifdef SND_INTERVAL_INLINE
#include "interval_inline.h"

View file

@ -20,12 +20,12 @@
*/
#ifdef SND_INTERVAL_C
#define INLINE inline
#define INTERVAL_INLINE inline
#else
#define INLINE extern inline
#define INTERVAL_INLINE extern inline
#endif
INLINE void snd_interval_any(snd_interval_t *i)
INTERVAL_INLINE void snd_interval_any(snd_interval_t *i)
{
i->min = 0;
i->openmin = 0;
@ -35,59 +35,59 @@ INLINE void snd_interval_any(snd_interval_t *i)
i->empty = 0;
}
INLINE void snd_interval_none(snd_interval_t *i)
INTERVAL_INLINE void snd_interval_none(snd_interval_t *i)
{
i->empty = 1;
}
INLINE int snd_interval_checkempty(const snd_interval_t *i)
INTERVAL_INLINE int snd_interval_checkempty(const snd_interval_t *i)
{
return (i->min > i->max ||
(i->min == i->max && (i->openmin || i->openmax)));
}
INLINE int snd_interval_empty(const snd_interval_t *i)
INTERVAL_INLINE int snd_interval_empty(const snd_interval_t *i)
{
return i->empty;
}
INLINE int snd_interval_single(const snd_interval_t *i)
INTERVAL_INLINE int snd_interval_single(const snd_interval_t *i)
{
assert(!snd_interval_empty(i));
return (i->min == i->max ||
(i->min + 1 == i->max && i->openmax));
}
INLINE int snd_interval_value(const snd_interval_t *i)
INTERVAL_INLINE int snd_interval_value(const snd_interval_t *i)
{
assert(snd_interval_single(i));
return i->min;
}
INLINE int snd_interval_min(const snd_interval_t *i)
INTERVAL_INLINE int snd_interval_min(const snd_interval_t *i)
{
assert(!snd_interval_empty(i));
return i->min;
}
INLINE int snd_interval_max(const snd_interval_t *i)
INTERVAL_INLINE int snd_interval_max(const snd_interval_t *i)
{
assert(!snd_interval_empty(i));
return i->max;
}
INLINE int snd_interval_test(const snd_interval_t *i, unsigned int val)
INTERVAL_INLINE int snd_interval_test(const snd_interval_t *i, unsigned int val)
{
return !((i->min > val || (i->min == val && i->openmin) ||
i->max < val || (i->max == val && i->openmax)));
}
INLINE void snd_interval_copy(snd_interval_t *d, const snd_interval_t *s)
INTERVAL_INLINE void snd_interval_copy(snd_interval_t *d, const snd_interval_t *s)
{
*d = *s;
}
INLINE int snd_interval_setinteger(snd_interval_t *i)
INTERVAL_INLINE int snd_interval_setinteger(snd_interval_t *i)
{
if (i->integer)
return 0;
@ -97,7 +97,7 @@ INLINE int snd_interval_setinteger(snd_interval_t *i)
return 1;
}
INLINE void snd_interval_floor(snd_interval_t *i)
INTERVAL_INLINE void snd_interval_floor(snd_interval_t *i)
{
if (i->integer || snd_interval_empty(i))
return;
@ -109,7 +109,7 @@ INLINE void snd_interval_floor(snd_interval_t *i)
i->integer = 1;
}
INLINE void snd_interval_unfloor(snd_interval_t *i)
INTERVAL_INLINE void snd_interval_unfloor(snd_interval_t *i)
{
if (snd_interval_empty(i))
return;
@ -123,13 +123,13 @@ INLINE void snd_interval_unfloor(snd_interval_t *i)
}
INLINE int snd_interval_always_eq(const snd_interval_t *i1, const snd_interval_t *i2)
INTERVAL_INLINE int snd_interval_always_eq(const snd_interval_t *i1, const snd_interval_t *i2)
{
return snd_interval_single(i1) && snd_interval_single(i2) &&
snd_interval_value(i1) == snd_interval_value(i2);
}
INLINE int snd_interval_never_eq(const snd_interval_t *i1, const snd_interval_t *i2)
INTERVAL_INLINE int snd_interval_never_eq(const snd_interval_t *i1, const snd_interval_t *i2)
{
return (i1->max < i2->min ||

View file

@ -26,6 +26,5 @@
#include <limits.h>
#include <errno.h>
#include <assert.h>
#include "asoundlib.h"
#include "mask.h"
#include "pcm_local.h"

View file

@ -19,12 +19,6 @@
*
*/
#include <sys/types.h>
#include <limits.h>
#include <errno.h>
#include <assert.h>
#include "asoundlib.h"
#define SND_MASK_MAX 31
#ifdef SND_MASK_INLINE

View file

@ -23,9 +23,9 @@
#include <assert.h>
#ifdef SND_MASK_C
#define INLINE inline
#define MASK_INLINE inline
#else
#define INLINE extern inline
#define MASK_INLINE extern inline
#endif
#ifndef MASK_MASK
@ -38,7 +38,7 @@ struct _snd_mask {
#define snd_mask_bits(mask) ((mask)->bits)
INLINE unsigned int ld2(u_int32_t v)
MASK_INLINE unsigned int ld2(u_int32_t v)
{
unsigned r = 0;
@ -63,7 +63,7 @@ INLINE unsigned int ld2(u_int32_t v)
return r;
}
INLINE unsigned int hweight32(u_int32_t v)
MASK_INLINE unsigned int hweight32(u_int32_t v)
{
v = (v & 0x55555555) + ((v >> 1) & 0x55555555);
v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
@ -72,116 +72,116 @@ INLINE unsigned int hweight32(u_int32_t v)
return (v & 0x0000FFFF) + ((v >> 16) & 0x0000FFFF);
}
INLINE size_t snd_mask_sizeof(void)
MASK_INLINE size_t snd_mask_sizeof(void)
{
return sizeof(snd_mask_t);
}
INLINE void snd_mask_none(snd_mask_t *mask)
MASK_INLINE void snd_mask_none(snd_mask_t *mask)
{
snd_mask_bits(mask) = 0;
}
INLINE void snd_mask_any(snd_mask_t *mask)
MASK_INLINE void snd_mask_any(snd_mask_t *mask)
{
snd_mask_bits(mask) = ~0U;
}
INLINE void snd_mask_load(snd_mask_t *mask, unsigned int msk)
MASK_INLINE void snd_mask_load(snd_mask_t *mask, unsigned int msk)
{
snd_mask_bits(mask) = msk;
}
INLINE int snd_mask_empty(const snd_mask_t *mask)
MASK_INLINE int snd_mask_empty(const snd_mask_t *mask)
{
return snd_mask_bits(mask) == 0;
}
INLINE int snd_mask_full(const snd_mask_t *mask)
MASK_INLINE int snd_mask_full(const snd_mask_t *mask)
{
return snd_mask_bits(mask) == ~0U;
}
INLINE unsigned int snd_mask_count(const snd_mask_t *mask)
MASK_INLINE unsigned int snd_mask_count(const snd_mask_t *mask)
{
return hweight32(snd_mask_bits(mask));
}
INLINE unsigned int snd_mask_min(const snd_mask_t *mask)
MASK_INLINE unsigned int snd_mask_min(const snd_mask_t *mask)
{
assert(!snd_mask_empty(mask));
return ffs(snd_mask_bits(mask)) - 1;
}
INLINE unsigned int snd_mask_max(const snd_mask_t *mask)
MASK_INLINE unsigned int snd_mask_max(const snd_mask_t *mask)
{
assert(!snd_mask_empty(mask));
return ld2(snd_mask_bits(mask));
}
INLINE void snd_mask_set(snd_mask_t *mask, unsigned int val)
MASK_INLINE void snd_mask_set(snd_mask_t *mask, unsigned int val)
{
assert(val <= SND_MASK_MAX);
snd_mask_bits(mask) |= (1U << val);
}
INLINE void snd_mask_reset(snd_mask_t *mask, unsigned int val)
MASK_INLINE void snd_mask_reset(snd_mask_t *mask, unsigned int val)
{
assert(val <= SND_MASK_MAX);
snd_mask_bits(mask) &= ~(1U << val);
}
INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int to)
MASK_INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int to)
{
assert(to <= SND_MASK_MAX && from <= to);
snd_mask_bits(mask) |= ((1U << (from - to + 1)) - 1) << from;
}
INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned int to)
MASK_INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned int to)
{
assert(to <= SND_MASK_MAX && from <= to);
snd_mask_bits(mask) &= ~(((1U << (from - to + 1)) - 1) << from);
}
INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val)
MASK_INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val)
{
assert(val <= SND_MASK_MAX);
snd_mask_bits(mask) &= 1U << val;
}
INLINE void snd_mask_intersect(snd_mask_t *mask, const snd_mask_t *v)
MASK_INLINE void snd_mask_intersect(snd_mask_t *mask, const snd_mask_t *v)
{
snd_mask_bits(mask) &= snd_mask_bits(v);
}
INLINE void snd_mask_union(snd_mask_t *mask, const snd_mask_t *v)
MASK_INLINE void snd_mask_union(snd_mask_t *mask, const snd_mask_t *v)
{
snd_mask_bits(mask) |= snd_mask_bits(v);
}
INLINE int snd_mask_eq(const snd_mask_t *mask, const snd_mask_t *v)
MASK_INLINE int snd_mask_eq(const snd_mask_t *mask, const snd_mask_t *v)
{
return snd_mask_bits(mask) == snd_mask_bits(v);
}
INLINE void snd_mask_copy(snd_mask_t *mask, const snd_mask_t *v)
MASK_INLINE void snd_mask_copy(snd_mask_t *mask, const snd_mask_t *v)
{
snd_mask_bits(mask) = snd_mask_bits(v);
}
INLINE int snd_mask_test(const snd_mask_t *mask, unsigned int val)
MASK_INLINE int snd_mask_test(const snd_mask_t *mask, unsigned int val)
{
assert(val <= SND_MASK_MAX);
return snd_mask_bits(mask) & (1U << val);
}
INLINE int snd_mask_single(const snd_mask_t *mask)
MASK_INLINE int snd_mask_single(const snd_mask_t *mask)
{
assert(!snd_mask_empty(mask));
return !(snd_mask_bits(mask) & (snd_mask_bits(mask) - 1));
}
INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v)
MASK_INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v)
{
snd_mask_t old;
assert(!snd_mask_empty(mask));
@ -192,7 +192,7 @@ INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v)
return !snd_mask_eq(mask, &old);
}
INLINE int snd_mask_refine_first(snd_mask_t *mask)
MASK_INLINE int snd_mask_refine_first(snd_mask_t *mask)
{
assert(!snd_mask_empty(mask));
if (snd_mask_single(mask))
@ -201,7 +201,7 @@ INLINE int snd_mask_refine_first(snd_mask_t *mask)
return 1;
}
INLINE int snd_mask_refine_last(snd_mask_t *mask)
MASK_INLINE int snd_mask_refine_last(snd_mask_t *mask)
{
assert(!snd_mask_empty(mask));
if (snd_mask_single(mask))
@ -210,7 +210,7 @@ INLINE int snd_mask_refine_last(snd_mask_t *mask)
return 1;
}
INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val)
MASK_INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val)
{
assert(!snd_mask_empty(mask));
if (snd_mask_min(mask) >= val)
@ -221,7 +221,7 @@ INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val)
return 1;
}
INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val)
MASK_INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val)
{
assert(!snd_mask_empty(mask));
if (snd_mask_max(mask) <= val)
@ -232,7 +232,7 @@ INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val)
return 1;
}
INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val)
MASK_INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val)
{
int changed;
assert(!snd_mask_empty(mask));
@ -243,19 +243,19 @@ INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val)
return changed;
}
INLINE int snd_mask_value(const snd_mask_t *mask)
MASK_INLINE int snd_mask_value(const snd_mask_t *mask)
{
assert(!snd_mask_empty(mask));
return snd_mask_min(mask);
}
INLINE int snd_mask_always_eq(const snd_mask_t *m1, const snd_mask_t *m2)
MASK_INLINE int snd_mask_always_eq(const snd_mask_t *m1, const snd_mask_t *m2)
{
return snd_mask_single(m1) && snd_mask_single(m2) &&
snd_mask_value(m1) == snd_mask_value(m2);
}
INLINE int snd_mask_never_eq(const snd_mask_t *m1, const snd_mask_t *m2)
MASK_INLINE int snd_mask_never_eq(const snd_mask_t *m1, const snd_mask_t *m2)
{
return (snd_mask_bits(m1) & snd_mask_bits(m2)) == 0;
}

View file

@ -229,12 +229,6 @@ snd_pcm_sframes_t snd_pcm_readv(snd_pcm_t *pcm, const struct iovec *vector, int
return snd_pcm_readn(pcm, bufs, vector[0].iov_len);
}
int snd_pcm_card(snd_pcm_t *pcm)
{
assert(pcm);
return pcm->ops->card(pcm->op_arg);
}
/* FIXME */
#define snd_pcm_link_descriptor snd_pcm_poll_descriptor
@ -545,12 +539,188 @@ int snd_pcm_dump_setup(snd_pcm_t *pcm, snd_output_t *out)
return 0;
}
size_t snd_pcm_info_sizeof()
{
return sizeof(snd_pcm_info_t);
}
int snd_pcm_info_malloc(snd_pcm_info_t **infop)
{
assert(infop);
*infop = malloc(sizeof(snd_pcm_info_t));
if (!*infop)
return -ENOMEM;
return 0;
}
int snd_pcm_info_free(snd_pcm_info_t *info)
{
assert(info);
free(info);
}
void snd_pcm_info_copy(snd_pcm_info_t *dst,
const snd_pcm_info_t *src)
{
assert(dst && src);
*dst = *src;
}
void snd_pcm_info_set_device(snd_pcm_info_t *info, unsigned int device)
{
assert(info);
info->device = device;
}
void snd_pcm_info_set_subdevice(snd_pcm_info_t *info, unsigned int subdevice)
{
assert(info);
info->subdevice = subdevice;
}
void snd_pcm_info_set_stream(snd_pcm_info_t *info, snd_pcm_stream_t stream)
{
assert(info);
info->stream = stream;
}
int snd_pcm_info_card(snd_pcm_info_t *info)
{
assert(info);
return info->card;
}
unsigned int snd_pcm_info_device(snd_pcm_info_t *info)
{
assert(info);
return info->device;
}
unsigned int snd_pcm_info_subdevice(snd_pcm_info_t *info)
{
assert(info);
return info->subdevice;
}
snd_pcm_stream_t snd_pcm_info_stream(snd_pcm_info_t *info)
{
assert(info);
return info->stream;
}
const char *snd_pcm_info_device_id(snd_pcm_info_t *info)
{
assert(info);
return info->id;
}
const char *snd_pcm_info_device_name(snd_pcm_info_t *info)
{
assert(info);
return info->name;
}
const char *snd_pcm_info_subdevice_name(snd_pcm_info_t *info)
{
assert(info);
return info->subname;
}
snd_pcm_class_t snd_pcm_info_device_class(snd_pcm_info_t *info)
{
assert(info);
return info->class;
}
snd_pcm_subclass_t snd_pcm_info_device_subclass(snd_pcm_info_t *info)
{
assert(info);
return info->subclass;
}
unsigned int snd_pcm_info_subdevices_count(snd_pcm_info_t *info)
{
assert(info);
return info->subdevices_count;
}
unsigned int snd_pcm_info_subdevices_avail(snd_pcm_info_t *info)
{
assert(info);
return info->subdevices_avail;
}
size_t snd_pcm_status_sizeof()
{
return sizeof(snd_pcm_status_t);
}
int snd_pcm_status_malloc(snd_pcm_status_t **statusp)
{
assert(statusp);
*statusp = malloc(sizeof(snd_pcm_status_t));
if (!*statusp)
return -ENOMEM;
return 0;
}
int snd_pcm_status_free(snd_pcm_status_t *status)
{
assert(status);
free(status);
}
void snd_pcm_status_copy(snd_pcm_status_t *dst,
const snd_pcm_status_t *src)
{
assert(dst && src);
*dst = *src;
}
snd_pcm_state_t snd_pcm_status_state(snd_pcm_status_t *status)
{
assert(status);
return status->state;
}
int snd_pcm_status_delay(snd_pcm_status_t *status)
{
assert(status);
return status->delay;
}
int snd_pcm_status_avail(snd_pcm_status_t *status)
{
assert(status);
return status->avail;
}
int snd_pcm_status_avail_max(snd_pcm_status_t *status)
{
assert(status);
return status->avail_max;
}
void snd_pcm_status_tstamp(snd_pcm_status_t *status,
snd_timestamp_t *tstamp)
{
assert(status && tstamp);
*tstamp = status->tstamp;
}
void snd_pcm_status_trigger_tstamp(snd_pcm_status_t *status,
snd_timestamp_t *tstamp)
{
assert(status && tstamp);
*tstamp = status->trigger_tstamp;
}
int snd_pcm_status_dump(snd_pcm_status_t *status, snd_output_t *out)
{
assert(status);
snd_output_printf(out, "state : %s\n", snd_pcm_state_name(status->state));
snd_output_printf(out, "trigger_time: %ld.%06ld\n",
status->trigger_time.tv_sec, status->trigger_time.tv_usec);
status->trigger_tstamp.tv_sec, status->trigger_tstamp.tv_usec);
snd_output_printf(out, "tstamp : %ld.%06ld\n",
status->tstamp.tv_sec, status->tstamp.tv_usec);
snd_output_printf(out, "delay : %ld\n", (long)status->delay);
@ -902,8 +1072,8 @@ int snd_pcm_areas_silence(const snd_pcm_channel_area_t *dst_areas, snd_pcm_ufram
}
int snd_pcm_area_copy(const snd_pcm_channel_area_t *src_area, snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes_t dst_offset,
int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_area, snd_pcm_uframes_t src_offset,
unsigned int samples, int format)
{
/* FIXME: sub byte resolution and odd dst_offset */
@ -997,8 +1167,8 @@ int snd_pcm_area_copy(const snd_pcm_channel_area_t *src_area, snd_pcm_uframes_t
return 0;
}
int snd_pcm_areas_copy(const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int format)
{
int width = snd_pcm_format_physical_width(format);
@ -1032,10 +1202,14 @@ int snd_pcm_areas_copy(const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_
d.addr = dst_start->addr;
d.first = dst_start->first;
d.step = width;
snd_pcm_area_copy(&s, src_offset * chns, &d, dst_offset * chns, frames * chns, format);
snd_pcm_area_copy(&d, dst_offset * chns,
&s, src_offset * chns,
frames * chns, format);
channels -= chns;
} else {
snd_pcm_area_copy(src_start, src_offset, dst_start, dst_offset, frames, format);
snd_pcm_area_copy(dst_start, dst_offset,
src_start, src_offset,
frames, format);
src_areas = src_start + 1;
dst_areas = dst_start + 1;
channels--;
@ -1216,3 +1390,8 @@ snd_pcm_uframes_t _snd_pcm_mmap_hw_ptr(snd_pcm_t *pcm)
return *pcm->hw_ptr;
}
snd_pcm_uframes_t _snd_pcm_boundary(snd_pcm_t *pcm)
{
return pcm->boundary;
}

View file

@ -51,10 +51,10 @@ IMA compatability project proceedings, Vol 2, Issue 2, May 1992.
#include "pcm_local.h"
#include "pcm_plugin.h"
typedef void (*adpcm_f)(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
typedef void (*adpcm_f)(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int getputidx,
snd_pcm_adpcm_state_t *states);
@ -190,10 +190,10 @@ static int adpcm_decoder(unsigned char code, snd_pcm_adpcm_state_t * state)
return (state->pred_val);
}
void snd_pcm_adpcm_decode(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
void snd_pcm_adpcm_decode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int putidx,
snd_pcm_adpcm_state_t *states)
{
@ -251,10 +251,10 @@ void snd_pcm_adpcm_decode(const snd_pcm_channel_area_t *src_areas,
}
}
void snd_pcm_adpcm_encode(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
void snd_pcm_adpcm_encode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int getidx,
snd_pcm_adpcm_state_t *states)
{
@ -473,8 +473,8 @@ static snd_pcm_sframes_t snd_pcm_adpcm_write_areas(snd_pcm_t *pcm,
assert(size > 0);
while (xfer < size) {
snd_pcm_uframes_t frames = snd_pcm_mmap_playback_xfer(slave, size - xfer);
adpcm->func(areas, offset,
snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
adpcm->func(snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
areas, offset,
pcm->channels, frames,
adpcm->getput_idx, adpcm->states);
err = snd_pcm_mmap_forward(slave, frames);
@ -508,8 +508,8 @@ static snd_pcm_sframes_t snd_pcm_adpcm_read_areas(snd_pcm_t *pcm,
assert(size > 0);
while (xfer < size) {
snd_pcm_uframes_t frames = snd_pcm_mmap_capture_xfer(slave, size - xfer);
adpcm->func(snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
areas, offset,
adpcm->func(areas, offset,
snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
pcm->channels, frames,
adpcm->getput_idx, adpcm->states);
err = snd_pcm_mmap_forward(slave, frames);
@ -543,7 +543,6 @@ static void snd_pcm_adpcm_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_ops_t snd_pcm_adpcm_ops = {
close: snd_pcm_plugin_close,
card: snd_pcm_plugin_card,
info: snd_pcm_plugin_info,
hw_refine: snd_pcm_adpcm_hw_refine,
hw_params: snd_pcm_adpcm_hw_params,

View file

@ -23,10 +23,10 @@
#include "pcm_local.h"
#include "pcm_plugin.h"
typedef void (*alaw_f)(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
typedef void (*alaw_f)(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int getputidx);
typedef struct {
@ -120,10 +120,10 @@ static int alaw_to_s16(unsigned char a_val)
return ((a_val & 0x80) ? t : -t);
}
void snd_pcm_alaw_decode(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
void snd_pcm_alaw_decode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int putidx)
{
#define PUT16_LABELS
@ -165,10 +165,10 @@ void snd_pcm_alaw_decode(const snd_pcm_channel_area_t *src_areas,
}
}
void snd_pcm_alaw_encode(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
void snd_pcm_alaw_encode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int getidx)
{
#define GET16_LABELS
@ -348,8 +348,8 @@ static snd_pcm_sframes_t snd_pcm_alaw_write_areas(snd_pcm_t *pcm,
assert(size > 0);
while (xfer < size) {
snd_pcm_uframes_t frames = snd_pcm_mmap_playback_xfer(slave, size - xfer);
alaw->func(areas, offset,
snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
alaw->func(snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
areas, offset,
pcm->channels, frames,
alaw->getput_idx);
err = snd_pcm_mmap_forward(slave, frames);
@ -383,8 +383,8 @@ static snd_pcm_sframes_t snd_pcm_alaw_read_areas(snd_pcm_t *pcm,
assert(size > 0);
while (xfer < size) {
snd_pcm_uframes_t frames = snd_pcm_mmap_capture_xfer(slave, size - xfer);
alaw->func(snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
areas, offset,
alaw->func(areas, offset,
snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
pcm->channels, frames,
alaw->getput_idx);
err = snd_pcm_mmap_forward(slave, frames);
@ -418,7 +418,6 @@ static void snd_pcm_alaw_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_ops_t snd_pcm_alaw_ops = {
close: snd_pcm_plugin_close,
card: snd_pcm_plugin_card,
info: snd_pcm_plugin_info,
hw_refine: snd_pcm_alaw_hw_refine,
hw_params: snd_pcm_alaw_hw_params,

View file

@ -108,8 +108,8 @@ static snd_pcm_sframes_t snd_pcm_copy_write_areas(snd_pcm_t *pcm,
while (xfer < size) {
snd_pcm_uframes_t frames = snd_pcm_mmap_playback_xfer(slave, size - xfer);
snd_pcm_areas_copy(areas, offset,
snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
snd_pcm_areas_copy(snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
areas, offset,
pcm->channels, frames, pcm->format);
err = snd_pcm_mmap_forward(slave, frames);
if (err < 0)
@ -142,8 +142,8 @@ static snd_pcm_sframes_t snd_pcm_copy_read_areas(snd_pcm_t *pcm,
assert(size > 0);
while (xfer < size) {
snd_pcm_uframes_t frames = snd_pcm_mmap_capture_xfer(slave, size - xfer);
snd_pcm_areas_copy(snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
areas, offset,
snd_pcm_areas_copy(areas, offset,
snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
pcm->channels, frames, pcm->format);
err = snd_pcm_mmap_forward(slave, frames);
if (err < 0)
@ -175,7 +175,6 @@ static void snd_pcm_copy_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_ops_t snd_pcm_copy_ops = {
close: snd_pcm_plugin_close,
card: snd_pcm_plugin_card,
info: snd_pcm_plugin_info,
hw_refine: snd_pcm_copy_hw_refine,
hw_params: snd_pcm_copy_hw_params,

View file

@ -81,8 +81,8 @@ static void snd_pcm_file_add_frames(snd_pcm_t *pcm,
n = cont;
if (n > avail)
n = avail;
snd_pcm_areas_copy(areas, offset,
file->wbuf_areas, file->appl_ptr,
snd_pcm_areas_copy(file->wbuf_areas, file->appl_ptr,
areas, offset,
pcm->channels, n, pcm->format);
frames -= n;
file->appl_ptr += n;
@ -109,12 +109,6 @@ static int snd_pcm_file_close(snd_pcm_t *pcm)
return 0;
}
static int snd_pcm_file_card(snd_pcm_t *pcm)
{
snd_pcm_file_t *file = pcm->private;
return snd_pcm_card(file->slave);
}
static int snd_pcm_file_nonblock(snd_pcm_t *pcm, int nonblock)
{
snd_pcm_file_t *file = pcm->private;
@ -377,7 +371,6 @@ static void snd_pcm_file_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_ops_t snd_pcm_file_ops = {
close: snd_pcm_file_close,
card: snd_pcm_file_card,
info: snd_pcm_file_info,
hw_refine: snd_pcm_file_hw_refine,
hw_params: snd_pcm_file_hw_params,

View file

@ -109,12 +109,6 @@ static int snd_pcm_hw_async(snd_pcm_t *pcm, int sig, pid_t pid)
return 0;
}
static int snd_pcm_hw_card(snd_pcm_t *pcm)
{
snd_pcm_hw_t *hw = pcm->private;
return hw->card;
}
static int snd_pcm_hw_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
{
snd_pcm_hw_t *hw = pcm->private;
@ -184,21 +178,21 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
static int snd_pcm_hw_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info)
{
snd_pcm_hw_t *hw = pcm->private;
snd_pcm_hw_channel_info_t hw_info;
struct sndrv_pcm_channel_info i;
int fd = hw->fd;
hw_info.channel = info->channel;
if (ioctl(fd, SNDRV_PCM_IOCTL_CHANNEL_INFO, &hw_info) < 0) {
i.channel = info->channel;
if (ioctl(fd, SNDRV_PCM_IOCTL_CHANNEL_INFO, &i) < 0) {
SYSERR("SNDRV_PCM_IOCTL_CHANNEL_INFO failed");
return -errno;
}
info->channel = hw_info.channel;
info->channel = i.channel;
if (pcm->info & SND_PCM_INFO_MMAP) {
info->addr = 0;
info->first = hw_info.first;
info->step = hw_info.step;
info->first = i.first;
info->step = i.step;
info->type = SND_PCM_AREA_MMAP;
info->u.mmap.fd = fd;
info->u.mmap.offset = hw_info.offset;
info->u.mmap.offset = i.offset;
return 0;
}
return snd_pcm_channel_info_shm(pcm, info, hw->shmid);
@ -515,7 +509,6 @@ static void snd_pcm_hw_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_ops_t snd_pcm_hw_ops = {
close: snd_pcm_hw_close,
card: snd_pcm_hw_card,
info: snd_pcm_hw_info,
hw_refine: snd_pcm_hw_hw_refine,
hw_params: snd_pcm_hw_hw_params,

View file

@ -87,8 +87,8 @@ int snd_pcm_linear_put_index(int src_format, int dst_format)
return width * 4 + endian * 2 + sign;
}
void snd_pcm_linear_convert(const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
void snd_pcm_linear_convert(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int convidx)
{
#define CONV_LABELS
@ -247,8 +247,8 @@ static snd_pcm_sframes_t snd_pcm_linear_write_areas(snd_pcm_t *pcm,
assert(size > 0);
while (xfer < size) {
snd_pcm_uframes_t frames = snd_pcm_mmap_playback_xfer(slave, size - xfer);
snd_pcm_linear_convert(areas, offset,
snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
snd_pcm_linear_convert(snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
areas, offset,
pcm->channels, frames, linear->conv_idx);
err = snd_pcm_mmap_forward(slave, frames);
if (err < 0)
@ -281,8 +281,8 @@ static snd_pcm_sframes_t snd_pcm_linear_read_areas(snd_pcm_t *pcm,
assert(size > 0);
while (xfer < size) {
snd_pcm_uframes_t frames = snd_pcm_mmap_capture_xfer(slave, size - xfer);
snd_pcm_linear_convert(snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
areas, offset,
snd_pcm_linear_convert(areas, offset,
snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
pcm->channels, frames, linear->conv_idx);
err = snd_pcm_mmap_forward(slave, frames);
if (err < 0)
@ -315,7 +315,6 @@ static void snd_pcm_linear_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_ops_t snd_pcm_linear_ops = {
close: snd_pcm_plugin_close,
card: snd_pcm_plugin_card,
info: snd_pcm_plugin_info,
hw_refine: snd_pcm_linear_hw_refine,
hw_params: snd_pcm_linear_hw_params,

View file

@ -20,15 +20,28 @@
*
*/
#define _snd_interval sndrv_interval
#define _snd_pcm_info sndrv_pcm_info
#define _snd_pcm_hw_params sndrv_pcm_hw_params
#define _snd_pcm_sw_params sndrv_pcm_sw_params
#define _snd_pcm_status sndrv_pcm_status
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <sys/uio.h>
#include <errno.h>
#include "asoundlib.h"
#include "local.h"
#define SND_INTERVAL_INLINE
#include "interval.h"
#define SND_MASK_INLINE
#include "mask.h"
typedef struct _snd_pcm_channel_info {
unsigned int channel;
void *addr; /* base address of channel samples */
@ -49,7 +62,6 @@ typedef struct _snd_pcm_channel_info {
typedef struct {
int (*close)(snd_pcm_t *pcm);
int (*card)(snd_pcm_t *pcm);
int (*nonblock)(snd_pcm_t *pcm, int nonblock);
int (*async)(snd_pcm_t *pcm, int sig, pid_t pid);
int (*info)(snd_pcm_t *pcm, snd_pcm_info_t *info);
@ -365,6 +377,10 @@ int snd_pcm_hw_param_always_eq(const snd_pcm_hw_params_t *params,
int snd_pcm_hw_param_never_eq(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var,
const snd_pcm_hw_params_t *params1);
const snd_mask_t *snd_pcm_hw_param_value_mask(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var);
const snd_interval_t *snd_pcm_hw_param_value_interval(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var);
#define SND_PCM_HW_PARBIT_ACCESS (1 << SND_PCM_HW_PARAM_ACCESS)
#define SND_PCM_HW_PARBIT_FORMAT (1 << SND_PCM_HW_PARAM_FORMAT)

View file

@ -146,8 +146,8 @@ snd_pcm_sframes_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm,
while (xfer < size) {
snd_pcm_uframes_t frames = snd_pcm_mmap_playback_xfer(pcm, size - xfer);
snd_pcm_sframes_t err;
snd_pcm_areas_copy(areas, offset,
snd_pcm_mmap_areas(pcm), snd_pcm_mmap_offset(pcm),
snd_pcm_areas_copy(snd_pcm_mmap_areas(pcm), snd_pcm_mmap_offset(pcm),
areas, offset,
pcm->channels,
frames, pcm->format);
err = snd_pcm_mmap_forward(pcm, frames);
@ -173,8 +173,8 @@ snd_pcm_sframes_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm,
while (xfer < size) {
snd_pcm_uframes_t frames = snd_pcm_mmap_capture_xfer(pcm, size - xfer);
snd_pcm_sframes_t err;
snd_pcm_areas_copy(snd_pcm_mmap_areas(pcm), snd_pcm_mmap_offset(pcm),
areas, offset,
snd_pcm_areas_copy(areas, offset,
snd_pcm_mmap_areas(pcm), snd_pcm_mmap_offset(pcm),
pcm->channels,
frames, pcm->format);
err = snd_pcm_mmap_forward(pcm, frames);

View file

@ -137,10 +137,10 @@ static int ulaw_to_s16(unsigned char u_val)
return ((u_val & 0x80) ? (0x84 - t) : (t - 0x84));
}
void snd_pcm_mulaw_decode(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
void snd_pcm_mulaw_decode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int putidx)
{
#define PUT16_LABELS
@ -182,10 +182,10 @@ void snd_pcm_mulaw_decode(const snd_pcm_channel_area_t *src_areas,
}
}
void snd_pcm_mulaw_encode(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
void snd_pcm_mulaw_encode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int getidx)
{
#define GET16_LABELS
@ -363,8 +363,8 @@ static snd_pcm_sframes_t snd_pcm_mulaw_write_areas(snd_pcm_t *pcm,
assert(size > 0);
while (xfer < size) {
snd_pcm_uframes_t frames = snd_pcm_mmap_playback_xfer(slave, size - xfer);
mulaw->func(areas, offset,
snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
mulaw->func(snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
areas, offset,
pcm->channels, frames,
mulaw->getput_idx);
err = snd_pcm_mmap_forward(slave, frames);
@ -398,8 +398,8 @@ static snd_pcm_sframes_t snd_pcm_mulaw_read_areas(snd_pcm_t *pcm,
assert(size > 0);
while (xfer < size) {
snd_pcm_uframes_t frames = snd_pcm_mmap_capture_xfer(slave, size - xfer);
mulaw->func(snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
areas, offset,
mulaw->func(areas, offset,
snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
pcm->channels, frames,
mulaw->getput_idx);
err = snd_pcm_mmap_forward(slave, frames);
@ -433,7 +433,6 @@ static void snd_pcm_mulaw_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_ops_t snd_pcm_mulaw_ops = {
close: snd_pcm_plugin_close,
card: snd_pcm_plugin_card,
info: snd_pcm_plugin_info,
hw_refine: snd_pcm_mulaw_hw_refine,
hw_params: snd_pcm_mulaw_hw_params,

View file

@ -26,7 +26,6 @@
#include <errno.h>
#include <math.h>
#include "pcm_local.h"
#include "interval.h"
typedef struct {
snd_pcm_t *pcm;
@ -67,14 +66,6 @@ static int snd_pcm_multi_close(snd_pcm_t *pcm)
return ret;
}
static int snd_pcm_multi_card(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
{
snd_pcm_multi_t *multi = pcm->private;
if (multi->slaves_count != 1)
return -ENOENT; /* not available */
return snd_pcm_card(multi->slaves[0].pcm);
}
static int snd_pcm_multi_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
{
return 0;
@ -90,12 +81,15 @@ static int snd_pcm_multi_async(snd_pcm_t *pcm, int sig, pid_t pid)
static int snd_pcm_multi_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
{
snd_pcm_multi_t *multi = pcm->private;
int err;
snd_pcm_t *slave_0 = multi->slaves[0].pcm;
/* FIXME */
err = snd_pcm_info(slave_0, info);
if (err < 0)
return err;
if (multi->slaves_count == 1)
return snd_pcm_info(multi->slaves[0].pcm, info);
memset(info, 0, sizeof(*info));
info->stream = pcm->stream;
info->card = -1;
strcpy(info->id, "multi");
strcpy(info->name, "multi");
strcpy(info->subname, "multi");
info->subdevices_count = 1;
return 0;
}
@ -483,7 +477,6 @@ static void snd_pcm_multi_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_ops_t snd_pcm_multi_ops = {
close: snd_pcm_multi_close,
card: snd_pcm_multi_card,
info: snd_pcm_multi_info,
hw_refine: snd_pcm_multi_hw_refine,
hw_params: snd_pcm_multi_hw_params,

View file

@ -26,7 +26,7 @@
#include "pcm_plugin.h"
typedef struct {
snd_timestamp_t trigger_time;
snd_timestamp_t trigger_tstamp;
int state;
int shmid;
snd_pcm_uframes_t appl_ptr;
@ -42,11 +42,6 @@ static int snd_pcm_null_close(snd_pcm_t *pcm)
return 0;
}
static int snd_pcm_null_card(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
{
return -ENOENT; /* not available */
}
static int snd_pcm_null_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
{
return 0;
@ -60,7 +55,12 @@ static int snd_pcm_null_async(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int sig ATTRIBUTE
static int snd_pcm_null_info(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_info_t * info)
{
memset(info, 0, sizeof(*info));
/* FIXME */
info->stream = pcm->stream;
info->card = -1;
strcpy(info->id, "null");
strcpy(info->name, "null");
strcpy(info->subname, "null");
info->subdevices_count = 1;
return 0;
}
@ -75,7 +75,7 @@ static int snd_pcm_null_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
snd_pcm_null_t *null = pcm->private;
memset(status, 0, sizeof(*status));
status->state = null->state;
status->trigger_time = null->trigger_time;
status->trigger_tstamp = null->trigger_tstamp;
gettimeofday(&status->tstamp, 0);
status->avail = pcm->buffer_size;
status->avail_max = status->avail;
@ -287,7 +287,6 @@ static void snd_pcm_null_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_ops_t snd_pcm_null_ops = {
close: snd_pcm_null_close,
card: snd_pcm_null_card,
info: snd_pcm_null_info,
hw_refine: snd_pcm_null_hw_refine,
hw_params: snd_pcm_null_hw_params,

View file

@ -20,10 +20,6 @@
*/
#include "pcm_local.h"
#define SND_INTERVAL_INLINE
#define SND_MASK_INLINE
#include "interval.h"
#include "mask.h"
static inline int hw_is_mask(int var)
{
@ -2334,3 +2330,53 @@ int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
return 0;
}
size_t snd_pcm_hw_params_sizeof()
{
return sizeof(snd_pcm_hw_params_t);
}
int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **paramsp)
{
*paramsp = malloc(sizeof(snd_pcm_hw_params_t));
if (!*paramsp)
return -ENOMEM;
return 0;
}
int snd_pcm_hw_params_free(snd_pcm_hw_params_t *params)
{
free(params);
}
void snd_pcm_hw_params_copy(snd_pcm_hw_params_t *dst,
const snd_pcm_hw_params_t *src)
{
*dst = *src;
}
size_t snd_pcm_sw_params_sizeof()
{
return sizeof(snd_pcm_sw_params_t);
}
int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **paramsp)
{
*paramsp = malloc(sizeof(snd_pcm_sw_params_t));
if (!*paramsp)
return -ENOMEM;
return 0;
}
int snd_pcm_sw_params_free(snd_pcm_sw_params_t *params)
{
free(params);
}
void snd_pcm_sw_params_copy(snd_pcm_sw_params_t *dst,
const snd_pcm_sw_params_t *src)
{
*dst = *src;
}

View file

@ -21,7 +21,6 @@
#include "pcm_local.h"
#include "pcm_plugin.h"
#include "interval.h"
typedef struct {
snd_pcm_t *req_slave;
@ -47,12 +46,6 @@ static int snd_pcm_plug_close(snd_pcm_t *pcm)
return result;
}
static int snd_pcm_plug_card(snd_pcm_t *pcm)
{
snd_pcm_plug_t *plug = pcm->private;
return snd_pcm_card(plug->slave);
}
static int snd_pcm_plug_nonblock(snd_pcm_t *pcm, int nonblock)
{
snd_pcm_plug_t *plug = pcm->private;
@ -640,7 +633,6 @@ static void snd_pcm_plug_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_ops_t snd_pcm_plug_ops = {
close: snd_pcm_plug_close,
card: snd_pcm_plug_card,
info: snd_pcm_plug_info,
hw_refine: snd_pcm_plug_hw_refine,
hw_params: snd_pcm_plug_hw_params,

View file

@ -34,12 +34,6 @@ int snd_pcm_plugin_close(snd_pcm_t *pcm)
return 0;
}
int snd_pcm_plugin_card(snd_pcm_t *pcm)
{
snd_pcm_plugin_t *plugin = pcm->private;
return snd_pcm_card(plugin->slave);
}
int snd_pcm_plugin_nonblock(snd_pcm_t *pcm, int nonblock)
{
snd_pcm_plugin_t *plugin = pcm->private;

View file

@ -118,28 +118,28 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, char *name, int sformat, int srate, snd_
(1 << SND_PCM_ACCESS_MMAP_NONINTERLEAVED) | \
(1 << SND_PCM_ACCESS_RW_NONINTERLEAVED))
void snd_pcm_linear_convert(const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
void snd_pcm_linear_convert(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int convidx);
void snd_pcm_alaw_decode(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
void snd_pcm_alaw_decode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int putidx);
void snd_pcm_alaw_encode(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
void snd_pcm_alaw_encode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int getidx);
void snd_pcm_mulaw_decode(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
void snd_pcm_mulaw_decode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int putidx);
void snd_pcm_mulaw_encode(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
void snd_pcm_mulaw_encode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int getidx);
typedef struct _snd_pcm_adpcm_state {
@ -147,15 +147,15 @@ typedef struct _snd_pcm_adpcm_state {
int step_idx; /* Previous StepSize lookup index */
} snd_pcm_adpcm_state_t;
void snd_pcm_adpcm_decode(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
void snd_pcm_adpcm_decode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int putidx,
snd_pcm_adpcm_state_t *states);
void snd_pcm_adpcm_encode(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
void snd_pcm_adpcm_encode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
unsigned int channels, snd_pcm_uframes_t frames, int getidx,
snd_pcm_adpcm_state_t *states);

View file

@ -23,7 +23,6 @@
#include <byteswap.h>
#include "pcm_local.h"
#include "pcm_plugin.h"
#include "interval.h"
#define DIV (1<<16)
@ -33,10 +32,12 @@ typedef struct {
unsigned int pos;
} snd_pcm_rate_state_t;
typedef snd_pcm_uframes_t (*rate_f)(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset, snd_pcm_uframes_t src_frames,
const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset, snd_pcm_uframes_t *dst_framesp,
typedef snd_pcm_uframes_t (*rate_f)(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
snd_pcm_uframes_t *dst_framesp,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
snd_pcm_uframes_t src_frames,
unsigned int channels,
int getidx, int putidx,
unsigned int arg,
@ -54,10 +55,10 @@ typedef struct {
snd_pcm_rate_state_t *states;
} snd_pcm_rate_t;
snd_pcm_uframes_t snd_pcm_rate_expand(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset, snd_pcm_uframes_t src_frames,
const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t snd_pcm_rate_expand(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset, snd_pcm_uframes_t *dst_framesp,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset, snd_pcm_uframes_t src_frames,
unsigned int channels,
int getidx, int putidx,
unsigned int get_threshold,
@ -136,10 +137,10 @@ snd_pcm_uframes_t snd_pcm_rate_expand(const snd_pcm_channel_area_t *src_areas,
return src_frames1;
}
snd_pcm_uframes_t snd_pcm_rate_shrink(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset, snd_pcm_uframes_t src_frames,
const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t snd_pcm_rate_shrink(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset, snd_pcm_uframes_t *dst_framesp,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset, snd_pcm_uframes_t src_frames,
unsigned int channels,
int getidx, int putidx,
unsigned int get_increment,
@ -444,9 +445,9 @@ static snd_pcm_sframes_t snd_pcm_rate_write_areas(snd_pcm_t *pcm,
snd_pcm_uframes_t src_frames, dst_frames;
src_frames = client_size - client_xfer;
dst_frames = snd_pcm_mmap_playback_xfer(slave, slave_size - slave_xfer);
src_frames = rate->func(areas, client_offset, src_frames,
snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
src_frames = rate->func(snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
&dst_frames,
areas, client_offset, src_frames,
pcm->channels,
rate->get_idx, rate->put_idx,
rate->pitch, rate->states);
@ -496,9 +497,9 @@ static snd_pcm_sframes_t snd_pcm_rate_read_areas(snd_pcm_t *pcm,
snd_pcm_uframes_t src_frames, dst_frames;
dst_frames = client_size - client_xfer;
src_frames = snd_pcm_mmap_capture_xfer(slave, slave_size - slave_xfer);
src_frames = rate->func(snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
src_frames = rate->func(areas, client_offset, &dst_frames,
snd_pcm_mmap_areas(slave), snd_pcm_mmap_offset(slave),
src_frames,
areas, client_offset, &dst_frames,
pcm->channels,
rate->get_idx, rate->put_idx,
rate->pitch, rate->states);
@ -564,7 +565,6 @@ static void snd_pcm_rate_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_ops_t snd_pcm_rate_ops = {
close: snd_pcm_plugin_close,
card: snd_pcm_plugin_card,
info: snd_pcm_plugin_info,
hw_refine: snd_pcm_rate_hw_refine,
hw_params: snd_pcm_rate_hw_params,

View file

@ -55,10 +55,10 @@ typedef struct {
} snd_pcm_route_params_t;
typedef void (*route_f)(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_area,
typedef void (*route_f)(const snd_pcm_channel_area_t *dst_area,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
snd_pcm_uframes_t frames,
const snd_pcm_route_ttable_dst_t *ttable,
const snd_pcm_route_params_t *params);
@ -87,10 +87,10 @@ typedef struct {
} snd_pcm_route_t;
void snd_pcm_route_convert1_zero(const snd_pcm_channel_area_t *src_areas ATTRIBUTE_UNUSED,
snd_pcm_uframes_t src_offset ATTRIBUTE_UNUSED,
const snd_pcm_channel_area_t *dst_area,
void snd_pcm_route_convert1_zero(const snd_pcm_channel_area_t *dst_area,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas ATTRIBUTE_UNUSED,
snd_pcm_uframes_t src_offset ATTRIBUTE_UNUSED,
snd_pcm_uframes_t frames,
const snd_pcm_route_ttable_dst_t* ttable ATTRIBUTE_UNUSED,
const snd_pcm_route_params_t *params)
@ -104,10 +104,10 @@ void snd_pcm_route_convert1_zero(const snd_pcm_channel_area_t *src_areas ATTRIBU
#endif
}
void snd_pcm_route_convert1_one(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_area,
void snd_pcm_route_convert1_one(const snd_pcm_channel_area_t *dst_area,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
snd_pcm_uframes_t frames,
const snd_pcm_route_ttable_dst_t* ttable,
const snd_pcm_route_params_t *params)
@ -126,7 +126,9 @@ void snd_pcm_route_convert1_one(const snd_pcm_channel_area_t *src_areas,
break;
}
if (srcidx == ttable->nsrcs) {
snd_pcm_route_convert1_zero(src_areas, src_offset, dst_area, dst_offset, frames, ttable, params);
snd_pcm_route_convert1_zero(dst_area, dst_offset,
src_areas, src_offset,
frames, ttable, params);
return;
}
@ -149,10 +151,10 @@ void snd_pcm_route_convert1_one(const snd_pcm_channel_area_t *src_areas,
}
}
void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_area,
void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
snd_pcm_uframes_t frames,
const snd_pcm_route_ttable_dst_t* ttable,
const snd_pcm_route_params_t *params)
@ -224,10 +226,14 @@ void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *src_areas,
}
nsrcs = srcidx1;
if (nsrcs == 0) {
snd_pcm_route_convert1_zero(src_areas, src_offset, dst_area, dst_offset, frames, ttable, params);
snd_pcm_route_convert1_zero(dst_area, dst_offset,
src_areas, src_offset,
frames, ttable, params);
return;
} else if (nsrcs == 1 && src_tt[0].as_int == ROUTE_PLUGIN_RESOLUTION) {
snd_pcm_route_convert1_one(src_areas, src_offset, dst_area, dst_offset, frames, ttable, params);
snd_pcm_route_convert1_one(dst_area, dst_offset,
src_areas, src_offset,
frames, ttable, params);
return;
}
@ -382,10 +388,10 @@ void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *src_areas,
}
}
void snd_pcm_route_convert(const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
void snd_pcm_route_convert(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
snd_pcm_uframes_t dst_channels,
snd_pcm_uframes_t frames,
snd_pcm_route_params_t *params)
@ -398,9 +404,13 @@ void snd_pcm_route_convert(const snd_pcm_channel_area_t *src_areas,
dst_area = dst_areas;
for (dst_channel = 0; dst_channel < dst_channels; ++dst_channel) {
if (dst_channel >= params->ndsts)
snd_pcm_route_convert1_zero(src_areas, src_offset, dst_area, dst_offset, frames, dstp, params);
snd_pcm_route_convert1_zero(dst_area, dst_offset,
src_areas, src_offset,
frames, dstp, params);
else
dstp->func(src_areas, src_offset, dst_area, dst_offset, frames, dstp, params);
dstp->func(dst_area, dst_offset,
src_areas, src_offset,
frames, dstp, params);
dstp++;
dst_area++;
}
@ -674,7 +684,6 @@ static void snd_pcm_route_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_ops_t snd_pcm_route_ops = {
close: snd_pcm_route_close,
card: snd_pcm_plugin_card,
info: snd_pcm_plugin_info,
hw_refine: snd_pcm_route_hw_refine,
hw_params: snd_pcm_route_hw_params,

View file

@ -99,7 +99,7 @@ typedef struct {
int async_sig;
pid_t async_pid;
int drain_silenced;
struct timeval trigger_time;
struct timeval trigger_tstamp;
int state;
snd_pcm_uframes_t hw_ptr;
snd_pcm_uframes_t appl_ptr;
@ -425,12 +425,6 @@ static void _snd_pcm_share_update(snd_pcm_t *pcm)
}
}
static int snd_pcm_share_card(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
{
snd_pcm_share_t *share = pcm->private;
return snd_pcm_card(share->slave->pcm);
}
static int snd_pcm_share_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
{
return 0;
@ -693,7 +687,7 @@ static int snd_pcm_share_status(snd_pcm_t *pcm, snd_pcm_status_t *status)
_notrunning:
status->delay = sd + d;
status->state = share->state;
status->trigger_time = share->trigger_time;
status->trigger_tstamp = share->trigger_tstamp;
_end:
Pthread_mutex_unlock(&slave->mutex);
return err;
@ -875,8 +869,8 @@ static int snd_pcm_share_start(snd_pcm_t *pcm)
snd_pcm_uframes_t cont = pcm->buffer_size - offset;
if (cont < frames)
frames = cont;
snd_pcm_areas_copy(pcm->stopped_areas, xfer,
pcm->running_areas, offset,
snd_pcm_areas_copy(pcm->running_areas, offset,
pcm->stopped_areas, xfer,
pcm->channels, frames,
pcm->format);
xfer += frames;
@ -892,7 +886,7 @@ static int snd_pcm_share_start(snd_pcm_t *pcm)
}
slave->running_count++;
_snd_pcm_share_update(pcm);
gettimeofday(&share->trigger_time, 0);
gettimeofday(&share->trigger_tstamp, 0);
_end:
Pthread_mutex_unlock(&slave->mutex);
return err;
@ -976,10 +970,10 @@ static void _snd_pcm_share_stop(snd_pcm_t *pcm, int state)
/* PCM closing already begun in the main thread */
return;
}
gettimeofday(&share->trigger_time, 0);
gettimeofday(&share->trigger_tstamp, 0);
if (pcm->stream == SND_PCM_STREAM_CAPTURE) {
snd_pcm_areas_copy(pcm->running_areas, 0,
pcm->stopped_areas, 0,
snd_pcm_areas_copy(pcm->stopped_areas, 0,
pcm->running_areas, 0,
pcm->channels, pcm->buffer_size,
pcm->format);
} else if (slave->running_count > 1) {
@ -1145,7 +1139,6 @@ static void snd_pcm_share_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_ops_t snd_pcm_share_ops = {
close: snd_pcm_share_close,
card: snd_pcm_share_card,
info: snd_pcm_share_info,
hw_refine: snd_pcm_share_hw_refine,
hw_params: snd_pcm_share_hw_params,

View file

@ -116,14 +116,6 @@ static int snd_pcm_shm_action_fd(snd_pcm_t *pcm, int *fd)
return ctrl->result;
}
static int snd_pcm_shm_card(snd_pcm_t *pcm)
{
snd_pcm_shm_t *shm = pcm->private;
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
ctrl->cmd = SND_PCM_IOCTL_CARD;
return snd_pcm_shm_action(pcm);
}
static int snd_pcm_shm_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
{
return 0;
@ -491,7 +483,6 @@ static void snd_pcm_shm_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_ops_t snd_pcm_shm_ops = {
close: snd_pcm_shm_close,
card: snd_pcm_shm_card,
info: snd_pcm_shm_info,
hw_refine: snd_pcm_shm_hw_refine,
hw_params: snd_pcm_shm_hw_params,

View file

@ -27,7 +27,6 @@
#include <errno.h>
#include <dlfcn.h>
#include "rawmidi_local.h"
#include "asoundlib.h"
int snd_rawmidi_close(snd_rawmidi_t *rmidi)
{

View file

@ -29,7 +29,6 @@
#include <sys/ioctl.h>
#include "../control/control_local.h"
#include "rawmidi_local.h"
#include "asoundlib.h"
#define SNDRV_FILE_RAWMIDI "/dev/snd/midiC%iD%i"
#define SNDRV_RAWMIDI_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 0)

View file

@ -24,7 +24,6 @@
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
#include "asoundlib.h"
#include "local.h"
typedef struct {

View file

@ -23,7 +23,6 @@
#include <sys/poll.h>
#include <dlfcn.h>
#include "seq_local.h"
#include "asoundlib.h"
int snd_seq_open(snd_seq_t **seqp, char *name,
int streams, int mode)

View file

@ -23,7 +23,6 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include "seq_local.h"
#include "asoundlib.h"
#define SNDRV_FILE_SEQ "/dev/snd/seq"
#define SNDRV_FILE_ALOADSEQ "/dev/aloadSEQ"

View file

@ -28,7 +28,6 @@
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
#include "asoundlib.h"
#include "local.h"
#define SND_SEQ_OBUF_SIZE (16*1024) /* default size */

View file

@ -21,7 +21,7 @@
#include <malloc.h>
#include <errno.h>
#include "asoundlib.h"
#include "local.h"
/* midi status */

View file

@ -27,7 +27,6 @@
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "asoundlib.h"
#include "seq_local.h"
/* direct passing (without queued) */

View file

@ -26,7 +26,7 @@
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "asoundlib.h"
#include "local.h"
#define SNDRV_FILE_TIMER "/dev/snd/timer"
#define SNDRV_TIMER_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 0)