mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-26 07:05:57 -05:00
libav 0.7: Use AVIO with libavformat >= 53
This commit is contained in:
parent
6aa45c0b0c
commit
a453e0e4ac
@ -136,6 +136,14 @@ save_LIBS="$LIBS"
|
||||
AC_CHECK_LIB([avcodec], [av_lockmgr_register], , AC_MSG_ERROR([libav (ffmpeg) >= 0.5.1 required]))
|
||||
LIBS="$save_LIBS"
|
||||
|
||||
# Check for libavformat >= 53; url -> avio switch
|
||||
_PKG_CONFIG([libavformat_VERSION], [atleast-version=53], [libavformat])
|
||||
if test $pkg_failed = yes; then
|
||||
AM_CONDITIONAL(COND_AVIO, false)
|
||||
else
|
||||
AM_CONDITIONAL(COND_AVIO, true)
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES(MINIXML, [ mxml ])
|
||||
|
||||
AC_CHECK_HEADER(event.h, , AC_MSG_ERROR([event.h not found]))
|
||||
|
@ -21,6 +21,12 @@ if COND_OSS4
|
||||
OSS4SRC=laudio_oss4.c
|
||||
endif
|
||||
|
||||
if COND_AVIO
|
||||
AVIO_SRC=avio_evbuffer.c avio_evbuffer.h
|
||||
else
|
||||
FFURL_SRC=ffmpeg_url_evbuffer.c ffmpeg_url_evbuffer.h
|
||||
endif
|
||||
|
||||
GPERF_FILES = \
|
||||
daap_query.gperf \
|
||||
rsp_query.gperf \
|
||||
@ -71,7 +77,7 @@ forked_daapd_SOURCES = main.c \
|
||||
remote_pairing.c remote_pairing.h \
|
||||
evhttp/http.c evhttp/evhttp.h \
|
||||
evhttp/http-internal.h evhttp/log.h \
|
||||
ffmpeg_url_evbuffer.c ffmpeg_url_evbuffer.h \
|
||||
$(FFURL_SRC) $(AVIO_SRC) \
|
||||
httpd.c httpd.h \
|
||||
httpd_rsp.c httpd_rsp.h \
|
||||
httpd_daap.c httpd_daap.h \
|
||||
|
@ -37,6 +37,9 @@
|
||||
|
||||
#include "db.h"
|
||||
#include "logger.h"
|
||||
#if LIBAVFORMAT_VERSION_MAJOR >= 53
|
||||
# include "avio_evbuffer.h"
|
||||
#endif
|
||||
#include "artwork.h"
|
||||
|
||||
|
||||
@ -196,6 +199,9 @@ artwork_rescale(AVFormatContext *src_ctx, int s, int out_w, int out_h, int forma
|
||||
|
||||
dst_ctx->oformat = dst_fmt;
|
||||
|
||||
#if LIBAVFORMAT_VERSION_MAJOR >= 53
|
||||
dst_fmt->flags &= ~AVFMT_NOFILE;
|
||||
#else
|
||||
ret = snprintf(dst_ctx->filename, sizeof(dst_ctx->filename), "evbuffer:%p", evbuf);
|
||||
if ((ret < 0) || (ret >= sizeof(dst_ctx->filename)))
|
||||
{
|
||||
@ -204,6 +210,7 @@ artwork_rescale(AVFormatContext *src_ctx, int s, int out_w, int out_h, int forma
|
||||
ret = -1;
|
||||
goto out_free_dst_ctx;
|
||||
}
|
||||
#endif
|
||||
|
||||
dst_st = av_new_stream(dst_ctx, 0);
|
||||
if (!dst_st)
|
||||
@ -357,7 +364,11 @@ artwork_rescale(AVFormatContext *src_ctx, int s, int out_w, int out_h, int forma
|
||||
av_free_packet(&pkt);
|
||||
|
||||
/* Open output file */
|
||||
#if LIBAVFORMAT_VERSION_MAJOR >= 53
|
||||
dst_ctx->pb = avio_evbuffer_open(evbuf);
|
||||
#else
|
||||
ret = url_fopen(&dst_ctx->pb, dst_ctx->filename, URL_WRONLY);
|
||||
#endif
|
||||
if (ret < 0)
|
||||
{
|
||||
DPRINTF(E_LOG, L_ART, "Could not open artwork destination buffer\n");
|
||||
@ -376,7 +387,11 @@ artwork_rescale(AVFormatContext *src_ctx, int s, int out_w, int out_h, int forma
|
||||
{
|
||||
DPRINTF(E_LOG, L_ART, "Out of memory for encoded artwork buffer\n");
|
||||
|
||||
#if LIBAVFORMAT_VERSION_MAJOR >= 53
|
||||
avio_evbuffer_close(dst_ctx->pb);
|
||||
#else
|
||||
url_fclose(dst_ctx->pb);
|
||||
#endif
|
||||
|
||||
ret = -1;
|
||||
goto out_free_buf;
|
||||
@ -441,7 +456,11 @@ artwork_rescale(AVFormatContext *src_ctx, int s, int out_w, int out_h, int forma
|
||||
}
|
||||
|
||||
out_fclose_dst:
|
||||
#if LIBAVFORMAT_VERSION_MAJOR >= 53
|
||||
avio_evbuffer_close(dst_ctx->pb);
|
||||
#else
|
||||
url_fclose(dst_ctx->pb);
|
||||
#endif
|
||||
av_free(outbuf);
|
||||
|
||||
out_free_buf:
|
||||
|
@ -64,7 +64,9 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL;
|
||||
#include "mdns.h"
|
||||
#include "remote_pairing.h"
|
||||
#include "player.h"
|
||||
#include "ffmpeg_url_evbuffer.h"
|
||||
#if LIBAVFORMAT_VERSION_MAJOR < 53
|
||||
# include "ffmpeg_url_evbuffer.h"
|
||||
#endif
|
||||
|
||||
|
||||
#define PIDFILE STATEDIR "/run/" PACKAGE ".pid"
|
||||
@ -597,7 +599,9 @@ main(int argc, char **argv)
|
||||
|
||||
av_register_all();
|
||||
av_log_set_callback(logger_ffmpeg);
|
||||
#if LIBAVFORMAT_VERSION_MAJOR < 53
|
||||
register_ffmpeg_evbuffer_url_protocol();
|
||||
#endif
|
||||
|
||||
/* Initialize libgcrypt */
|
||||
gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
|
||||
|
Loading…
Reference in New Issue
Block a user