From c6ab78a01cce354d35207b9f29b23be9e7ae3bbd Mon Sep 17 00:00:00 2001 From: Pierre Lespagnol <pierre.lespagnol@savoirfairelinux.com> Date: Mon, 17 Feb 2020 09:57:21 -0500 Subject: [PATCH] accel: filter accel APIs by platform Use ffmpeg flags Change-Id: I86246e86d3c7038825fc4416789d7b62a2f260a4 --- src/media/video/accel.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/media/video/accel.cpp b/src/media/video/accel.cpp index dc375e1566..0632bbc4c6 100644 --- a/src/media/video/accel.cpp +++ b/src/media/video/accel.cpp @@ -350,11 +350,16 @@ HardwareAccel::getCompatibleAccel(AVCodecID id, int width, int height, CodecType for (auto api : *list) { const auto& it = std::find(api.supportedCodecs.begin(), api.supportedCodecs.end(), id); if (it != api.supportedCodecs.end()) { - auto accel = HardwareAccel(id, api.name, api.hwType, api.format, api.swFormat, type); - accel.height_ = height; - accel.width_ = width; - accel.possible_devices_= api.possible_devices; - l.emplace_back(std::move(accel)); + auto hwtype = AV_HWDEVICE_TYPE_NONE; + while ((hwtype = av_hwdevice_iterate_types(hwtype)) != AV_HWDEVICE_TYPE_NONE) { + if (hwtype == api.hwType) { + auto accel = HardwareAccel(id, api.name, api.hwType, api.format, api.swFormat, type); + accel.height_ = height; + accel.width_ = width; + accel.possible_devices_= api.possible_devices; + l.emplace_back(std::move(accel)); + } + } } } return l; -- GitLab