浏览代码

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.
Kurt Kartaltepe 1 年之前
父节点
当前提交
fc1ab5fcbc
共有 1 个文件被更改,包括 16 次插入1 次删除
  1. 16 1
      plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c

+ 16 - 1
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)