Tidy up configure.ac and drop old pulseaudio back end

This commit is contained in:
Mike Brady
2017-10-09 09:38:35 +01:00
parent 578981887e
commit 1e0d0944c0
6 changed files with 15 additions and 192 deletions
-9
View File
@@ -32,11 +32,6 @@ AM_CFLAGS+= \
-DPIDDIR=\"$(CUSTOM_PID_DIR)\"
endif
if USE_FIRSTCONFDIR
AM_CFLAGS+= \
-DFIRSTCONFDIR=\"$(FIRST_CONF_DIR)\"
endif
if USE_AVAHI
shairport_sync_SOURCES += mdns_avahi.c
endif
@@ -73,10 +68,6 @@ if USE_SOUNDIO
shairport_sync_SOURCES += audio_soundio.c
endif
if USE_PULSE
shairport_sync_SOURCES += audio_pulse.c
endif
if USE_PA
shairport_sync_SOURCES += audio_pa.c
endif
-6
View File
@@ -39,9 +39,6 @@ extern audio_output audio_ao;
#ifdef CONFIG_SOUNDIO
extern audio_output audio_soundio;
#endif
#ifdef CONFIG_PULSE
extern audio_output audio_pulse;
#endif
#ifdef CONFIG_PA
extern audio_output audio_pa;
#endif
@@ -82,9 +79,6 @@ static audio_output *outputs[] = {
#endif
#ifdef CONFIG_DUMMY
&audio_dummy,
#endif
#ifdef CONFIG_PULSE
&audio_pulse,
#endif
NULL};
-142
View File
@@ -1,142 +0,0 @@
/*
* PulseAudio output driver. This file is part of Shairport.
* Copyright (c) Paul Lietar 2013
* All rights reserved.
*
* Modifications for audio synchronisation
* and related work, copyright (c) Mike Brady 2014
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "audio.h"
#include "common.h"
#include <memory.h>
#include <pulse/def.h>
#include <pulse/error.h>
#include <pulse/simple.h>
#include <stdio.h>
#include <unistd.h>
static pa_simple *pa_dev = NULL;
static struct {
char *server;
char *sink;
char *service_name;
} pulse_options = {.server = NULL, .sink = NULL, .service_name = NULL};
static int pa_error;
static void pulse_connect(void);
static void help(void) {
printf(" -a server set the server name\n"
" -s sink set the output sink\n"
" -n name set the application name, as seen by PulseAudio\n"
" defaults to the access point name\n");
}
static int init(int argc, char **argv) {
pulse_options.service_name = config.service_name;
config.audio_backend_buffer_desired_length = 1; // one second.
config.audio_backend_latency_offset = 0;
optind = 1; // optind=0 is equivalent to optind=1 plus special behaviour
argv--; // so we shift the arguments to satisfy getopt()
argc++;
// some platforms apparently require optreset = 1; - which?
int opt;
while ((opt = getopt(argc, argv, "a:s:n:")) > 0) {
switch (opt) {
case 'a':
pulse_options.server = optarg;
break;
case 's':
pulse_options.sink = optarg;
break;
case 'n':
pulse_options.service_name = optarg;
break;
default:
help();
die("Invalid audio option -%c specified", opt);
}
}
if (optind < argc)
die("Invalid audio argument: %s", argv[optind]);
pulse_connect();
return 0;
}
static void pulse_connect(void) {
static const pa_sample_spec ss = {.format = PA_SAMPLE_S16LE, .rate = 44100, .channels = 2};
pa_dev = pa_simple_new(pulse_options.server, pulse_options.service_name, PA_STREAM_PLAYBACK,
pulse_options.sink, "Shairport Stream", &ss, NULL, NULL, &pa_error);
if (!pa_dev)
die("Could not connect to pulseaudio server: %s", pa_strerror(pa_error));
}
static void deinit(void) {
if (pa_dev)
pa_simple_free(pa_dev);
pa_dev = NULL;
}
static void start(int sample_rate, int sample_format) {}
static void play(short buf[], int samples) {
if (pa_simple_write(pa_dev, (char *)buf, (size_t)samples * 4, &pa_error) < 0) {
fprintf(stderr, __FILE__ ": pa_simple_write() failed: %s\n", pa_strerror(pa_error));
if (pa_error == PA_ERR_CONNECTIONTERMINATED) {
fprintf(stderr, __FILE__ ": reconnecting.");
deinit();
pulse_connect();
}
}
}
static void stop(void) {
if (pa_simple_drain(pa_dev, &pa_error) < 0)
fprintf(stderr, __FILE__ ": pa_simple_drain() failed: %s\n", pa_strerror(pa_error));
}
audio_output audio_pulse = {.name = "pulse",
.help = &help,
.init = &init,
.deinit = &deinit,
.start = &start,
.stop = &stop,
.flush = NULL,
.delay = NULL,
.play = &play,
.volume = NULL,
.parameters = NULL,
.mute = NULL};
-22
View File
@@ -116,19 +116,6 @@ AC_ARG_WITH(apple-alac, [ --with-apple-alac = include support for the Apple ALA
fi ])
AM_CONDITIONAL([USE_APPLE_ALAC], [test "x$HAS_APPLE_ALAC" = "x1"])
# Look for firstconfdir flag
AC_ARG_WITH(firstconfdir, [ --with-firstconfdir=<pathname> Specify a pathname to a directory where a configuration file will be searched for before looking in sysconfdir.], [
AC_MSG_CHECKING(--with-firstconfdir argument)
if test "x${with_firstconfdir}" = x -o "x${with_firstconfdir}" = xyes ; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(when you use the --with-firstconfdir directive you must specify a pathname to a directory where a configuration file will be searched for before looking in sysconfdir.)
fi
AC_MSG_RESULT(${with_firstconfdir})
HAS_FIRSTCONFDIR=1
AC_SUBST(FIRST_CONF_DIR,["${with_firstconfdir}"])
AC_DEFINE([USE_FIRSTCONFDIR],1,[Look for a configuration file here before looking in the sysconfdir])], )
AM_CONDITIONAL([USE_FIRSTCONFDIR], [test "x$HAS_FIRSTCONFDIR" = "x1"])
# Look for piddir flag
AC_ARG_WITH(piddir, [ --with-piddir=<pathname> Specify a pathname to a directory in which to write the PID file.], [
AC_MSG_CHECKING(--with-piddir argument)
@@ -262,15 +249,6 @@ AC_ARG_WITH(pa, [ --with-pa = choose PulseAudio support.], [
fi ])
AM_CONDITIONAL([USE_PA], [test "x$HAS_PA" = "x1"])
# Look for old pulseaudio flag
AC_ARG_WITH(pulseaudio, [ --with-pulseaudio = choose PulseAudio API support. Note that this backend is deprecated. Use --with-pa for an updated PulseAudio backend!], [
AC_MSG_RESULT(>>Including an outdated PulseAudio back end. Note that this backend is deprecated. Use --with-pa for an updated PulseAudio backend!)
HAS_PULSE=1
AC_DEFINE([CONFIG_PULSE], 1, [Needed by the compiler.])
AC_CHECK_LIB([pulse-simple], [pa_simple_new], , AC_MSG_ERROR(PulseAudio support requires the pulse-simple library -- possibly in the libpulse-dev package!))
AC_CHECK_LIB([pulse], [pa_stream_peek], , AC_MSG_ERROR(PulseAudio support requires the libpulse-dev library.))], )
AM_CONDITIONAL([USE_PULSE], [test "x$HAS_PULSE" = "x1"])
# Look for Convolution flag
AC_ARG_WITH(convolution, [ --with-convolution = choose audio DSP convolution support], [
AC_MSG_RESULT(>>Including convolution support)
+15 -10
View File
@@ -760,16 +760,21 @@ void rtp_request_resend(seq_t first, uint32_t count, rtsp_conn_info *conn) {
void rtp_request_client_pause(rtsp_conn_info *conn) {
if (conn->rtp_running) {
if (conn->dacp_active_remote == 0) {
if (conn->dacp_port == 0) {
debug(1, "Can't request a client pause: no valid active remote.");
} else {
// debug(1,"Send a client pause request to %s:3689 with active remote
// %u.",client_ip_string,dacp_active_remote);
struct addrinfo hints, *res;
int sockfd;
char message[1000], server_reply[2000];
char message[1000], server_reply[2000], portstring[10];
sprintf(portstring,"%u",conn->dacp_port);
debug(1,
"Attempting to send:\nGET /ctrl-int/1/pause HTTP/1.1\r\nHost: %s:%u\r\nActive-Remote: %u\r\n\r\n",
conn->client_ip_string, conn->dacp_port, conn->dacp_active_remote);
// first, load up address structs with getaddrinfo():
@@ -777,7 +782,7 @@ void rtp_request_client_pause(rtsp_conn_info *conn) {
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
getaddrinfo(conn->client_ip_string, "3689", &hints, &res);
getaddrinfo(conn->client_ip_string, portstring, &hints, &res);
// make a socket:
@@ -786,19 +791,19 @@ void rtp_request_client_pause(rtsp_conn_info *conn) {
if (sockfd == -1) {
die("Could not create socket");
}
// debug(1,"Socket created");
debug(1,"Socket created");
// connect!
if (connect(sockfd, res->ai_addr, res->ai_addrlen) < 0) {
die("connect failed. Error");
}
// debug(1,"Connect successful");
debug(1,"Connect successful");
sprintf(message,
"GET /ctrl-int/1/pause HTTP/1.1\r\nHost: %s:3689\r\nActive-Remote: %u\r\n\r\n",
conn->client_ip_string, conn->dacp_active_remote);
// debug(1,"Sending this message: \"%s\".",message);
"GET /ctrl-int/1/pause HTTP/1.1\r\nHost: %s:%u\r\nActive-Remote: %u\r\n\r\n",
conn->client_ip_string, conn->dacp_port, conn->dacp_active_remote);
debug(1,"Sending this message: \"%s\".",message);
// Send some data
if (send(sockfd, message, strlen(message), 0) < 0) {
-3
View File
@@ -204,9 +204,6 @@ char *get_version_string() {
#ifdef CONFIG_PA
strcat(version_string, "-pa");
#endif
#ifdef CONFIG_PULSE
strcat(version_string, "-pulse");
#endif
#ifdef CONFIG_SOUNDIO
strcat(version_string, "-soundio");
#endif