Move from libavresample to libswresample
- The libavresample as part of FFmpeg was declared as deprecated in favor of libswresample on Dec 25 2017 in commit "lavr: deprecate the entire library" (c29038f304
;c29038f304
). As major Linux distributions (RPM, DEB and Archlinux) provide now FFmpeg and libswresample as its part use the libswresample instead of libavresample. Signed-off-by: Vladimir Lomov <vladimir@smoon7.vl-lomov.ru>
This commit is contained in:
parent
2e1bf90bd9
commit
41cc2b63cb
@ -13,7 +13,7 @@ include(FindPkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(AVCODEC libavcodec)
|
||||
pkg_check_modules(AVUTIL libavutil)
|
||||
pkg_check_modules(AVRESAMPLE libavresample)
|
||||
pkg_check_modules(SWRESAMPLE libswresample)
|
||||
endif(PKG_CONFIG_FOUND)
|
||||
|
||||
# avcodec
|
||||
@ -24,21 +24,21 @@ find_library(AVCODEC_LIBRARY avcodec PATHS $ {AVCODEC_LIBRARY_DIRS})
|
||||
find_path(AVUTIL_INCLUDE_DIR libavutil/avutil.h PATHS ${AVUTIL_INCLUDE_DIRS})
|
||||
find_library(AVUTIL_LIBRARY avutil PATHS ${AVUTIL_LIBRARY_DIRS})
|
||||
|
||||
# avresample
|
||||
find_path(AVRESAMPLE_INCLUDE_DIR libavresample/avresample.h PATHS ${AVRESAMPLE_INCLUDE_DIRS})
|
||||
find_library(AVRESAMPLE_LIBRARY avresample PATHS ${AVRESAMPLE_LIBRARY_DIRS})
|
||||
# swresample
|
||||
find_path(SWRESAMPLE_INCLUDE_DIR libswresample/swresample.h PATHS ${SWRESAMPLE_INCLUDE_DIRS})
|
||||
find_library(SWRESAMPLE_LIBRARY swresample PATHS ${SWRESAMPLE_LIBRARY_DIRS})
|
||||
|
||||
|
||||
if (AVCODEC_INCLUDE_DIR AND AVCODEC_LIBRARY AND AVRESAMPLE_LIBRARY)
|
||||
if (AVCODEC_INCLUDE_DIR AND AVCODEC_LIBRARY AND SWRESAMPLE_LIBRARY)
|
||||
set(AVCODEC_FOUND TRUE)
|
||||
endif(AVCODEC_INCLUDE_DIR AND AVCODEC_LIBRARY AND AVRESAMPLE_LIBRARY)
|
||||
endif(AVCODEC_INCLUDE_DIR AND AVCODEC_LIBRARY AND SWRESAMPLE_LIBRARY)
|
||||
|
||||
if (AVUTIL_INCLUDE_DIR AND AVUTIL_LIBRARY)
|
||||
set(AVUTIL_FOUND TRUE)
|
||||
endif(AVUTIL_INCLUDE_DIR AND AVUTIL_LIBRARY)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFmpeg DEFAULT_MSG AVUTIL_FOUND AVCODEC_FOUND AVRESAMPLE_FOUND)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFmpeg DEFAULT_MSG AVUTIL_FOUND AVCODEC_FOUND SWRESAMPLE_FOUND)
|
||||
|
||||
if (AVCODEC_VERSION)
|
||||
if (${AVCODEC_VERSION} VERSION_LESS ${REQUIRED_AVCODEC_API_VERSION})
|
||||
@ -50,8 +50,8 @@ else(AVCODEC_VERSION)
|
||||
endif(AVCODEC_VERSION)
|
||||
|
||||
if (FFMPEG_FOUND)
|
||||
set(FFMPEG_INCLUDE_DIRS ${AVCODEC_INCLUDE_DIR} ${AVUTIL_INCLUDE_DIR} ${AVRESAMPLE_INCLUDE_DIR})
|
||||
set(FFMPEG_LIBRARIES ${AVCODEC_LIBRARY} ${AVUTIL_LIBRARY} ${AVRESAMPLE_LIBRARY})
|
||||
set(FFMPEG_INCLUDE_DIRS ${AVCODEC_INCLUDE_DIR} ${AVUTIL_INCLUDE_DIR} ${SWRESAMPLE_INCLUDE_DIR})
|
||||
set(FFMPEG_LIBRARIES ${AVCODEC_LIBRARY} ${AVUTIL_LIBRARY} ${SWRESAMPLE_LIBRARY})
|
||||
endif(FFMPEG_FOUND)
|
||||
|
||||
mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES)
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavutil/avutil.h>
|
||||
#include <libavutil/opt.h>
|
||||
#include <libavresample/avresample.h>
|
||||
#include <libswresample/swresample.h>
|
||||
|
||||
#include "dsp.h"
|
||||
#include "dsp_ffmpeg.h"
|
||||
@ -50,7 +50,7 @@ struct _FREERDP_DSP_CONTEXT
|
||||
AVFrame* resampled;
|
||||
AVFrame* buffered;
|
||||
AVPacket* packet;
|
||||
AVAudioResampleContext* rcontext;
|
||||
SwrContext* rcontext;
|
||||
};
|
||||
|
||||
static BOOL ffmpeg_codec_is_filtered(enum AVCodecID id, BOOL encoder)
|
||||
@ -185,7 +185,7 @@ static void ffmpeg_close_context(FREERDP_DSP_CONTEXT* context)
|
||||
av_packet_free(&context->packet);
|
||||
|
||||
if (context->rcontext)
|
||||
avresample_free(&context->rcontext);
|
||||
swr_free(&context->rcontext);
|
||||
|
||||
context->id = AV_CODEC_ID_NONE;
|
||||
context->codec = NULL;
|
||||
@ -281,7 +281,7 @@ static BOOL ffmpeg_open_context(FREERDP_DSP_CONTEXT* context)
|
||||
if (!context->buffered)
|
||||
goto fail;
|
||||
|
||||
context->rcontext = avresample_alloc_context();
|
||||
context->rcontext = swr_alloc;
|
||||
|
||||
if (!context->rcontext)
|
||||
goto fail;
|
||||
@ -322,21 +322,21 @@ fail:
|
||||
ffmpeg_close_context(context);
|
||||
return FALSE;
|
||||
}
|
||||
static BOOL ffmpeg_resample_frame(AVAudioResampleContext* context,
|
||||
static BOOL ffmpeg_resample_frame(SwrContext* context,
|
||||
AVFrame* in, AVFrame* out)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!avresample_is_open(context))
|
||||
if (!swr_is_initialized(context))
|
||||
{
|
||||
if ((ret = avresample_config(context, out, in)) < 0)
|
||||
if ((ret = swr_config_frame(context, out, in)) < 0)
|
||||
{
|
||||
const char* err = av_err2str(ret);
|
||||
WLog_ERR(TAG, "Error during resampling %s [%d]", err, ret);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((ret = (avresample_open(context))) < 0)
|
||||
if ((ret = (swr_init(context))) < 0)
|
||||
{
|
||||
const char* err = av_err2str(ret);
|
||||
WLog_ERR(TAG, "Error during resampling %s [%d]", err, ret);
|
||||
@ -344,7 +344,7 @@ static BOOL ffmpeg_resample_frame(AVAudioResampleContext* context,
|
||||
}
|
||||
}
|
||||
|
||||
if ((ret = avresample_convert_frame(context, out, in)) < 0)
|
||||
if ((ret = swr_convert_frame(context, out, in)) < 0)
|
||||
{
|
||||
const char* err = av_err2str(ret);
|
||||
WLog_ERR(TAG, "Error during resampling %s [%d]", err, ret);
|
||||
@ -416,7 +416,7 @@ static BOOL ffmpeg_fill_frame(AVFrame* frame, const AUDIO_FORMAT* inputFormat,
|
||||
}
|
||||
static BOOL ffmpeg_decode(AVCodecContext* dec_ctx, AVPacket* pkt,
|
||||
AVFrame* frame,
|
||||
AVAudioResampleContext* resampleContext,
|
||||
SwrContext* resampleContext,
|
||||
AVFrame* resampled, wStream* out)
|
||||
{
|
||||
int ret;
|
||||
@ -445,16 +445,16 @@ static BOOL ffmpeg_decode(AVCodecContext* dec_ctx, AVPacket* pkt,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!avresample_is_open(resampleContext))
|
||||
if (!swr_is_initialized(resampleContext))
|
||||
{
|
||||
if ((ret = avresample_config(resampleContext, resampled, frame)) < 0)
|
||||
if ((ret = swr_config_frame(resampleContext, resampled, frame)) < 0)
|
||||
{
|
||||
const char* err = av_err2str(ret);
|
||||
WLog_ERR(TAG, "Error during resampling %s [%d]", err, ret);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((ret = (avresample_open(resampleContext))) < 0)
|
||||
if ((ret = (swr_init(resampleContext))) < 0)
|
||||
{
|
||||
const char* err = av_err2str(ret);
|
||||
WLog_ERR(TAG, "Error during resampling %s [%d]", err, ret);
|
||||
@ -462,7 +462,7 @@ static BOOL ffmpeg_decode(AVCodecContext* dec_ctx, AVPacket* pkt,
|
||||
}
|
||||
}
|
||||
|
||||
if ((ret = avresample_convert_frame(resampleContext, resampled, frame)) < 0)
|
||||
if ((ret = swr_convert_frame(resampleContext, resampled, frame)) < 0)
|
||||
{
|
||||
const char* err = av_err2str(ret);
|
||||
WLog_ERR(TAG, "Error during resampling %s [%d]", err, ret);
|
||||
|
@ -32,7 +32,7 @@ Build-Depends:
|
||||
libpulse-dev,
|
||||
libavcodec-dev,
|
||||
libavutil-dev,
|
||||
libavresample-dev,
|
||||
libswresample-dev,
|
||||
libusb-1.0-0-dev,
|
||||
libudev-dev,
|
||||
libdbus-glib-1-dev,
|
||||
|
@ -63,7 +63,7 @@ BuildRequires: wayland-devel
|
||||
BuildRequires: libjpeg-devel
|
||||
BuildRequires: libavutil-devel
|
||||
BuildRequires: libavcodec-devel
|
||||
BuildRequires: libavresample-devel
|
||||
BuildRequires: libswresample-devel
|
||||
%endif
|
||||
# fedora 21+
|
||||
%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7
|
||||
|
Loading…
Reference in New Issue
Block a user