Explorar o código

obs-ffmpeg: Add localization for NVENC error messages

Richard Stanway %!s(int64=5) %!d(string=hai) anos
pai
achega
35e218e05b

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

@@ -58,3 +58,11 @@ ReplayBuffer.Save="Save Replay"
 HelperProcessFailed="Unable to start the recording helper process. Check that OBS files have not been blocked or removed by any 3rd party antivirus / security software."
 HelperProcessFailed="Unable to start the recording helper process. Check that OBS files have not been blocked or removed by any 3rd party antivirus / security software."
 UnableToWritePath="Unable to write to %1. Make sure you're using a recording path which your user account is allowed to write to and that there is sufficient disk space."
 UnableToWritePath="Unable to write to %1. Make sure you're using a recording path which your user account is allowed to write to and that there is sufficient disk space."
 WarnWindowsDefender="If Windows 10 Ransomware Protection is enabled it can also cause this error. Try turning off controlled folder access in Windows Security / Virus & threat protection settings."
 WarnWindowsDefender="If Windows 10 Ransomware Protection is enabled it can also cause this error. Try turning off controlled folder access in Windows Security / Virus & threat protection settings."
+
+NVENC.Error="Failed to open NVENC codec: %1"
+NVENC.GenericError="Check your video drivers are up to date. Try closing other recording software which might be using NVENC such as NVIDIA Shadowplay or Windows 10 Game DVR."
+NVENC.BadGPUIndex="You have selected GPU %1 in your output encoder settings. Set this back to 0 and try again."
+NVENC.OutdatedDriver="Your current video card driver does not support this NVENC version, please update your drivers."
+NVENC.UnsupportedDevice="NVENC Error: Unsupported device. Check your video card supports NVENC and that the drivers are up to date."
+NVENC.TooManySessions="NVENC Error: Too many concurrent sessions. Try closing other recording software which might be using NVENC such as NVIDIA Shadowplay or Windows 10 Game DVR."
+NVENC.CheckDrivers="Please check your video drivers are up to date."

+ 3 - 11
plugins/obs-ffmpeg/jim-nvenc-helpers.c

@@ -21,18 +21,12 @@ bool nv_failed(obs_encoder_t *encoder, NVENCSTATUS err, const char *func,
 
 
 	case NV_ENC_ERR_OUT_OF_MEMORY:
 	case NV_ENC_ERR_OUT_OF_MEMORY:
 		obs_encoder_set_last_error(
 		obs_encoder_set_last_error(
-			encoder,
-			"NVENC Error: Too many concurrent sessions. "
-			"Try closing other recording software which might "
-			"be using NVENC such as Windows 10 Game DVR.");
+			encoder, obs_module_text("NVENC.TooManySessions"));
 		break;
 		break;
 
 
 	case NV_ENC_ERR_UNSUPPORTED_DEVICE:
 	case NV_ENC_ERR_UNSUPPORTED_DEVICE:
 		obs_encoder_set_last_error(
 		obs_encoder_set_last_error(
-			encoder,
-			"NVENC Error: Unsupported device. Check your "
-			"video card supports NVENC and that the drivers are "
-			"up to date.");
+			encoder, obs_module_text("NVENC.UnsupportedDevice"));
 		break;
 		break;
 
 
 	default:
 	default:
@@ -140,9 +134,7 @@ static inline bool init_nvenc_internal(obs_encoder_t *encoder)
 			   NVENCAPI_MINOR_VERSION;
 			   NVENCAPI_MINOR_VERSION;
 	if (cur_ver > ver) {
 	if (cur_ver > ver) {
 		obs_encoder_set_last_error(
 		obs_encoder_set_last_error(
-			encoder,
-			"Your current video card driver does not support "
-			"this NVENC version, please update your drivers.");
+			encoder, obs_module_text("NVENC.OutdatedDriver"));
 
 
 		error("Current driver version does not support this NVENC "
 		error("Current driver version does not support this NVENC "
 		      "version, please upgrade your driver");
 		      "version, please upgrade your driver");

+ 10 - 15
plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c

@@ -96,23 +96,18 @@ static bool nvenc_init_codec(struct nvenc_encoder *enc)
 		if (!obs_encoder_get_last_error(enc->encoder)) {
 		if (!obs_encoder_get_last_error(enc->encoder)) {
 			struct dstr error_message = {0};
 			struct dstr error_message = {0};
 
 
-			// special case for common NVENC error
+			dstr_copy(&error_message,
+				  obs_module_text("NVENC.Error"));
+			dstr_replace(&error_message, "%1", av_err2str(ret));
+			dstr_cat(&error_message, "\r\n\r\n");
+
 			if (ret == AVERROR_EXTERNAL) {
 			if (ret == AVERROR_EXTERNAL) {
-				dstr_printf(
-					&error_message,
-					"Failed to open NVENC codec: %s\r\n\r\n"
-					"Check your video drivers are up to "
-					"date. Disable other software that may "
-					"be using NVENC such as NVIDIA "
-					"ShadowPlay or Windows 10 Game "
-					"DVR.",
-					av_err2str(ret));
+				// special case for common NVENC error
+				dstr_cat(&error_message,
+					 obs_module_text("NVENC.GenericError"));
 			} else {
 			} else {
-				dstr_printf(
-					&error_message,
-					"Failed to open NVENC codec: %s\r\n\r\n"
-					"Please check your video drivers are up to date.",
-					av_err2str(ret));
+				dstr_cat(&error_message,
+					 obs_module_text("NVENC.CheckDrivers"));
 			}
 			}
 
 
 			obs_encoder_set_last_error(enc->encoder,
 			obs_encoder_set_last_error(enc->encoder,