mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-25 12:53:09 -04:00
[xcode/artwork] Drop support for ffmpeg legacy versions
This commit is contained in:
parent
b33e2665a1
commit
55d9d9e6bd
32
configure.ac
32
configure.ac
@ -210,7 +210,7 @@ AC_ARG_WITH([libav], [AS_HELP_STRING([--with-libav],
|
|||||||
[[LIBAV=-libav]], [[LIBAV=]])
|
[[LIBAV=-libav]], [[LIBAV=]])
|
||||||
dnl libav/ffmpeg requires many feature checks
|
dnl libav/ffmpeg requires many feature checks
|
||||||
FORK_MODULES_CHECK([FORKED], [LIBAV],
|
FORK_MODULES_CHECK([FORKED], [LIBAV],
|
||||||
[libavformat$LIBAV libavcodec$LIBAV libswscale$LIBAV libavutil$LIBAV libavfilter$LIBAV],
|
[libavformat$LIBAV libavcodec$LIBAV libavutil$LIBAV libavfilter$LIBAV],
|
||||||
[av_init_packet], [libavcodec/avcodec.h],
|
[av_init_packet], [libavcodec/avcodec.h],
|
||||||
[dnl Checks for misc libav and ffmpeg API differences
|
[dnl Checks for misc libav and ffmpeg API differences
|
||||||
AC_MSG_CHECKING([whether libav libraries are ffmpeg])
|
AC_MSG_CHECKING([whether libav libraries are ffmpeg])
|
||||||
@ -231,37 +231,7 @@ FORK_MODULES_CHECK([FORKED], [LIBAV],
|
|||||||
[libavutil/avutil.h])
|
[libavutil/avutil.h])
|
||||||
FORK_CHECK_DECLS([avformat_network_init],
|
FORK_CHECK_DECLS([avformat_network_init],
|
||||||
[libavformat/avformat.h])
|
[libavformat/avformat.h])
|
||||||
dnl Check if we have modern or legacy AV api
|
|
||||||
FORK_CHECK_DECLS([avcodec_send_packet, avcodec_parameters_from_context],
|
|
||||||
[libavcodec/avcodec.h], [[libav_modern_api=yes]], [[libav_modern_api=no]])
|
|
||||||
dnl The below we need to know only if we are going to use the legacy AV api
|
|
||||||
FORK_CHECK_DECLS([av_buffersrc_add_frame_flags],
|
|
||||||
[libavfilter/buffersrc.h])
|
|
||||||
FORK_CHECK_DECLS([av_buffersink_get_frame],
|
|
||||||
[libavfilter/buffersink.h])
|
|
||||||
FORK_CHECK_DECLS([avfilter_graph_parse_ptr],
|
|
||||||
[libavfilter/avfilter.h])
|
|
||||||
FORK_CHECK_DECLS([av_packet_unref],
|
|
||||||
[libavcodec/avcodec.h])
|
|
||||||
FORK_CHECK_DECLS([av_packet_rescale_ts],
|
|
||||||
[libavcodec/avcodec.h])
|
|
||||||
FORK_CHECK_DECLS([avformat_alloc_output_context2],
|
|
||||||
[libavformat/avformat.h])
|
|
||||||
FORK_CHECK_DECLS([av_frame_alloc],
|
|
||||||
[libavutil/frame.h])
|
|
||||||
FORK_CHECK_DECLS([av_frame_get_best_effort_timestamp],
|
|
||||||
[libavutil/frame.h])
|
|
||||||
FORK_CHECK_DECLS([av_image_fill_arrays],
|
|
||||||
[libavutil/imgutils.h])
|
|
||||||
FORK_CHECK_DECLS([av_image_get_buffer_size],
|
|
||||||
[libavutil/imgutils.h])
|
|
||||||
AC_CHECK_HEADERS([libavutil/channel_layout.h libavutil/mathematics.h])
|
|
||||||
])
|
])
|
||||||
dnl Option to choose old ffmpeg/libav API even if modern api was found
|
|
||||||
FORK_ARG_DISABLE([use of ffmpeg/libav API with avcodec_send_packet() and family],
|
|
||||||
[avcodecsend], [USE_AVCODEC_SEND])
|
|
||||||
AM_CONDITIONAL([COND_FFMPEG_LEGACY],
|
|
||||||
[[test "x$libav_modern_api" = "xno" || test "x$enable_avcodecsend" = "xno" ]])
|
|
||||||
|
|
||||||
AC_CHECK_SIZEOF([void *])
|
AC_CHECK_SIZEOF([void *])
|
||||||
|
|
||||||
|
@ -47,12 +47,6 @@ if COND_LIBWEBSOCKETS
|
|||||||
LIBWEBSOCKETS_SRC=websocket.c websocket.h
|
LIBWEBSOCKETS_SRC=websocket.c websocket.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_FFMPEG_LEGACY
|
|
||||||
FFMPEG_SRC=transcode_legacy.c artwork_legacy.c ffmpeg-compat.h
|
|
||||||
else
|
|
||||||
FFMPEG_SRC=transcode.c artwork.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
GPERF_FILES = \
|
GPERF_FILES = \
|
||||||
daap_query.gperf \
|
daap_query.gperf \
|
||||||
rsp_query.gperf \
|
rsp_query.gperf \
|
||||||
@ -118,8 +112,8 @@ forked_daapd_SOURCES = main.c \
|
|||||||
httpd_artworkapi.c httpd_artworkapi.h \
|
httpd_artworkapi.c httpd_artworkapi.h \
|
||||||
http.c http.h \
|
http.c http.h \
|
||||||
dmap_common.c dmap_common.h \
|
dmap_common.c dmap_common.h \
|
||||||
transcode.h artwork.h \
|
transcode.c transcode.h \
|
||||||
$(FFMPEG_SRC) \
|
artwork.c artwork.h \
|
||||||
misc.c misc.h \
|
misc.c misc.h \
|
||||||
misc_json.c misc_json.h \
|
misc_json.c misc_json.h \
|
||||||
rng.c rng.h \
|
rng.c rng.h \
|
||||||
|
1630
src/artwork_legacy.c
1630
src/artwork_legacy.c
File diff suppressed because it is too large
Load Diff
@ -1,105 +0,0 @@
|
|||||||
#ifndef __FFMPEG_COMPAT_H__
|
|
||||||
#define __FFMPEG_COMPAT_H__
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBAVUTIL_CHANNEL_LAYOUT_H
|
|
||||||
# include <libavutil/channel_layout.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBAVUTIL_MATHEMATICS_H
|
|
||||||
# include <libavutil/mathematics.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_FFMPEG
|
|
||||||
# define avcodec_find_best_pix_fmt_of_list(a, b, c, d) avcodec_find_best_pix_fmt2((enum AVPixelFormat *)(a), (b), (c), (d))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !HAVE_DECL_AV_FRAME_ALLOC
|
|
||||||
# define av_frame_alloc() avcodec_alloc_frame()
|
|
||||||
# define av_frame_free(x) avcodec_free_frame((x))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !HAVE_DECL_AV_FRAME_GET_BEST_EFFORT_TIMESTAMP
|
|
||||||
# define av_frame_get_best_effort_timestamp(x) (x)->pts
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !HAVE_DECL_AV_IMAGE_GET_BUFFER_SIZE
|
|
||||||
# define av_image_get_buffer_size(a, b, c, d) avpicture_get_size((a), (b), (c))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !HAVE_DECL_AV_PACKET_UNREF
|
|
||||||
# define av_packet_unref(a) av_free_packet((a))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !HAVE_DECL_AV_PACKET_RESCALE_TS
|
|
||||||
__attribute__((unused)) static void
|
|
||||||
av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational dst_tb)
|
|
||||||
{
|
|
||||||
if (pkt->pts != AV_NOPTS_VALUE)
|
|
||||||
pkt->pts = av_rescale_q(pkt->pts, src_tb, dst_tb);
|
|
||||||
if (pkt->dts != AV_NOPTS_VALUE)
|
|
||||||
pkt->dts = av_rescale_q(pkt->dts, src_tb, dst_tb);
|
|
||||||
if (pkt->duration > 0)
|
|
||||||
pkt->duration = av_rescale_q(pkt->duration, src_tb, dst_tb);
|
|
||||||
if (pkt->convergence_duration > 0)
|
|
||||||
pkt->convergence_duration = av_rescale_q(pkt->convergence_duration, src_tb, dst_tb);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !HAVE_DECL_AVFORMAT_ALLOC_OUTPUT_CONTEXT2
|
|
||||||
# include <libavutil/opt.h>
|
|
||||||
|
|
||||||
__attribute__((unused)) static int
|
|
||||||
avformat_alloc_output_context2(AVFormatContext **avctx, AVOutputFormat *oformat, const char *format, const char *filename)
|
|
||||||
{
|
|
||||||
AVFormatContext *s = avformat_alloc_context();
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
*avctx = NULL;
|
|
||||||
if (!s)
|
|
||||||
goto nomem;
|
|
||||||
|
|
||||||
if (!oformat) {
|
|
||||||
if (format) {
|
|
||||||
oformat = av_guess_format(format, NULL, NULL);
|
|
||||||
if (!oformat) {
|
|
||||||
av_log(s, AV_LOG_ERROR, "Requested output format '%s' is not a suitable output format\n", format);
|
|
||||||
ret = AVERROR(EINVAL);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
oformat = av_guess_format(NULL, filename, NULL);
|
|
||||||
if (!oformat) {
|
|
||||||
ret = AVERROR(EINVAL);
|
|
||||||
av_log(s, AV_LOG_ERROR, "Unable to find a suitable output format for '%s'\n",
|
|
||||||
filename);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
s->oformat = oformat;
|
|
||||||
if (s->oformat->priv_data_size > 0) {
|
|
||||||
s->priv_data = av_mallocz(s->oformat->priv_data_size);
|
|
||||||
if (!s->priv_data)
|
|
||||||
goto nomem;
|
|
||||||
if (s->oformat->priv_class) {
|
|
||||||
*(const AVClass**)s->priv_data= s->oformat->priv_class;
|
|
||||||
av_opt_set_defaults(s->priv_data);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
s->priv_data = NULL;
|
|
||||||
|
|
||||||
if (filename)
|
|
||||||
snprintf(s->filename, sizeof(s->filename), "%s", filename);
|
|
||||||
*avctx = s;
|
|
||||||
return 0;
|
|
||||||
nomem:
|
|
||||||
av_log(s, AV_LOG_ERROR, "Out of memory\n");
|
|
||||||
ret = AVERROR(ENOMEM);
|
|
||||||
error:
|
|
||||||
avformat_free_context(s);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* !__FFMPEG_COMPAT_H__ */
|
|
@ -416,21 +416,13 @@ scan_metadata_ffmpeg(const char *file, struct media_file_info *mfi)
|
|||||||
|
|
||||||
for (i = 0; i < ctx->nb_streams; i++)
|
for (i = 0; i < ctx->nb_streams; i++)
|
||||||
{
|
{
|
||||||
#if HAVE_DECL_AVCODEC_PARAMETERS_FROM_CONTEXT
|
|
||||||
codec_type = ctx->streams[i]->codecpar->codec_type;
|
codec_type = ctx->streams[i]->codecpar->codec_type;
|
||||||
codec_id = ctx->streams[i]->codecpar->codec_id;
|
codec_id = ctx->streams[i]->codecpar->codec_id;
|
||||||
sample_rate = ctx->streams[i]->codecpar->sample_rate;
|
sample_rate = ctx->streams[i]->codecpar->sample_rate;
|
||||||
sample_fmt = ctx->streams[i]->codecpar->format;
|
sample_fmt = ctx->streams[i]->codecpar->format;
|
||||||
#else
|
|
||||||
codec_type = ctx->streams[i]->codec->codec_type;
|
|
||||||
codec_id = ctx->streams[i]->codec->codec_id;
|
|
||||||
sample_rate = ctx->streams[i]->codec->sample_rate;
|
|
||||||
sample_fmt = ctx->streams[i]->codec->sample_fmt;
|
|
||||||
#endif
|
|
||||||
switch (codec_type)
|
switch (codec_type)
|
||||||
{
|
{
|
||||||
case AVMEDIA_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
#if LIBAVFORMAT_VERSION_MAJOR >= 55 || (LIBAVFORMAT_VERSION_MAJOR == 54 && LIBAVFORMAT_VERSION_MINOR >= 6)
|
|
||||||
if (ctx->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC)
|
if (ctx->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC)
|
||||||
{
|
{
|
||||||
DPRINTF(E_DBG, L_SCAN, "Found embedded artwork (stream %d)\n", i);
|
DPRINTF(E_DBG, L_SCAN, "Found embedded artwork (stream %d)\n", i);
|
||||||
@ -438,7 +430,7 @@ scan_metadata_ffmpeg(const char *file, struct media_file_info *mfi)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
// We treat these as audio no matter what
|
// We treat these as audio no matter what
|
||||||
if (mfi->compilation || (mfi->media_kind & (MEDIA_KIND_PODCAST | MEDIA_KIND_AUDIOBOOK)))
|
if (mfi->compilation || (mfi->media_kind & (MEDIA_KIND_PODCAST | MEDIA_KIND_AUDIOBOOK)))
|
||||||
break;
|
break;
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user