mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
new package: add package 'libshairport'
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
bc366bd56a
commit
36ebf90953
35
packages/devel/libshairport/build
Executable file
35
packages/devel/libshairport/build
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# This Program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This Program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenELEC.tv; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
. config/options $1
|
||||
|
||||
cd $PKG_BUILD
|
||||
./configure --host=$TARGET_NAME \
|
||||
--build=$HOST_NAME \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc \
|
||||
--disable-static \
|
||||
--enable-shared \
|
||||
|
||||
make
|
||||
|
||||
$MAKEINSTALL
|
26
packages/devel/libshairport/install
Executable file
26
packages/devel/libshairport/install
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# This Program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This Program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenELEC.tv; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
. config/options $1
|
||||
|
||||
mkdir -p $INSTALL/usr/lib
|
||||
cp -P $PKG_BUILD/src/.libs/*.so* $INSTALL/usr/lib
|
36
packages/devel/libshairport/meta
Normal file
36
packages/devel/libshairport/meta
Normal file
@ -0,0 +1,36 @@
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
|
||||
#
|
||||
# This Program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This Program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenELEC.tv; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
PKG_NAME="libshairport"
|
||||
PKG_VERSION="1.2.0.20310_lib"
|
||||
PKG_REV="1"
|
||||
PKG_ARCH="any"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="http://www.xbmc.org"
|
||||
PKG_URL="http://mirrors.xbmc.org/build-deps/darwin-libs/${PKG_NAME}-${PKG_VERSION}.tar.gz"
|
||||
PKG_DEPENDS=""
|
||||
PKG_BUILD_DEPENDS="toolchain"
|
||||
PKG_PRIORITY="optional"
|
||||
PKG_SECTION="network"
|
||||
PKG_SHORTDESC="libshairport: emulates AirPort Express"
|
||||
PKG_LONGDESC="libshairPort emulates an AirPort Express for the purpose of streaming music from iTunes and compatible iPods."
|
||||
PKG_IS_ADDON="no"
|
||||
|
||||
PKG_AUTORECONF="yes"
|
@ -0,0 +1,270 @@
|
||||
diff -uP libshairport-1.2.0.20310_lib/src/ao.h ../../../../../libshairport-1.2.0.20310_lib/src/ao.h
|
||||
--- a/src/ao.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ b/src/ao.h 2011-09-25 20:36:36.000000000 +0200
|
||||
@@ -0,0 +1,156 @@
|
||||
+/*
|
||||
+ *
|
||||
+ * ao.h
|
||||
+ *
|
||||
+ * Original Copyright (C) Aaron Holtzman - May 1999
|
||||
+ * Modifications Copyright (C) Stan Seibert - July 2000, July 2001
|
||||
+ * More Modifications Copyright (C) Jack Moffitt - October 2000
|
||||
+ *
|
||||
+ * This file is part of libao, a cross-platform audio outputlibrary. See
|
||||
+ * README for a history of this source code.
|
||||
+ *
|
||||
+ * libao is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2, or (at your option)
|
||||
+ * any later version.
|
||||
+ *
|
||||
+ * libao is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with GNU Make; see the file COPYING. If not, write to
|
||||
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
+ *
|
||||
+ */
|
||||
+#ifndef __AO_H__
|
||||
+#define __AO_H__
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+extern "C"
|
||||
+{
|
||||
+#endif /* __cplusplus */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <stdint.h>
|
||||
+#include <errno.h>
|
||||
+
|
||||
+/* --- Constants ---*/
|
||||
+
|
||||
+#define AO_TYPE_LIVE 1
|
||||
+#define AO_TYPE_FILE 2
|
||||
+
|
||||
+
|
||||
+#define AO_ENODRIVER 1
|
||||
+#define AO_ENOTFILE 2
|
||||
+#define AO_ENOTLIVE 3
|
||||
+#define AO_EBADOPTION 4
|
||||
+#define AO_EOPENDEVICE 5
|
||||
+#define AO_EOPENFILE 6
|
||||
+#define AO_EFILEEXISTS 7
|
||||
+#define AO_EBADFORMAT 8
|
||||
+
|
||||
+#define AO_EFAIL 100
|
||||
+
|
||||
+
|
||||
+#define AO_FMT_LITTLE 1
|
||||
+#define AO_FMT_BIG 2
|
||||
+#define AO_FMT_NATIVE 4
|
||||
+
|
||||
+/* --- Structures --- */
|
||||
+
|
||||
+typedef struct ao_info {
|
||||
+ int type; /* live output or file output? */
|
||||
+ char *name; /* full name of driver */
|
||||
+ char *short_name; /* short name of driver */
|
||||
+ char *author; /* driver author */
|
||||
+ char *comment; /* driver comment */
|
||||
+ int preferred_byte_format;
|
||||
+ int priority;
|
||||
+ char **options;
|
||||
+ int option_count;
|
||||
+} ao_info;
|
||||
+
|
||||
+typedef struct ao_functions ao_functions;
|
||||
+typedef struct ao_device ao_device;
|
||||
+
|
||||
+typedef struct ao_sample_format {
|
||||
+ int bits; /* bits per sample */
|
||||
+ int rate; /* samples per second (in a single channel) */
|
||||
+ int channels; /* number of audio channels */
|
||||
+ int byte_format; /* Byte ordering in sample, see constants below */
|
||||
+ char *matrix; /* input channel location/ordering */
|
||||
+} ao_sample_format;
|
||||
+
|
||||
+typedef struct ao_option {
|
||||
+ char *key;
|
||||
+ char *value;
|
||||
+ struct ao_option *next;
|
||||
+} ao_option;
|
||||
+
|
||||
+#if defined(AO_BUILDING_LIBAO)
|
||||
+#include "ao_private.h"
|
||||
+#endif
|
||||
+
|
||||
+/* --- Functions --- */
|
||||
+
|
||||
+/* library setup/teardown */
|
||||
+void ao_initialize(void);
|
||||
+void ao_shutdown(void);
|
||||
+
|
||||
+/* device setup/playback/teardown */
|
||||
+int ao_append_global_option(const char *key,
|
||||
+ const char *value);
|
||||
+int ao_append_option(ao_option **options,
|
||||
+ const char *key,
|
||||
+ const char *value);
|
||||
+void ao_free_options(ao_option *options);
|
||||
+
|
||||
+char* ao_get_option(ao_option *options, const char* key);
|
||||
+
|
||||
+ao_device* ao_open_live(int driver_id,
|
||||
+ ao_sample_format *format,
|
||||
+ ao_option *option);
|
||||
+ao_device* ao_open_file(int driver_id,
|
||||
+ const char *filename,
|
||||
+ int overwrite,
|
||||
+ ao_sample_format *format,
|
||||
+ ao_option *option);
|
||||
+
|
||||
+int ao_play(ao_device *device,
|
||||
+ char *output_samples,
|
||||
+ uint32_t num_bytes);
|
||||
+int ao_close(ao_device *device);
|
||||
+
|
||||
+/* driver information */
|
||||
+int ao_driver_id(const char *short_name);
|
||||
+int ao_default_driver_id(void);
|
||||
+ao_info *ao_driver_info(int driver_id);
|
||||
+ao_info **ao_driver_info_list(int *driver_count);
|
||||
+char *ao_file_extension(int driver_id);
|
||||
+
|
||||
+/* miscellaneous */
|
||||
+int ao_is_big_endian(void);
|
||||
+
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+}
|
||||
+#endif /* __cplusplus */
|
||||
+
|
||||
+#endif /* __AO_H__ */
|
||||
+
|
||||
+extern struct AudioOutput g_ao;
|
||||
+struct AudioOutput
|
||||
+ {
|
||||
+ void (*ao_initialize)(void);
|
||||
+ int (*ao_play)(ao_device *, char *, uint32_t);
|
||||
+ int (*ao_default_driver_id)(void);
|
||||
+ ao_device* (*ao_open_live)( int, ao_sample_format *, ao_option *);
|
||||
+ int (*ao_close)(ao_device *);
|
||||
+ /* -- Device Setup/Playback/Teardown -- */
|
||||
+ int (*ao_append_option)(ao_option **, const char *, const char *);
|
||||
+ void (*ao_free_options)(ao_option *);
|
||||
+ char* (*ao_get_option)(ao_option *, const char* );
|
||||
+ };
|
||||
diff -uP libshairport-1.2.0.20310_lib/src/hairtunes.c ../../../../../libshairport-1.2.0.20310_lib/src/hairtunes.c
|
||||
--- a/src/hairtunes.c 2011-09-23 21:55:48.000000000 +0200
|
||||
+++ b/src/hairtunes.c 2011-09-25 20:37:49.000000000 +0200
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#define XBMC
|
||||
-//#defined HAS_AO
|
||||
+#define HAS_AO
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -45,7 +45,7 @@
|
||||
#include <sys/signal.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef HAS_AO
|
||||
-#include <ao/ao.h>
|
||||
+#include "ao.h"
|
||||
#endif
|
||||
|
||||
#ifdef FANCY_RESAMPLING
|
||||
@@ -881,7 +881,7 @@
|
||||
}
|
||||
#ifdef HAS_AO
|
||||
} else {
|
||||
- ao_play(dev, (char *)outbuf, play_samples*4);
|
||||
+ g_ao.ao_play(dev, (char *)outbuf, play_samples*4);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -906,7 +906,7 @@
|
||||
ao_device *dev;
|
||||
|
||||
void* init_ao() {
|
||||
- ao_initialize();
|
||||
+ g_ao.ao_initialize();
|
||||
|
||||
int driver;
|
||||
#ifndef XBMC
|
||||
@@ -921,7 +921,7 @@
|
||||
#endif
|
||||
{
|
||||
// otherwise choose the default
|
||||
- driver = ao_default_driver_id();
|
||||
+ driver = g_ao.ao_default_driver_id();
|
||||
}
|
||||
|
||||
ao_sample_format fmt;
|
||||
@@ -944,9 +944,9 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
- ao_append_option(&ao_opts, "name", "Streaming...");
|
||||
+ g_ao.ao_append_option(&ao_opts, "name", "Streaming...");
|
||||
|
||||
- dev = ao_open_live(driver, &fmt, ao_opts);
|
||||
+ dev = g_ao.ao_open_live(driver, &fmt, ao_opts);
|
||||
if (dev == NULL) {
|
||||
die("Could not open ao device");
|
||||
}
|
||||
@@ -985,7 +985,7 @@
|
||||
audio_running = 0;
|
||||
pthread_join(audio_thread, NULL);
|
||||
#ifdef HAS_AO
|
||||
- ao_close(dev);
|
||||
+ g_ao.ao_close(dev);
|
||||
#endif
|
||||
}
|
||||
|
||||
diff -uP libshairport-1.2.0.20310_lib/src/shairport.c ../../../../../libshairport-1.2.0.20310_lib/src/shairport.c
|
||||
--- a/src/shairport.c 2011-08-21 01:57:56.000000000 +0200
|
||||
+++ b/src/shairport.c 2011-09-25 20:44:40.000000000 +0200
|
||||
@@ -92,6 +92,14 @@
|
||||
static char tPassword[56] = "";
|
||||
static char tHWID[HWID_SIZE] = {0,51,52,53,54,55};
|
||||
|
||||
+#ifdef XBMC
|
||||
+struct AudioOutput g_ao;
|
||||
+void shairport_set_ao(struct AudioOutput *ao)
|
||||
+{
|
||||
+ g_ao=*ao;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#ifndef XBMC
|
||||
int main(int argc, char **argv)
|
||||
#else
|
||||
diff -uP libshairport-1.2.0.20310_lib/src/shairport.h ../../../../../libshairport-1.2.0.20310_lib/src/shairport.h
|
||||
--- a/src/shairport.h 2011-08-21 01:58:11.000000000 +0200
|
||||
+++ b/src/shairport.h 2011-09-25 20:36:43.000000000 +0200
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <regex.h>
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
+#include "ao.h"
|
||||
|
||||
|
||||
#define HWID_SIZE 6
|
||||
@@ -62,9 +63,11 @@
|
||||
void shairport_exit(void);
|
||||
int shairport_loop(void);
|
||||
int shairport_is_running(void);
|
||||
+void shairport_set_ao(struct AudioOutput *ao);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
+
|
@ -0,0 +1,12 @@
|
||||
--- a/src/Makefile.am.old 2011-09-23 23:14:39.000000000 +0200
|
||||
+++ b/src/Makefile.am 2011-09-25 21:38:08.000000000 +0200
|
||||
@@ -1,7 +1,7 @@
|
||||
lib_LTLIBRARIES=libshairport.la
|
||||
|
||||
-library_includedir=$(includedir)
|
||||
-library_include_HEADERS = shairport.h
|
||||
+library_includedir=$(includedir)/shairport
|
||||
+library_include_HEADERS = shairport.h ao.h socketlib.h
|
||||
|
||||
libshairport_la_SOURCES=shairport.c hairtunes.c socketlib.c alac.c
|
||||
libshairport_la_LDFLAGS=-dynamiclib
|
@ -0,0 +1,10 @@
|
||||
--- a/src/hairtunes.c.orig 2011-09-25 21:58:08.000000000 +0200
|
||||
+++ b/src/hairtunes.c 2011-09-25 21:58:12.000000000 +0200
|
||||
@@ -991,6 +991,7 @@
|
||||
|
||||
void hairtunes_cleanup(void)
|
||||
{
|
||||
+ pthread_cond_signal(&ab_buffer_ready);
|
||||
clean_output();
|
||||
clean_rtp();
|
||||
clean_buffer();
|
@ -0,0 +1,22 @@
|
||||
--- a/src/hairtunes.c.orig 2011-09-25 23:26:56.000000000 +0200
|
||||
+++ b/src/hairtunes.c 2011-09-25 23:29:27.000000000 +0200
|
||||
@@ -89,7 +89,6 @@
|
||||
// maximal resampling shift - conservative
|
||||
#define OUTFRAME_BYTES (4*(frame_size+3))
|
||||
|
||||
-
|
||||
alac_file *decoder_info;
|
||||
|
||||
#ifdef FANCY_RESAMPLING
|
||||
@@ -849,6 +848,11 @@
|
||||
inbuf = buffer_get_frame();
|
||||
} while (!inbuf && audio_running);
|
||||
|
||||
+ if(!audio_running)
|
||||
+ {
|
||||
+ return 0; //don't access inbuf if audio stopped
|
||||
+ }
|
||||
+
|
||||
#ifdef FANCY_RESAMPLING
|
||||
if (fancy_resampling) {
|
||||
int i;
|
@ -0,0 +1,10 @@
|
||||
--- a/src/shairport.c 2011-09-25 23:58:06.000000000 +0200
|
||||
+++ b/src/shairport.c.new 2011-09-25 23:57:54.000000000 +0200
|
||||
@@ -368,6 +368,7 @@
|
||||
void shairport_exit(void)
|
||||
{
|
||||
m_running = 0;
|
||||
+ close(tServerSock);
|
||||
}
|
||||
|
||||
int shairport_is_running(void)
|
Loading…
x
Reference in New Issue
Block a user