From fc1ab5fcbc8d99296dd36618e1a3c7682a70e65f Mon Sep 17 00:00:00 2001 From: Kurt Kartaltepe Date: Sat, 25 May 2024 16:58:05 -0700 Subject: [PATCH] obs-ffmpeg: Check correct VA-API codec support Previously, we just checked for H264 regardless of which codec was selected. This mostly worked, but on Fedora they ship AV1 without H264 or HEVC. In that case users wont see AV1 as an option. --- plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c index 2f580f811..96d08f29f 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c @@ -1074,6 +1074,21 @@ static bool get_device_name_from_pci(struct pci_access *pacc, char *pci_slot, return false; } +static bool vaapi_device_codec_supported(const char *path, + enum codec_type codec) +{ + switch (codec) { + case CODEC_H264: + return vaapi_device_h264_supported(path); + case CODEC_HEVC: + return vaapi_device_hevc_supported(path); + case CODEC_AV1: + return vaapi_device_av1_supported(path); + default: + return false; + } +} + static obs_properties_t *vaapi_properties_internal(enum codec_type codec) { obs_properties_t *props = obs_properties_create(); @@ -1122,7 +1137,7 @@ static obs_properties_t *vaapi_properties_internal(enum codec_type codec) pacc, pci_slot, namebuf, sizeof(namebuf)); - if (!vaapi_device_h264_supported(path)) + if (!vaapi_device_codec_supported(path, codec)) continue; if (!name_found)