mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-01 22:58:49 -04:00
Merged pcm2 branch.
This commit is contained in:
parent
986c1500d2
commit
1cd6778173
40 changed files with 5053 additions and 3045 deletions
|
|
@ -22,60 +22,133 @@
|
|||
#include <pthread.h>
|
||||
#include "asoundlib.h"
|
||||
|
||||
struct snd_pcm_plug {
|
||||
|
||||
struct snd_pcm_ops {
|
||||
int (*channel_close)(snd_pcm_t *pcm, int channel);
|
||||
int (*channel_nonblock)(snd_pcm_t *pcm, int channel, int nonblock);
|
||||
int (*info)(snd_pcm_t *pcm, snd_pcm_info_t *info);
|
||||
int (*channel_info)(snd_pcm_t *pcm, snd_pcm_channel_info_t *info);
|
||||
int (*channel_params)(snd_pcm_t *pcm, snd_pcm_channel_params_t *params);
|
||||
int (*channel_setup)(snd_pcm_t *pcm, snd_pcm_channel_setup_t *setup);
|
||||
int (*voice_setup)(snd_pcm_t *pcm, int channel, snd_pcm_voice_setup_t *setup);
|
||||
int (*channel_status)(snd_pcm_t *pcm, snd_pcm_channel_status_t *status);
|
||||
int (*channel_prepare)(snd_pcm_t *pcm, int channel);
|
||||
int (*channel_go)(snd_pcm_t *pcm, int channel);
|
||||
int (*sync_go)(snd_pcm_t *pcm, snd_pcm_sync_t *sync);
|
||||
int (*channel_drain)(snd_pcm_t *pcm, int channel);
|
||||
int (*channel_flush)(snd_pcm_t *pcm, int channel);
|
||||
int (*channel_pause)(snd_pcm_t *pcm, int channel, int enable);
|
||||
ssize_t (*write)(snd_pcm_t *pcm, const void *buffer, size_t size);
|
||||
ssize_t (*writev)(snd_pcm_t *pcm, const struct iovec *vector, unsigned long count);
|
||||
ssize_t (*read)(snd_pcm_t *pcm, void *buffer, size_t size);
|
||||
ssize_t (*readv)(snd_pcm_t *pcm, const struct iovec *vector, unsigned long count);
|
||||
int (*mmap_control)(snd_pcm_t *pcm, int channel, snd_pcm_mmap_control_t **control, size_t csize);
|
||||
int (*mmap_data)(snd_pcm_t *pcm, int channel, void **buffer, size_t bsize);
|
||||
int (*munmap_control)(snd_pcm_t *pcm, int channel, snd_pcm_mmap_control_t *control, size_t csize);
|
||||
int (*munmap_data)(snd_pcm_t *pcm, int channel, void *buffer, size_t bsize);
|
||||
int (*file_descriptor)(snd_pcm_t* pcm, int channel);
|
||||
int (*voices_mask)(snd_pcm_t *pcm, int channel, bitset_t *client_vmask);
|
||||
};
|
||||
|
||||
|
||||
struct snd_pcm_plug_chan {
|
||||
snd_pcm_plugin_t *first;
|
||||
snd_pcm_plugin_t *last;
|
||||
void *alloc_ptr[2];
|
||||
long alloc_size[2];
|
||||
size_t alloc_size[2];
|
||||
int alloc_lock[2];
|
||||
snd_pcm_mmap_control_t *mmap_control;
|
||||
char *mmap_data;
|
||||
long mmap_size;
|
||||
pthread_t thread;
|
||||
int thread_stop;
|
||||
int setup_is_valid;
|
||||
snd_pcm_channel_setup_t setup;
|
||||
int hwstatus;
|
||||
};
|
||||
|
||||
struct snd_pcm_chan {
|
||||
typedef struct snd_pcm_plug {
|
||||
int close_slave;
|
||||
snd_pcm_t *slave;
|
||||
struct snd_pcm_plug_chan chan[2];
|
||||
} snd_pcm_plug_t;
|
||||
|
||||
struct snd_pcm_hw_chan {
|
||||
int fd;
|
||||
int setup_is_valid;
|
||||
};
|
||||
|
||||
typedef struct snd_pcm_hw {
|
||||
int card;
|
||||
int device;
|
||||
int ver;
|
||||
struct snd_pcm_hw_chan chan[2];
|
||||
} snd_pcm_hw_t;
|
||||
|
||||
struct snd_pcm_chan {
|
||||
int open;
|
||||
int mode;
|
||||
int valid_setup;
|
||||
snd_pcm_channel_setup_t setup;
|
||||
int valid_voices_setup;
|
||||
snd_pcm_voice_setup_t *voices_setup;
|
||||
snd_pcm_mmap_control_t *mmap_control;
|
||||
size_t mmap_control_size;
|
||||
int mmap_control_emulation;
|
||||
char *mmap_data;
|
||||
long mmap_size;
|
||||
struct snd_pcm_plug plug;
|
||||
size_t mmap_data_size;
|
||||
int mmap_data_emulation;
|
||||
pthread_t mmap_thread;
|
||||
int mmap_thread_stop;
|
||||
pthread_mutex_t mutex;
|
||||
pthread_cond_t status_cond;
|
||||
pthread_cond_t ready_cond;
|
||||
};
|
||||
|
||||
struct snd_pcm {
|
||||
int card;
|
||||
int device;
|
||||
snd_pcm_type_t type;
|
||||
int mode;
|
||||
int ver;
|
||||
struct snd_pcm_ops *ops;
|
||||
struct snd_pcm_chan chan[2];
|
||||
int private[0];
|
||||
};
|
||||
|
||||
unsigned int snd_pcm_plugin_formats(unsigned int formats);
|
||||
int snd_pcm_plugin_hwparams(snd_pcm_channel_params_t *params,
|
||||
snd_pcm_channel_info_t *hwinfo,
|
||||
snd_pcm_channel_params_t *hwparams);
|
||||
int snd_pcm_plugin_format(snd_pcm_t *pcm,
|
||||
snd_pcm_channel_params_t *params,
|
||||
snd_pcm_channel_params_t *hwparams,
|
||||
snd_pcm_channel_info_t *hwinfo);
|
||||
void snd_pcm_mmap_status_change(snd_pcm_t *pcm, int channel, int newstatus);
|
||||
|
||||
int snd_pcm_abstract_open(snd_pcm_t **handle, int mode, snd_pcm_type_t type, size_t extra);
|
||||
|
||||
|
||||
unsigned int snd_pcm_plug_formats(unsigned int formats);
|
||||
int snd_pcm_plug_slave_params(snd_pcm_channel_params_t *params,
|
||||
snd_pcm_channel_info_t *slave_info,
|
||||
snd_pcm_channel_params_t *slave_params);
|
||||
int snd_pcm_plug_format(snd_pcm_plugin_handle_t *pcm,
|
||||
snd_pcm_channel_params_t *params,
|
||||
snd_pcm_channel_params_t *slave_params);
|
||||
|
||||
ssize_t snd_pcm_plug_write_transfer(snd_pcm_plugin_handle_t *handle, snd_pcm_plugin_voice_t *src_voices, size_t size);
|
||||
ssize_t snd_pcm_plug_read_transfer(snd_pcm_plugin_handle_t *handle, snd_pcm_plugin_voice_t *dst_voices_final, size_t size);
|
||||
ssize_t snd_pcm_plug_client_voices_iovec(snd_pcm_plugin_handle_t *handle, int channel,
|
||||
const struct iovec *vector, unsigned long count,
|
||||
snd_pcm_plugin_voice_t **voices);
|
||||
ssize_t snd_pcm_plug_client_voices_buf(snd_pcm_plugin_handle_t *handle, int channel,
|
||||
char *buf, size_t count,
|
||||
snd_pcm_plugin_voice_t **voices);
|
||||
|
||||
int snd_pcm_plug_playback_voices_mask(snd_pcm_plugin_handle_t *handle,
|
||||
bitset_t *client_vmask);
|
||||
int snd_pcm_plug_capture_voices_mask(snd_pcm_plugin_handle_t *handle,
|
||||
bitset_t *client_vmask);
|
||||
int snd_pcm_plugin_client_voices(snd_pcm_plugin_t *plugin,
|
||||
size_t samples,
|
||||
snd_pcm_plugin_voice_t **voices);
|
||||
|
||||
void *snd_pcm_plug_buf_alloc(snd_pcm_t *pcm, int channel, size_t size);
|
||||
void snd_pcm_plug_buf_unlock(snd_pcm_t *pcm, int channel, void *ptr);
|
||||
|
||||
#define ROUTE_PLUGIN_RESOLUTION 16
|
||||
|
||||
int getput_index(int format);
|
||||
int copy_index(int src_format, int dst_format);
|
||||
int copy_index(int format);
|
||||
int conv_index(int src_format, int dst_format);
|
||||
|
||||
void zero_voice(snd_pcm_plugin_t *plugin,
|
||||
const snd_pcm_plugin_voice_t *dst_voice,
|
||||
size_t samples);
|
||||
void snd_pcm_plugin_silence_voice(snd_pcm_plugin_t *plugin,
|
||||
const snd_pcm_plugin_voice_t *dst_voice,
|
||||
size_t samples);
|
||||
|
||||
#ifdef PLUGIN_DEBUG
|
||||
#define pdprintf( args... ) printf( "plugin: " ##args)
|
||||
#define pdprintf( args... ) fprintf(stderr, "plugin: " ##args)
|
||||
#else
|
||||
#define pdprintf( args... ) { ; }
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue