Add libglade2 needed for virt-viewer
[fedora-mingw.git] / SDL / SDL-1.2.13-pulse-rework.patch
1 --- SDL-1.2.13/src/audio/pulse/SDL_pulseaudio.c 2007-12-31 05:47:58.000000000 +0100
2 +++ SDL-1.2.13.lennart/src/audio/pulse/SDL_pulseaudio.c 2008-03-31 16:09:05.000000000 +0200
3 @@ -1,3 +1,4 @@
4 +/* -*- Mode: C; c-basic-offset: 8; indent-tabs-mode: t -*- */
5  /*
6      SDL - Simple DirectMedia Layer
7      Copyright (C) 1997-2007 Sam Lantinga
8 @@ -18,7 +19,7 @@
9  
10      Stéphan Kochen
11      stephan@kochen.nl
12 -    
13 +
14      Based on parts of the ALSA and ESounD output drivers.
15  */
16  #include "SDL_config.h"
17 @@ -78,14 +79,14 @@ static int (*SDL_NAME(pa_simple_write))(
18         pa_simple *s,
19         const void *data,
20         size_t length,
21 -       int *error 
22 +       int *error
23  );
24  static pa_channel_map* (*SDL_NAME(pa_channel_map_init_auto))(
25         pa_channel_map *m,
26         unsigned channels,
27         pa_channel_map_def_t def
28  );
29 -       
30 +
31  
32  static struct {
33         const char *name;
34 @@ -158,16 +159,16 @@ static int Audio_Available(void)
35         if ( LoadPulseLibrary() < 0 ) {
36                 return available;
37         }
38 -       
39 +
40         /* Connect with a dummy format. */
41         paspec.format = PA_SAMPLE_U8;
42         paspec.rate = 11025;
43         paspec.channels = 1;
44         connection = SDL_NAME(pa_simple_new)(
45 -               SDL_getenv("PASERVER"),      /* server */
46 +               NULL,                        /* server */
47                 "Test stream",               /* application name */
48                 PA_STREAM_PLAYBACK,          /* playback mode */
49 -               SDL_getenv("PADEVICE"),      /* device on the server */
50 +               NULL,                        /* device on the server */
51                 "Simple DirectMedia Layer",  /* stream description */
52                 &paspec,                     /* sample format spec */
53                 NULL,                        /* channel map */
54 @@ -178,7 +179,7 @@ static int Audio_Available(void)
55                 available = 1;
56                 SDL_NAME(pa_simple_free)(connection);
57         }
58 -       
59 +
60         UnloadPulseLibrary();
61         return(available);
62  }
63 @@ -233,7 +234,7 @@ static void PULSE_WaitAudio(_THIS)
64  {
65         /* Check to see if the thread-parent process is still alive */
66         { static int cnt = 0;
67 -               /* Note that this only works with thread implementations 
68 +               /* Note that this only works with thread implementations
69                    that use a different process id for each thread.
70                 */
71                 if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */
72 @@ -302,7 +303,7 @@ static int PULSE_OpenAudio(_THIS, SDL_Au
73         pa_sample_spec  paspec;
74         pa_buffer_attr  paattr;
75         pa_channel_map  pacmap;
76 -       
77 +
78         paspec.format = PA_SAMPLE_INVALID;
79         for ( test_format = SDL_FirstAudioFormat(spec->format); test_format; ) {
80                 switch ( test_format ) {
81 @@ -324,7 +325,7 @@ static int PULSE_OpenAudio(_THIS, SDL_Au
82                 return(-1);
83         }
84         spec->format = test_format;
85 -       
86 +
87         paspec.channels = spec->channels;
88         paspec.rate = spec->freq;
89  
90 @@ -338,25 +339,24 @@ static int PULSE_OpenAudio(_THIS, SDL_Au
91                 return(-1);
92         }
93         SDL_memset(mixbuf, spec->silence, spec->size);
94 -       
95 +
96         /* Reduced prebuffering compared to the defaults. */
97 -       paattr.tlength = mixlen;
98 +       paattr.tlength = mixlen*2;
99         paattr.minreq = mixlen;
100 -       paattr.fragsize = mixlen;
101 -       paattr.prebuf = mixlen;
102 -       paattr.maxlength = mixlen * 4;
103 -       
104 +       paattr.prebuf = mixlen*2;
105 +       paattr.maxlength = mixlen*2;
106 +
107         /* The SDL ALSA output hints us that we use Windows' channel mapping */
108         /* http://bugzilla.libsdl.org/show_bug.cgi?id=110 */
109         SDL_NAME(pa_channel_map_init_auto)(
110                 &pacmap, spec->channels, PA_CHANNEL_MAP_WAVEEX);
111 -       
112 +
113         /* Connect to the PulseAudio server */
114         stream = SDL_NAME(pa_simple_new)(
115 -               SDL_getenv("PASERVER"),      /* server */
116 +               NULL,                        /* server */
117                 get_progname(),              /* application name */
118                 PA_STREAM_PLAYBACK,          /* playback mode */
119 -               SDL_getenv("PADEVICE"),      /* device on the server */
120 +               NULL,                        /* device on the server */
121                 "Simple DirectMedia Layer",  /* stream description */
122                 &paspec,                     /* sample format spec */
123                 &pacmap,                     /* channel map */
124 @@ -371,7 +371,6 @@ static int PULSE_OpenAudio(_THIS, SDL_Au
125  
126         /* Get the parent process id (we're the parent of the audio thread) */
127         parent = getpid();
128 -       
129 +
130         return(0);
131  }
132 -