194 |
static uint16 tick, format; |
static uint16 tick, format; |
195 |
static uint8 packet_index; |
static uint8 packet_index; |
196 |
static BOOL awaiting_data_packet; |
static BOOL awaiting_data_packet; |
197 |
|
static unsigned char missing_bytes[4] = { 0, 0, 0, 0 }; |
198 |
|
|
199 |
#ifdef RDPSND_DEBUG |
#ifdef RDPSND_DEBUG |
200 |
printf("RDPSND recv:\n"); |
printf("RDPSND recv:\n"); |
227 |
current_format = format; |
current_format = format; |
228 |
} |
} |
229 |
|
|
230 |
|
/* Insert the 4 missing bytes retrieved from last RDPSND_WRITE */ |
231 |
|
memcpy(s->data, missing_bytes, 4); |
232 |
|
|
233 |
current_driver-> |
current_driver-> |
234 |
wave_out_write(rdpsnd_dsp_process |
wave_out_write(rdpsnd_dsp_process |
235 |
(s, current_driver, &formats[current_format]), tick, |
(s, current_driver, &formats[current_format]), tick, |
248 |
in_uint16_le(s, tick); |
in_uint16_le(s, tick); |
249 |
in_uint16_le(s, format); |
in_uint16_le(s, format); |
250 |
in_uint8(s, packet_index); |
in_uint8(s, packet_index); |
251 |
|
/* Here are our lost bytes, but why? */ |
252 |
|
memcpy(missing_bytes, s->end - 4, 4); |
253 |
awaiting_data_packet = True; |
awaiting_data_packet = True; |
254 |
break; |
break; |
255 |
case RDPSND_CLOSE: |
case RDPSND_CLOSE: |
277 |
} |
} |
278 |
|
|
279 |
BOOL |
BOOL |
|
rdpsnd_init(void) |
|
|
{ |
|
|
rdpsnd_channel = |
|
|
channel_register("rdpsnd", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP, |
|
|
rdpsnd_process); |
|
|
|
|
|
return (rdpsnd_channel != NULL); |
|
|
} |
|
|
|
|
|
BOOL |
|
280 |
rdpsnd_auto_open(void) |
rdpsnd_auto_open(void) |
281 |
{ |
{ |
282 |
current_driver = drivers; |
static BOOL failed = False; |
283 |
while (current_driver != NULL) |
|
284 |
|
if (!failed) |
285 |
{ |
{ |
286 |
DEBUG(("trying %s...\n", current_driver->name)); |
struct audio_driver *auto_driver = current_driver; |
287 |
if (current_driver->wave_out_open()) |
|
288 |
|
current_driver = drivers; |
289 |
|
while (current_driver != NULL) |
290 |
{ |
{ |
291 |
DEBUG(("selected %s\n", current_driver->name)); |
DEBUG(("trying %s...\n", current_driver->name)); |
292 |
return True; |
if (current_driver->wave_out_open()) |
293 |
|
{ |
294 |
|
DEBUG(("selected %s\n", current_driver->name)); |
295 |
|
return True; |
296 |
|
} |
297 |
|
g_dsp_fd = 0; |
298 |
|
current_driver = current_driver->next; |
299 |
} |
} |
|
g_dsp_fd = 0; |
|
|
current_driver = current_driver->next; |
|
|
} |
|
300 |
|
|
301 |
warning("no working audio-driver found\n"); |
warning("no working audio-driver found\n"); |
302 |
|
failed = True; |
303 |
|
current_driver = auto_driver; |
304 |
|
} |
305 |
|
|
306 |
return False; |
return False; |
307 |
} |
} |
318 |
*reg = alsa_register(options); |
*reg = alsa_register(options); |
319 |
reg = &((*reg)->next); |
reg = &((*reg)->next); |
320 |
#endif |
#endif |
|
#if defined(RDPSND_OSS) |
|
|
*reg = oss_register(options); |
|
|
reg = &((*reg)->next); |
|
|
#endif |
|
321 |
#if defined(RDPSND_SUN) |
#if defined(RDPSND_SUN) |
322 |
*reg = sun_register(options); |
*reg = sun_register(options); |
323 |
reg = &((*reg)->next); |
reg = &((*reg)->next); |
324 |
#endif |
#endif |
325 |
|
#if defined(RDPSND_OSS) |
326 |
|
*reg = oss_register(options); |
327 |
|
reg = &((*reg)->next); |
328 |
|
#endif |
329 |
#if defined(RDPSND_SGI) |
#if defined(RDPSND_SGI) |
330 |
*reg = sgi_register(options); |
*reg = sgi_register(options); |
331 |
reg = &((*reg)->next); |
reg = &((*reg)->next); |
337 |
} |
} |
338 |
|
|
339 |
BOOL |
BOOL |
340 |
rdpsnd_select_driver(char *driver, char *options) |
rdpsnd_init(char *optarg) |
341 |
{ |
{ |
342 |
static struct audio_driver auto_driver; |
static struct audio_driver auto_driver; |
343 |
struct audio_driver *pos; |
struct audio_driver *pos; |
344 |
|
char *driver = NULL, *options = NULL; |
345 |
|
|
346 |
drivers = NULL; |
drivers = NULL; |
347 |
|
|
348 |
|
rdpsnd_channel = |
349 |
|
channel_register("rdpsnd", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP, |
350 |
|
rdpsnd_process); |
351 |
|
|
352 |
|
if (rdpsnd_channel == NULL) |
353 |
|
{ |
354 |
|
error("channel_register\n"); |
355 |
|
return False; |
356 |
|
} |
357 |
|
|
358 |
|
if (optarg != NULL && strlen(optarg) > 0) |
359 |
|
{ |
360 |
|
driver = options = optarg; |
361 |
|
|
362 |
|
while (*options != '\0' && *options != ':') |
363 |
|
options++; |
364 |
|
|
365 |
|
if (*options == ':') |
366 |
|
{ |
367 |
|
*options = '\0'; |
368 |
|
options++; |
369 |
|
} |
370 |
|
|
371 |
|
if (*options == '\0') |
372 |
|
options = NULL; |
373 |
|
} |
374 |
|
|
375 |
rdpsnd_register_drivers(options); |
rdpsnd_register_drivers(options); |
376 |
|
|
377 |
if (!driver) |
if (!driver) |