mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-09 21:49:48 -05:00
Merge pull request #328 from sshambar/fixconfig
Updated configure/makefiles related to Issue #327
This commit is contained in:
13
src/.gitignore
vendored
13
src/.gitignore
vendored
@@ -3,13 +3,10 @@ forked-daapd
|
||||
*.tokens
|
||||
*Lexer.[ch]
|
||||
*Parser.[ch]
|
||||
DAAP2SQL.[ch]
|
||||
RSP2SQL.[ch]
|
||||
SMARTPL2SQL.[ch]
|
||||
|
||||
*2SQL.[ch]
|
||||
*.u
|
||||
|
||||
daap_query_hash.c
|
||||
rsp_query_hash.c
|
||||
dacp_prop_hash.c
|
||||
dmap_fields_hash.c
|
||||
daap_query_hash.h
|
||||
rsp_query_hash.h
|
||||
dacp_prop_hash.h
|
||||
dmap_fields_hash.h
|
||||
|
||||
@@ -44,7 +44,7 @@ options {
|
||||
};
|
||||
|
||||
/* gperf static hash, daap_query.gperf */
|
||||
#include "daap_query_hash.c"
|
||||
#include "daap_query_hash.h"
|
||||
}
|
||||
|
||||
query returns [ pANTLR3_STRING result ]
|
||||
|
||||
110
src/Makefile.am
110
src/Makefile.am
@@ -39,18 +39,18 @@ GPERF_FILES = \
|
||||
dacp_prop.gperf \
|
||||
dmap_fields.gperf
|
||||
|
||||
GPERF_PRODUCTS = \
|
||||
daap_query_hash.c \
|
||||
rsp_query_hash.c \
|
||||
dacp_prop_hash.c \
|
||||
dmap_fields_hash.c
|
||||
GPERF_SRC = $(GPERF_FILES:.gperf=_hash.h)
|
||||
|
||||
ANTLR_GRAMMARS = \
|
||||
RSP.g RSP2SQL.g \
|
||||
DAAP.g DAAP2SQL.g \
|
||||
SMARTPL.g SMARTPL2SQL.g
|
||||
|
||||
ANTLR_SOURCES = \
|
||||
ANTLR_TOKENS = $(ANTLR_GRAMMARS:.g=.tokens)
|
||||
|
||||
ANTLR_DEPS = $(ANTLR_GRAMMARS:%.g=$(srcdir)/%.u)
|
||||
|
||||
ANTLR_SRC = \
|
||||
RSPLexer.c RSPLexer.h RSPParser.c RSPParser.h \
|
||||
RSP2SQL.c RSP2SQL.h \
|
||||
DAAPLexer.c DAAPLexer.h DAAPParser.c DAAPParser.h \
|
||||
@@ -58,24 +58,19 @@ ANTLR_SOURCES = \
|
||||
SMARTPLLexer.c SMARTPLLexer.h SMARTPLParser.c SMARTPLParser.h \
|
||||
SMARTPL2SQL.c SMARTPL2SQL.h
|
||||
|
||||
ANTLR_PRODUCTS =
|
||||
AM_CPPFLAGS += \
|
||||
$(FORKED_CPPFLAGS) \
|
||||
$(COMMON_CPPFLAGS) \
|
||||
\
|
||||
-D_GNU_SOURCE \
|
||||
-DDATADIR=\"$(pkgdatadir)\" \
|
||||
-DCONFDIR=\"$(sysconfdir)\" \
|
||||
-DSTATEDIR=\"$(localstatedir)\" \
|
||||
-DPKGLIBDIR=\"$(pkglibdir)\"
|
||||
|
||||
forked_daapd_CPPFLAGS = -D_GNU_SOURCE \
|
||||
-DDATADIR="\"$(pkgdatadir)\"" -DCONFDIR="\"$(sysconfdir)\"" \
|
||||
-DSTATEDIR="\"$(localstatedir)\"" -DPKGLIBDIR="\"$(pkglibdir)\""
|
||||
|
||||
forked_daapd_CFLAGS = \
|
||||
@ZLIB_CFLAGS@ @AVAHI_CFLAGS@ @SQLITE3_CFLAGS@ @LIBAV_CFLAGS@ \
|
||||
@CONFUSE_CFLAGS@ @MINIXML_CFLAGS@ @LIBPLIST_CFLAGS@ @SPOTIFY_CFLAGS@ \
|
||||
@LIBGCRYPT_CFLAGS@ @GPG_ERROR_CFLAGS@ @ALSA_CFLAGS@ @LIBPULSE_CFLAGS@ \
|
||||
@LIBCURL_CFLAGS@ @LIBPROTOBUF_C_CFLAGS@ @GNUTLS_CFLAGS@ @JSON_C_CFLAGS@
|
||||
|
||||
forked_daapd_LDADD = -lrt \
|
||||
@ZLIB_LIBS@ @AVAHI_LIBS@ @SQLITE3_LIBS@ @LIBAV_LIBS@ \
|
||||
@CONFUSE_LIBS@ @LIBEVENT_LIBS@ @LIBUNISTRING@ \
|
||||
@MINIXML_LIBS@ @ANTLR3C_LIBS@ @LIBPLIST_LIBS@ @SPOTIFY_LIBS@ \
|
||||
@LIBGCRYPT_LIBS@ @GPG_ERROR_LIBS@ @ALSA_LIBS@ @LIBPULSE_LIBS@ \
|
||||
@LIBCURL_LIBS@ @LIBPROTOBUF_C_LIBS@ @GNUTLS_LIBS@ @JSON_C_LIBS@
|
||||
forked_daapd_LDADD = \
|
||||
$(FORKED_LIBS) \
|
||||
$(COMMON_LIBS)
|
||||
|
||||
forked_daapd_SOURCES = main.c \
|
||||
db.c db.h \
|
||||
@@ -109,63 +104,42 @@ forked_daapd_SOURCES = main.c \
|
||||
outputs.h outputs.c \
|
||||
outputs/raop.c outputs/streaming.c outputs/dummy.c outputs/fifo.c \
|
||||
$(ALSA_SRC) $(PULSEAUDIO_SRC) $(CHROMECAST_SRC) \
|
||||
evrtsp/rtsp.c evrtp/evrtsp.h evrtsp/rtsp-internal.h evrtsp/log.h \
|
||||
evrtsp/rtsp.c evrtsp/evrtsp.h evrtsp/rtsp-internal.h evrtsp/log.h \
|
||||
$(SPOTIFY_SRC) \
|
||||
$(LASTFM_SRC) \
|
||||
$(MPD_SRC) \
|
||||
listener.c listener.h \
|
||||
commands.c commands.h
|
||||
|
||||
nodist_forked_daapd_SOURCES = \
|
||||
$(ANTLR_SOURCES)
|
||||
commands.c commands.h \
|
||||
ffmpeg-compat.h \
|
||||
$(GPERF_SRC) \
|
||||
$(ANTLR_SRC)
|
||||
|
||||
# built by maintainers, and distributed. Clean with maintainer-clean
|
||||
BUILT_SOURCES = \
|
||||
$(GPERF_PRODUCTS)
|
||||
$(GPERF_SRC) \
|
||||
$(ANTLR_SRC) \
|
||||
$(ANTLR_TOKENS) \
|
||||
$(ANTLR_DEPS)
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(ANTLR_GRAMMARS)
|
||||
|
||||
CLEANFILES = \
|
||||
$(GPERF_PRODUCTS)
|
||||
|
||||
$(GPERF_FILES) \
|
||||
$(ANTLR_GRAMMARS) \
|
||||
$(ANTLR_TOKENS) \
|
||||
$(ANTLR_DEPS)
|
||||
|
||||
# gperf construction rules
|
||||
%_hash.c: %.gperf
|
||||
if $(GPERF) $< > $@.tmp; then \
|
||||
mv $@.tmp $@; \
|
||||
elif $(GPERF) --version >/dev/null 2>&1; then \
|
||||
rm $@.tmp; \
|
||||
exit 1; \
|
||||
else \
|
||||
rm $@.tmp; \
|
||||
touch $@; \
|
||||
fi
|
||||
|
||||
# Support for building the parsers when ANTLR3 is available
|
||||
if COND_ANTLR
|
||||
SUFFIXES = .g .u
|
||||
%_hash.h: %.gperf
|
||||
$(AM_V_GEN)$(GPERF) --output-file=$@ $<
|
||||
|
||||
# ANTLR grammar products
|
||||
%.tokens %.c %Lexer.c %Parser.c %Lexer.h %Parser.h %.h: %.g
|
||||
$(ANTLR) -Xconversiontimeout 30000 $(ANTLR_OPTIONS) $<
|
||||
@$(AM_V_P) || echo " GEN " $< "products"
|
||||
$(AM_V_at)$(ANTLR) -Xconversiontimeout 30000 $(ANTLR_OPTIONS) -fo . $<
|
||||
|
||||
# ANTLR dependency files (bypass circular dependency of .g on .tokens)
|
||||
%.u: %.g
|
||||
$(ANTLR) -depend $< > $@
|
||||
@echo -n "ANTLR_PRODUCTS += " > $@.tmp
|
||||
@grep : $@ | cut -d : -f 1 | tr -d ' ' | { while read f; do test "$$f" != "$<" && echo -n "$$f "; done } >> $@.tmp
|
||||
@cat $@.tmp >> $@
|
||||
@rm $@.tmp
|
||||
$(AM_V_GEN)$(ANTLR) -depend -fo . $< > $@
|
||||
$(AM_V_at)$(SED) -n -e '/^.*\.g[ ]*:\(.*\)/ { s//\1/;h;d; }' -e '/\.tokens.*:/ { p;d; }' -e '/:/ { G;s/\n/ /;p; }' $@ > $@-t
|
||||
$(AM_V_at)mv $@-t $@
|
||||
|
||||
BUILT_SOURCES += $(ANTLR_SOURCES)
|
||||
|
||||
CLEANFILES += \
|
||||
$(ANTLR_PRODUCTS) \
|
||||
$(ANTLR_GRAMMARS:.g=.u)
|
||||
|
||||
else !COND_ANTLR
|
||||
DISTCLEANFILES = \
|
||||
$(ANTLR_PRODUCTS) \
|
||||
$(ANTLR_GRAMMARS:.g=.u)
|
||||
|
||||
endif
|
||||
|
||||
-include $(ANTLR_GRAMMARS:.g=.u)
|
||||
-include $(ANTLR_DEPS)
|
||||
|
||||
@@ -50,7 +50,7 @@ options {
|
||||
};
|
||||
|
||||
/* gperf static hash, rsp_query.gperf */
|
||||
#include "rsp_query_hash.c"
|
||||
#include "rsp_query_hash.h"
|
||||
}
|
||||
|
||||
query returns [ pANTLR3_STRING result ]
|
||||
|
||||
@@ -505,7 +505,7 @@ artwork_rescale(struct evbuffer *evbuf, AVFormatContext *src_ctx, int s, int out
|
||||
goto out_free_frames;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBAV_IMAGE_FILL_ARRAYS
|
||||
#ifdef HAVE_AV_IMAGE_FILL_ARRAYS
|
||||
av_image_fill_arrays(o_frame->data, o_frame->linesize, buf, dst->pix_fmt, src->width, src->height, 1);
|
||||
#else
|
||||
avpicture_fill((AVPicture *)o_frame, buf, dst->pix_fmt, src->width, src->height);
|
||||
|
||||
@@ -183,11 +183,11 @@ commands_base_new(struct event_base *evbase, command_exit_cb exit_cb)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
# if defined(__linux__)
|
||||
#ifdef HAVE_PIPE2
|
||||
ret = pipe2(cmdbase->command_pipe, O_CLOEXEC);
|
||||
# else
|
||||
#else
|
||||
ret = pipe(cmdbase->command_pipe);
|
||||
# endif
|
||||
#endif
|
||||
if (ret < 0)
|
||||
{
|
||||
DPRINTF(E_LOG, L_MAIN, "Could not create command pipe: %s\n", strerror(errno));
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
/* gperf static hash, dmap_fields.gperf */
|
||||
#include "dmap_fields_hash.c"
|
||||
#include "dmap_fields_hash.h"
|
||||
|
||||
|
||||
const struct dmap_field *
|
||||
|
||||
@@ -13,24 +13,24 @@
|
||||
# define avcodec_find_best_pix_fmt_of_list(a, b, c, d) avcodec_find_best_pix_fmt2((enum AVPixelFormat *)(a), (b), (c), (d))
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LIBAV_FRAME_ALLOC
|
||||
#ifndef HAVE_AV_FRAME_ALLOC
|
||||
# define av_frame_alloc() avcodec_alloc_frame()
|
||||
# define av_frame_free(x) avcodec_free_frame((x))
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LIBAV_BEST_EFFORT_TIMESTAMP
|
||||
#ifndef HAVE_AV_FRAME_GET_BEST_EFFORT_TIMESTAMP
|
||||
# define av_frame_get_best_effort_timestamp(x) (x)->pts
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LIBAV_IMAGE_GET_BUFFER_SIZE
|
||||
#ifndef HAVE_AV_IMAGE_GET_BUFFER_SIZE
|
||||
# define av_image_get_buffer_size(a, b, c, d) avpicture_get_size((a), (b), (c))
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LIBAV_PACKET_UNREF
|
||||
#ifndef HAVE_AV_PACKET_UNREF
|
||||
# define av_packet_unref(a) av_free_packet((a))
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LIBAV_PACKET_RESCALE_TS
|
||||
#ifndef HAVE_AV_PACKET_RESCALE_TS
|
||||
static void
|
||||
av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational dst_tb)
|
||||
{
|
||||
@@ -45,7 +45,7 @@ av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational dst_tb)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LIBAV_ALLOC_OUTPUT_CONTEXT2
|
||||
#ifndef HAVE_AVFORMAT_ALLOC_OUTPUT_CONTEXT2
|
||||
# include <libavutil/opt.h>
|
||||
|
||||
static int
|
||||
|
||||
@@ -113,14 +113,15 @@ static struct deferred_pl *playlists;
|
||||
static struct stacked_dir *dirstack;
|
||||
static struct commands_base *cmdbase;
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#ifndef __linux__
|
||||
struct deferred_file
|
||||
{
|
||||
struct watch_info wi;
|
||||
struct inotify_event ie;
|
||||
char path[PATH_MAX];
|
||||
|
||||
struct deferred_file *next;
|
||||
/* variable sized, must be at the end */
|
||||
struct inotify_event ie;
|
||||
};
|
||||
|
||||
static struct deferred_file *filestack;
|
||||
@@ -1068,9 +1069,9 @@ process_directory(char *path, int parent_id, int flags)
|
||||
|
||||
// Add inotify watch (for FreeBSD we limit the flags so only dirs will be
|
||||
// opened, otherwise we will be opening way too many files)
|
||||
#if defined(__linux__)
|
||||
#ifdef __linux__
|
||||
wi.wd = inotify_add_watch(inofd, path, IN_ATTRIB | IN_CREATE | IN_DELETE | IN_CLOSE_WRITE | IN_MOVE | IN_DELETE | IN_MOVE_SELF);
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#else
|
||||
wi.wd = inotify_add_watch(inofd, path, IN_CREATE | IN_DELETE | IN_MOVE);
|
||||
#endif
|
||||
if (wi.wd < 0)
|
||||
@@ -1260,7 +1261,7 @@ filescanner(void *arg)
|
||||
{
|
||||
int clear_queue_on_stop_disabled;
|
||||
int ret;
|
||||
#if defined(__linux__)
|
||||
#ifdef __linux__
|
||||
struct sched_param param;
|
||||
|
||||
/* Lower the priority of the thread so forked-daapd may still respond
|
||||
@@ -1724,9 +1725,10 @@ process_inotify_file(struct watch_info *wi, char *path, struct inotify_event *ie
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
/* Since FreeBSD doesn't really have inotify we only get a IN_CREATE. That is
|
||||
* a bit too soon to start scanning the file, so we defer it for 10 seconds.
|
||||
#ifndef __linux__
|
||||
/* Since kexec based inotify doesn't really have inotify we only get
|
||||
* a IN_CREATE. That is a bit too soon to start scanning the file,
|
||||
* so we defer it for 10 seconds.
|
||||
*/
|
||||
static void
|
||||
inotify_deferred_cb(int fd, short what, void *arg)
|
||||
@@ -1765,6 +1767,7 @@ process_inotify_file_defer(struct watch_info *wi, char *path, struct inotify_eve
|
||||
f = calloc(1, sizeof(struct deferred_file));
|
||||
f->wi = *wi;
|
||||
f->wi.path = strdup(wi->path);
|
||||
/* ie->name not copied here, so don't use in process_inotify_* */
|
||||
f->ie = *ie;
|
||||
strcpy(f->path, path);
|
||||
|
||||
@@ -1876,9 +1879,9 @@ inotify_cb(int fd, short event, void *arg)
|
||||
if ((ie->mask & IN_ISDIR) || (ie->len == 0))
|
||||
process_inotify_dir(&wi, path, ie);
|
||||
else
|
||||
#if defined(__linux__)
|
||||
#ifdef __linux__
|
||||
process_inotify_file(&wi, path, ie);
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#else
|
||||
process_inotify_file_defer(&wi, path, ie);
|
||||
#endif
|
||||
free(wi.path);
|
||||
@@ -1903,7 +1906,7 @@ inofd_event_set(void)
|
||||
|
||||
inoev = event_new(evbase_scan, inofd, EV_READ, inotify_cb, NULL);
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#ifndef __linux__
|
||||
deferred_inoev = evtimer_new(evbase_scan, inotify_deferred_cb, NULL);
|
||||
if (!deferred_inoev)
|
||||
{
|
||||
@@ -1920,7 +1923,7 @@ inofd_event_set(void)
|
||||
static void
|
||||
inofd_event_unset(void)
|
||||
{
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#ifndef __linux__
|
||||
event_free(deferred_inoev);
|
||||
#endif
|
||||
event_free(inoev);
|
||||
|
||||
@@ -25,9 +25,7 @@
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
|
||||
15
src/httpd.c
15
src/httpd.c
@@ -39,8 +39,7 @@
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if defined(HAVE_SYS_EVENTFD_H) && defined(HAVE_EVENTFD)
|
||||
# define USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
# include <sys/eventfd.h>
|
||||
#endif
|
||||
#include <event2/event.h>
|
||||
@@ -133,7 +132,7 @@ static const struct content_type_map ext2ctype[] =
|
||||
|
||||
struct event_base *evbase_httpd;
|
||||
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
static int exit_efd;
|
||||
#else
|
||||
static int exit_pipe[2];
|
||||
@@ -1453,7 +1452,7 @@ httpd_init(void)
|
||||
|
||||
streaming_init();
|
||||
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
exit_efd = eventfd(0, EFD_CLOEXEC);
|
||||
if (exit_efd < 0)
|
||||
{
|
||||
@@ -1477,7 +1476,7 @@ httpd_init(void)
|
||||
}
|
||||
|
||||
exitev = event_new(evbase_httpd, exit_pipe[0], EV_READ, exit_cb, NULL);
|
||||
#endif /* USE_EVENTFD */
|
||||
#endif /* HAVE_EVENTFD */
|
||||
if (!exitev)
|
||||
{
|
||||
DPRINTF(E_FATAL, L_HTTPD, "Could not create exit event\n");
|
||||
@@ -1549,7 +1548,7 @@ httpd_init(void)
|
||||
bind_fail:
|
||||
evhttp_free(evhttpd);
|
||||
event_fail:
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
close(exit_efd);
|
||||
#else
|
||||
close(exit_pipe[0]);
|
||||
@@ -1574,7 +1573,7 @@ httpd_deinit(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
ret = eventfd_write(exit_efd, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -1607,7 +1606,7 @@ httpd_deinit(void)
|
||||
dacp_deinit();
|
||||
daap_deinit();
|
||||
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
close(exit_efd);
|
||||
#else
|
||||
close(exit_pipe[0]);
|
||||
|
||||
@@ -32,8 +32,7 @@
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if defined(HAVE_SYS_EVENTFD_H) && defined(HAVE_EVENTFD)
|
||||
# define USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
# include <sys/eventfd.h>
|
||||
#endif
|
||||
|
||||
@@ -136,11 +135,11 @@ dacp_propset_userrating(const char *value, struct evkeyvalq *query);
|
||||
|
||||
|
||||
/* gperf static hash, dacp_prop.gperf */
|
||||
#include "dacp_prop_hash.c"
|
||||
#include "dacp_prop_hash.h"
|
||||
|
||||
|
||||
/* Play status update */
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
static int update_efd;
|
||||
#else
|
||||
static int update_pipe[2];
|
||||
@@ -322,7 +321,7 @@ playstatusupdate_cb(int fd, short what, void *arg)
|
||||
size_t len;
|
||||
int ret;
|
||||
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
eventfd_t count;
|
||||
|
||||
ret = eventfd_read(update_efd, &count);
|
||||
@@ -406,7 +405,7 @@ dacp_playstatus_update_handler(enum listener_event_type type)
|
||||
if (type != LISTENER_PLAYER)
|
||||
return;
|
||||
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
ret = eventfd_write(update_efd, 1);
|
||||
if (ret < 0)
|
||||
DPRINTF(E_LOG, L_DACP, "Could not send status update event: %s\n", strerror(errno));
|
||||
@@ -2728,7 +2727,7 @@ dacp_init(void)
|
||||
current_rev = 2;
|
||||
update_requests = NULL;
|
||||
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
update_efd = eventfd(0, EFD_CLOEXEC);
|
||||
if (update_efd < 0)
|
||||
{
|
||||
@@ -2748,7 +2747,7 @@ dacp_init(void)
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif /* USE_EVENTFD */
|
||||
#endif /* HAVE_EVENTFD */
|
||||
|
||||
for (i = 0; dacp_handlers[i].handler; i++)
|
||||
{
|
||||
@@ -2762,7 +2761,7 @@ dacp_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
updateev = event_new(evbase_httpd, update_efd, EV_READ, playstatusupdate_cb, NULL);
|
||||
#else
|
||||
updateev = event_new(evbase_httpd, update_pipe[0], EV_READ, playstatusupdate_cb, NULL);
|
||||
@@ -2788,7 +2787,7 @@ dacp_init(void)
|
||||
return 0;
|
||||
|
||||
regexp_fail:
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
close(update_efd);
|
||||
#else
|
||||
close(update_pipe[0]);
|
||||
@@ -2827,7 +2826,7 @@ dacp_deinit(void)
|
||||
|
||||
event_free(updateev);
|
||||
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
close(update_efd);
|
||||
#else
|
||||
close(update_pipe[0]);
|
||||
|
||||
@@ -216,7 +216,7 @@ param_sign(struct keyval *kv)
|
||||
}
|
||||
|
||||
/* For compability with mxml 2.6 */
|
||||
#ifndef HAVE_MXML_GETOPAQUE
|
||||
#ifndef HAVE_MXMLGETOPAQUE
|
||||
const char * /* O - Opaque string or NULL */
|
||||
mxmlGetOpaque(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
|
||||
@@ -184,7 +184,7 @@ logger_libevent(int severity, const char *msg)
|
||||
DPRINTF(severity, L_EVENT, "%s\n", msg);
|
||||
}
|
||||
|
||||
#ifdef ALSA
|
||||
#ifdef HAVE_ALSA
|
||||
void
|
||||
logger_alsa(const char *file, int line, const char *function, int err, const char *fmt, ...)
|
||||
{
|
||||
@@ -194,7 +194,7 @@ logger_alsa(const char *file, int line, const char *function, int err, const cha
|
||||
vlogger(E_LOG, L_LAUDIO, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif /* ALSA */
|
||||
#endif /* HAVE_ALSA */
|
||||
|
||||
void
|
||||
logger_reinit(void)
|
||||
|
||||
@@ -55,7 +55,7 @@ logger_ffmpeg(void *ptr, int level, const char *fmt, va_list ap);
|
||||
void
|
||||
logger_libevent(int severity, const char *msg);
|
||||
|
||||
#ifdef ALSA
|
||||
#ifdef HAVE_ALSA
|
||||
void
|
||||
logger_alsa(const char *file, int line, const char *function, int err, const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
20
src/main.c
20
src/main.c
@@ -37,9 +37,9 @@
|
||||
#include <grp.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(__linux__)
|
||||
#ifdef HAVE_SIGNALFD
|
||||
# include <sys/signalfd.h>
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#else
|
||||
# include <sys/time.h>
|
||||
# include <sys/event.h>
|
||||
#endif
|
||||
@@ -334,7 +334,7 @@ register_services(char *ffid, int no_rsp, int no_daap, int mdns_no_mpd)
|
||||
}
|
||||
|
||||
|
||||
#if defined(__linux__)
|
||||
#ifdef HAVE_SIGNALFD
|
||||
static void
|
||||
signal_signalfd_cb(int fd, short event, void *arg)
|
||||
{
|
||||
@@ -374,7 +374,7 @@ signal_signalfd_cb(int fd, short event, void *arg)
|
||||
event_add(sig_event, NULL);
|
||||
}
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#else
|
||||
|
||||
static void
|
||||
signal_kqueue_cb(int fd, short event, void *arg)
|
||||
@@ -468,7 +468,7 @@ main(int argc, char **argv)
|
||||
const char *gcry_version;
|
||||
sigset_t sigs;
|
||||
int sigfd;
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#ifdef HAVE_KQUEUE
|
||||
struct kevent ke_sigs[4];
|
||||
#endif
|
||||
int ret;
|
||||
@@ -607,14 +607,14 @@ main(int argc, char **argv)
|
||||
#ifdef MPD
|
||||
strcat(buildopts, " --enable-mpd");
|
||||
#endif
|
||||
#ifdef ALSA
|
||||
#ifdef HAVE_ALSA
|
||||
strcat(buildopts, " --with-alsa");
|
||||
#endif
|
||||
#ifdef PULSEAUDIO
|
||||
#ifdef HAVE_LIBPULSE
|
||||
strcat(buildopts, " --with-pulseaudio");
|
||||
#endif
|
||||
|
||||
DPRINTF(E_LOG, L_MAIN, "Built %s with:%s\n", BUILDDATE, buildopts);
|
||||
DPRINTF(E_LOG, L_MAIN, "Built %s with:%s\n", __DATE__, buildopts);
|
||||
|
||||
ret = av_lockmgr_register(ffmpeg_lockmgr);
|
||||
if (ret < 0)
|
||||
@@ -813,7 +813,7 @@ main(int argc, char **argv)
|
||||
/* Register this CNAME with mDNS for OAuth */
|
||||
mdns_cname("forked-daapd.local");
|
||||
|
||||
#if defined(__linux__)
|
||||
#ifdef HAVE_SIGNALFD
|
||||
/* Set up signal fd */
|
||||
sigfd = signalfd(-1, &sigs, SFD_NONBLOCK | SFD_CLOEXEC);
|
||||
if (sigfd < 0)
|
||||
@@ -825,7 +825,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
sig_event = event_new(evbase_main, sigfd, EV_READ, signal_signalfd_cb, NULL);
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#else
|
||||
sigfd = kqueue();
|
||||
if (sigfd < 0)
|
||||
{
|
||||
|
||||
@@ -636,6 +636,11 @@ entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_U
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef HOST_NAME_MAX
|
||||
/* some systems want programs to query this, just define a reasonable limit */
|
||||
#define HOST_NAME_MAX 64
|
||||
#endif
|
||||
|
||||
static int
|
||||
create_group_entry(struct mdns_group_entry *ge, int commit)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
#ifndef __MISC_H__
|
||||
#define __MISC_H__
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
@@ -43,11 +43,6 @@
|
||||
#include <event2/http.h>
|
||||
#include <event2/listener.h>
|
||||
|
||||
#if defined(HAVE_SYS_EVENTFD_H) && defined(HAVE_EVENTFD)
|
||||
# define USE_EVENTFD
|
||||
# include <sys/eventfd.h>
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
@@ -35,10 +35,10 @@ extern struct output_definition output_raop;
|
||||
extern struct output_definition output_streaming;
|
||||
extern struct output_definition output_dummy;
|
||||
extern struct output_definition output_fifo;
|
||||
#ifdef ALSA
|
||||
#ifdef HAVE_ALSA
|
||||
extern struct output_definition output_alsa;
|
||||
#endif
|
||||
#ifdef PULSEAUDIO
|
||||
#ifdef HAVE_LIBPULSE
|
||||
extern struct output_definition output_pulse;
|
||||
#endif
|
||||
#ifdef CHROMECAST
|
||||
@@ -51,10 +51,10 @@ static struct output_definition *outputs[] = {
|
||||
&output_streaming,
|
||||
&output_dummy,
|
||||
&output_fifo,
|
||||
#ifdef ALSA
|
||||
#ifdef HAVE_ALSA
|
||||
&output_alsa,
|
||||
#endif
|
||||
#ifdef PULSEAUDIO
|
||||
#ifdef HAVE_LIBPULSE
|
||||
&output_pulse,
|
||||
#endif
|
||||
#ifdef CHROMECAST
|
||||
|
||||
@@ -53,10 +53,10 @@ enum output_types
|
||||
OUTPUT_TYPE_STREAMING,
|
||||
OUTPUT_TYPE_DUMMY,
|
||||
OUTPUT_TYPE_FIFO,
|
||||
#ifdef ALSA
|
||||
#ifdef HAVE_ALSA
|
||||
OUTPUT_TYPE_ALSA,
|
||||
#endif
|
||||
#ifdef PULSEAUDIO
|
||||
#ifdef HAVE_LIBPULSE
|
||||
OUTPUT_TYPE_PULSE,
|
||||
#endif
|
||||
#ifdef CHROMECAST
|
||||
|
||||
@@ -30,18 +30,19 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <ifaddrs.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <endian.h>
|
||||
#ifdef HAVE_ENDIAN_H
|
||||
# include <endian.h>
|
||||
#elif defined(HAVE_SYS_ENDIAN_H)
|
||||
# include <sys/endian.h>
|
||||
#endif
|
||||
#include <gnutls/gnutls.h>
|
||||
#include <event2/event.h>
|
||||
|
||||
#ifdef HAVE_JSON_C_OLD
|
||||
# include <json/json.h>
|
||||
#else
|
||||
# include <json-c/json.h>
|
||||
#endif
|
||||
#include <json.h>
|
||||
|
||||
#include "conffile.h"
|
||||
#include "mdns.h"
|
||||
@@ -368,7 +369,11 @@ tcp_connect(const char *address, unsigned int port, int family)
|
||||
|
||||
// TODO Open non-block right away so we don't block the player while connecting
|
||||
// and during TLS handshake (we would probably need to introduce a deferredev)
|
||||
#ifdef SOCK_CLOEXEC
|
||||
fd = socket(family, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||
#else
|
||||
fd = socket(family, SOCK_STREAM, 0);
|
||||
#endif
|
||||
if (fd < 0)
|
||||
{
|
||||
DPRINTF(E_LOG, L_CAST, "Could not create socket: %s\n", strerror(errno));
|
||||
|
||||
@@ -903,7 +903,7 @@ pulse_init(void)
|
||||
if (!(pulse.cmdbase = commands_base_new(evbase_player, NULL)))
|
||||
goto fail;
|
||||
|
||||
#ifdef HAVE_PULSE_MAINLOOP_SET_NAME
|
||||
#ifdef HAVE_PA_THREADED_MAINLOOP_SET_NAME
|
||||
pa_threaded_mainloop_set_name(pulse.mainloop, "pulseaudio");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -47,10 +47,9 @@
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
|
||||
#if defined(__linux__) || defined(__GLIBC__)
|
||||
#ifdef HAVE_ENDIAN_H
|
||||
# include <endian.h>
|
||||
# include <byteswap.h>
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#elif defined(HAVE_SYS_ENDIAN_H)
|
||||
# include <sys/endian.h>
|
||||
#endif
|
||||
|
||||
@@ -2688,7 +2687,7 @@ raop_v2_timing_start_one(struct raop_service *svc, int family)
|
||||
int len;
|
||||
int ret;
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef SOCK_CLOEXEC
|
||||
svc->fd = socket(family, SOCK_DGRAM | SOCK_CLOEXEC, 0);
|
||||
#else
|
||||
svc->fd = socket(family, SOCK_DGRAM, 0);
|
||||
@@ -3020,7 +3019,7 @@ raop_v2_control_start_one(struct raop_service *svc, int family)
|
||||
int len;
|
||||
int ret;
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef SOCK_CLOEXEC
|
||||
svc->fd = socket(family, SOCK_DGRAM | SOCK_CLOEXEC, 0);
|
||||
#else
|
||||
svc->fd = socket(family, SOCK_DGRAM, 0);
|
||||
@@ -3418,7 +3417,7 @@ raop_v2_stream_open(struct raop_session *rs)
|
||||
int len;
|
||||
int ret;
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef SOCK_CLOEXEC
|
||||
rs->server_fd = socket(rs->sa.ss.ss_family, SOCK_DGRAM | SOCK_CLOEXEC, 0);
|
||||
#else
|
||||
rs->server_fd = socket(rs->sa.ss.ss_family, SOCK_DGRAM, 0);
|
||||
|
||||
20
src/player.c
20
src/player.c
@@ -35,7 +35,7 @@
|
||||
# include <pthread_np.h>
|
||||
#endif
|
||||
|
||||
#if defined(__linux__)
|
||||
#ifdef HAVE_TIMERFD
|
||||
# include <sys/timerfd.h>
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
# include <signal.h>
|
||||
@@ -193,7 +193,7 @@ static char shuffle;
|
||||
static char consume;
|
||||
|
||||
/* Playback timer */
|
||||
#if defined(__linux__)
|
||||
#ifdef HAVE_TIMERFD
|
||||
static int pb_timer_fd;
|
||||
#else
|
||||
timer_t pb_timer;
|
||||
@@ -389,7 +389,7 @@ pb_timer_start(void)
|
||||
tick.it_interval = tick_interval;
|
||||
tick.it_value = tick_interval;
|
||||
|
||||
#if defined(__linux__)
|
||||
#ifdef HAVE_TIMERFD
|
||||
ret = timerfd_settime(pb_timer_fd, 0, &tick, NULL);
|
||||
#else
|
||||
ret = timer_settime(pb_timer, 0, &tick, NULL);
|
||||
@@ -412,7 +412,7 @@ pb_timer_stop(void)
|
||||
|
||||
memset(&tick, 0, sizeof(struct itimerspec));
|
||||
|
||||
#if defined(__linux__)
|
||||
#ifdef HAVE_TIMERFD
|
||||
ret = timerfd_settime(pb_timer_fd, 0, &tick, NULL);
|
||||
#else
|
||||
ret = timer_settime(pb_timer, 0, &tick, NULL);
|
||||
@@ -1451,7 +1451,7 @@ player_playback_cb(int fd, short what, void *arg)
|
||||
|
||||
// Check if we missed any timer expirations
|
||||
overrun = 0;
|
||||
#if defined(__linux__)
|
||||
#ifdef HAVE_TIMERFD
|
||||
ret = read(fd, &overrun, sizeof(overrun));
|
||||
if (ret <= 0)
|
||||
DPRINTF(E_LOG, L_PLAYER, "Error reading timer\n");
|
||||
@@ -1463,7 +1463,7 @@ player_playback_cb(int fd, short what, void *arg)
|
||||
DPRINTF(E_LOG, L_PLAYER, "Error getting timer overrun\n");
|
||||
else
|
||||
overrun = ret;
|
||||
#endif /* __linux__ */
|
||||
#endif /* HAVE_TIMERFD */
|
||||
|
||||
// The reason we get behind the playback timer may be that we are playing a
|
||||
// network stream OR that the source is slow to open OR some interruption.
|
||||
@@ -3479,7 +3479,7 @@ player_init(void)
|
||||
tick_interval.tv_nsec = interval;
|
||||
|
||||
// Create the playback timer
|
||||
#if defined(__linux__)
|
||||
#ifdef HAVE_TIMERFD
|
||||
pb_timer_fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
||||
ret = pb_timer_fd;
|
||||
#else
|
||||
@@ -3512,7 +3512,7 @@ player_init(void)
|
||||
goto evbase_fail;
|
||||
}
|
||||
|
||||
#if defined(__linux__)
|
||||
#ifdef HAVE_TIMERFD
|
||||
pb_timer_ev = event_new(evbase_player, pb_timer_fd, EV_READ | EV_PERSIST, player_playback_cb, NULL);
|
||||
#else
|
||||
pb_timer_ev = event_new(evbase_player, SIGALRM, EV_SIGNAL | EV_PERSIST, player_playback_cb, NULL);
|
||||
@@ -3557,7 +3557,7 @@ player_init(void)
|
||||
evbase_fail:
|
||||
evbuffer_free(audio_buf);
|
||||
audio_fail:
|
||||
#if defined(__linux__)
|
||||
#ifdef HAVE_TIMERFD
|
||||
close(pb_timer_fd);
|
||||
#else
|
||||
timer_delete(pb_timer);
|
||||
@@ -3586,7 +3586,7 @@ player_deinit(void)
|
||||
free(history);
|
||||
|
||||
pb_timer_stop();
|
||||
#if defined(__linux__)
|
||||
#ifdef HAVE_TIMERFD
|
||||
close(pb_timer_fd);
|
||||
#else
|
||||
timer_delete(pb_timer);
|
||||
|
||||
@@ -41,8 +41,7 @@
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#if defined(HAVE_SYS_EVENTFD_H) && defined(HAVE_EVENTFD)
|
||||
# define USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
# include <sys/eventfd.h>
|
||||
#endif
|
||||
|
||||
@@ -80,7 +79,7 @@ struct remote_info {
|
||||
/* Main event base, from main.c */
|
||||
extern struct event_base *evbase_main;
|
||||
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
static int pairing_efd;
|
||||
#else
|
||||
static int pairing_pipe[2];
|
||||
@@ -389,7 +388,7 @@ add_remote_pin_data(char *devname, char *pin)
|
||||
static void
|
||||
kickoff_pairing(void)
|
||||
{
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
int ret;
|
||||
|
||||
ret = eventfd_write(pairing_efd, 1);
|
||||
@@ -642,7 +641,7 @@ pairing_cb(int fd, short event, void *arg)
|
||||
{
|
||||
struct remote_info *ri;
|
||||
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
eventfd_t count;
|
||||
int ret;
|
||||
|
||||
@@ -908,7 +907,7 @@ remote_pairing_init(void)
|
||||
|
||||
remote_list = NULL;
|
||||
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
pairing_efd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
|
||||
if (pairing_efd < 0)
|
||||
{
|
||||
@@ -933,7 +932,7 @@ remote_pairing_init(void)
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif /* USE_EVENTFD */
|
||||
#endif /* HAVE_EVENTFD */
|
||||
|
||||
// No ipv6 for remote at the moment
|
||||
ret = mdns_browse("_touch-remote._tcp", AF_INET, touch_remote_cb);
|
||||
@@ -944,7 +943,7 @@ remote_pairing_init(void)
|
||||
goto mdns_browse_fail;
|
||||
}
|
||||
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
pairingev = event_new(evbase_main, pairing_efd, EV_READ, pairing_cb, NULL);
|
||||
#else
|
||||
pairingev = event_new(evbase_main, pairing_pipe[0], EV_READ, pairing_cb, NULL);
|
||||
@@ -962,7 +961,7 @@ remote_pairing_init(void)
|
||||
|
||||
pairingev_fail:
|
||||
mdns_browse_fail:
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
close(pairing_efd);
|
||||
#else
|
||||
close(pairing_pipe[0]);
|
||||
@@ -985,7 +984,7 @@ remote_pairing_deinit(void)
|
||||
free_remote(ri);
|
||||
}
|
||||
|
||||
#ifdef USE_EVENTFD
|
||||
#ifdef HAVE_EVENTFD
|
||||
close(pairing_efd);
|
||||
#else
|
||||
close(pairing_pipe[0]);
|
||||
|
||||
@@ -43,12 +43,7 @@
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <libspotify/api.h>
|
||||
|
||||
#ifdef HAVE_JSON_C_OLD
|
||||
# include <json/json.h>
|
||||
#else
|
||||
# include <json-c/json.h>
|
||||
#endif
|
||||
#include <json.h>
|
||||
|
||||
#include "spotify.h"
|
||||
#include "logger.h"
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
#include <libavutil/pixdesc.h>
|
||||
|
||||
#ifdef HAVE_LIBAVFILTER
|
||||
# ifdef HAVE_LIBAVUTIL_CHANNEL_LAYOUT_H
|
||||
# include <libavutil/channel_layout.h>
|
||||
# endif
|
||||
# include <libavfilter/avcodec.h>
|
||||
#else
|
||||
# include "ffmpeg-compat.h"
|
||||
@@ -402,7 +405,7 @@ encode_write_frame(struct encode_ctx *ctx, AVFrame *filt_frame, unsigned int str
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if defined(HAVE_LIBAV_BUFFERSRC_ADD_FRAME_FLAGS) && defined(HAVE_LIBAV_BUFFERSINK_GET_FRAME)
|
||||
#if defined(HAVE_AV_BUFFERSRC_ADD_FRAME_FLAGS) && defined(HAVE_AV_BUFFERSINK_GET_FRAME)
|
||||
static int
|
||||
filter_encode_write_frame(struct encode_ctx *ctx, AVFrame *frame, unsigned int stream_index)
|
||||
{
|
||||
@@ -857,7 +860,7 @@ close_output(struct encode_ctx *ctx)
|
||||
avformat_free_context(ctx->ofmt_ctx);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBAV_GRAPH_PARSE_PTR
|
||||
#ifdef HAVE_AVFILTER_GRAPH_PARSE_PTR
|
||||
static int
|
||||
open_filter(struct filter_ctx *filter_ctx, AVCodecContext *dec_ctx, AVCodecContext *enc_ctx, const char *filter_spec)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user