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
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
13 + * This file is part of libao, a cross-platform audio outputlibrary. See
14 + * README for a history of this source code.
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.
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.
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.
37 +#endif /* __cplusplus */
44 +/* --- Constants ---*/
46 +#define AO_TYPE_LIVE 1
47 +#define AO_TYPE_FILE 2
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
62 +#define AO_FMT_LITTLE 1
64 +#define AO_FMT_NATIVE 4
66 +/* --- Structures --- */
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;
80 +typedef struct ao_functions ao_functions;
81 +typedef struct ao_device ao_device;
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 */
91 +typedef struct ao_option {
94 + struct ao_option *next;
97 +#if defined(AO_BUILDING_LIBAO)
98 +#include "ao_private.h"
101 +/* --- Functions --- */
103 +/* library setup/teardown */
104 +void ao_initialize(void);
105 +void ao_shutdown(void);
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,
112 + const char *value);
113 +void ao_free_options(ao_option *options);
115 +char* ao_get_option(ao_option *options, const char* key);
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,
123 + ao_sample_format *format,
124 + ao_option *option);
126 +int ao_play(ao_device *device,
127 + char *output_samples,
128 + uint32_t num_bytes);
129 +int ao_close(ao_device *device);
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);
139 +int ao_is_big_endian(void);
144 +#endif /* __cplusplus */
146 +#endif /* __AO_H__ */
148 +extern struct AudioOutput g_ao;
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* );
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
174 #include <sys/signal.h>
181 #ifdef FANCY_RESAMPLING
186 - ao_play(dev, (char *)outbuf, play_samples*4);
187 + g_ao.ao_play(dev, (char *)outbuf, play_samples*4);
196 + g_ao.ao_initialize();
203 // otherwise choose the default
204 - driver = ao_default_driver_id();
205 + driver = g_ao.ao_default_driver_id();
208 ao_sample_format fmt;
213 - ao_append_option(&ao_opts, "name", "Streaming...");
214 + g_ao.ao_append_option(&ao_opts, "name", "Streaming...");
216 - dev = ao_open_live(driver, &fmt, ao_opts);
217 + dev = g_ao.ao_open_live(driver, &fmt, ao_opts);
219 die("Could not open ao device");
223 pthread_join(audio_thread, NULL);
226 + g_ao.ao_close(dev);
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
234 static char tPassword[56] = "";
235 static char tHWID[HWID_SIZE] = {0,51,52,53,54,55};
238 +struct AudioOutput g_ao;
239 +void shairport_set_ao(struct AudioOutput *ao)
246 int main(int argc, char **argv)
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
253 #include <sys/types.h>
260 void shairport_exit(void);
261 int shairport_loop(void);
262 int shairport_is_running(void);
263 +void shairport_set_ao(struct AudioOutput *ao);
267 #endif /* __cplusplus */