From ab1311ba7cb2b6b573d08eeec8c2989f9ee7dd44 Mon Sep 17 00:00:00 2001 From: Exeldro Date: Wed, 7 Aug 2024 12:05:49 +0200 Subject: [PATCH] split MainOutputNotActive warning --- data/locale/en-US.ini | 1 + multistream.cpp | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/data/locale/en-US.ini b/data/locale/en-US.ini index 897ac5f..09c82c0 100644 --- a/data/locale/en-US.ini +++ b/data/locale/en-US.ini @@ -36,6 +36,7 @@ AudioEncoderSettings="Audio Settings" # Errors and warnings MainOutputNotActive="Unable to start output. \nThis output is configured to use your main encoder's output (Built-in stream), which is not currently active.\nPlease start your main encoder first." +MainOutputEncoderIndexNotFound="Unable to start output. \nThis output is configured to use your main encoder's output (Built-in stream), with an encoder index that does not have an encoder.\nPlease select an encoder index that has an encoder." NewVersion="New version (%1) available here" NoVerticalWarning="Aitum Vertical is not installed, or is out of date.
Click here to download the latest version.
" diff --git a/multistream.cpp b/multistream.cpp index 263c873..2b61c7d 100644 --- a/multistream.cpp +++ b/multistream.cpp @@ -824,14 +824,20 @@ bool MultistreamDock::StartOutput(obs_data_t *settings, QPushButton *streamButto if (!venc_name || venc_name[0] == '\0') { //use main encoder auto main_output = obs_frontend_get_streaming_output(); - venc = obs_output_get_video_encoder2(main_output, obs_data_get_int(settings, "video_encoder_index")); - if (!venc || !obs_output_active(main_output)) { + if (!obs_output_active(main_output)) { obs_output_release(main_output); QMessageBox::warning(this, QString::fromUtf8(obs_module_text("MainOutputNotActive")), QString::fromUtf8(obs_module_text("MainOutputNotActive"))); return false; } + auto vei = obs_data_get_int(settings, "video_encoder_index"); + venc = obs_output_get_video_encoder2(main_output, vei); obs_output_release(main_output); + if (!venc) { + QMessageBox::warning(this, QString::fromUtf8(obs_module_text("MainOutputEncoderIndexNotFound")), + QString::fromUtf8(obs_module_text("MainOutputEncoderIndexNotFound"))); + return false; + } } else { obs_data_t *s = nullptr; auto ves = obs_data_get_obj(settings, "video_encoder_settings"); @@ -860,14 +866,20 @@ bool MultistreamDock::StartOutput(obs_data_t *settings, QPushButton *streamButto if (!aenc_name || aenc_name[0] == '\0') { //use main encoder auto main_output = obs_frontend_get_streaming_output(); - aenc = obs_output_get_audio_encoder(main_output, obs_data_get_int(settings, "audio_encoder_index")); - if (!aenc || !obs_output_active(main_output)) { + if (!obs_output_active(main_output)) { obs_output_release(main_output); QMessageBox::warning(this, QString::fromUtf8(obs_module_text("MainOutputNotActive")), QString::fromUtf8(obs_module_text("MainOutputNotActive"))); return false; } + auto aei = obs_data_get_int(settings, "audio_encoder_index"); + aenc = obs_output_get_audio_encoder(main_output, aei); obs_output_release(main_output); + if (!aenc) { + QMessageBox::warning(this, QString::fromUtf8(obs_module_text("MainOutputEncoderIndexNotFound")), + QString::fromUtf8(obs_module_text("MainOutputEncoderIndexNotFound"))); + return false; + } } else { obs_data_t *s = nullptr; auto aes = obs_data_get_obj(settings, "audio_encoder_settings");