5
* Copyright (C) Stan Seibert - July 2001
7
* This file is part of libao, a cross-platform audio output library. See
8
* README for a history of this source code.
10
* libao is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2, or (at your option)
15
* libao is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with GNU Make; see the file COPYING. If not, write to
22
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
26
#ifndef __AO_PRIVATE_H__
27
#define __AO_PRIVATE_H__
29
/* --- Operating System Compatibility --- */
32
OpenBSD systems with a.out binaries require dlsym()ed symbols to be
33
prepended with an underscore, so we need the following nasty #ifdef
36
#if defined(__OpenBSD__) && !defined(__ELF__)
37
#define dlsym(h,s) dlsym(h, "_" s)
40
/* RTLD_NOW is the preferred symbol resolution behavior, but
41
* some platforms do not support it. The autoconf script will have
42
* already defined DLOPEN_FLAG if the default is unacceptable on the
45
* ALSA requires RTLD_GLOBAL.
47
#if !defined(DLOPEN_FLAG)
48
#define DLOPEN_FLAG (RTLD_NOW | RTLD_GLOBAL)
51
/* --- Constants --- */
53
#ifndef AO_SYSTEM_CONFIG
54
#define AO_SYSTEM_CONFIG "/etc/libao.conf"
56
#ifndef AO_USER_CONFIG
57
#define AO_USER_CONFIG "/.libao"
60
/* --- Structures --- */
62
typedef struct ao_config {
67
AO_OUTPUT_MATRIX_UNDEFINED=0, /* matrix unset */
68
AO_OUTPUT_MATRIX_FIXED=1, /* fixed, immutable channel order, eg, ALSA */
69
AO_OUTPUT_MATRIX_COLLAPSIBLE=2, /* fixed order but only used channels sent, eg MACOS */
70
AO_OUTPUT_MATRIX_PERMUTABLE=3, /* channel map is fully permutable. eg Pulse */
74
int type; /* live output or file output? */
77
FILE *file; /* File for output if this is a file driver */
79
/* input not necessarily == output. Right now, byte order, channel
80
count, and channel mappings may be altered. */
82
int client_byte_format;
83
int machine_byte_format;
84
int driver_byte_format;
86
int swap_buffer_size; /* Bytes allocated to swap_buffer */
93
ao_outorder output_matrix_order;
94
char *output_matrix; /* physical output channel
95
ordering/numbering matrix set by
96
driver if there's a channel
97
name->number mapping useful to the
98
backend driver in some way. Eg,
99
Pulse has fully permutable input
100
channel masks, but specific channels
101
locations (eg, 'Center') still have
102
assigned numbers even if not a
103
specific slot int he input
106
int *input_map; /* input permutation mapping from each
107
input channel to a location in the
108
output_matrix. Made by ao_open,
109
intended for convenience use by
110
driver in device open. */
112
char *inter_matrix; /* channel matrix as presented to the
114
int *inter_permute; /* maps from each channel in the
115
inter_matrix back to an input channel
118
void *internal; /* Pointer to driver-specific data */
123
struct ao_functions {
125
ao_info* (*driver_info)(void);
126
int (*device_init)(ao_device *device);
127
int (*set_option)(ao_device *device, const char *key,
129
int (*open)(ao_device *device, ao_sample_format *format);
130
int (*play)(ao_device *device, const char *output_samples,
132
int (*close)(ao_device *device);
133
void (*device_clear)(ao_device *device);
134
char* (*file_extension)(void);
137
/* --- Functions --- */
139
void ao_read_config_files (ao_config *config);
141
#define adebug(format, args...) {\
142
if(device->verbose==2){ \
143
if(strcmp(format,"\n")){ \
144
if(device->funcs->driver_info()->short_name){ \
145
fprintf(stderr,"ao_%s debug: " format,device->funcs->driver_info()->short_name,## args); \
147
fprintf(stderr,"debug: " format,## args); \
150
fprintf(stderr,"\n"); \
155
#define averbose(format, args...) {\
156
if(device->verbose>0){ \
157
if(strcmp(format,"\n")){ \
158
if(device->funcs->driver_info()->short_name){ \
159
fprintf(stderr,"ao_%s info: " format,device->funcs->driver_info()->short_name,## args); \
161
fprintf(stderr,"info: " format,## args); \
164
fprintf(stderr,"\n"); \
169
#define ainfo(format, args...) {\
170
if(device->verbose>=0){ \
171
if(strcmp(format,"\n")){ \
172
if(device->funcs->driver_info()->short_name){ \
173
fprintf(stderr,"ao_%s info: " format,device->funcs->driver_info()->short_name,## args); \
175
fprintf(stderr,"info: " format,## args); \
178
fprintf(stderr,"\n"); \
183
#define awarn(format, args...) {\
184
if(device->verbose>=0){ \
185
if(strcmp(format,"\n")){ \
186
if(device->funcs->driver_info()->short_name){ \
187
fprintf(stderr,"ao_%s WARNING: " format,device->funcs->driver_info()->short_name,## args); \
189
fprintf(stderr,"WARNING: " format,## args); \
192
fprintf(stderr,"\n"); \
197
#define aerror(format, args...) { \
198
if(device->verbose>=0){ \
199
if(strcmp(format,"\n")){ \
200
if(device->funcs->driver_info()->short_name){ \
201
fprintf(stderr,"ao_%s ERROR: " format,device->funcs->driver_info()->short_name,## args); \
203
fprintf(stderr,"ERROR: " format,## args); \
206
fprintf(stderr,"\n"); \
211
#endif /* __AO_PRIVATE_H__ */