CVS: rdesktop rdpsnd.h, NONE, 1.1 rdpsnd.c, 1.10, 1.11 rdpsnd_alsa.c, 1.1, 1.2 rdpsnd_libao.c, 1.14, 1.15 rdpsnd_oss.c, 1.20, 1.21 rdpsnd_sgi.c, 1.9, 1.10 rdpsnd_sun.c, 1.16, 1.17
Michael Gernoth <[email protected]> Sun, 17 Sep 2006 03:32:22 -0700
| Newsgroups | gmane.network.rdesktop.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv25213
Modified Files:
rdpsnd.c rdpsnd_alsa.c rdpsnd_libao.c rdpsnd_oss.c
rdpsnd_sgi.c rdpsnd_sun.c
Added Files:
rdpsnd.h
Log Message:
unify queue-handling in rdpsnd.c (remove private copies from all
drivers)
--- NEW FILE: rdpsnd.h ---
/*
rdesktop: A Remote Desktop Protocol client.
Sound infrastructure
Copyright (C) Michael Gernoth 2006
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.
*/
struct audio_packet
{
struct stream s;
uint16 tick;
uint8 index;
};
extern BOOL g_dsp_busy;
extern int g_dsp_fd;
void rdpsnd_queue_write(STREAM s, uint16 tick, uint8 index);
inline struct audio_packet *rdpsnd_queue_current_packet(void);
inline BOOL rdpsnd_queue_empty(void);
inline void rdpsnd_queue_init(void);
inline void rdpsnd_queue_next(void);
inline int rdpsnd_queue_next_tick(void);
Index: rdpsnd.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** rdpsnd.c 8 Feb 2006 12:10:41 -0000 1.10
--- rdpsnd.c 17 Sep 2006 10:32:18 -0000 1.11
***************
*** 21,24 ****
--- 21,25 ----
#include "rdesktop.h"
+ #include "rdpsnd.h"
#define RDPSND_CLOSE 1
***************
*** 31,34 ****
--- 32,39 ----
#define MAX_FORMATS 10
+ #define MAX_QUEUE 10
+
+ BOOL g_dsp_busy = False;
+ int g_dsp_fd;
static VCHANNEL *rdpsnd_channel;
***************
*** 38,41 ****
--- 43,48 ----
static unsigned int format_count;
static unsigned int current_format;
+ static unsigned int queue_hi, queue_lo;
+ static struct audio_packet packet_queue[MAX_QUEUE];
static STREAM
***************
*** 67,71 ****
s = rdpsnd_init_packet(RDPSND_COMPLETION, 4);
! out_uint16_le(s, tick + 50);
out_uint8(s, packet_index);
out_uint8(s, 0);
--- 74,78 ----
s = rdpsnd_init_packet(RDPSND_COMPLETION, 4);
! out_uint16_le(s, tick);
out_uint8(s, packet_index);
out_uint8(s, 0);
***************
*** 215,219 ****
}
! wave_out_write(s, tick, packet_index);
awaiting_data_packet = False;
return;
--- 222,226 ----
}
! rdpsnd_queue_write(s, tick, packet_index);
awaiting_data_packet = False;
return;
***************
*** 261,264 ****
--- 268,336 ----
channel_register("rdpsnd", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP,
rdpsnd_process);
+
return (rdpsnd_channel != NULL);
}
+
+ void
+ rdpsnd_queue_write(STREAM s, uint16 tick, uint8 index)
+ {
+ struct audio_packet *packet = &packet_queue[queue_hi];
+ unsigned int next_hi = (queue_hi + 1) % MAX_QUEUE;
+
+ if (next_hi == queue_lo)
+ {
+ error("No space to queue audio packet\n");
+ return;
+ }
+
+ queue_hi = next_hi;
+
+ packet->s = *s;
+ packet->tick = tick;
+ packet->index = index;
+ packet->s.p += 4;
+
+ /* we steal the data buffer from s, give it a new one */
+ s->data = malloc(s->size);
+
+ if (!g_dsp_busy)
+ wave_out_play();
+ }
+
+ inline struct audio_packet *
+ rdpsnd_queue_current_packet(void)
+ {
+ return &packet_queue[queue_lo];
+ }
+
+ inline BOOL
+ rdpsnd_queue_empty(void)
+ {
+ return (queue_lo == queue_hi);
+ }
+
+ inline void
+ rdpsnd_queue_init(void)
+ {
+ queue_lo = queue_hi = 0;
+ }
+
+ inline void
+ rdpsnd_queue_next(void)
+ {
+ free(packet_queue[queue_lo].s.data);
+ queue_lo = (queue_lo + 1) % MAX_QUEUE;
+ }
+
+ inline int
+ rdpsnd_queue_next_tick(void)
+ {
+ if (((queue_lo + 1) % MAX_QUEUE) != queue_hi)
+ {
+ return packet_queue[(queue_lo + 1) % MAX_QUEUE].tick;
+ }
+ else
+ {
+ return (packet_queue[queue_lo].tick + 65535) % 65536;
+ }
+ }
Index: rdpsnd_alsa.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd_alsa.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rdpsnd_alsa.c 17 Sep 2006 10:00:55 -0000 1.1
--- rdpsnd_alsa.c 17 Sep 2006 10:32:18 -0000 1.2
***************
*** 22,25 ****
--- 22,26 ----
#include "rdesktop.h"
+ #include "rdpsnd.h"
#include <unistd.h>
#include <fcntl.h>
***************
*** 29,37 ****
#define DEFAULTDEVICE "default"
- #define MAX_QUEUE 10
#define MAX_FRAMES 32
- int g_dsp_fd;
- BOOL g_dsp_busy = False;
static snd_pcm_t *pcm_handle = NULL;
static snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK;
--- 30,35 ----
***************
*** 40,51 ****
static int audiochannels;
- static struct audio_packet
- {
- struct stream s;
- uint16 tick;
- uint8 index;
- } packet_queue[MAX_QUEUE];
- static unsigned int queue_hi, queue_lo;
-
BOOL
wave_out_open(void)
--- 38,41 ----
***************
*** 63,67 ****
g_dsp_fd = 0;
! queue_lo = queue_hi = 0;
reopened = True;
--- 53,57 ----
g_dsp_fd = 0;
! rdpsnd_queue_init();
reopened = True;
***************
*** 74,84 ****
{
/* Ack all remaining packets */
! while (queue_lo != queue_hi)
{
! rdpsnd_send_completion(packet_queue[queue_lo].tick, packet_queue[queue_lo].index);
! free(packet_queue[queue_lo].s.data);
! queue_lo = (queue_lo + 1) % MAX_QUEUE;
}
if (pcm_handle)
{
--- 64,75 ----
{
/* Ack all remaining packets */
! while (!rdpsnd_queue_empty())
{
! rdpsnd_send_completion(rdpsnd_queue_current_packet()->tick,
! rdpsnd_queue_current_packet()->index);
! rdpsnd_queue_next();
}
+
if (pcm_handle)
{
***************
*** 232,261 ****
void
- wave_out_write(STREAM s, uint16 tick, uint8 index)
- {
- struct audio_packet *packet = &packet_queue[queue_hi];
- unsigned int next_hi = (queue_hi + 1) % MAX_QUEUE;
-
- if (next_hi == queue_lo)
- {
- error("No space to queue audio packet\n");
- return;
- }
-
- queue_hi = next_hi;
-
- packet->s = *s;
- packet->tick = tick;
- packet->index = index;
- packet->s.p += 4;
-
- /* we steal the data buffer from s, give it a new one */
- s->data = (uint8 *) malloc(s->size);
-
- if (!g_dsp_busy)
- wave_out_play();
- }
-
- void
wave_out_play(void)
{
--- 223,226 ----
***************
*** 276,280 ****
}
! if (queue_lo == queue_hi)
{
g_dsp_busy = 0;
--- 241,245 ----
}
! if (rdpsnd_queue_empty())
{
g_dsp_busy = 0;
***************
*** 282,296 ****
}
! packet = &packet_queue[queue_lo];
out = &packet->s;
! if (((queue_lo + 1) % MAX_QUEUE) != queue_hi)
! {
! next_tick = packet_queue[(queue_lo + 1) % MAX_QUEUE].tick;
! }
! else
! {
! next_tick = (packet->tick + 65535) % 65536;
! }
len = (out->end - out->p) / (samplewidth * audiochannels);
--- 247,254 ----
}
! packet = rdpsnd_queue_current_packet();
out = &packet->s;
! next_tick = rdpsnd_queue_next_tick();
len = (out->end - out->p) / (samplewidth * audiochannels);
***************
*** 321,329 ****
}
! /* Until all drivers are using the windows sound-ticks, we need to
! substract the 50 ticks added later by rdpsnd.c */
! rdpsnd_send_completion(((packet->tick + duration) % 65536) - 50, packet->index);
! free(out->data);
! queue_lo = (queue_lo + 1) % MAX_QUEUE;
}
--- 279,284 ----
}
! rdpsnd_send_completion(((packet->tick + duration) % 65536), packet->index);
! rdpsnd_queue_next();
}
Index: rdpsnd_libao.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd_libao.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** rdpsnd_libao.c 9 Jul 2006 23:41:07 -0000 1.14
--- rdpsnd_libao.c 17 Sep 2006 10:32:18 -0000 1.15
***************
*** 4,8 ****
Copyright (C) Matthew Chapman 2003
Copyright (C) GuoJunBo [email protected] 2003
! Copyright (C) Michael Gernoth [email protected] 2005
This program is free software; you can redistribute it and/or modify
--- 4,8 ----
Copyright (C) Matthew Chapman 2003
Copyright (C) GuoJunBo [email protected] 2003
! Copyright (C) Michael Gernoth [email protected] 2005-2006
This program is free software; you can redistribute it and/or modify
***************
*** 22,25 ****
--- 22,26 ----
#include "rdesktop.h"
+ #include "rdpsnd.h"
#include <unistd.h>
#include <fcntl.h>
***************
*** 28,36 ****
#include <sys/time.h>
- #define MAX_QUEUE 10
#define WAVEOUTBUF 16
- int g_dsp_fd;
- BOOL g_dsp_busy = False;
static ao_device *o_device = NULL;
static int default_driver;
--- 29,34 ----
***************
*** 40,51 ****
static short samplewidth;
- static struct audio_packet
- {
- struct stream s;
- uint16 tick;
- uint8 index;
- } packet_queue[MAX_QUEUE];
- static unsigned int queue_hi, queue_lo;
-
BOOL
wave_out_open(void)
--- 38,41 ----
***************
*** 70,74 ****
g_dsp_fd = 0;
! queue_lo = queue_hi = 0;
reopened = True;
--- 60,64 ----
g_dsp_fd = 0;
! rdpsnd_queue_init();
reopened = True;
***************
*** 81,89 ****
{
/* Ack all remaining packets */
! while (queue_lo != queue_hi)
{
! rdpsnd_send_completion(packet_queue[queue_lo].tick, packet_queue[queue_lo].index);
! free(packet_queue[queue_lo].s.data);
! queue_lo = (queue_lo + 1) % MAX_QUEUE;
}
--- 71,79 ----
{
/* Ack all remaining packets */
! while (!rdpsnd_queue_empty())
{
! rdpsnd_send_completion(rdpsnd_queue_current_packet()->tick,
! rdpsnd_queue_current_packet()->index);
! rdpsnd_queue_next();
}
***************
*** 146,175 ****
void
- wave_out_write(STREAM s, uint16 tick, uint8 index)
- {
- struct audio_packet *packet = &packet_queue[queue_hi];
- unsigned int next_hi = (queue_hi + 1) % MAX_QUEUE;
-
- if (next_hi == queue_lo)
- {
- error("No space to queue audio packet\n");
- return;
- }
-
- queue_hi = next_hi;
-
- packet->s = *s;
- packet->tick = tick;
- packet->index = index;
- packet->s.p += 4;
-
- /* we steal the data buffer from s, give it a new one */
- s->data = malloc(s->size);
-
- if (!g_dsp_busy)
- wave_out_play();
- }
-
- void
wave_out_play(void)
{
--- 136,139 ----
***************
*** 191,195 ****
}
! if (queue_lo == queue_hi)
{
g_dsp_busy = 0;
--- 155,159 ----
}
! if (rdpsnd_queue_empty())
{
g_dsp_busy = 0;
***************
*** 197,211 ****
}
! packet = &packet_queue[queue_lo];
out = &packet->s;
! if (((queue_lo + 1) % MAX_QUEUE) != queue_hi)
! {
! next_tick = packet_queue[(queue_lo + 1) % MAX_QUEUE].tick;
! }
! else
! {
! next_tick = (packet->tick + 65535) % 65536;
! }
len = 0;
--- 161,168 ----
}
! packet = rdpsnd_queue_current_packet();
out = &packet->s;
! next_tick = rdpsnd_queue_next_tick();
len = 0;
***************
*** 262,270 ****
}
! /* Until all drivers are using the windows sound-ticks, we need to
! substract the 50 ticks added later by rdpsnd.c */
! rdpsnd_send_completion(((packet->tick + duration) % 65536) - 50, packet->index);
! free(out->data);
! queue_lo = (queue_lo + 1) % MAX_QUEUE;
}
--- 219,224 ----
}
! rdpsnd_send_completion(((packet->tick + duration) % 65536), packet->index);
! rdpsnd_queue_next();
}
Index: rdpsnd_oss.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd_oss.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** rdpsnd_oss.c 12 Jul 2006 09:57:05 -0000 1.20
--- rdpsnd_oss.c 17 Sep 2006 10:32:18 -0000 1.21
***************
*** 29,32 ****
--- 29,33 ----
#include "rdesktop.h"
+ #include "rdpsnd.h"
#include <unistd.h>
#include <fcntl.h>
***************
*** 36,55 ****
#include <sys/soundcard.h>
#define MAX_LEN 512
- #define MAX_QUEUE 10
- int g_dsp_fd;
- BOOL g_dsp_busy = False;
static int snd_rate;
static short samplewidth;
- static struct audio_packet
- {
- struct stream s;
- uint16 tick;
- uint8 index;
- } packet_queue[MAX_QUEUE];
- static unsigned int queue_hi, queue_lo;
-
BOOL
wave_out_open(void)
--- 37,46 ----
#include <sys/soundcard.h>
+ #define DEFAULTDEVICE "/dev/dsp"
#define MAX_LEN 512
static int snd_rate;
static short samplewidth;
BOOL
wave_out_open(void)
***************
*** 59,63 ****
if (dsp_dev == NULL)
{
! dsp_dev = xstrdup("/dev/dsp");
}
--- 50,54 ----
if (dsp_dev == NULL)
{
! dsp_dev = xstrdup(DEFAULTDEVICE);
}
***************
*** 202,231 ****
void
- wave_out_write(STREAM s, uint16 tick, uint8 index)
- {
- struct audio_packet *packet = &packet_queue[queue_hi];
- unsigned int next_hi = (queue_hi + 1) % MAX_QUEUE;
-
- if (next_hi == queue_lo)
- {
- error("No space to queue audio packet\n");
- return;
- }
-
- queue_hi = next_hi;
-
- packet->s = *s;
- packet->tick = tick;
- packet->index = index;
- packet->s.p += 4;
-
- /* we steal the data buffer from s, give it a new one */
- s->data = (uint8 *) malloc(s->size);
-
- if (!g_dsp_busy)
- wave_out_play();
- }
-
- void
wave_out_play(void)
{
--- 193,196 ----
***************
*** 238,242 ****
struct timeval tv;
! if (queue_lo == queue_hi)
{
g_dsp_busy = 0;
--- 203,207 ----
struct timeval tv;
! if (rdpsnd_queue_empty())
{
g_dsp_busy = 0;
***************
*** 244,248 ****
}
! packet = &packet_queue[queue_lo];
out = &packet->s;
--- 209,213 ----
}
! packet = rdpsnd_queue_current_packet();
out = &packet->s;
***************
*** 278,284 ****
if (elapsed >= (duration * 85) / 100)
{
! rdpsnd_send_completion(packet->tick, packet->index);
! free(out->data);
! queue_lo = (queue_lo + 1) % MAX_QUEUE;
started = False;
}
--- 243,250 ----
if (elapsed >= (duration * 85) / 100)
{
! /* We need to add 50 to tell windows that time has passed while
! * playing this packet */
! rdpsnd_send_completion(packet->tick + 50, packet->index);
! rdpsnd_queue_next();
started = False;
}
Index: rdpsnd_sgi.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd_sgi.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** rdpsnd_sgi.c 16 Dec 2005 07:48:02 -0000 1.9
--- rdpsnd_sgi.c 17 Sep 2006 10:32:18 -0000 1.10
***************
*** 29,39 ****
#define IRIX_MAX_VOL 65535
- #define MAX_QUEUE 10
-
- int g_dsp_fd;
ALconfig audioconfig;
ALport output_port;
- BOOL g_dsp_busy = False;
static BOOL g_swapaudio;
static int g_snd_rate;
--- 29,35 ----
***************
*** 45,56 ****
int combinedFrameSize;
- static struct audio_packet
- {
- struct stream s;
- uint16 tick;
- uint8 index;
- } packet_queue[MAX_QUEUE];
- static unsigned int queue_hi, queue_lo;
-
BOOL
wave_out_open(void)
--- 41,44 ----
***************
*** 59,68 ****
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "wave_out_open: begin\n");
#endif
if (alGetParamInfo(AL_DEFAULT_OUTPUT, AL_GAIN, &pinfo) < 0)
{
! fprintf(stderr, "wave_out_open: alGetParamInfo failed: %s\n",
alGetErrorString(oserror()));
}
--- 47,56 ----
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "sgi_open: begin\n");
#endif
if (alGetParamInfo(AL_DEFAULT_OUTPUT, AL_GAIN, &pinfo) < 0)
{
! fprintf(stderr, "sgi_open: alGetParamInfo failed: %s\n",
alGetErrorString(oserror()));
}
***************
*** 71,85 ****
volume_range = (max_volume - min_volume);
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "wave_out_open: minvol = %lf, maxvol= %lf, range = %lf.\n",
min_volume, max_volume, volume_range);
#endif
! queue_lo = queue_hi = 0;
audioconfig = alNewConfig();
if (audioconfig == (ALconfig) 0)
{
! fprintf(stderr, "wave_out_open: alNewConfig failed: %s\n",
! alGetErrorString(oserror()));
return False;
}
--- 59,72 ----
volume_range = (max_volume - min_volume);
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "sgi_open: minvol = %lf, maxvol= %lf, range = %lf.\n",
min_volume, max_volume, volume_range);
#endif
! rdpsnd_queue_init();
audioconfig = alNewConfig();
if (audioconfig == (ALconfig) 0)
{
! fprintf(stderr, "sgi_open: alNewConfig failed: %s\n", alGetErrorString(oserror()));
return False;
}
***************
*** 88,98 ****
if (output_port == (ALport) 0)
{
! fprintf(stderr, "wave_out_open: alOpenPort failed: %s\n",
! alGetErrorString(oserror()));
return False;
}
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "wave_out_open: returning\n");
#endif
return True;
--- 75,84 ----
if (output_port == (ALport) 0)
{
! fprintf(stderr, "sgi_open: alOpenPort failed: %s\n", alGetErrorString(oserror()));
return False;
}
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "sgi_open: returning\n");
#endif
return True;
***************
*** 104,115 ****
/* Ack all remaining packets */
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "wave_out_close: begin\n");
#endif
! while (queue_lo != queue_hi)
{
! rdpsnd_send_completion(packet_queue[queue_lo].tick, packet_queue[queue_lo].index);
! free(packet_queue[queue_lo].s.data);
! queue_lo = (queue_lo + 1) % MAX_QUEUE;
}
alDiscardFrames(output_port, 0);
--- 90,103 ----
/* Ack all remaining packets */
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "sgi_close: begin\n");
#endif
! while (!rdpsnd_queue_empty())
{
! /* We need to add 50 to tell windows that time has passed while
! * playing this packet */
! rdpsnd_send_completion(rdpsnd_queue_current_packet()->tick + 50,
! rdpsnd_queue_current_packet()->index);
! rdpsnd_queue_next();
}
alDiscardFrames(output_port, 0);
***************
*** 118,122 ****
alFreeConfig(audioconfig);
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "wave_out_close: returning\n");
#endif
}
--- 106,110 ----
alFreeConfig(audioconfig);
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "sgi_close: returning\n");
#endif
}
***************
*** 143,147 ****
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "wave_out_set_format: init...\n");
#endif
--- 131,135 ----
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "sgi_set_format: init...\n");
#endif
***************
*** 179,183 ****
if (output_port == (ALport) 0)
{
! fprintf(stderr, "wave_out_set_format: alOpenPort failed: %s\n",
alGetErrorString(oserror()));
return False;
--- 167,171 ----
if (output_port == (ALport) 0)
{
! fprintf(stderr, "sgi_set_format: alOpenPort failed: %s\n",
alGetErrorString(oserror()));
return False;
***************
*** 193,197 ****
if (frameSize == 0 || channelCount == 0)
{
! fprintf(stderr, "wave_out_set_format: bad frameSize or channelCount\n");
return False;
}
--- 181,185 ----
if (frameSize == 0 || channelCount == 0)
{
! fprintf(stderr, "sgi_set_format: bad frameSize or channelCount\n");
return False;
}
***************
*** 214,218 ****
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "wave_out_set_format: returning...\n");
#endif
return True;
--- 202,206 ----
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "sgi_set_format: returning...\n");
#endif
return True;
***************
*** 227,231 ****
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "wave_out_volume: begin\n");
fprintf(stderr, "left='%d', right='%d'\n", left, right);
#endif
--- 215,219 ----
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "sgi_volume: begin\n");
fprintf(stderr, "left='%d', right='%d'\n", left, right);
#endif
***************
*** 242,246 ****
if (alSetParams(AL_DEFAULT_OUTPUT, pv, 1) < 0)
{
! fprintf(stderr, "wave_out_volume: alSetParams failed: %s\n",
alGetErrorString(oserror()));
return;
--- 230,234 ----
if (alSetParams(AL_DEFAULT_OUTPUT, pv, 1) < 0)
{
! fprintf(stderr, "sgi_volume: alSetParams failed: %s\n",
alGetErrorString(oserror()));
return;
***************
*** 248,282 ****
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "wave_out_volume: returning\n");
#endif
}
void
- wave_out_write(STREAM s, uint16 tick, uint8 index)
- {
- struct audio_packet *packet = &packet_queue[queue_hi];
- unsigned int next_hi = (queue_hi + 1) % MAX_QUEUE;
-
- if (next_hi == queue_lo)
- {
- fprintf(stderr, "No space to queue audio packet\n");
- return;
- }
-
- queue_hi = next_hi;
-
- packet->s = *s;
- packet->tick = tick;
- packet->index = index;
- packet->s.p += 4;
-
- /* we steal the data buffer from s, give it a new one */
- s->data = malloc(s->size);
-
- if (!g_dsp_busy)
- wave_out_play();
- }
-
- void
wave_out_play(void)
{
--- 236,244 ----
#if (defined(IRIX_DEBUG))
! fprintf(stderr, "sgi_volume: returning\n");
#endif
}
void
wave_out_play(void)
{
***************
*** 291,295 ****
while (1)
{
! if (queue_lo == queue_hi)
{
g_dsp_busy = False;
--- 253,257 ----
while (1)
{
! if (rdpsnd_queue_empty())
{
g_dsp_busy = False;
***************
*** 297,301 ****
}
! packet = &packet_queue[queue_lo];
out = &packet->s;
--- 259,263 ----
}
! packet = rdpsnd_queue_current_packet();
out = &packet->s;
***************
*** 323,328 ****
{
rdpsnd_send_completion(packet->tick, packet->index);
! free(out->data);
! queue_lo = (queue_lo + 1) % MAX_QUEUE;
swapped = False;
}
--- 285,289 ----
{
rdpsnd_send_completion(packet->tick, packet->index);
! rdpsnd_queue_next();
swapped = False;
}
Index: rdpsnd_sun.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd_sun.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** rdpsnd_sun.c 4 Aug 2005 12:50:15 -0000 1.16
--- rdpsnd_sun.c 17 Sep 2006 10:32:18 -0000 1.17
***************
*** 4,8 ****
Copyright (C) Matthew Chapman 2003
Copyright (C) GuoJunBo [email protected] 2003
! Copyright (C) Michael Gernoth [email protected] 2003
This program is free software; you can redistribute it and/or modify
--- 4,8 ----
Copyright (C) Matthew Chapman 2003
Copyright (C) GuoJunBo [email protected] 2003
! Copyright (C) Michael Gernoth [email protected] 2003-2006
This program is free software; you can redistribute it and/or modify
***************
*** 22,25 ****
--- 22,26 ----
#include "rdesktop.h"
+ #include "rdpsnd.h"
#include <unistd.h>
#include <fcntl.h>
***************
*** 32,51 ****
#endif
! #define MAX_QUEUE 10
- int g_dsp_fd;
- BOOL g_dsp_busy = False;
static BOOL g_reopened;
static BOOL g_swapaudio;
static short g_samplewidth;
- static struct audio_packet
- {
- struct stream s;
- uint16 tick;
- uint8 index;
- } packet_queue[MAX_QUEUE];
- static unsigned int queue_hi, queue_lo;
-
BOOL
wave_out_open(void)
--- 33,42 ----
#endif
! #define DEFAULTDEVICE "/dev/audio"
static BOOL g_reopened;
static BOOL g_swapaudio;
static short g_samplewidth;
BOOL
wave_out_open(void)
***************
*** 55,59 ****
if (dsp_dev == NULL)
{
! dsp_dev = xstrdup("/dev/audio");
}
--- 46,50 ----
if (dsp_dev == NULL)
{
! dsp_dev = xstrdup(DEFAULTDEVICE);
}
***************
*** 67,71 ****
fcntl(g_dsp_fd, F_SETFL, fcntl(g_dsp_fd, F_GETFL) | O_NONBLOCK);
! queue_lo = queue_hi = 0;
g_reopened = True;
--- 58,62 ----
fcntl(g_dsp_fd, F_SETFL, fcntl(g_dsp_fd, F_GETFL) | O_NONBLOCK);
! rdpsnd_queue_init();
g_reopened = True;
***************
*** 77,85 ****
{
/* Ack all remaining packets */
! while (queue_lo != queue_hi)
{
! rdpsnd_send_completion(packet_queue[queue_lo].tick, packet_queue[queue_lo].index);
! free(packet_queue[queue_lo].s.data);
! queue_lo = (queue_lo + 1) % MAX_QUEUE;
}
--- 68,76 ----
{
/* Ack all remaining packets */
! while (!rdpsnd_queue_empty())
{
! rdpsnd_send_completion(rdpsnd_queue_current_packet()->tick,
! rdpsnd_queue_current_packet()->index);
! rdpsnd_queue_next();
}
***************
*** 194,223 ****
void
- wave_out_write(STREAM s, uint16 tick, uint8 index)
- {
- struct audio_packet *packet = &packet_queue[queue_hi];
- unsigned int next_hi = (queue_hi + 1) % MAX_QUEUE;
-
- if (next_hi == queue_lo)
- {
- error("No space to queue audio packet\n");
- return;
- }
-
- queue_hi = next_hi;
-
- packet->s = *s;
- packet->tick = tick;
- packet->index = index;
- packet->s.p += 4;
-
- /* we steal the data buffer from s, give it a new one */
- s->data = malloc(s->size);
-
- if (!g_dsp_busy)
- wave_out_play();
- }
-
- void
wave_out_play(void)
{
--- 185,188 ----
***************
*** 244,248 ****
}
! if (queue_lo == queue_hi)
{
g_dsp_busy = 0;
--- 209,213 ----
}
! if (rdpsnd_queue_empty())
{
g_dsp_busy = 0;
***************
*** 250,254 ****
}
! packet = &packet_queue[queue_lo];
out = &packet->s;
--- 215,219 ----
}
! packet = rdpsnd_queue_current_packet();
out = &packet->s;
***************
*** 298,304 ****
{
samplecnt += numsamples;
! rdpsnd_send_completion(packet->tick, packet->index);
! free(out->data);
! queue_lo = (queue_lo + 1) % MAX_QUEUE;
swapped = False;
sentcompletion = True;
--- 263,270 ----
{
samplecnt += numsamples;
! /* We need to add 50 to tell windows that time has passed while
! * playing this packet */
! rdpsnd_send_completion(packet->tick + 50, packet->index);
! rdpsnd_queue_next();
swapped = False;
sentcompletion = True;
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642