mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-10 22:10:15 -05:00
[config] Many updates to configuration and feature checks
- Added custom checks for libraries and pkgconfig modules that test library presence with additional checks for use of headers and functions with given options. Also support correct additional feature library checks using provided flags. - Added custom enable/disable feature macros to simplify their use. - Use custom CFLAGS and LIBS variables for Makefiles to simplify maintenance. - Update many feature checks from platform to function. - Streamline many function checks. - Correctly check gnutls, gcrypt and gpg-error libraries. - Fix chromecast and spotify config and compile on FreeBSD - Added inotify, signalfd and kqueue, and byte swap checks. - Many clarifications of error messages. - Correct json-c checks to properly use supplied CFLAGS. - Correct many quoting inconsistencies - Use __DATE__ in place of BUILDDATE - Use full path for gperf and antlr3 - Remove unnecessary CFLAGS - Added tests for pthread_setname_np parameters - Added tests for clock_gettime and timer_settime - Added tests for time.h - Test if pthread, dl and rt libs are required/available. - Updated checks for libunistring
This commit is contained in:
@@ -59,22 +59,8 @@ ANTLR_SRC = \
|
||||
SMARTPL2SQL.c SMARTPL2SQL.h
|
||||
|
||||
AM_CPPFLAGS += \
|
||||
$(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_CPPFLAGS) \
|
||||
$(COMMON_CPPFLAGS) \
|
||||
\
|
||||
-D_GNU_SOURCE \
|
||||
-DDATADIR=\"$(pkgdatadir)\" \
|
||||
@@ -82,26 +68,9 @@ AM_CPPFLAGS += \
|
||||
-DSTATEDIR=\"$(localstatedir)\" \
|
||||
-DPKGLIBDIR=\"$(pkglibdir)\"
|
||||
|
||||
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 \
|
||||
@@ -170,7 +139,7 @@ EXTRA_DIST = \
|
||||
# ANTLR dependency files (bypass circular dependency of .g on .tokens)
|
||||
%.u: %.g
|
||||
$(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)$(SED) -n -e '/^.*\.g[ ]*:\(.*\)/ { s//\1/;h;d; }' -e '/\.tokens.*:/ { p;d; }' -e '/:/ { G;s/\n/ /;p; }' $@ > $@-t
|
||||
$(AM_V_at)mv $@-t $@
|
||||
|
||||
-include $(ANTLR_DEPS)
|
||||
|
||||
@@ -498,7 +498,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);
|
||||
|
||||
@@ -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;
|
||||
@@ -1059,9 +1060,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)
|
||||
@@ -1252,7 +1253,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
|
||||
@@ -1716,9 +1717,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)
|
||||
@@ -1757,6 +1759,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);
|
||||
|
||||
@@ -1868,9 +1871,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);
|
||||
@@ -1895,7 +1898,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)
|
||||
{
|
||||
@@ -1912,7 +1915,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);
|
||||
|
||||
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
|
||||
|
||||
@@ -140,7 +139,7 @@ dacp_propset_userrating(const char *value, struct evkeyvalq *query);
|
||||
|
||||
|
||||
/* 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
|
||||
|
||||
14
src/main.c
14
src/main.c
@@ -39,7 +39,7 @@
|
||||
|
||||
#ifdef HAVE_SIGNALFD
|
||||
# include <sys/signalfd.h>
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#else
|
||||
# include <sys/time.h>
|
||||
# include <sys/event.h>
|
||||
#endif
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -32,9 +32,11 @@
|
||||
#include <libavutil/opt.h>
|
||||
#include <libavutil/time.h>
|
||||
#include <libavutil/pixdesc.h>
|
||||
#include <libavutil/channel_layout.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"
|
||||
@@ -403,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)
|
||||
{
|
||||
@@ -858,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