mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Added I/O classes
This commit is contained in:
parent
da4d6f5ee8
commit
e283a3f642
32 changed files with 1882 additions and 226 deletions
|
|
@ -53,6 +53,6 @@ AC_OUTPUT(Makefile doc/Makefile include/Makefile src/Makefile \
|
|||
src/control/Makefile src/mixer/Makefile src/pcm/Makefile \
|
||||
src/rawmidi/Makefile src/timer/Makefile \
|
||||
src/hwdep/Makefile src/seq/Makefile src/instr/Makefile \
|
||||
src/compat/Makefile src/conf/Makefile aserver/Makefile \
|
||||
src/compat/Makefile aserver/Makefile \
|
||||
test/Makefile utils/Makefile \
|
||||
utils/alsa-lib.spec)
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ sysinclude_HEADERS = asoundlib.h
|
|||
|
||||
# This is the order they will be concatenated into asoundlib.h!
|
||||
#
|
||||
header_files=header.h version.h global.h error.h control.h mixer.h pcm.h \
|
||||
rawmidi.h timer.h hwdep.h seq.h seqmid.h seq_midi_event.h \
|
||||
header_files=header.h version.h global.h input.h output.h error.h control.h mixer.h \
|
||||
pcm.h rawmidi.h timer.h hwdep.h seq.h seqmid.h seq_midi_event.h \
|
||||
conv.h instr.h conf.h footer.h
|
||||
|
||||
noinst_HEADERS=$(header_files) search.h list.h aserver.h local.h
|
||||
|
|
|
|||
|
|
@ -24,10 +24,20 @@ struct _snd_config {
|
|||
snd_config_t *father;
|
||||
};
|
||||
|
||||
static inline snd_config_type_t snd_config_type(snd_config_t *config)
|
||||
{
|
||||
return config->type;
|
||||
}
|
||||
|
||||
static inline char *snd_config_id(snd_config_t *config)
|
||||
{
|
||||
return config->id;
|
||||
}
|
||||
|
||||
int snd_config_top(snd_config_t **config);
|
||||
|
||||
int snd_config_load(snd_config_t *config, FILE *fp);
|
||||
int snd_config_save(snd_config_t *config, FILE *fp);
|
||||
int snd_config_load(snd_config_t *config, snd_input_t *in);
|
||||
int snd_config_save(snd_config_t *config, snd_output_t *out);
|
||||
|
||||
int snd_config_search(snd_config_t *config, char *key, snd_config_t **result);
|
||||
int snd_config_searchv(snd_config_t *config,
|
||||
|
|
@ -62,15 +72,8 @@ typedef struct list_head *snd_config_iterator_t;
|
|||
|
||||
#define snd_config_entry(iterator) list_entry(iterator, snd_config_t, list)
|
||||
|
||||
static inline snd_config_type_t snd_config_type(snd_config_t *config)
|
||||
{
|
||||
return config->type;
|
||||
}
|
||||
|
||||
static inline char *snd_config_id(snd_config_t *config)
|
||||
{
|
||||
return config->id;
|
||||
}
|
||||
snd_config_type_t snd_config_type(snd_config_t *config);
|
||||
char *snd_config_id(snd_config_t *config);
|
||||
|
||||
extern snd_config_t *snd_config;
|
||||
int snd_config_update();
|
||||
|
|
|
|||
15
include/input.h
Normal file
15
include/input.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
typedef struct _snd_input snd_input_t;
|
||||
|
||||
typedef enum _snd_input_type {
|
||||
SND_INPUT_STDIO,
|
||||
SND_INPUT_BUFFER,
|
||||
} snd_input_type_t;
|
||||
|
||||
int snd_input_stdio_open(snd_input_t **inputp, const char *file);
|
||||
int snd_input_stdio_attach(snd_input_t **inputp, FILE *fp, int close);
|
||||
int snd_input_buffer_open(snd_input_t **inputp, const char *buffer, int size);
|
||||
int snd_input_close(snd_input_t *input);
|
||||
int snd_input_scanf(snd_input_t *input, const char *format, ...) __attribute__ ((format (scanf, 2, 3)));
|
||||
char *snd_input_gets(snd_input_t *input, char *str, size_t size);
|
||||
int snd_input_getc(snd_input_t *input);
|
||||
17
include/output.h
Normal file
17
include/output.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
typedef struct _snd_output snd_output_t;
|
||||
|
||||
typedef enum _snd_output_type {
|
||||
SND_OUTPUT_STDIO,
|
||||
SND_OUTPUT_BUFFER,
|
||||
} snd_output_type_t;
|
||||
|
||||
int snd_output_stdio_open(snd_output_t **outputp, const char *file);
|
||||
int snd_output_stdio_attach(snd_output_t **outputp, FILE *fp, int close);
|
||||
int snd_output_buffer_open(snd_output_t **outputp);
|
||||
size_t snd_output_buffer_string(snd_output_t *output, char **buf);
|
||||
int snd_output_close(snd_output_t *output);
|
||||
int snd_output_printf(snd_output_t *output, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
int snd_output_puts(snd_output_t *output, const char *str);
|
||||
int snd_output_putc(snd_output_t *output, int c);
|
||||
int snd_output_flush(snd_output_t *output);
|
||||
|
|
@ -76,11 +76,11 @@ snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t
|
|||
snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
|
||||
snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
|
||||
|
||||
int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, FILE *fp);
|
||||
int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, FILE *fp);
|
||||
int snd_pcm_dump_setup(snd_pcm_t *pcm, FILE *fp);
|
||||
int snd_pcm_dump(snd_pcm_t *pcm, FILE *fp);
|
||||
int snd_pcm_status_dump(snd_pcm_status_t *status, FILE *fp);
|
||||
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);
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ int snd_pcm_hw_params_try_explain_failure(snd_pcm_t *pcm,
|
|||
snd_pcm_hw_params_t *fail,
|
||||
snd_pcm_hw_params_t *success,
|
||||
unsigned int depth,
|
||||
FILE *fp);
|
||||
snd_output_t *out);
|
||||
|
||||
int snd_pcm_hw_params_info_rate(const snd_pcm_hw_params_t *params,
|
||||
unsigned int *rate_num,
|
||||
|
|
@ -167,7 +167,7 @@ int snd_pcm_hw_params_info_msbits(const snd_pcm_hw_params_t *params);
|
|||
int snd_pcm_hw_params_info_flags(const snd_pcm_hw_params_t *params);
|
||||
int snd_pcm_hw_params_info_fifo_size(const snd_pcm_hw_params_t *params);
|
||||
int snd_pcm_hw_params_info_dig_groups(const snd_pcm_hw_params_t *params);
|
||||
int snd_pcm_hw_params_dump(snd_pcm_hw_params_t *params, FILE *fp);
|
||||
int snd_pcm_hw_params_dump(snd_pcm_hw_params_t *params, snd_output_t *out);
|
||||
|
||||
typedef struct _snd_pcm_hw_strategy snd_pcm_hw_strategy_t;
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ 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, FILE *fp);
|
||||
int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, snd_output_t *out);
|
||||
|
||||
/* mmap */
|
||||
const snd_pcm_channel_area_t *snd_pcm_mmap_areas(snd_pcm_t *pcm);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
SUBDIRS=control mixer pcm rawmidi timer hwdep seq instr compat conf
|
||||
SUBDIRS=control mixer pcm rawmidi timer hwdep seq instr compat
|
||||
COMPATNUM=@LIBTOOL_VERSION_INFO@
|
||||
|
||||
lib_LTLIBRARIES = libasound.la
|
||||
libasound_la_SOURCES = error.c
|
||||
libasound_la_SOURCES = conf.c input.c output.c error.c
|
||||
libasound_la_LIBADD = control/libcontrol.la mixer/libmixer.la pcm/libpcm.la \
|
||||
rawmidi/librawmidi.la timer/libtimer.la \
|
||||
hwdep/libhwdep.la seq/libseq.la instr/libinstr.la \
|
||||
compat/libcompat.la conf/libconf.la -lm -ldl -lpthread
|
||||
compat/libcompat.la -lm -ldl -lpthread
|
||||
|
||||
libasound_la_LDFLAGS = -version-info $(COMPATNUM)
|
||||
|
||||
|
|
@ -37,7 +37,4 @@ instr/libinstr.la:
|
|||
compat/libcompat.la:
|
||||
$(MAKE) -C compat libcompat.la
|
||||
|
||||
conf/libconf.la:
|
||||
$(MAKE) -C conf libconf.la
|
||||
|
||||
INCLUDES=-I$(top_srcdir)/include
|
||||
|
|
|
|||
1100
src/conf.c
Normal file
1100
src/conf.c
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,8 +0,0 @@
|
|||
EXTRA_LTLIBRARIES = libconf.la
|
||||
|
||||
libconf_la_SOURCES = conf.c
|
||||
|
||||
all: libconf.la
|
||||
|
||||
|
||||
INCLUDES=-I$(top_srcdir)/include
|
||||
|
|
@ -57,7 +57,7 @@ static int snd_ctl_shm_action(snd_ctl_t *ctl)
|
|||
if (err != 1)
|
||||
return -EBADFD;
|
||||
if (ctrl->cmd) {
|
||||
fprintf(stderr, "Server has not done the cmd\n");
|
||||
ERR("Server has not done the cmd");
|
||||
return -EBADFD;
|
||||
}
|
||||
return ctrl->result;
|
||||
|
|
@ -76,7 +76,7 @@ static int snd_ctl_shm_action_fd(snd_ctl_t *ctl, int *fd)
|
|||
if (err != 1)
|
||||
return -EBADFD;
|
||||
if (ctrl->cmd) {
|
||||
fprintf(stderr, "Server has not done the cmd\n");
|
||||
ERR("Server has not done the cmd");
|
||||
return -EBADFD;
|
||||
}
|
||||
return ctrl->result;
|
||||
|
|
|
|||
261
src/input.c
Normal file
261
src/input.c
Normal file
|
|
@ -0,0 +1,261 @@
|
|||
/*
|
||||
* Input object
|
||||
* Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <ansidecl.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include "local.h"
|
||||
#include "asoundlib.h"
|
||||
|
||||
typedef struct _snd_input_ops {
|
||||
int (*close)(snd_input_t *input);
|
||||
int (*scanf)(snd_input_t *input, const char *format, va_list args);
|
||||
char *(*gets)(snd_input_t *input, char *str, size_t size);
|
||||
int (*getch)(snd_input_t *input);
|
||||
int (*ungetch)(snd_input_t *input, int c);
|
||||
} snd_input_ops_t;
|
||||
|
||||
struct _snd_input {
|
||||
snd_input_type_t type;
|
||||
snd_input_ops_t *ops;
|
||||
void *private;
|
||||
};
|
||||
|
||||
int snd_input_close(snd_input_t *input)
|
||||
{
|
||||
int err = input->ops->close(input);
|
||||
free(input);
|
||||
return err;
|
||||
}
|
||||
|
||||
int snd_input_scanf(snd_input_t *input, const char *format, ...)
|
||||
{
|
||||
int result;
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
result = input->ops->scanf(input, format, args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
|
||||
char *snd_input_gets(snd_input_t *input, char *str, size_t size)
|
||||
{
|
||||
return input->ops->gets(input, str, size);
|
||||
}
|
||||
|
||||
int snd_input_getc(snd_input_t *input)
|
||||
{
|
||||
return input->ops->getch(input);
|
||||
}
|
||||
|
||||
int snd_input_ungetc(snd_input_t *input, int c)
|
||||
{
|
||||
return input->ops->ungetch(input, c);
|
||||
}
|
||||
|
||||
typedef struct _snd_input_stdio {
|
||||
int close;
|
||||
FILE *fp;
|
||||
} snd_input_stdio_t;
|
||||
|
||||
int snd_input_stdio_close(snd_input_t *input ATTRIBUTE_UNUSED)
|
||||
{
|
||||
snd_input_stdio_t *stdio = input->private;
|
||||
if (close)
|
||||
fclose(stdio->fp);
|
||||
free(stdio);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_input_stdio_scanf(snd_input_t *input, const char *format, va_list args)
|
||||
{
|
||||
snd_input_stdio_t *stdio = input->private;
|
||||
extern int vfscanf(FILE *fp, const char *format, va_list args);
|
||||
return vfscanf(stdio->fp, format, args);
|
||||
}
|
||||
|
||||
char *snd_input_stdio_gets(snd_input_t *input, char *str, size_t size)
|
||||
{
|
||||
snd_input_stdio_t *stdio = input->private;
|
||||
return fgets(str, size, stdio->fp);
|
||||
}
|
||||
|
||||
int snd_input_stdio_getc(snd_input_t *input)
|
||||
{
|
||||
snd_input_stdio_t *stdio = input->private;
|
||||
return getc(stdio->fp);
|
||||
}
|
||||
|
||||
int snd_input_stdio_ungetc(snd_input_t *input, int c)
|
||||
{
|
||||
snd_input_stdio_t *stdio = input->private;
|
||||
return ungetc(c, stdio->fp);
|
||||
}
|
||||
|
||||
snd_input_ops_t snd_input_stdio_ops = {
|
||||
close: snd_input_stdio_close,
|
||||
scanf: snd_input_stdio_scanf,
|
||||
gets: snd_input_stdio_gets,
|
||||
getch: snd_input_stdio_getc,
|
||||
ungetch: snd_input_stdio_ungetc,
|
||||
};
|
||||
|
||||
int snd_input_stdio_attach(snd_input_t **inputp, FILE *fp, int close)
|
||||
{
|
||||
snd_input_t *input;
|
||||
snd_input_stdio_t *stdio;
|
||||
assert(inputp && fp);
|
||||
stdio = calloc(1, sizeof(*stdio));
|
||||
if (!stdio)
|
||||
return -ENOMEM;
|
||||
input = calloc(1, sizeof(*input));
|
||||
if (!input) {
|
||||
free(stdio);
|
||||
return -ENOMEM;
|
||||
}
|
||||
stdio->fp = fp;
|
||||
stdio->close = close;
|
||||
input->type = SND_INPUT_STDIO;
|
||||
input->ops = &snd_input_stdio_ops;
|
||||
input->private = stdio;
|
||||
*inputp = input;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_input_stdio_open(snd_input_t **inputp, const char *file)
|
||||
{
|
||||
int err;
|
||||
FILE *fp = fopen(file, "r");
|
||||
if (!fp) {
|
||||
SYSERR("fopen");
|
||||
return -errno;
|
||||
}
|
||||
err = snd_input_stdio_attach(inputp, fp, 1);
|
||||
if (err < 0)
|
||||
fclose(fp);
|
||||
return err;
|
||||
}
|
||||
|
||||
typedef struct _snd_input_buffer {
|
||||
unsigned char *buf;
|
||||
unsigned char *ptr;
|
||||
size_t size;
|
||||
} snd_input_buffer_t;
|
||||
|
||||
int snd_input_buffer_close(snd_input_t *input)
|
||||
{
|
||||
snd_input_buffer_t *buffer = input->private;
|
||||
free(buffer->buf);
|
||||
free(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_input_buffer_scanf(snd_input_t *input, const char *format, va_list args)
|
||||
{
|
||||
snd_input_buffer_t *buffer = input->private;
|
||||
extern int vsscanf(const char *buf, const char *format, va_list args);
|
||||
/* FIXME: how can I obtain consumed chars count? */
|
||||
assert(0);
|
||||
return vsscanf(buffer->ptr, format, args);
|
||||
}
|
||||
|
||||
char *snd_input_buffer_gets(snd_input_t *input, char *str, size_t size)
|
||||
{
|
||||
snd_input_buffer_t *buffer = input->private;
|
||||
size_t bsize = buffer->size;
|
||||
while (--size > 0 && bsize > 0) {
|
||||
unsigned char c = *buffer->ptr++;
|
||||
bsize--;
|
||||
*str++ = c;
|
||||
if (c == '\n')
|
||||
break;
|
||||
}
|
||||
if (bsize == buffer->size)
|
||||
return NULL;
|
||||
buffer->size = bsize;
|
||||
*str = '\0';
|
||||
return str;
|
||||
}
|
||||
|
||||
int snd_input_buffer_getc(snd_input_t *input)
|
||||
{
|
||||
snd_input_buffer_t *buffer = input->private;
|
||||
if (buffer->size == 0)
|
||||
return EOF;
|
||||
buffer->size--;
|
||||
return *buffer->ptr++;
|
||||
}
|
||||
|
||||
int snd_input_buffer_ungetc(snd_input_t *input, int c)
|
||||
{
|
||||
snd_input_buffer_t *buffer = input->private;
|
||||
if (buffer->ptr == buffer->buf)
|
||||
return EOF;
|
||||
buffer->ptr--;
|
||||
assert(*buffer->ptr == (unsigned char) c);
|
||||
buffer->size++;
|
||||
return c;
|
||||
}
|
||||
|
||||
snd_input_ops_t snd_input_buffer_ops = {
|
||||
close: snd_input_buffer_close,
|
||||
scanf: snd_input_buffer_scanf,
|
||||
gets: snd_input_buffer_gets,
|
||||
getch: snd_input_buffer_getc,
|
||||
ungetch: snd_input_buffer_ungetc,
|
||||
};
|
||||
|
||||
int snd_input_buffer_open(snd_input_t **inputp, const char *buf, int size)
|
||||
{
|
||||
snd_input_t *input;
|
||||
snd_input_buffer_t *buffer;
|
||||
assert(inputp);
|
||||
buffer = calloc(1, sizeof(*buffer));
|
||||
if (!buffer)
|
||||
return -ENOMEM;
|
||||
input = calloc(1, sizeof(*input));
|
||||
if (!input) {
|
||||
free(buffer);
|
||||
return -ENOMEM;
|
||||
}
|
||||
if (size < 0)
|
||||
size = strlen(buf);
|
||||
buffer->buf = malloc(size+1);
|
||||
if (!buffer->buf) {
|
||||
free(input);
|
||||
free(buffer);
|
||||
return -ENOMEM;
|
||||
}
|
||||
memcpy(buffer->buf, buf, size);
|
||||
buffer->buf[size] = 0;
|
||||
buffer->ptr = buffer->buf;
|
||||
buffer->size = size;
|
||||
input->type = SND_INPUT_BUFFER;
|
||||
input->ops = &snd_input_buffer_ops;
|
||||
input->private = buffer;
|
||||
*inputp = input;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -278,7 +278,7 @@ int snd_instr_iwffff_open_rom(snd_iwffff_handle_t **handle, int card, int bank,
|
|||
next_ffff = lseek(fd, 0, SEEK_CUR) + ffff.length;
|
||||
if (file == index) {
|
||||
#ifdef IW_ROM_DEBUG
|
||||
fprintf(stderr, "file header at 0x%x size 0x%x\n", rom_pos - sizeof(ffff), ffff.length);
|
||||
ERR("file header at 0x%x size 0x%x\n", rom_pos - sizeof(ffff), ffff.length);
|
||||
#endif
|
||||
iwf = malloc(sizeof(*iwf));
|
||||
if (iwf == NULL) {
|
||||
|
|
@ -505,7 +505,7 @@ static int load_iw_patch(snd_iwffff_handle_t *iwf, iwffff_instrument_t *instr,
|
|||
unsigned char *current;
|
||||
|
||||
#ifdef IW_ROM_DEBUG
|
||||
fprintf(stderr, "load_iw_patch - nlayers = %i\n", snd_LE_to_host_16(*(((unsigned short *)patch) + 8/2));
|
||||
ERR("load_iw_patch - nlayers = %i\n", snd_LE_to_host_16(*(((unsigned short *)patch) + 8/2));
|
||||
#endif
|
||||
instr->layer_type = patch[6];
|
||||
instr->exclusion = patch[7];
|
||||
|
|
|
|||
283
src/output.c
Normal file
283
src/output.c
Normal file
|
|
@ -0,0 +1,283 @@
|
|||
/*
|
||||
* Output object
|
||||
* Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <ansidecl.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include "local.h"
|
||||
#include "asoundlib.h"
|
||||
|
||||
typedef struct _snd_output_ops {
|
||||
int (*close)(snd_output_t *output);
|
||||
int (*printf)(snd_output_t *output, const char *format, va_list args);
|
||||
int (*puts)(snd_output_t *output, const char *str);
|
||||
int (*putch)(snd_output_t *output, int c);
|
||||
int (*flush)(snd_output_t *output);
|
||||
} snd_output_ops_t;
|
||||
|
||||
struct _snd_output {
|
||||
snd_output_type_t type;
|
||||
snd_output_ops_t *ops;
|
||||
void *private;
|
||||
};
|
||||
|
||||
int snd_output_close(snd_output_t *output)
|
||||
{
|
||||
int err = output->ops->close(output);
|
||||
free(output);
|
||||
return err;
|
||||
}
|
||||
|
||||
int snd_output_printf(snd_output_t *output, const char *format, ...)
|
||||
{
|
||||
int result;
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
result = output->ops->printf(output, format, args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
|
||||
int snd_output_puts(snd_output_t *output, const char *str)
|
||||
{
|
||||
return output->ops->puts(output, str);
|
||||
}
|
||||
|
||||
int snd_output_putc(snd_output_t *output, int c)
|
||||
{
|
||||
return output->ops->putch(output, c);
|
||||
}
|
||||
|
||||
int snd_output_flush(snd_output_t *output)
|
||||
{
|
||||
return output->ops->flush(output);
|
||||
}
|
||||
|
||||
typedef struct _snd_output_stdio {
|
||||
int close;
|
||||
FILE *fp;
|
||||
} snd_output_stdio_t;
|
||||
|
||||
int snd_output_stdio_close(snd_output_t *output ATTRIBUTE_UNUSED)
|
||||
{
|
||||
snd_output_stdio_t *stdio = output->private;
|
||||
if (close)
|
||||
fclose(stdio->fp);
|
||||
free(stdio);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_output_stdio_printf(snd_output_t *output, const char *format, va_list args)
|
||||
{
|
||||
snd_output_stdio_t *stdio = output->private;
|
||||
return vfprintf(stdio->fp, format, args);
|
||||
}
|
||||
|
||||
int snd_output_stdio_puts(snd_output_t *output, const char *str)
|
||||
{
|
||||
snd_output_stdio_t *stdio = output->private;
|
||||
return fputs(str, stdio->fp);
|
||||
}
|
||||
|
||||
int snd_output_stdio_putc(snd_output_t *output, int c)
|
||||
{
|
||||
snd_output_stdio_t *stdio = output->private;
|
||||
return putc(c, stdio->fp);
|
||||
}
|
||||
|
||||
int snd_output_stdio_flush(snd_output_t *output)
|
||||
{
|
||||
snd_output_stdio_t *stdio = output->private;
|
||||
return fflush(stdio->fp);
|
||||
}
|
||||
|
||||
snd_output_ops_t snd_output_stdio_ops = {
|
||||
close: snd_output_stdio_close,
|
||||
printf: snd_output_stdio_printf,
|
||||
puts: snd_output_stdio_puts,
|
||||
putch: snd_output_stdio_putc,
|
||||
flush: snd_output_stdio_flush,
|
||||
};
|
||||
|
||||
int snd_output_stdio_attach(snd_output_t **outputp, FILE *fp, int close)
|
||||
{
|
||||
snd_output_t *output;
|
||||
snd_output_stdio_t *stdio;
|
||||
assert(outputp && fp);
|
||||
stdio = calloc(1, sizeof(*stdio));
|
||||
if (!stdio)
|
||||
return -ENOMEM;
|
||||
output = calloc(1, sizeof(*output));
|
||||
if (!output) {
|
||||
free(stdio);
|
||||
return -ENOMEM;
|
||||
}
|
||||
stdio->fp = fp;
|
||||
stdio->close = close;
|
||||
output->type = SND_OUTPUT_STDIO;
|
||||
output->ops = &snd_output_stdio_ops;
|
||||
output->private = stdio;
|
||||
*outputp = output;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_output_stdio_open(snd_output_t **outputp, const char *file)
|
||||
{
|
||||
int err;
|
||||
FILE *fp = fopen(file, "w");
|
||||
if (!fp) {
|
||||
SYSERR("fopen");
|
||||
return -errno;
|
||||
}
|
||||
err = snd_output_stdio_attach(outputp, fp, 1);
|
||||
if (err < 0)
|
||||
fclose(fp);
|
||||
return err;
|
||||
}
|
||||
|
||||
typedef struct _snd_output_buffer {
|
||||
unsigned char *buf;
|
||||
size_t alloc;
|
||||
size_t size;
|
||||
} snd_output_buffer_t;
|
||||
|
||||
int snd_output_buffer_close(snd_output_t *output ATTRIBUTE_UNUSED)
|
||||
{
|
||||
snd_output_buffer_t *buffer = output->private;
|
||||
free(buffer->buf);
|
||||
free(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_output_buffer_need(snd_output_t *output, size_t size)
|
||||
{
|
||||
snd_output_buffer_t *buffer = output->private;
|
||||
size_t free = buffer->alloc - buffer->size;
|
||||
size_t alloc;
|
||||
if (free >= size)
|
||||
return free;
|
||||
if (buffer->alloc == 0)
|
||||
alloc = 256;
|
||||
else
|
||||
alloc = buffer->alloc * 2;
|
||||
buffer->buf = realloc(buffer->buf, alloc);
|
||||
if (!buffer->buf)
|
||||
return -ENOMEM;
|
||||
buffer->alloc = alloc;
|
||||
return buffer->alloc - buffer->size;
|
||||
}
|
||||
|
||||
int snd_output_buffer_printf(snd_output_t *output, const char *format, va_list args)
|
||||
{
|
||||
snd_output_buffer_t *buffer = output->private;
|
||||
size_t size = 256;
|
||||
int result;
|
||||
result = snd_output_buffer_need(output, size);
|
||||
if (result < 0)
|
||||
return result;
|
||||
result = vsnprintf(buffer->buf + buffer->size, size, format, args);
|
||||
assert(result >= 0);
|
||||
if ((size_t)result <= size) {
|
||||
buffer->size += result;
|
||||
return result;
|
||||
}
|
||||
size = result;
|
||||
result = snd_output_buffer_need(output, size);
|
||||
if (result < 0)
|
||||
return result;
|
||||
result = vsprintf(buffer->buf + buffer->size, format, args);
|
||||
assert(result == (int)size);
|
||||
return result;
|
||||
}
|
||||
|
||||
int snd_output_buffer_puts(snd_output_t *output, const char *str)
|
||||
{
|
||||
snd_output_buffer_t *buffer = output->private;
|
||||
size_t size = strlen(str);
|
||||
int err;
|
||||
err = snd_output_buffer_need(output, size);
|
||||
if (err < 0)
|
||||
return err;
|
||||
memcpy(buffer->buf + buffer->size, str, size);
|
||||
buffer->size += size;
|
||||
return size;
|
||||
}
|
||||
|
||||
int snd_output_buffer_putc(snd_output_t *output, int c)
|
||||
{
|
||||
snd_output_buffer_t *buffer = output->private;
|
||||
int err;
|
||||
err = snd_output_buffer_need(output, 1);
|
||||
if (err < 0)
|
||||
return err;
|
||||
buffer->buf[buffer->size++] = c;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_output_buffer_flush(snd_output_t *output ATTRIBUTE_UNUSED)
|
||||
{
|
||||
snd_output_buffer_t *buffer = output->private;
|
||||
buffer->size = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t snd_output_buffer_string(snd_output_t *output, char **buf)
|
||||
{
|
||||
snd_output_buffer_t *buffer = output->private;
|
||||
*buf = buffer->buf;
|
||||
return buffer->size;
|
||||
}
|
||||
|
||||
snd_output_ops_t snd_output_buffer_ops = {
|
||||
close: snd_output_buffer_close,
|
||||
printf: snd_output_buffer_printf,
|
||||
puts: snd_output_buffer_puts,
|
||||
putch: snd_output_buffer_putc,
|
||||
flush: snd_output_buffer_flush,
|
||||
};
|
||||
|
||||
int snd_output_buffer_open(snd_output_t **outputp)
|
||||
{
|
||||
snd_output_t *output;
|
||||
snd_output_buffer_t *buffer;
|
||||
assert(outputp);
|
||||
buffer = calloc(1, sizeof(*buffer));
|
||||
if (!buffer)
|
||||
return -ENOMEM;
|
||||
output = calloc(1, sizeof(*output));
|
||||
if (!output) {
|
||||
free(buffer);
|
||||
return -ENOMEM;
|
||||
}
|
||||
buffer->buf = NULL;
|
||||
buffer->alloc = 0;
|
||||
buffer->size = 0;
|
||||
output->type = SND_OUTPUT_BUFFER;
|
||||
output->ops = &snd_output_buffer_ops;
|
||||
output->private = buffer;
|
||||
*outputp = output;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <linux/asound.h>
|
||||
#include "asoundlib.h"
|
||||
#include "interval.h"
|
||||
|
||||
static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)
|
||||
|
|
@ -352,17 +352,17 @@ void interval_mulkdiv(const interval_t *a, unsigned int k,
|
|||
c->integer = 0;
|
||||
}
|
||||
|
||||
void interval_print(const interval_t *i, FILE *fp)
|
||||
void interval_print(const interval_t *i, snd_output_t *out)
|
||||
{
|
||||
if (interval_empty(i))
|
||||
fprintf(fp, "NONE");
|
||||
snd_output_printf(out, "NONE");
|
||||
else if (i->min == 0 && i->openmin == 0 &&
|
||||
i->max == UINT_MAX && i->openmax == 0)
|
||||
fprintf(fp, "ALL");
|
||||
snd_output_printf(out, "ALL");
|
||||
else if (interval_single(i))
|
||||
fprintf(fp, "%u", interval_value(i));
|
||||
snd_output_printf(out, "%u", interval_value(i));
|
||||
else
|
||||
fprintf(fp, "%c%u %u%c",
|
||||
snd_output_printf(out, "%c%u %u%c",
|
||||
i->openmin ? '(' : '[',
|
||||
i->min, i->max,
|
||||
i->openmax ? ')' : ']');
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ void interval_muldivk(const interval_t *a, const interval_t *b,
|
|||
unsigned int k, interval_t *c);
|
||||
void interval_mulkdiv(const interval_t *a, unsigned int k,
|
||||
const interval_t *b, interval_t *c);
|
||||
void interval_print(const interval_t *i, FILE *fp);
|
||||
void interval_print(const interval_t *i, snd_output_t *out);
|
||||
int interval_refine_min(interval_t *i, unsigned int min, int openmin);
|
||||
int interval_refine_max(interval_t *i, unsigned int max, int openmax);
|
||||
int interval_refine(interval_t *i, const interval_t *v);
|
||||
|
|
|
|||
|
|
@ -501,70 +501,70 @@ const char *snd_pcm_state_name(snd_pcm_state_t state)
|
|||
return snd_pcm_state_names[state];
|
||||
}
|
||||
|
||||
int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, FILE *fp)
|
||||
int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
assert(pcm);
|
||||
assert(fp);
|
||||
assert(out);
|
||||
assert(pcm->setup);
|
||||
fprintf(fp, "stream : %s\n", snd_pcm_stream_name(pcm->stream));
|
||||
fprintf(fp, "access : %s\n", snd_pcm_access_name(pcm->access));
|
||||
fprintf(fp, "format : %s\n", snd_pcm_format_name(pcm->format));
|
||||
fprintf(fp, "subformat : %s\n", snd_pcm_subformat_name(pcm->subformat));
|
||||
fprintf(fp, "channels : %u\n", pcm->channels);
|
||||
fprintf(fp, "rate : %u\n", pcm->rate);
|
||||
fprintf(fp, "exact rate : %g (%u/%u)\n", (double) pcm->rate_num / pcm->rate_den, pcm->rate_num, pcm->rate_den);
|
||||
fprintf(fp, "msbits : %u\n", pcm->msbits);
|
||||
fprintf(fp, "buffer_size : %lu\n", pcm->buffer_size);
|
||||
fprintf(fp, "period_size : %lu\n", pcm->period_size);
|
||||
fprintf(fp, "period_time : %u\n", pcm->period_time);
|
||||
fprintf(fp, "tick_time : %u\n", pcm->tick_time);
|
||||
snd_output_printf(out, "stream : %s\n", snd_pcm_stream_name(pcm->stream));
|
||||
snd_output_printf(out, "access : %s\n", snd_pcm_access_name(pcm->access));
|
||||
snd_output_printf(out, "format : %s\n", snd_pcm_format_name(pcm->format));
|
||||
snd_output_printf(out, "subformat : %s\n", snd_pcm_subformat_name(pcm->subformat));
|
||||
snd_output_printf(out, "channels : %u\n", pcm->channels);
|
||||
snd_output_printf(out, "rate : %u\n", pcm->rate);
|
||||
snd_output_printf(out, "exact rate : %g (%u/%u)\n", (double) pcm->rate_num / pcm->rate_den, pcm->rate_num, pcm->rate_den);
|
||||
snd_output_printf(out, "msbits : %u\n", pcm->msbits);
|
||||
snd_output_printf(out, "buffer_size : %lu\n", pcm->buffer_size);
|
||||
snd_output_printf(out, "period_size : %lu\n", pcm->period_size);
|
||||
snd_output_printf(out, "period_time : %u\n", pcm->period_time);
|
||||
snd_output_printf(out, "tick_time : %u\n", pcm->tick_time);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, FILE *fp)
|
||||
int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
assert(pcm);
|
||||
assert(fp);
|
||||
assert(out);
|
||||
assert(pcm->setup);
|
||||
fprintf(fp, "start_mode : %s\n", snd_pcm_start_mode_name(pcm->start_mode));
|
||||
fprintf(fp, "xrun_mode : %s\n", snd_pcm_xrun_mode_name(pcm->xrun_mode));
|
||||
fprintf(fp, "tstamp_mode : %s\n", snd_pcm_tstamp_mode_name(pcm->tstamp_mode));
|
||||
fprintf(fp, "period_step : %ld\n", (long)pcm->period_step);
|
||||
fprintf(fp, "sleep_min : %ld\n", (long)pcm->sleep_min);
|
||||
fprintf(fp, "avail_min : %ld\n", (long)pcm->avail_min);
|
||||
fprintf(fp, "xfer_align : %ld\n", (long)pcm->xfer_align);
|
||||
fprintf(fp, "silence_threshold: %ld\n", (long)pcm->silence_threshold);
|
||||
fprintf(fp, "silence_size : %ld\n", (long)pcm->silence_size);
|
||||
fprintf(fp, "boundary : %ld\n", (long)pcm->boundary);
|
||||
snd_output_printf(out, "start_mode : %s\n", snd_pcm_start_mode_name(pcm->start_mode));
|
||||
snd_output_printf(out, "xrun_mode : %s\n", snd_pcm_xrun_mode_name(pcm->xrun_mode));
|
||||
snd_output_printf(out, "tstamp_mode : %s\n", snd_pcm_tstamp_mode_name(pcm->tstamp_mode));
|
||||
snd_output_printf(out, "period_step : %ld\n", (long)pcm->period_step);
|
||||
snd_output_printf(out, "sleep_min : %ld\n", (long)pcm->sleep_min);
|
||||
snd_output_printf(out, "avail_min : %ld\n", (long)pcm->avail_min);
|
||||
snd_output_printf(out, "xfer_align : %ld\n", (long)pcm->xfer_align);
|
||||
snd_output_printf(out, "silence_threshold: %ld\n", (long)pcm->silence_threshold);
|
||||
snd_output_printf(out, "silence_size : %ld\n", (long)pcm->silence_size);
|
||||
snd_output_printf(out, "boundary : %ld\n", (long)pcm->boundary);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_pcm_dump_setup(snd_pcm_t *pcm, FILE *fp)
|
||||
int snd_pcm_dump_setup(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_dump_hw_setup(pcm, fp);
|
||||
snd_pcm_dump_sw_setup(pcm, fp);
|
||||
snd_pcm_dump_hw_setup(pcm, out);
|
||||
snd_pcm_dump_sw_setup(pcm, out);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_pcm_status_dump(snd_pcm_status_t *status, FILE *fp)
|
||||
int snd_pcm_status_dump(snd_pcm_status_t *status, snd_output_t *out)
|
||||
{
|
||||
assert(status);
|
||||
fprintf(fp, "state : %s\n", snd_pcm_state_name(status->state));
|
||||
fprintf(fp, "trigger_time: %ld.%06ld\n",
|
||||
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);
|
||||
fprintf(fp, "tstamp : %ld.%06ld\n",
|
||||
snd_output_printf(out, "tstamp : %ld.%06ld\n",
|
||||
status->tstamp.tv_sec, status->tstamp.tv_usec);
|
||||
fprintf(fp, "delay : %ld\n", (long)status->delay);
|
||||
fprintf(fp, "avail : %ld\n", (long)status->avail);
|
||||
fprintf(fp, "avail_max : %ld\n", (long)status->avail_max);
|
||||
snd_output_printf(out, "delay : %ld\n", (long)status->delay);
|
||||
snd_output_printf(out, "avail : %ld\n", (long)status->avail);
|
||||
snd_output_printf(out, "avail_max : %ld\n", (long)status->avail_max);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_pcm_dump(snd_pcm_t *pcm, FILE *fp)
|
||||
int snd_pcm_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
assert(pcm);
|
||||
assert(fp);
|
||||
pcm->ops->dump(pcm->op_arg, fp);
|
||||
assert(out);
|
||||
pcm->ops->dump(pcm->op_arg, out);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -530,17 +530,17 @@ static snd_pcm_sframes_t snd_pcm_adpcm_read_areas(snd_pcm_t *pcm,
|
|||
return err;
|
||||
}
|
||||
|
||||
static void snd_pcm_adpcm_dump(snd_pcm_t *pcm, FILE *fp)
|
||||
static void snd_pcm_adpcm_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private;
|
||||
fprintf(fp, "Ima-ADPCM conversion PCM (%s)\n",
|
||||
snd_output_printf(out, "Ima-ADPCM conversion PCM (%s)\n",
|
||||
snd_pcm_format_name(adpcm->sformat));
|
||||
if (pcm->setup) {
|
||||
fprintf(fp, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, fp);
|
||||
snd_output_printf(out, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, out);
|
||||
}
|
||||
fprintf(fp, "Slave: ");
|
||||
snd_pcm_dump(adpcm->plug.slave, fp);
|
||||
snd_output_printf(out, "Slave: ");
|
||||
snd_pcm_dump(adpcm->plug.slave, out);
|
||||
}
|
||||
|
||||
snd_pcm_ops_t snd_pcm_adpcm_ops = {
|
||||
|
|
|
|||
|
|
@ -398,17 +398,17 @@ static snd_pcm_sframes_t snd_pcm_alaw_read_areas(snd_pcm_t *pcm,
|
|||
return err;
|
||||
}
|
||||
|
||||
static void snd_pcm_alaw_dump(snd_pcm_t *pcm, FILE *fp)
|
||||
static void snd_pcm_alaw_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_alaw_t *alaw = pcm->private;
|
||||
fprintf(fp, "A-Law conversion PCM (%s)\n",
|
||||
snd_output_printf(out, "A-Law conversion PCM (%s)\n",
|
||||
snd_pcm_format_name(alaw->sformat));
|
||||
if (pcm->setup) {
|
||||
fprintf(fp, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, fp);
|
||||
snd_output_printf(out, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, out);
|
||||
}
|
||||
fprintf(fp, "Slave: ");
|
||||
snd_pcm_dump(alaw->plug.slave, fp);
|
||||
snd_output_printf(out, "Slave: ");
|
||||
snd_pcm_dump(alaw->plug.slave, out);
|
||||
}
|
||||
|
||||
snd_pcm_ops_t snd_pcm_alaw_ops = {
|
||||
|
|
|
|||
|
|
@ -155,16 +155,16 @@ static snd_pcm_sframes_t snd_pcm_copy_read_areas(snd_pcm_t *pcm,
|
|||
return err;
|
||||
}
|
||||
|
||||
static void snd_pcm_copy_dump(snd_pcm_t *pcm, FILE *fp)
|
||||
static void snd_pcm_copy_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_copy_t *copy = pcm->private;
|
||||
fprintf(fp, "Copy conversion PCM\n");
|
||||
snd_output_printf(out, "Copy conversion PCM\n");
|
||||
if (pcm->setup) {
|
||||
fprintf(fp, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, fp);
|
||||
snd_output_printf(out, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, out);
|
||||
}
|
||||
fprintf(fp, "Slave: ");
|
||||
snd_pcm_dump(copy->plug.slave, fp);
|
||||
snd_output_printf(out, "Slave: ");
|
||||
snd_pcm_dump(copy->plug.slave, out);
|
||||
}
|
||||
|
||||
snd_pcm_ops_t snd_pcm_copy_ops = {
|
||||
|
|
|
|||
|
|
@ -357,19 +357,19 @@ static int snd_pcm_file_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void snd_pcm_file_dump(snd_pcm_t *pcm, FILE *fp)
|
||||
static void snd_pcm_file_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
if (file->fname)
|
||||
fprintf(fp, "File PCM (file=%s)\n", file->fname);
|
||||
snd_output_printf(out, "File PCM (file=%s)\n", file->fname);
|
||||
else
|
||||
fprintf(fp, "File PCM (fd=%d)\n", file->fd);
|
||||
snd_output_printf(out, "File PCM (fd=%d)\n", file->fd);
|
||||
if (pcm->setup) {
|
||||
fprintf(fp, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, fp);
|
||||
snd_output_printf(out, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, out);
|
||||
}
|
||||
fprintf(fp, "Slave: ");
|
||||
snd_pcm_dump(file->slave, fp);
|
||||
snd_output_printf(out, "Slave: ");
|
||||
snd_pcm_dump(file->slave, out);
|
||||
}
|
||||
|
||||
snd_pcm_ops_t snd_pcm_file_ops = {
|
||||
|
|
|
|||
|
|
@ -488,17 +488,17 @@ static snd_pcm_sframes_t snd_pcm_hw_avail_update(snd_pcm_t *pcm)
|
|||
return avail;
|
||||
}
|
||||
|
||||
static void snd_pcm_hw_dump(snd_pcm_t *pcm, FILE *fp)
|
||||
static void snd_pcm_hw_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
char *name = "Unknown";
|
||||
snd_card_get_name(hw->card, &name);
|
||||
fprintf(fp, "Hardware PCM card %d '%s' device %d subdevice %d\n",
|
||||
snd_output_printf(out, "Hardware PCM card %d '%s' device %d subdevice %d\n",
|
||||
hw->card, name, hw->device, hw->subdevice);
|
||||
free(name);
|
||||
if (pcm->setup) {
|
||||
fprintf(fp, "\nIts setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, fp);
|
||||
snd_output_printf(out, "\nIts setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, out);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -237,17 +237,17 @@ static snd_pcm_sframes_t snd_pcm_linear_read_areas(snd_pcm_t *pcm,
|
|||
return err;
|
||||
}
|
||||
|
||||
static void snd_pcm_linear_dump(snd_pcm_t *pcm, FILE *fp)
|
||||
static void snd_pcm_linear_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_linear_t *linear = pcm->private;
|
||||
fprintf(fp, "Linear conversion PCM (%s)\n",
|
||||
snd_output_printf(out, "Linear conversion PCM (%s)\n",
|
||||
snd_pcm_format_name(linear->sformat));
|
||||
if (pcm->setup) {
|
||||
fprintf(fp, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, fp);
|
||||
snd_output_printf(out, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, out);
|
||||
}
|
||||
fprintf(fp, "Slave: ");
|
||||
snd_pcm_dump(linear->plug.slave, fp);
|
||||
snd_output_printf(out, "Slave: ");
|
||||
snd_pcm_dump(linear->plug.slave, out);
|
||||
}
|
||||
|
||||
snd_pcm_ops_t snd_pcm_linear_ops = {
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ typedef struct {
|
|||
int (*hw_params)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
int (*sw_params)(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
|
||||
int (*channel_info)(snd_pcm_t *pcm, snd_pcm_channel_info_t *info);
|
||||
void (*dump)(snd_pcm_t *pcm, FILE *fp);
|
||||
void (*dump)(snd_pcm_t *pcm, snd_output_t *out);
|
||||
int (*mmap)(snd_pcm_t *pcm);
|
||||
int (*munmap)(snd_pcm_t *pcm);
|
||||
} snd_pcm_ops_t;
|
||||
|
|
|
|||
|
|
@ -415,17 +415,17 @@ static snd_pcm_sframes_t snd_pcm_mulaw_read_areas(snd_pcm_t *pcm,
|
|||
return err;
|
||||
}
|
||||
|
||||
static void snd_pcm_mulaw_dump(snd_pcm_t *pcm, FILE *fp)
|
||||
static void snd_pcm_mulaw_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_mulaw_t *mulaw = pcm->private;
|
||||
fprintf(fp, "Mu-Law conversion PCM (%s)\n",
|
||||
snd_output_printf(out, "Mu-Law conversion PCM (%s)\n",
|
||||
snd_pcm_format_name(mulaw->sformat));
|
||||
if (pcm->setup) {
|
||||
fprintf(fp, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, fp);
|
||||
snd_output_printf(out, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, out);
|
||||
}
|
||||
fprintf(fp, "Slave: ");
|
||||
snd_pcm_dump(mulaw->plug.slave, fp);
|
||||
snd_output_printf(out, "Slave: ");
|
||||
snd_pcm_dump(mulaw->plug.slave, out);
|
||||
}
|
||||
|
||||
snd_pcm_ops_t snd_pcm_mulaw_ops = {
|
||||
|
|
|
|||
|
|
@ -383,26 +383,26 @@ int snd_pcm_multi_poll_descriptor(snd_pcm_t *pcm)
|
|||
return snd_pcm_poll_descriptor(slave);
|
||||
}
|
||||
|
||||
static void snd_pcm_multi_dump(snd_pcm_t *pcm, FILE *fp)
|
||||
static void snd_pcm_multi_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
unsigned int k;
|
||||
fprintf(fp, "Multi PCM\n");
|
||||
fprintf(fp, "\nChannel bindings:\n");
|
||||
snd_output_printf(out, "Multi PCM\n");
|
||||
snd_output_printf(out, "\nChannel bindings:\n");
|
||||
for (k = 0; k < multi->channels_count; ++k) {
|
||||
snd_pcm_multi_channel_t *c = &multi->channels[k];
|
||||
if (c->slave_idx < 0)
|
||||
continue;
|
||||
fprintf(fp, "%d: slave %d, channel %d\n",
|
||||
snd_output_printf(out, "%d: slave %d, channel %d\n",
|
||||
k, c->slave_idx, c->slave_channel);
|
||||
}
|
||||
if (pcm->setup) {
|
||||
fprintf(fp, "\nIts setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, fp);
|
||||
snd_output_printf(out, "\nIts setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, out);
|
||||
}
|
||||
for (k = 0; k < multi->slaves_count; ++k) {
|
||||
fprintf(fp, "\nSlave #%d: ", k);
|
||||
snd_pcm_dump(multi->slaves[k].pcm, fp);
|
||||
snd_output_printf(out, "\nSlave #%d: ", k);
|
||||
snd_pcm_dump(multi->slaves[k].pcm, out);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -271,12 +271,12 @@ static int snd_pcm_null_munmap(snd_pcm_t *pcm)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void snd_pcm_null_dump(snd_pcm_t *pcm, FILE *fp)
|
||||
static void snd_pcm_null_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
fprintf(fp, "Null PCM\n");
|
||||
snd_output_printf(out, "Null PCM\n");
|
||||
if (pcm->setup) {
|
||||
fprintf(fp, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, fp);
|
||||
snd_output_printf(out, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, out);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1117,7 +1117,7 @@ void snd_pcm_hw_param_copy(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var,
|
|||
}
|
||||
|
||||
void snd_pcm_hw_param_dump(const snd_pcm_hw_params_t *params,
|
||||
snd_pcm_hw_param_t var, FILE *fp)
|
||||
snd_pcm_hw_param_t var, snd_output_t *out)
|
||||
{
|
||||
static const char *(*funcs[])(unsigned int k) = {
|
||||
[SND_PCM_HW_PARAM_ACCESS] = snd_pcm_access_name,
|
||||
|
|
@ -1127,9 +1127,9 @@ void snd_pcm_hw_param_dump(const snd_pcm_hw_params_t *params,
|
|||
if (hw_is_mask(var)) {
|
||||
const mask_t *mask = hw_param_mask_c(params, var);
|
||||
if (mask_empty(mask))
|
||||
fputs(" NONE", fp);
|
||||
snd_output_puts(out, " NONE");
|
||||
else if (mask_full(mask))
|
||||
fputs(" ALL", fp);
|
||||
snd_output_puts(out, " ALL");
|
||||
else {
|
||||
unsigned int k;
|
||||
const char *(*f)(unsigned int k);
|
||||
|
|
@ -1138,27 +1138,27 @@ void snd_pcm_hw_param_dump(const snd_pcm_hw_params_t *params,
|
|||
assert(f);
|
||||
for (k = 0; k <= MASK_MAX; ++k) {
|
||||
if (mask_test(mask, k)) {
|
||||
putc(' ', fp);
|
||||
fputs(f(k), fp);
|
||||
snd_output_putc(out, ' ');
|
||||
snd_output_puts(out, f(k));
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (hw_is_interval(var)) {
|
||||
interval_print(hw_param_interval_c(params, var), fp);
|
||||
interval_print(hw_param_interval_c(params, var), out);
|
||||
return;
|
||||
}
|
||||
assert(0);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_dump(snd_pcm_hw_params_t *params, FILE *fp)
|
||||
int snd_pcm_hw_params_dump(snd_pcm_hw_params_t *params, snd_output_t *out)
|
||||
{
|
||||
unsigned int k;
|
||||
for (k = 0; k <= SND_PCM_HW_PARAM_LAST; k++) {
|
||||
fprintf(fp, "%s: ", snd_pcm_hw_param_name(k));
|
||||
snd_pcm_hw_param_dump(params, k, fp);
|
||||
putc('\n', fp);
|
||||
snd_output_printf(out, "%s: ", snd_pcm_hw_param_name(k));
|
||||
snd_pcm_hw_param_dump(params, k, out);
|
||||
snd_output_putc(out, '\n');
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1466,7 +1466,7 @@ int snd_pcm_hw_params_try_explain_failure1(snd_pcm_t *pcm,
|
|||
snd_pcm_hw_params_t *fail,
|
||||
snd_pcm_hw_params_t *success,
|
||||
unsigned int depth,
|
||||
FILE *fp)
|
||||
snd_output_t *out)
|
||||
{
|
||||
snd_pcm_hw_param_t var;
|
||||
snd_pcm_hw_params_t i;
|
||||
|
|
@ -1478,11 +1478,11 @@ int snd_pcm_hw_params_try_explain_failure1(snd_pcm_t *pcm,
|
|||
snd_pcm_hw_param_copy(&i, var, fail);
|
||||
err = snd_pcm_hw_refine(pcm, &i);
|
||||
if (err == 0 &&
|
||||
snd_pcm_hw_params_try_explain_failure1(pcm, fail, &i, depth - 1, fp) < 0)
|
||||
snd_pcm_hw_params_try_explain_failure1(pcm, fail, &i, depth - 1, out) < 0)
|
||||
continue;
|
||||
fprintf(fp, "%s: ", snd_pcm_hw_param_name(var));
|
||||
snd_pcm_hw_param_dump(fail, var, fp);
|
||||
putc('\n', fp);
|
||||
snd_output_printf(out, "%s: ", snd_pcm_hw_param_name(var));
|
||||
snd_pcm_hw_param_dump(fail, var, out);
|
||||
snd_output_putc(out, '\n');
|
||||
return 0;
|
||||
}
|
||||
return -ENOENT;
|
||||
|
|
@ -1492,7 +1492,7 @@ int snd_pcm_hw_params_try_explain_failure(snd_pcm_t *pcm,
|
|||
snd_pcm_hw_params_t *fail,
|
||||
snd_pcm_hw_params_t *success,
|
||||
unsigned int depth,
|
||||
FILE *fp)
|
||||
snd_output_t *out)
|
||||
{
|
||||
snd_pcm_hw_params_t i, any;
|
||||
int err;
|
||||
|
|
@ -1502,7 +1502,7 @@ int snd_pcm_hw_params_try_explain_failure(snd_pcm_t *pcm,
|
|||
for (var = 0; var <= SND_PCM_HW_PARAM_LAST; var++) {
|
||||
if (!snd_pcm_hw_param_empty(fail, var))
|
||||
continue;
|
||||
fprintf(fp, "%s is empty\n", snd_pcm_hw_param_name(var));
|
||||
snd_output_printf(out, "%s is empty\n", snd_pcm_hw_param_name(var));
|
||||
done = 1;
|
||||
}
|
||||
if (done)
|
||||
|
|
@ -1510,14 +1510,14 @@ int snd_pcm_hw_params_try_explain_failure(snd_pcm_t *pcm,
|
|||
i = *fail;
|
||||
err = snd_pcm_hw_refine(pcm, &i);
|
||||
if (err == 0) {
|
||||
fprintf(fp, "Configuration is virtually correct\n");
|
||||
snd_output_printf(out, "Configuration is virtually correct\n");
|
||||
return 0;
|
||||
}
|
||||
if (!success) {
|
||||
snd_pcm_hw_params_any(pcm, &any);
|
||||
success = &any;
|
||||
}
|
||||
return snd_pcm_hw_params_try_explain_failure1(pcm, fail, success, depth, fp);
|
||||
return snd_pcm_hw_params_try_explain_failure1(pcm, fail, success, depth, out);
|
||||
}
|
||||
|
||||
typedef struct _snd_pcm_hw_rule snd_pcm_hw_rule_t;
|
||||
|
|
@ -2151,48 +2151,48 @@ int snd_pcm_sw_param_near(snd_pcm_t *pcm, snd_pcm_sw_params_t *params,
|
|||
}
|
||||
|
||||
void snd_pcm_sw_param_dump(const snd_pcm_sw_params_t *params,
|
||||
snd_pcm_sw_param_t var, FILE *fp)
|
||||
snd_pcm_sw_param_t var, snd_output_t *out)
|
||||
{
|
||||
switch (var) {
|
||||
case SND_PCM_SW_PARAM_START_MODE:
|
||||
fputs(snd_pcm_start_mode_name(params->start_mode), fp);
|
||||
snd_output_puts(out, snd_pcm_start_mode_name(params->start_mode));
|
||||
break;
|
||||
case SND_PCM_SW_PARAM_XRUN_MODE:
|
||||
fputs(snd_pcm_xrun_mode_name(params->xrun_mode), fp);
|
||||
snd_output_puts(out, snd_pcm_xrun_mode_name(params->xrun_mode));
|
||||
break;
|
||||
case SND_PCM_SW_PARAM_TSTAMP_MODE:
|
||||
fputs(snd_pcm_tstamp_mode_name(params->tstamp_mode), fp);
|
||||
snd_output_puts(out, snd_pcm_tstamp_mode_name(params->tstamp_mode));
|
||||
break;
|
||||
case SND_PCM_SW_PARAM_PERIOD_STEP:
|
||||
fprintf(fp, "%d", params->period_step);
|
||||
snd_output_printf(out, "%d", params->period_step);
|
||||
break;
|
||||
case SND_PCM_SW_PARAM_SLEEP_MIN:
|
||||
fprintf(fp, "%d", params->sleep_min);
|
||||
snd_output_printf(out, "%d", params->sleep_min);
|
||||
break;
|
||||
case SND_PCM_SW_PARAM_AVAIL_MIN:
|
||||
fprintf(fp, "%ld", (long) params->avail_min);
|
||||
snd_output_printf(out, "%ld", (long) params->avail_min);
|
||||
break;
|
||||
case SND_PCM_SW_PARAM_XFER_ALIGN:
|
||||
fprintf(fp, "%ld", (long) params->xfer_align);
|
||||
snd_output_printf(out, "%ld", (long) params->xfer_align);
|
||||
break;
|
||||
case SND_PCM_SW_PARAM_SILENCE_THRESHOLD:
|
||||
fprintf(fp, "%ld", (long) params->silence_threshold);
|
||||
snd_output_printf(out, "%ld", (long) params->silence_threshold);
|
||||
break;
|
||||
case SND_PCM_SW_PARAM_SILENCE_SIZE:
|
||||
fprintf(fp, "%ld", (long) params->silence_size);
|
||||
snd_output_printf(out, "%ld", (long) params->silence_size);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, FILE *fp)
|
||||
int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, snd_output_t *out)
|
||||
{
|
||||
unsigned int k;
|
||||
for (k = 0; k <= SND_PCM_SW_PARAM_LAST; k++) {
|
||||
fprintf(fp, "%s: ", snd_pcm_sw_param_name(k));
|
||||
snd_pcm_sw_param_dump(params, k, fp);
|
||||
putc('\n', fp);
|
||||
snd_output_printf(out, "%s: ", snd_pcm_sw_param_name(k));
|
||||
snd_pcm_sw_param_dump(params, k, out);
|
||||
snd_output_putc(out, '\n');
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -365,19 +365,7 @@ static int snd_pcm_plug_hw_refine1(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
|
|||
static int snd_pcm_plug_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_hw_params_t sparams;
|
||||
int err;
|
||||
#if 0
|
||||
fprintf(stderr, "Enter: client =\n");
|
||||
snd_pcm_hw_params_dump(params, stderr);
|
||||
#endif
|
||||
err = snd_pcm_plug_hw_refine1(pcm, params, &sparams);
|
||||
#if 0
|
||||
fprintf(stderr, "Exit: client =\n");
|
||||
snd_pcm_hw_params_dump(params, stderr);
|
||||
fprintf(stderr, "Exit: slave =\n");
|
||||
snd_pcm_hw_params_dump(&sparams, stderr);
|
||||
#endif
|
||||
return err;
|
||||
return snd_pcm_plug_hw_refine1(pcm, params, &sparams);
|
||||
}
|
||||
|
||||
static void snd_pcm_plug_clear(snd_pcm_t *pcm)
|
||||
|
|
@ -670,11 +658,11 @@ static int snd_pcm_plug_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void snd_pcm_plug_dump(snd_pcm_t *pcm, FILE *fp)
|
||||
static void snd_pcm_plug_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
fprintf(fp, "Plug PCM: ");
|
||||
snd_pcm_dump(plug->slave, fp);
|
||||
snd_output_printf(out, "Plug PCM: ");
|
||||
snd_pcm_dump(plug->slave, out);
|
||||
}
|
||||
|
||||
snd_pcm_ops_t snd_pcm_plug_ops = {
|
||||
|
|
|
|||
|
|
@ -531,22 +531,22 @@ snd_pcm_sframes_t snd_pcm_rate_slave_frames(snd_pcm_t *pcm, snd_pcm_sframes_t fr
|
|||
return muldiv_down(frames, DIV, rate->pitch);
|
||||
}
|
||||
|
||||
static void snd_pcm_rate_dump(snd_pcm_t *pcm, FILE *fp)
|
||||
static void snd_pcm_rate_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_rate_t *rate = pcm->private;
|
||||
if (rate->sformat < 0)
|
||||
fprintf(fp, "Rate conversion PCM (%d)\n",
|
||||
snd_output_printf(out, "Rate conversion PCM (%d)\n",
|
||||
rate->srate);
|
||||
else
|
||||
fprintf(fp, "Rate conversion PCM (%d, sformat=%s)\n",
|
||||
snd_output_printf(out, "Rate conversion PCM (%d, sformat=%s)\n",
|
||||
rate->srate,
|
||||
snd_pcm_format_name(rate->sformat));
|
||||
if (pcm->setup) {
|
||||
fprintf(fp, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, fp);
|
||||
snd_output_printf(out, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, out);
|
||||
}
|
||||
fprintf(fp, "Slave: ");
|
||||
snd_pcm_dump(rate->plug.slave, fp);
|
||||
snd_output_printf(out, "Slave: ");
|
||||
snd_pcm_dump(rate->plug.slave, out);
|
||||
}
|
||||
|
||||
snd_pcm_ops_t snd_pcm_rate_ops = {
|
||||
|
|
|
|||
|
|
@ -633,42 +633,42 @@ static snd_pcm_sframes_t snd_pcm_route_read_areas(snd_pcm_t *pcm,
|
|||
return err;
|
||||
}
|
||||
|
||||
static void snd_pcm_route_dump(snd_pcm_t *pcm, FILE *fp)
|
||||
static void snd_pcm_route_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_route_t *route = pcm->private;
|
||||
unsigned int dst;
|
||||
if (route->sformat < 0)
|
||||
fprintf(fp, "Route conversion PCM\n");
|
||||
snd_output_printf(out, "Route conversion PCM\n");
|
||||
else
|
||||
fprintf(fp, "Route conversion PCM (sformat=%s)\n",
|
||||
snd_output_printf(out, "Route conversion PCM (sformat=%s)\n",
|
||||
snd_pcm_format_name(route->sformat));
|
||||
fputs("Transformation table:\n", fp);
|
||||
snd_output_puts(out, "Transformation table:\n");
|
||||
for (dst = 0; dst < route->params.ndsts; dst++) {
|
||||
ttable_dst_t *d = &route->params.dsts[dst];
|
||||
unsigned int src;
|
||||
if (d->nsrcs == 0)
|
||||
continue;
|
||||
fprintf(fp, "%d <- ", dst);
|
||||
snd_output_printf(out, "%d <- ", dst);
|
||||
src = 0;
|
||||
while (1) {
|
||||
ttable_src_t *s = &d->srcs[src];
|
||||
if (d->att)
|
||||
fprintf(fp, "%d*%g", s->channel, s->as_float);
|
||||
snd_output_printf(out, "%d*%g", s->channel, s->as_float);
|
||||
else
|
||||
fprintf(fp, "%d", s->channel);
|
||||
snd_output_printf(out, "%d", s->channel);
|
||||
src++;
|
||||
if (src == d->nsrcs)
|
||||
break;
|
||||
fputs(" + ", fp);
|
||||
snd_output_puts(out, " + ");
|
||||
}
|
||||
putc('\n', fp);
|
||||
snd_output_putc(out, '\n');
|
||||
}
|
||||
if (pcm->setup) {
|
||||
fprintf(fp, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, fp);
|
||||
snd_output_printf(out, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, out);
|
||||
}
|
||||
fprintf(fp, "Slave: ");
|
||||
snd_pcm_dump(route->plug.slave, fp);
|
||||
snd_output_printf(out, "Slave: ");
|
||||
snd_pcm_dump(route->plug.slave, out);
|
||||
}
|
||||
|
||||
snd_pcm_ops_t snd_pcm_route_ops = {
|
||||
|
|
|
|||
|
|
@ -1071,21 +1071,21 @@ static int snd_pcm_share_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void snd_pcm_share_dump(snd_pcm_t *pcm, FILE *fp)
|
||||
static void snd_pcm_share_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
unsigned int k;
|
||||
fprintf(fp, "Share PCM\n");
|
||||
fprintf(fp, "\nChannel bindings:\n");
|
||||
snd_output_printf(out, "Share PCM\n");
|
||||
snd_output_printf(out, "\nChannel bindings:\n");
|
||||
for (k = 0; k < share->channels_count; ++k)
|
||||
fprintf(fp, "%d: %d\n", k, share->slave_channels[k]);
|
||||
snd_output_printf(out, "%d: %d\n", k, share->slave_channels[k]);
|
||||
if (pcm->setup) {
|
||||
fprintf(fp, "\nIts setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, fp);
|
||||
snd_output_printf(out, "\nIts setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, out);
|
||||
}
|
||||
fprintf(fp, "Slave: ");
|
||||
snd_pcm_dump(slave->pcm, fp);
|
||||
snd_output_printf(out, "Slave: ");
|
||||
snd_pcm_dump(slave->pcm, out);
|
||||
}
|
||||
|
||||
snd_pcm_ops_t snd_pcm_share_ops = {
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ static int snd_pcm_shm_action(snd_pcm_t *pcm)
|
|||
if (err != 1)
|
||||
return -EBADFD;
|
||||
if (ctrl->cmd) {
|
||||
fprintf(stderr, "Server has not done the cmd\n");
|
||||
ERR("Server has not done the cmd");
|
||||
return -EBADFD;
|
||||
}
|
||||
return ctrl->result;
|
||||
|
|
@ -110,7 +110,7 @@ static int snd_pcm_shm_action_fd(snd_pcm_t *pcm, int *fd)
|
|||
if (err != 1)
|
||||
return -EBADFD;
|
||||
if (ctrl->cmd) {
|
||||
fprintf(stderr, "Server has not done the cmd\n");
|
||||
ERR("Server has not done the cmd");
|
||||
return -EBADFD;
|
||||
}
|
||||
return ctrl->result;
|
||||
|
|
@ -463,12 +463,12 @@ static int snd_pcm_shm_close(snd_pcm_t *pcm)
|
|||
return result;
|
||||
}
|
||||
|
||||
static void snd_pcm_shm_dump(snd_pcm_t *pcm, FILE *fp)
|
||||
static void snd_pcm_shm_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
fprintf(fp, "Shm PCM\n");
|
||||
snd_output_printf(out, "Shm PCM\n");
|
||||
if (pcm->setup) {
|
||||
fprintf(fp, "\nIts setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, fp);
|
||||
snd_output_printf(out, "\nIts setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, out);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue