Proper update to libevent 2 (artwork, avio_evbuffer, dmap_common, transcode)

This commit is contained in:
ejurgensen 2014-09-28 22:44:45 +02:00
parent 661a557500
commit 513e38dcda
6 changed files with 30 additions and 9 deletions

View File

@ -43,6 +43,10 @@
#endif #endif
#include "artwork.h" #include "artwork.h"
#ifndef HAVE_LIBEVENT2
# define evbuffer_get_length(x) (x)->off
#endif
#ifdef HAVE_SPOTIFY_H #ifdef HAVE_SPOTIFY_H
# include "spotify.h" # include "spotify.h"
#endif #endif
@ -717,8 +721,8 @@ artwork_get(char *filename, int max_w, int max_h, int format, struct evbuffer *e
if (ret < 0) if (ret < 0)
{ {
if (EVBUFFER_LENGTH(evbuf) > 0) if (evbuffer_get_length(evbuf) > 0)
evbuffer_drain(evbuf, EVBUFFER_LENGTH(evbuf)); evbuffer_drain(evbuf, evbuffer_get_length(evbuf));
} }
return ret; return ret;
@ -838,8 +842,8 @@ artwork_get_embedded_image(char *filename, int max_w, int max_h, int format, str
if (ret < 0) if (ret < 0)
{ {
if (EVBUFFER_LENGTH(evbuf) > 0) if (evbuffer_get_length(evbuf) > 0)
evbuffer_drain(evbuf, EVBUFFER_LENGTH(evbuf)); evbuffer_drain(evbuf, evbuffer_get_length(evbuf));
} }
return ret; return ret;

View File

@ -8,7 +8,11 @@
#define ART_FMT_PNG 1 #define ART_FMT_PNG 1
#define ART_FMT_JPEG 2 #define ART_FMT_JPEG 2
#include <event.h> #ifdef HAVE_LIBEVENT2
# include <event2/buffer.h>
#else
# include <event.h>
#endif
int int
artwork_get_item_filename(char *filename, int max_w, int max_h, int format, struct evbuffer *evbuf); artwork_get_item_filename(char *filename, int max_w, int max_h, int format, struct evbuffer *evbuf);

View File

@ -2,7 +2,11 @@
#ifndef __AVIO_EVBUFFER_H__ #ifndef __AVIO_EVBUFFER_H__
#define __AVIO_EVBUFFER_H__ #define __AVIO_EVBUFFER_H__
#include <event.h> #ifdef HAVE_LIBEVENT2
# include <event2/buffer.h>
#else
# include <event.h>
#endif
AVIOContext * AVIOContext *
avio_evbuffer_open(struct evbuffer *evbuf); avio_evbuffer_open(struct evbuffer *evbuf);

View File

@ -23,6 +23,10 @@
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#ifndef HAVE_LIBEVENT2
# define evbuffer_get_length(x) (x)->off
#endif
#include "db.h" #include "db.h"
#include "misc.h" #include "misc.h"
#include "logger.h" #include "logger.h"
@ -529,7 +533,7 @@ dmap_encode_file_metadata(struct evbuffer *songlist, struct evbuffer *song, stru
if (want_asdk) if (want_asdk)
val += 9; val += 9;
dmap_add_container(songlist, "mlit", EVBUFFER_LENGTH(song) + val); dmap_add_container(songlist, "mlit", evbuffer_get_length(song) + val);
/* Prepend mikd & asdk if needed */ /* Prepend mikd & asdk if needed */
if (want_mikd) if (want_mikd)

View File

@ -2,10 +2,11 @@
#ifndef __DMAP_HELPERS_H__ #ifndef __DMAP_HELPERS_H__
#define __DMAP_HELPERS_H__ #define __DMAP_HELPERS_H__
#include <event.h>
#ifdef HAVE_LIBEVENT2 #ifdef HAVE_LIBEVENT2
# include <event2/buffer.h>
# include <event2/http.h> # include <event2/http.h>
#else #else
# include <event.h>
# include "evhttp/evhttp.h" # include "evhttp/evhttp.h"
#endif #endif

View File

@ -2,7 +2,11 @@
#ifndef __TRANSCODE_H__ #ifndef __TRANSCODE_H__
#define __TRANSCODE_H__ #define __TRANSCODE_H__
#include <event.h> #ifdef HAVE_LIBEVENT2
# include <event2/buffer.h>
#else
# include <event.h>
#endif
struct transcode_ctx; struct transcode_ctx;