mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-26 07:05:57 -05:00
[httpd/artwork] Drop support for libevent <2.1.4
This commit is contained in:
parent
d38b07bbad
commit
5f342ea60b
@ -148,13 +148,7 @@ OWNTONE_MODULES_CHECK([COMMON], [SQLITE3], [sqlite3 >= 3.5.0],
|
||||
[AC_MSG_RESULT([[runtime will tell]])])
|
||||
])
|
||||
|
||||
OWNTONE_MODULES_CHECK([OWNTONE], [LIBEVENT], [libevent >= 2],
|
||||
[event_base_new], [event2/event.h],
|
||||
[dnl check for old version
|
||||
PKG_CHECK_EXISTS([libevent >= 2.1.4], [],
|
||||
[AC_DEFINE([HAVE_LIBEVENT2_OLD], 1,
|
||||
[Define to 1 if you have libevent 2 (<2.1.4)])])
|
||||
])
|
||||
OWNTONE_MODULES_CHECK([OWNTONE], [LIBEVENT], [libevent >= 2.1.4], [event_base_new], [event2/event.h])
|
||||
|
||||
dnl Check for evhttp_connection_get_peer() signature
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
|
@ -224,7 +224,7 @@ Libraries:
|
||||
from <http://ffmpeg.org/>
|
||||
- libconfuse
|
||||
from <http://www.nongnu.org/confuse/>
|
||||
- libevent 2.0+ (best with 2.1.4+)
|
||||
- libevent 2.1.4+
|
||||
from <http://libevent.org/>
|
||||
- MiniXML (aka mxml or libmxml)
|
||||
from <http://minixml.org/software.php>
|
||||
|
@ -582,20 +582,6 @@ size_calculate(int *dst_w, int *dst_h, int src_w, int src_h, int max_w, int max_
|
||||
DPRINTF(E_DBG, L_ART, "Rescale required, destination width %d height %d\n", *dst_w, *dst_h);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBEVENT2_OLD
|
||||
// This is not how this function is actually defined in libevent 2.1+, but it
|
||||
// works as a less optimal stand-in
|
||||
int
|
||||
evbuffer_add_buffer_reference(struct evbuffer *outbuf, struct evbuffer *inbuf)
|
||||
{
|
||||
uint8_t *buf = evbuffer_pullup(inbuf, -1);
|
||||
if (!buf)
|
||||
return -1;
|
||||
|
||||
return evbuffer_add_reference(outbuf, buf, evbuffer_get_length(inbuf), NULL, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Either gets the artwork file given in "path" (rescaled if needed) or rescales
|
||||
* the artwork given in "inbuf".
|
||||
|
@ -63,17 +63,6 @@
|
||||
#include "log.h"
|
||||
#include "rtsp-internal.h"
|
||||
|
||||
// For compability with libevent 2.0 (HAVE_LIBEVENT2_OLD)
|
||||
#if defined(_EVENT_HAVE_GETNAMEINFO)
|
||||
# define EVENT__HAVE_GETNAMEINFO 1
|
||||
#endif
|
||||
#if defined(_EVENT_HAVE_GETADDRINFO)
|
||||
# define EVENT__HAVE_GETADDRINFO 1
|
||||
#endif
|
||||
#if defined(_EVENT_HAVE_STRSEP)
|
||||
# define EVENT__HAVE_STRSEP 1
|
||||
#endif
|
||||
|
||||
#ifndef EVENT__HAVE_GETNAMEINFO
|
||||
#define NI_MAXSERV 32
|
||||
#define NI_MAXHOST 1025
|
||||
|
42
src/httpd.c
42
src/httpd.c
@ -42,10 +42,6 @@
|
||||
#include <event2/event.h>
|
||||
#include <event2/http.h>
|
||||
#include <event2/http_struct.h>
|
||||
#ifdef HAVE_LIBEVENT2_OLD
|
||||
# include <event2/bufferevent.h>
|
||||
# include <event2/bufferevent_struct.h>
|
||||
#endif
|
||||
#include <zlib.h>
|
||||
|
||||
#include "logger.h"
|
||||
@ -134,10 +130,6 @@ static pthread_t tid_httpd;
|
||||
static const char *allow_origin;
|
||||
static int httpd_port;
|
||||
|
||||
#ifdef HAVE_LIBEVENT2_OLD
|
||||
struct stream_ctx *g_st;
|
||||
#endif
|
||||
|
||||
|
||||
/* -------------------------------- HELPERS --------------------------------- */
|
||||
|
||||
@ -550,11 +542,6 @@ stream_end(struct stream_ctx *st, int failed)
|
||||
close(st->fd);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBEVENT2_OLD
|
||||
if (g_st == st)
|
||||
g_st = NULL;
|
||||
#endif
|
||||
|
||||
free(st);
|
||||
}
|
||||
|
||||
@ -592,15 +579,6 @@ stream_chunk_resched_cb(struct evhttp_connection *evcon, void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBEVENT2_OLD
|
||||
static void
|
||||
stream_chunk_resched_cb_wrapper(struct bufferevent *bufev, void *arg)
|
||||
{
|
||||
if (g_st)
|
||||
stream_chunk_resched_cb(NULL, g_st);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
stream_chunk_xcode_cb(int fd, short event, void *arg)
|
||||
{
|
||||
@ -648,17 +626,7 @@ stream_chunk_xcode_cb(int fd, short event, void *arg)
|
||||
else
|
||||
ret = xcoded;
|
||||
|
||||
#ifdef HAVE_LIBEVENT2_OLD
|
||||
evhttp_send_reply_chunk(st->req, st->evbuf);
|
||||
|
||||
struct evhttp_connection *evcon = evhttp_request_get_connection(st->req);
|
||||
struct bufferevent *bufev = evhttp_connection_get_bufferevent(evcon);
|
||||
|
||||
g_st = st; // Can't pass st to callback so use global - limits libevent 2.0 to a single stream
|
||||
bufev->writecb = stream_chunk_resched_cb_wrapper;
|
||||
#else
|
||||
evhttp_send_reply_chunk_with_cb(st->req, st->evbuf, stream_chunk_resched_cb, st);
|
||||
#endif
|
||||
|
||||
st->offset += ret;
|
||||
|
||||
@ -714,17 +682,7 @@ stream_chunk_raw_cb(int fd, short event, void *arg)
|
||||
|
||||
evbuffer_add(st->evbuf, st->buf, ret);
|
||||
|
||||
#ifdef HAVE_LIBEVENT2_OLD
|
||||
evhttp_send_reply_chunk(st->req, st->evbuf);
|
||||
|
||||
struct evhttp_connection *evcon = evhttp_request_get_connection(st->req);
|
||||
struct bufferevent *bufev = evhttp_connection_get_bufferevent(evcon);
|
||||
|
||||
g_st = st; // Can't pass st to callback so use global - limits libevent 2.0 to a single stream
|
||||
bufev->writecb = stream_chunk_resched_cb_wrapper;
|
||||
#else
|
||||
evhttp_send_reply_chunk_with_cb(st->req, st->evbuf, stream_chunk_resched_cb, st);
|
||||
#endif
|
||||
|
||||
st->offset += ret;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user