summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliushuyu <liushuyu011@gmail.com>2021-11-30 00:47:24 +0100
committerliushuyu <liushuyu011@gmail.com>2021-12-03 05:01:34 +0100
commit20a46790d7059c7fa8efeb1c95e62a57d97e42e3 (patch)
tree716206d9dd8c0fb61efad5de1ed295a0b8dd3dec
parentvideo_core/codecs: more robust ffmpeg hwdecoder selection logic (diff)
downloadyuzu-20a46790d7059c7fa8efeb1c95e62a57d97e42e3.tar
yuzu-20a46790d7059c7fa8efeb1c95e62a57d97e42e3.tar.gz
yuzu-20a46790d7059c7fa8efeb1c95e62a57d97e42e3.tar.bz2
yuzu-20a46790d7059c7fa8efeb1c95e62a57d97e42e3.tar.lz
yuzu-20a46790d7059c7fa8efeb1c95e62a57d97e42e3.tar.xz
yuzu-20a46790d7059c7fa8efeb1c95e62a57d97e42e3.tar.zst
yuzu-20a46790d7059c7fa8efeb1c95e62a57d97e42e3.zip
-rw-r--r--src/video_core/command_classes/codecs/codec.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/video_core/command_classes/codecs/codec.cpp b/src/video_core/command_classes/codecs/codec.cpp
index 1949a8cf3..2c0d8da64 100644
--- a/src/video_core/command_classes/codecs/codec.cpp
+++ b/src/video_core/command_classes/codecs/codec.cpp
@@ -23,14 +23,17 @@ namespace Tegra {
namespace {
constexpr AVPixelFormat PREFERRED_GPU_FMT = AV_PIX_FMT_NV12;
constexpr AVPixelFormat PREFERRED_CPU_FMT = AV_PIX_FMT_YUV420P;
-constexpr std::array PREFERRED_GPU_DECODERS = {AV_HWDEVICE_TYPE_CUDA,
+constexpr std::array PREFERRED_GPU_DECODERS = {
+ AV_HWDEVICE_TYPE_CUDA,
#ifdef _WIN32
- AV_HWDEVICE_TYPE_D3D11VA, AV_HWDEVICE_TYPE_DXVA2,
-#elif linux
- AV_HWDEVICE_TYPE_VDPAU,
+ AV_HWDEVICE_TYPE_D3D11VA,
+ AV_HWDEVICE_TYPE_DXVA2,
+#elif defined(__linux__)
+ AV_HWDEVICE_TYPE_VDPAU,
#endif
- // last resort for Linux Flatpak (w/ NVIDIA)
- AV_HWDEVICE_TYPE_VULKAN};
+ // last resort for Linux Flatpak (w/ NVIDIA)
+ AV_HWDEVICE_TYPE_VULKAN,
+};
void AVPacketDeleter(AVPacket* ptr) {
av_packet_free(&ptr);
@@ -72,12 +75,13 @@ Codec::~Codec() {
// List all the currently available hwcontext in ffmpeg
static std::vector<AVHWDeviceType> ListSupportedContexts() {
std::vector<AVHWDeviceType> contexts{};
- enum AVHWDeviceType current_device_type = AV_HWDEVICE_TYPE_NONE;
+ AVHWDeviceType current_device_type = AV_HWDEVICE_TYPE_NONE;
do {
current_device_type = av_hwdevice_iterate_types(current_device_type);
// filter out VA-API since we will try that first if supported
- if (current_device_type != AV_HWDEVICE_TYPE_VAAPI)
+ if (current_device_type != AV_HWDEVICE_TYPE_VAAPI) {
contexts.push_back(current_device_type);
+ }
} while (current_device_type != AV_HWDEVICE_TYPE_NONE);
return contexts;
}