Commit 26743109 authored by Philippe Gorley's avatar Philippe Gorley Committed by Philippe Gorley

accel: remove vda

VDA is deprecated by Apple and replaced by VideoToolbox starting with
OSX 10.8+. FFmpeg is also deprecating VDA, as it was not ported to the
new hwaccel API.

Change-Id: I3cef3e98e31a8ba2497bebeeb6c72046a7552610
Reviewed-by: default avatarAnthony Léonard <anthony.leonard@savoirfairelinux.com>
parent 20094c7c
......@@ -456,7 +456,6 @@ AC_ARG_ENABLE([accel], AS_HELP_STRING([--disable-accel], [Disable all hardware a
AC_ARG_ENABLE([vdpau], AS_HELP_STRING([--disable-vdpau], [Disable VDPAU hardware acceleration (auto)]))
AC_ARG_ENABLE([vaapi], AS_HELP_STRING([--disable-vaapi], [Disable VAAPI hardware acceleration (auto)]))
AC_ARG_ENABLE([videotoolbox], AS_HELP_STRING([--disable-videotoolbox], [Disable VideoToolbox hardware acceleration (auto)]))
AC_ARG_ENABLE([vda], AS_HELP_STRING([--disable-vda], [Disable VDA hardware acceleration (auto)]))
AS_IF([test "x$enable_video" != "xno" -a "x$enable_accel" != "xno"], [
ring_accel="yes"
AC_DEFINE([RING_ACCEL], [1], [Hardware acceleration is enabled in Ring])
......@@ -499,21 +498,12 @@ AS_IF([test "x$enable_video" != "xno" -a "x$enable_accel" != "xno"], [
])
])
])
AS_IF([test "x$enable_vda" != "xno"], [
AC_CHECK_HEADER([VideoDecodeAcceleration/VDADecoder.h], [
AC_CHECK_HEADER([libavcodec/vda.h], [
ring_vda="yes"
AC_DEFINE([RING_VDA], [1], [Defined if vda is available in Ring])
])
])
])
])
])
AM_CONDITIONAL([RING_ACCEL], [test "x${ring_accel}" = "xyes"])
AM_CONDITIONAL([RING_VAAPI], [test "x${ring_vaapi}" = "xyes"])
AM_CONDITIONAL([RING_VDPAU], [test "x${ring_vdpau}" = "xyes"])
AM_CONDITIONAL([RING_VIDEOTOOLBOX], [test "x${ring_vt}" = "xyes"])
AM_CONDITIONAL([RING_VDA], [test "x${ring_vda}" = "xyes"])
dnl check for GnuTLS
PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.4.14], [HAVE_GNUTLS=1], [HAVE_GNUTLS=0])
......
......@@ -142,9 +142,7 @@ FFMPEGCONF += \
--enable-videotoolbox \
--enable-hwaccel=h263_videotoolbox \
--enable-hwaccel=h264_videotoolbox \
--enable-hwaccel=mpeg4_videotoolbox \
--enable-vda \
--enable-hwaccel=h264_vda
--enable-hwaccel=mpeg4_videotoolbox
endif
ifdef HAVE_IOS
......
......@@ -31,7 +31,7 @@
#include "v4l2/vdpau.h"
#endif
#if defined(RING_VIDEOTOOLBOX) || defined(RING_VDA)
#ifdef RING_VIDEOTOOLBOX
#include "osxvideo/videotoolbox.h"
#endif
......@@ -176,7 +176,6 @@ makeHardwareAccel(AVCodecContext* codecCtx)
Vdpau,
Vaapi,
VideoToolbox,
Vda,
};
struct AccelInfo {
......@@ -208,9 +207,6 @@ makeHardwareAccel(AVCodecContext* codecCtx)
#endif
#ifdef RING_VIDEOTOOLBOX
{ AccelID::VideoToolbox, "videotoolbox", AV_PIX_FMT_VIDEOTOOLBOX, makeHardwareAccel<VideoToolboxAccel> },
#endif
#ifdef RING_VDA
{ AccelID::Vda, "vda", AV_PIX_FMT_VDA, makeHardwareAccel<VideoToolboxAccel> },
#endif
{ AccelID::NoAccel, "none", AV_PIX_FMT_NONE, nullptr },
};
......@@ -221,7 +217,6 @@ makeHardwareAccel(AVCodecContext* codecCtx)
possibleAccels.push_back(AccelID::Vdpau);
possibleAccels.push_back(AccelID::Vaapi);
possibleAccels.push_back(AccelID::VideoToolbox);
possibleAccels.push_back(AccelID::Vda);
break;
case AV_CODEC_ID_MPEG4:
case AV_CODEC_ID_H263P:
......
......@@ -24,16 +24,11 @@
#include "config.h"
#if defined(RING_VIDEOTOOLBOX) || defined(RING_VDA)
#ifdef RING_VIDEOTOOLBOX
extern "C" {
#include <libavcodec/avcodec.h>
#ifdef RING_VIDEOTOOLBOX
#include <libavcodec/videotoolbox.h>
#endif
#ifdef RING_VDA
#include <libavcodec/vda.h>
#endif
#include <libavutil/imgutils.h>
}
......@@ -53,12 +48,8 @@ class VideoToolboxAccel : public HardwareAccel {
bool init() override;
int allocateBuffer(AVFrame* frame, int flags) override;
void extractData(VideoFrame& input, VideoFrame& output) override;
private:
bool usingVT_ = false;
std::string decoderName_;
};
}} // namespace ring::video
#endif // defined(RING_VIDEOTOOLBOX) || defined(RING_VDA)
#endif // RING_VIDEOTOOLBOX
......@@ -22,7 +22,7 @@
#include "config.h"
#if defined(RING_VIDEOTOOLBOX) || defined(RING_VDA)
#ifdef RING_VIDEOTOOLBOX
#include <string>
#include <sstream>
......@@ -42,23 +42,14 @@ VideoToolboxAccel::VideoToolboxAccel(const std::string name, const AVPixelFormat
VideoToolboxAccel::~VideoToolboxAccel()
{
if (codecCtx_) {
if (usingVT_) {
#ifdef RING_VIDEOTOOLBOX
av_videotoolbox_default_free(codecCtx_);
#endif
} else {
#ifdef RING_VDA
av_vda_default_free(codecCtx_);
#endif
}
}
if (codecCtx_)
av_videotoolbox_default_free(codecCtx_);
}
int
VideoToolboxAccel::allocateBuffer(AVFrame* frame, int flags)
{
// do nothing, as this is done during extractData for VideoT and VDA
// do nothing, as this is done during extractData
(void) frame; // unused
(void) flags; // unused
return 0;
......@@ -89,7 +80,7 @@ VideoToolboxAccel::extractData(VideoFrame& input, VideoFrame& output)
char codecTag[32];
av_get_codec_tag_string(codecTag, sizeof(codecTag), codecCtx_->codec_tag);
std::stringstream buf;
buf << decoderName_ << " (" << codecTag << "): unsupported pixel format (";
buf << "VideoToolbox (" << codecTag << "): unsupported pixel format (";
buf << av_get_pix_fmt_name(format_) << ")";
throw std::runtime_error(buf.str());
}
......@@ -99,7 +90,7 @@ VideoToolboxAccel::extractData(VideoFrame& input, VideoFrame& output)
// align on 32 bytes
if (av_frame_get_buffer(outFrame, 32) < 0) {
std::stringstream buf;
buf << "Could not allocate a buffer for " << decoderName_;
buf << "Could not allocate a buffer for VideoToolbox";
throw std::runtime_error(buf.str());
}
......@@ -144,33 +135,15 @@ VideoToolboxAccel::checkAvailability()
bool
VideoToolboxAccel::init()
{
decoderName_ = "";
bool success = false;
#ifdef RING_VIDEOTOOLBOX
if (int ret = av_videotoolbox_default_init(codecCtx_) == 0) {
success = true;
usingVT_ = true;
decoderName_ = "VideoToolbox";
}
#endif
#ifdef RING_VDA
if (!success) {
if (int ret = av_vda_default_init(codecCtx_) == 0) {
success = true;
usingVT_ = false;
decoderName_ = "VDA";
}
if (av_videotoolbox_default_init(codecCtx_) >= 0) {
RING_DBG("VideoToolbox decoder initialized");
return true;
} else {
RING_ERR("Failed to initialize VideoToolbox decoder");
return false;
}
#endif
if (success)
RING_DBG("%s decoder initialized", decoderName_.c_str());
else
RING_ERR("Failed to initialize Mac hardware accelerator");
return success;
}
}}
#endif // defined(RING_VIDEOTOOLBOX) || defined(RING_VDA)
#endif // RING_VIDEOTOOLBOX
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment