22 |
|
|
23 |
#include "rdesktop.h" |
#include "rdesktop.h" |
24 |
#include "rdpsnd.h" |
#include "rdpsnd.h" |
25 |
|
#include "rdpsnd_dsp.h" |
26 |
#include <unistd.h> |
#include <unistd.h> |
27 |
#include <fcntl.h> |
#include <fcntl.h> |
28 |
#include <errno.h> |
#include <errno.h> |
43 |
libao_open(void) |
libao_open(void) |
44 |
{ |
{ |
45 |
ao_sample_format format; |
ao_sample_format format; |
|
static int warned = 0; |
|
46 |
|
|
47 |
if (!warned && libao_device) |
ao_initialize(); |
48 |
|
|
49 |
|
if (libao_device) |
50 |
{ |
{ |
51 |
warning("device-options not supported for libao-driver\n"); |
default_driver = ao_driver_id(libao_device); |
52 |
warned = 1; |
} |
53 |
|
else |
54 |
|
{ |
55 |
|
default_driver = ao_default_driver_id(); |
56 |
} |
} |
|
|
|
|
ao_initialize(); |
|
|
default_driver = ao_default_driver_id(); |
|
57 |
|
|
58 |
format.bits = 16; |
format.bits = 16; |
59 |
format.channels = 2; |
format.channels = 2; |
139 |
} |
} |
140 |
|
|
141 |
void |
void |
|
libao_volume(uint16 left, uint16 right) |
|
|
{ |
|
|
warning("volume changes not supported with libao-output\n"); |
|
|
} |
|
|
|
|
|
void |
|
142 |
libao_play(void) |
libao_play(void) |
143 |
{ |
{ |
144 |
struct audio_packet *packet; |
struct audio_packet *packet; |
230 |
return; |
return; |
231 |
} |
} |
232 |
|
|
|
static struct audio_driver libao_driver = { |
|
|
wave_out_write:rdpsnd_queue_write, |
|
|
wave_out_open:libao_open, |
|
|
wave_out_close:libao_close, |
|
|
wave_out_format_supported:libao_format_supported, |
|
|
wave_out_set_format:libao_set_format, |
|
|
wave_out_volume:libao_volume, |
|
|
wave_out_play:libao_play, |
|
|
name:"libao", |
|
|
description:"libao output driver", |
|
|
next:NULL, |
|
|
}; |
|
|
|
|
233 |
struct audio_driver * |
struct audio_driver * |
234 |
libao_register(char *options) |
libao_register(char *options) |
235 |
{ |
{ |
236 |
|
static struct audio_driver libao_driver; |
237 |
|
struct ao_info *libao_info; |
238 |
|
static char description[101]; |
239 |
|
|
240 |
|
libao_driver.wave_out_write = rdpsnd_queue_write; |
241 |
|
libao_driver.wave_out_open = libao_open; |
242 |
|
libao_driver.wave_out_close = libao_close; |
243 |
|
libao_driver.wave_out_format_supported = libao_format_supported; |
244 |
|
libao_driver.wave_out_set_format = libao_set_format; |
245 |
|
libao_driver.wave_out_volume = rdpsnd_dsp_softvol_set; |
246 |
|
libao_driver.wave_out_play = libao_play; |
247 |
|
libao_driver.name = xstrdup("libao"); |
248 |
|
libao_driver.description = description; |
249 |
|
libao_driver.need_byteswap_on_be = 0; |
250 |
|
libao_driver.next = NULL; |
251 |
|
|
252 |
|
ao_initialize(); |
253 |
|
|
254 |
|
libao_info = ao_driver_info(ao_default_driver_id()); |
255 |
|
|
256 |
|
if (libao_info) |
257 |
|
{ |
258 |
|
snprintf(description, 100, "libao output driver, default device: %s", |
259 |
|
libao_info->short_name); |
260 |
|
} |
261 |
|
else |
262 |
|
{ |
263 |
|
snprintf(description, 100, "libao output driver, default device: none"); |
264 |
|
} |
265 |
|
|
266 |
|
ao_shutdown(); |
267 |
|
|
268 |
if (options) |
if (options) |
269 |
{ |
{ |
270 |
libao_device = xstrdup(options); |
libao_device = xstrdup(options); |