--- Makefile.orig Sun Jun 11 20:35:47 2006 +++ Makefile Thu Feb 8 15:38:34 2007 @@ -105,6 +105,8 @@ $(X264_LIB) \ $(MUSEPACK_LIB) \ $(SPEEX_LIB) \ + -lcrypto \ + -lrtunes \ COMMON_LIBS = libmpcodecs/libmpcodecs.a \ $(W32_LIB) \ @@ -158,6 +160,7 @@ endif PARTS = libmpdemux \ + librtunes \ libmpcodecs \ libavutil \ libavcodec \ --- libao2/Makefile.orig Sun Jun 11 20:35:42 2006 +++ libao2/Makefile Thu Feb 8 15:38:34 2007 @@ -6,6 +6,7 @@ ao_mpegpes.c \ ao_null.c \ ao_pcm.c \ + ao_rtunes.c \ $(OPTIONAL_SRCS) \ OBJS=$(SRCS:.c=.o) --- libao2/ao_rtunes.c.orig Thu Feb 8 15:38:34 2007 +++ libao2/ao_rtunes.c Thu Feb 8 15:38:34 2007 @@ -0,0 +1,142 @@ +#include "config.h" + +#include +#include +#include + +#include "bswap.h" +#include "subopt-helper.h" +#include "libaf/af_format.h" +#include "audio_out.h" +#include "audio_out_internal.h" +#include "mp_msg.h" +#include "help_mp.h" + +static ao_info_t info = { + "Apple AirPort Express audio output", + "rtunes", + "Marcus Glocker", + "" +}; + +LIBAO_EXTERN(rtunes) + +extern int vo_pts; +static char *ao_device = NULL; + +/* to set/get/query special features/parameters */ +static int +control(int cmd, void *arg) +{ + return (-1); +} + +/* + * open & setup audio device + * return: 1 = success 0 = fail + */ +static int +init(int rate, int channels, int format, int flags) +{ + int bits; + + opt_t subopts[] = { + { "device", OPT_ARG_MSTRZ, &ao_device, NULL }, + { NULL } + }; + /* set defaults */ + /* + ao_device = strdup("192.168.1.23"); + */ + + if (subopt_parse(ao_subdevice, subopts) != 0) + return (0); + + /* + * bits is only equal to format if (format == 8) or (format == 16); + * this means that the following "if" is a kludge and should + * really be a switch to be correct in all cases + */ + bits = 8; + switch (format) { + case AF_FORMAT_S8: + format = AF_FORMAT_U8; + case AF_FORMAT_U8: + break; + default: + format = AF_FORMAT_S16_LE; + bits = 16; + break; + } + + ao_data.outburst = 16384; + ao_data.buffersize = 2 * 16384; + ao_data.channels = channels; + ao_data.samplerate = rate; + ao_data.format = format; + ao_data.bps = channels * rate * (bits / 8); + + if (rtunes_init(ao_device) == -1) + return (0); + + return (1); +} + +/* close audio device */ +static void +uninit(int immed) +{ + mp_msg(MSGT_AO, MSGL_INFO, "Closing rtunes stream, please wait ..."); + rtunes_close(); +} + +/* stop playing and empty buffers (for seeking/pause) */ +static void +reset(void) +{ + +} + +/* stop playing, keep buffers (for pause) */ +static void +audio_pause(void) +{ + /* for now, just call reset() */ + reset(); +} + +/* resume playing, after audio_pause() */ +static void +audio_resume(void) +{ + +} + +/* return: how many bytes can be played without blocking */ +static int +get_space(void) +{ + if (vo_pts) + return ao_data.pts < vo_pts ? ao_data.outburst : 0; + return (ao_data.outburst); +} + +/* + * plays 'len' bytes of 'data' + * it should round it down to outburst*n + * return: number of bytes played + */ +static int +play(void *data, int len, int flags) +{ + rtunes_play(data, len); + + return (len); +} + +/* return: delay in seconds between first and last sample in buffer */ +static float +get_delay(void) +{ + return (0.0); +} --- libao2/audio_out.c.orig Sun Jun 11 20:35:42 2006 +++ libao2/audio_out.c Thu Feb 8 15:38:34 2007 @@ -68,6 +68,7 @@ extern ao_functions_t audio_out_mpegpes; extern ao_functions_t audio_out_pcm; extern ao_functions_t audio_out_pss; +extern ao_functions_t audio_out_rtunes; ao_functions_t* audio_out_drivers[] = { @@ -129,6 +130,7 @@ &audio_out_null, // should not be auto-selected: &audio_out_pcm, + &audio_out_rtunes, NULL };