diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake index 645971e5e..08f465916 100644 --- a/cmake/FindFFmpeg.cmake +++ b/cmake/FindFFmpeg.cmake @@ -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) diff --git a/libfreerdp/codec/dsp_ffmpeg.c b/libfreerdp/codec/dsp_ffmpeg.c index 68bfd0691..bcde25b0a 100644 --- a/libfreerdp/codec/dsp_ffmpeg.c +++ b/libfreerdp/codec/dsp_ffmpeg.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #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); diff --git a/packaging/deb/freerdp-nightly/control b/packaging/deb/freerdp-nightly/control index 1e0c19226..498e9cb21 100644 --- a/packaging/deb/freerdp-nightly/control +++ b/packaging/deb/freerdp-nightly/control @@ -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, diff --git a/packaging/rpm/freerdp-nightly.spec b/packaging/rpm/freerdp-nightly.spec index c2c47e416..959510483 100644 --- a/packaging/rpm/freerdp-nightly.spec +++ b/packaging/rpm/freerdp-nightly.spec @@ -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