21 |
|
|
22 |
#include "rdesktop.h" |
#include "rdesktop.h" |
23 |
#include "rdpsnd.h" |
#include "rdpsnd.h" |
24 |
|
#include "rdpsnd_dsp.h" |
25 |
|
|
26 |
#define RDPSND_CLOSE 1 |
#define RDPSND_CLOSE 1 |
27 |
#define RDPSND_WRITE 2 |
#define RDPSND_WRITE 2 |
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 |
current_driver->wave_out_write(s, tick, packet_index); |
/* Insert the 4 missing bytes retrieved from last RDPSND_WRITE */ |
231 |
|
memcpy(s->data, missing_bytes, 4); |
232 |
|
|
233 |
|
current_driver-> |
234 |
|
wave_out_write(rdpsnd_dsp_process |
235 |
|
(s, current_driver, &formats[current_format]), tick, |
236 |
|
packet_index); |
237 |
awaiting_data_packet = False; |
awaiting_data_packet = False; |
238 |
return; |
return; |
239 |
} |
} |
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: |
319 |
*reg = alsa_register(options); |
*reg = alsa_register(options); |
320 |
reg = &((*reg)->next); |
reg = &((*reg)->next); |
321 |
#endif |
#endif |
|
#if defined(RDPSND_OSS) |
|
|
*reg = oss_register(options); |
|
|
reg = &((*reg)->next); |
|
|
#endif |
|
322 |
#if defined(RDPSND_SUN) |
#if defined(RDPSND_SUN) |
323 |
*reg = sun_register(options); |
*reg = sun_register(options); |
324 |
reg = &((*reg)->next); |
reg = &((*reg)->next); |
325 |
#endif |
#endif |
326 |
|
#if defined(RDPSND_OSS) |
327 |
|
*reg = oss_register(options); |
328 |
|
reg = &((*reg)->next); |
329 |
|
#endif |
330 |
#if defined(RDPSND_SGI) |
#if defined(RDPSND_SGI) |
331 |
*reg = sgi_register(options); |
*reg = sgi_register(options); |
332 |
reg = &((*reg)->next); |
reg = &((*reg)->next); |
405 |
packet->s = *s; |
packet->s = *s; |
406 |
packet->tick = tick; |
packet->tick = tick; |
407 |
packet->index = index; |
packet->index = index; |
|
packet->s.p += 4; |
|
|
|
|
|
/* we steal the data buffer from s, give it a new one */ |
|
|
s->data = malloc(s->size); |
|
408 |
|
|
409 |
if (!g_dsp_busy) |
if (!g_dsp_busy) |
410 |
current_driver->wave_out_play(); |
current_driver->wave_out_play(); |
431 |
inline void |
inline void |
432 |
rdpsnd_queue_next(void) |
rdpsnd_queue_next(void) |
433 |
{ |
{ |
434 |
free(packet_queue[queue_lo].s.data); |
xfree(packet_queue[queue_lo].s.data); |
435 |
queue_lo = (queue_lo + 1) % MAX_QUEUE; |
queue_lo = (queue_lo + 1) % MAX_QUEUE; |
436 |
} |
} |
437 |
|
|