Browse Source

obs-ffmpeg: Set error message for AMF with P216/P416

If P216 or P416 color formats are selected with AMF, these color formats
were not explicitly handled, so the switch statements would end up in
the default case. If the user had also selected a Rec. 2100 color space,
this would result in the strange error message:
"OBS does not support 8-bit output of Rec. 2100."

This message is confusing and does not correctly reflect the chosen
settings. Let's explicitly handle the P216/P416 cases and provide a more
accurate error message.
Ryan Foster 2 years ago
parent
commit
877c1c74d0
2 changed files with 22 additions and 0 deletions
  1. 1 0
      plugins/obs-ffmpeg/data/locale/en-US.ini
  2. 21 0
      plugins/obs-ffmpeg/texture-amf.cpp

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

@@ -99,6 +99,7 @@ AMF.Error="Failed to open AMF codec: %1"
 AMF.GenericError="Try installing the latest <a href=\"https://obsproject.com/go/amd-drivers\">AMD driver</a> and closing other recording software that might be using the AMD encoder such as the Radeon Software or Windows Game DVR."
 AMF.8bitUnsupportedHdr="OBS does not support 8-bit output of Rec. 2100."
 AMF.10bitUnsupportedAvc="Cannot perform 10-bit encode on AMD H.264 encoder."
+AMF.16bitUnsupported="Cannot perform 16-bit encode on this encoder."
 
 NVENC.Error="Failed to open NVENC codec: %1"
 NVENC.GenericError="Try installing the latest <a href=\"https://obsproject.com/go/nvidia-drivers\">NVIDIA driver</a> and closing other recording software that might be using NVENC such as NVIDIA ShadowPlay or Windows Game DVR."

+ 21 - 0
plugins/obs-ffmpeg/texture-amf.cpp

@@ -1447,6 +1447,13 @@ try {
 		obs_encoder_set_last_error(encoder, text);
 		throw text;
 	}
+	case VIDEO_FORMAT_P216:
+	case VIDEO_FORMAT_P416: {
+		const char *const text =
+			obs_module_text("AMF.16bitUnsupported");
+		obs_encoder_set_last_error(encoder, text);
+		throw text;
+	}
 	default:
 		switch (voi->colorspace) {
 		case VIDEO_CS_2100_PQ:
@@ -1787,6 +1794,13 @@ try {
 	case VIDEO_FORMAT_I010:
 	case VIDEO_FORMAT_P010:
 		break;
+	case VIDEO_FORMAT_P216:
+	case VIDEO_FORMAT_P416: {
+		const char *const text =
+			obs_module_text("AMF.16bitUnsupported");
+		obs_encoder_set_last_error(encoder, text);
+		throw text;
+	}
 	default:
 		switch (voi->colorspace) {
 		case VIDEO_CS_2100_PQ:
@@ -2089,6 +2103,13 @@ try {
 	case VIDEO_FORMAT_P010: {
 		break;
 	}
+	case VIDEO_FORMAT_P216:
+	case VIDEO_FORMAT_P416: {
+		const char *const text =
+			obs_module_text("AMF.16bitUnsupported");
+		obs_encoder_set_last_error(encoder, text);
+		throw text;
+	}
 	default:
 		switch (voi->colorspace) {
 		case VIDEO_CS_2100_PQ: