浏览代码

obs-x264: Block 10-bit formats

Don't want to silently generate 8-bit video.
jpark37 3 年之前
父节点
当前提交
175093b26b
共有 2 个文件被更改,包括 17 次插入5 次删除
  1. 1 0
      plugins/obs-x264/data/locale/en-US.ini
  2. 16 5
      plugins/obs-x264/obs-x264.c

+ 1 - 0
plugins/obs-x264/data/locale/en-US.ini

@@ -10,4 +10,5 @@ Tune="Tune"
 None="(None)"
 EncoderOptions="x264 Options (separated by space)"
 VFR="Variable Framerate (VFR)"
+10bitUnsupported="OBS does not support using x264 with 10-bit formats."
 HdrUnsupported="OBS does not support using x264 with Rec. 2100."

+ 16 - 5
plugins/obs-x264/obs-x264.c

@@ -700,14 +700,25 @@ static void *obs_x264_create(obs_data_t *settings, obs_encoder_t *encoder)
 {
 	video_t *video = obs_encoder_video(encoder);
 	const struct video_output_info *voi = video_output_get_info(video);
-	switch (voi->colorspace) {
-	case VIDEO_CS_2100_PQ:
-	case VIDEO_CS_2100_HLG:
+	switch (voi->format) {
+	case VIDEO_FORMAT_I010:
+	case VIDEO_FORMAT_P010:
 		obs_encoder_set_last_error(encoder,
-					   obs_module_text("HdrUnsupported"));
+					   obs_module_text("10bitUnsupported"));
 		warn_enc(encoder,
-			 "OBS does not support using x264 with Rec. 2100");
+			 "OBS does not support using x264 with 10-bit formats");
 		return NULL;
+	default:
+		switch (voi->colorspace) {
+		case VIDEO_CS_2100_PQ:
+		case VIDEO_CS_2100_HLG:
+			obs_encoder_set_last_error(
+				encoder, obs_module_text("HdrUnsupported"));
+			warn_enc(
+				encoder,
+				"OBS does not support using x264 with Rec. 2100");
+			return NULL;
+		}
 	}
 
 	struct obs_x264 *obsx264 = bzalloc(sizeof(struct obs_x264));