Support gles animation.
[vuplus_openvuplus] / meta-openvuplus / recipes-support / libshairport / libshairport / 001_add_ao.patch
1 diff -uP libshairport-1.2.0.20310_lib/src/ao.h ../../../../../libshairport-1.2.0.20310_lib/src/ao.h
2 --- src/ao.h    1970-01-01 01:00:00.000000000 +0100
3 +++ src/ao.h    2011-09-25 20:36:36.000000000 +0200
4 @@ -0,0 +1,156 @@
5 +/*
6 + *
7 + *  ao.h 
8 + *
9 + *  Original Copyright (C) Aaron Holtzman - May 1999
10 + *      Modifications Copyright (C) Stan Seibert - July 2000, July 2001
11 + *      More Modifications Copyright (C) Jack Moffitt - October 2000
12 + *
13 + *  This file is part of libao, a cross-platform audio outputlibrary.  See
14 + *  README for a history of this source code.
15 + *
16 + *  libao is free software; you can redistribute it and/or modify
17 + *  it under the terms of the GNU General Public License as published by
18 + *  the Free Software Foundation; either version 2, or (at your option)
19 + *  any later version.
20 + *
21 + *  libao is distributed in the hope that it will be useful,
22 + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
23 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 + *  GNU General Public License for more details.
25 + *
26 + *  You should have received a copy of the GNU General Public License
27 + *  along with GNU Make; see the file COPYING.  If not, write to
28 + *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
29 + *
30 + */
31 +#ifndef __AO_H__
32 +#define __AO_H__
33 +
34 +#ifdef __cplusplus
35 +extern "C"
36 +{
37 +#endif /* __cplusplus */
38 +
39 +#include <stdio.h>
40 +#include <stdlib.h>
41 +#include <stdint.h>
42 +#include <errno.h>
43 +
44 +/* --- Constants ---*/
45 +
46 +#define AO_TYPE_LIVE 1
47 +#define AO_TYPE_FILE 2
48 +
49 +
50 +#define AO_ENODRIVER   1
51 +#define AO_ENOTFILE    2
52 +#define AO_ENOTLIVE    3
53 +#define AO_EBADOPTION  4
54 +#define AO_EOPENDEVICE 5
55 +#define AO_EOPENFILE   6
56 +#define AO_EFILEEXISTS 7
57 +#define AO_EBADFORMAT  8
58 +
59 +#define AO_EFAIL       100
60 +
61 +
62 +#define AO_FMT_LITTLE 1
63 +#define AO_FMT_BIG    2
64 +#define AO_FMT_NATIVE 4
65 +
66 +/* --- Structures --- */
67 +
68 +typedef struct ao_info {
69 +  int  type; /* live output or file output? */
70 +  char *name; /* full name of driver */
71 +  char *short_name; /* short name of driver */
72 +        char *author; /* driver author */
73 +  char *comment; /* driver comment */
74 +  int  preferred_byte_format;
75 +  int  priority;
76 +  char **options;
77 +  int  option_count;
78 +} ao_info;
79 +
80 +typedef struct ao_functions ao_functions;
81 +typedef struct ao_device ao_device;
82 +
83 +typedef struct ao_sample_format {
84 +  int  bits; /* bits per sample */
85 +  int  rate; /* samples per second (in a single channel) */
86 +  int  channels; /* number of audio channels */
87 +  int  byte_format; /* Byte ordering in sample, see constants below */
88 +        char *matrix; /* input channel location/ordering */
89 +} ao_sample_format;
90 +
91 +typedef struct ao_option {
92 +  char *key;
93 +  char *value;
94 +  struct ao_option *next;
95 +} ao_option;
96 +
97 +#if defined(AO_BUILDING_LIBAO)
98 +#include "ao_private.h"
99 +#endif
100 +
101 +/* --- Functions --- */
102 +
103 +/* library setup/teardown */
104 +void ao_initialize(void);
105 +void ao_shutdown(void);
106 +
107 +/* device setup/playback/teardown */
108 +int   ao_append_global_option(const char *key,
109 +                              const char *value);
110 +int          ao_append_option(ao_option **options,
111 +                              const char *key,
112 +                              const char *value);
113 +void          ao_free_options(ao_option *options);
114 +
115 +char* ao_get_option(ao_option *options, const char* key);
116 +
117 +ao_device*       ao_open_live(int driver_id,
118 +                              ao_sample_format *format,
119 +                              ao_option *option);
120 +ao_device*       ao_open_file(int driver_id,
121 +                              const char *filename,
122 +                              int overwrite,
123 +                              ao_sample_format *format,
124 +                              ao_option *option);
125 +
126 +int                   ao_play(ao_device *device,
127 +                              char *output_samples,
128 +                              uint32_t num_bytes);
129 +int                  ao_close(ao_device *device);
130 +
131 +/* driver information */
132 +int              ao_driver_id(const char *short_name);
133 +int      ao_default_driver_id(void);
134 +ao_info       *ao_driver_info(int driver_id);
135 +ao_info **ao_driver_info_list(int *driver_count);
136 +char       *ao_file_extension(int driver_id);
137 +
138 +/* miscellaneous */
139 +int          ao_is_big_endian(void);
140 +
141 +
142 +#ifdef __cplusplus
143 +}
144 +#endif /* __cplusplus */
145 +
146 +#endif  /* __AO_H__ */
147 +
148 +extern struct AudioOutput g_ao;
149 +struct AudioOutput                                                                                                                                                                                              
150 +  {                                                                                                                                                                                                              
151 +      void (*ao_initialize)(void);                                                                                                                                                                               
152 +      int (*ao_play)(ao_device *, char *, uint32_t);                                                                                                                                                             
153 +      int (*ao_default_driver_id)(void);                                                                                                                                                                         
154 +      ao_device* (*ao_open_live)( int, ao_sample_format *, ao_option *);                                                                                                                                         
155 +      int (*ao_close)(ao_device *);                                                                                                                                                                              
156 +      /* -- Device Setup/Playback/Teardown -- */                                                                                                                                                                 
157 +      int (*ao_append_option)(ao_option **, const char *, const char *);                                                                                                                                         
158 +      void (*ao_free_options)(ao_option *);                                                                                                                                                                      
159 +      char* (*ao_get_option)(ao_option *, const char* );                                                                                                                                                         
160 +  }; 
161 diff -uP libshairport-1.2.0.20310_lib/src/hairtunes.c ../../../../../libshairport-1.2.0.20310_lib/src/hairtunes.c
162 --- src/hairtunes.c     2011-09-23 21:55:48.000000000 +0200
163 +++ src/hairtunes.c     2011-09-25 20:37:49.000000000 +0200
164 @@ -25,7 +25,7 @@
165   */
166  
167  #define XBMC
168 -//#defined HAS_AO
169 +#define HAS_AO
170  
171  #include <stdio.h>
172  #include <stdlib.h>
173 @@ -45,7 +45,7 @@
174  #include <sys/signal.h>
175  #include <fcntl.h>
176  #ifdef HAS_AO
177 -#include <ao/ao.h>
178 +#include "ao.h"
179  #endif
180  
181  #ifdef FANCY_RESAMPLING
182 @@ -881,7 +881,7 @@
183              }
184  #ifdef HAS_AO
185          } else {
186 -            ao_play(dev, (char *)outbuf, play_samples*4);
187 +            g_ao.ao_play(dev, (char *)outbuf, play_samples*4);
188  #endif
189          }
190      }
191 @@ -906,7 +906,7 @@
192  ao_device *dev;
193  
194  void* init_ao() {
195 -    ao_initialize();
196 +    g_ao.ao_initialize();
197  
198      int driver;
199  #ifndef XBMC
200 @@ -921,7 +921,7 @@
201  #endif
202      {
203          // otherwise choose the default
204 -        driver = ao_default_driver_id();
205 +        driver = g_ao.ao_default_driver_id();
206      }
207  
208      ao_sample_format fmt;
209 @@ -944,9 +944,9 @@
210      }
211  #endif
212  
213 -    ao_append_option(&ao_opts, "name", "Streaming...");
214 +    g_ao.ao_append_option(&ao_opts, "name", "Streaming...");
215  
216 -    dev = ao_open_live(driver, &fmt, ao_opts);
217 +    dev = g_ao.ao_open_live(driver, &fmt, ao_opts);
218      if (dev == NULL) {
219          die("Could not open ao device");
220      }
221 @@ -985,7 +985,7 @@
222    audio_running = 0;
223    pthread_join(audio_thread, NULL);
224  #ifdef HAS_AO
225 -  ao_close(dev);
226 +  g_ao.ao_close(dev);
227  #endif
228  }
229  
230 diff -uP libshairport-1.2.0.20310_lib/src/shairport.c ../../../../../libshairport-1.2.0.20310_lib/src/shairport.c
231 --- src/shairport.c     2011-08-21 01:57:56.000000000 +0200
232 +++ src/shairport.c     2011-09-25 20:44:40.000000000 +0200
233 @@ -92,6 +92,14 @@
234  static char tPassword[56] = "";
235  static char tHWID[HWID_SIZE] = {0,51,52,53,54,55};
236  
237 +#ifdef XBMC
238 +struct AudioOutput g_ao;
239 +void shairport_set_ao(struct AudioOutput *ao)
240 +{
241 + g_ao=*ao;
242 +}
243 +#endif
244 +
245  #ifndef XBMC
246  int main(int argc, char **argv)
247  #else
248 diff -uP libshairport-1.2.0.20310_lib/src/shairport.h ../../../../../libshairport-1.2.0.20310_lib/src/shairport.h
249 --- src/shairport.h     2011-08-21 01:58:11.000000000 +0200
250 +++ src/shairport.h     2011-09-25 20:36:43.000000000 +0200
251 @@ -11,6 +11,7 @@
252  #include <regex.h>
253  #include <sys/types.h>
254  #include <regex.h>
255 +#include "ao.h"
256  
257  
258  #define HWID_SIZE 6
259 @@ -62,9 +63,11 @@
260  void shairport_exit(void);
261  int shairport_loop(void);
262  int shairport_is_running(void);
263 +void shairport_set_ao(struct AudioOutput *ao);
264  
265  #ifdef __cplusplus
266  }
267  #endif /* __cplusplus */
268  
269  #endif
270 +