/[rdesktop]/sourceforge.net/rdesktop/trunk/rdpsnd.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/rdesktop/trunk/rdpsnd.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1271 by stargo, Mon Sep 18 21:42:50 2006 UTC revision 1299 by ossman_, Thu Oct 19 11:28:53 2006 UTC
# Line 19  Line 19 
19     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */  */
21    
22    #include <assert.h>
23    
24  #include "rdesktop.h"  #include "rdesktop.h"
25  #include "rdpsnd.h"  #include "rdpsnd.h"
26  #include "rdpsnd_dsp.h"  #include "rdpsnd_dsp.h"
# Line 276  rdpsnd_process(STREAM s) Line 278  rdpsnd_process(STREAM s)
278          }          }
279  }  }
280    
281  BOOL  static BOOL
 rdpsnd_init(void)  
 {  
         rdpsnd_channel =  
                 channel_register("rdpsnd", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP,  
                                  rdpsnd_process);  
   
         return (rdpsnd_channel != NULL);  
 }  
   
 BOOL  
282  rdpsnd_auto_open(void)  rdpsnd_auto_open(void)
283  {  {
284          static BOOL failed = False;          static BOOL failed = False;
# Line 316  rdpsnd_auto_open(void) Line 308  rdpsnd_auto_open(void)
308          return False;          return False;
309  }  }
310    
311  void  static void
312  rdpsnd_register_drivers(char *options)  rdpsnd_register_drivers(char *options)
313  {  {
314          struct audio_driver **reg;          struct audio_driver **reg;
# Line 326  rdpsnd_register_drivers(char *options) Line 318  rdpsnd_register_drivers(char *options)
318          reg = &drivers;          reg = &drivers;
319  #if defined(RDPSND_ALSA)  #if defined(RDPSND_ALSA)
320          *reg = alsa_register(options);          *reg = alsa_register(options);
321            assert(*reg);
322          reg = &((*reg)->next);          reg = &((*reg)->next);
323  #endif  #endif
324  #if defined(RDPSND_SUN)  #if defined(RDPSND_SUN)
325          *reg = sun_register(options);          *reg = sun_register(options);
326            assert(*reg);
327          reg = &((*reg)->next);          reg = &((*reg)->next);
328  #endif  #endif
329  #if defined(RDPSND_OSS)  #if defined(RDPSND_OSS)
330          *reg = oss_register(options);          *reg = oss_register(options);
331            assert(*reg);
332          reg = &((*reg)->next);          reg = &((*reg)->next);
333  #endif  #endif
334  #if defined(RDPSND_SGI)  #if defined(RDPSND_SGI)
335          *reg = sgi_register(options);          *reg = sgi_register(options);
336            assert(*reg);
337          reg = &((*reg)->next);          reg = &((*reg)->next);
338  #endif  #endif
339  #if defined(RDPSND_LIBAO)  #if defined(RDPSND_LIBAO)
340          *reg = libao_register(options);          *reg = libao_register(options);
341        assert(*reg);
342          reg = &((*reg)->next);          reg = &((*reg)->next);
343  #endif  #endif
344  }  }
345    
346  BOOL  BOOL
347  rdpsnd_select_driver(char *driver, char *options)  rdpsnd_init(char *optarg)
348  {  {
349          static struct audio_driver auto_driver;          static struct audio_driver auto_driver;
350          struct audio_driver *pos;          struct audio_driver *pos;
351            char *driver = NULL, *options = NULL;
352    
353          drivers = NULL;          drivers = NULL;
354    
355            rdpsnd_channel =
356                    channel_register("rdpsnd", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP,
357                                     rdpsnd_process);
358    
359            if (rdpsnd_channel == NULL)
360            {
361                    error("channel_register\n");
362                    return False;
363            }
364    
365            if (optarg != NULL && strlen(optarg) > 0)
366            {
367                    driver = options = optarg;
368    
369                    while (*options != '\0' && *options != ':')
370                            options++;
371    
372                    if (*options == ':')
373                    {
374                            *options = '\0';
375                            options++;
376                    }
377    
378                    if (*options == '\0')
379                            options = NULL;
380            }
381    
382          rdpsnd_register_drivers(options);          rdpsnd_register_drivers(options);
383    
384          if (!driver)          if (!driver)
# Line 391  rdpsnd_show_help(void) Line 417  rdpsnd_show_help(void)
417          }          }
418  }  }
419    
420  inline void  void
421  rdpsnd_play(void)  rdpsnd_play(void)
422  {  {
423          current_driver->wave_out_play();          current_driver->wave_out_play();
# Line 419  rdpsnd_queue_write(STREAM s, uint16 tick Line 445  rdpsnd_queue_write(STREAM s, uint16 tick
445                  current_driver->wave_out_play();                  current_driver->wave_out_play();
446  }  }
447    
448  inline struct audio_packet *  struct audio_packet *
449  rdpsnd_queue_current_packet(void)  rdpsnd_queue_current_packet(void)
450  {  {
451          return &packet_queue[queue_lo];          return &packet_queue[queue_lo];
452  }  }
453    
454  inline BOOL  BOOL
455  rdpsnd_queue_empty(void)  rdpsnd_queue_empty(void)
456  {  {
457          return (queue_lo == queue_hi);          return (queue_lo == queue_hi);
458  }  }
459    
460  inline void  void
461  rdpsnd_queue_init(void)  rdpsnd_queue_init(void)
462  {  {
463          queue_lo = queue_hi = 0;          queue_lo = queue_hi = 0;
464  }  }
465    
466  inline void  void
467  rdpsnd_queue_next(void)  rdpsnd_queue_next(void)
468  {  {
469          xfree(packet_queue[queue_lo].s.data);          xfree(packet_queue[queue_lo].s.data);
470          queue_lo = (queue_lo + 1) % MAX_QUEUE;          queue_lo = (queue_lo + 1) % MAX_QUEUE;
471  }  }
472    
473  inline int  int
474  rdpsnd_queue_next_tick(void)  rdpsnd_queue_next_tick(void)
475  {  {
476          if (((queue_lo + 1) % MAX_QUEUE) != queue_hi)          if (((queue_lo + 1) % MAX_QUEUE) != queue_hi)

Legend:
Removed from v.1271  
changed lines
  Added in v.1299

  ViewVC Help
Powered by ViewVC 1.1.26