Browse Source

UI: Add warning for non-NV12 color formats

Non-NV12 video formats are primarily intended for recording.  For
streaming, if the libobs color format is not set to NV12, it's likely
that the video frames will have to be converted to NV12, which will use
extra CPU usage.  Due to that fact, it's important to warn the user of
that potential extra increased CPU usage that may be required when
streaming.
jp9000 10 years ago
parent
commit
724644ef03

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

@@ -333,6 +333,7 @@ Basic.Settings.Audio.AuxDevice3="Mic/Auxiliary Audio Device 3"
 
 
 # basic mode 'advanced' settings
 # basic mode 'advanced' settings
 Basic.Settings.Advanced="Advanced"
 Basic.Settings.Advanced="Advanced"
+Basic.Settings.Advanced.FormatWarning="Warning:  Color formats other than NV12 are primarily intended for recording, and are not recommended when streaming.  Streaming may incur increased CPU usage due to color format conversion."
 Basic.Settings.Advanced.Audio.BufferingTime="Audio Buffering Time"
 Basic.Settings.Advanced.Audio.BufferingTime="Audio Buffering Time"
 Basic.Settings.Advanced.Video.ColorFormat="Color Format"
 Basic.Settings.Advanced.Video.ColorFormat="Color Format"
 Basic.Settings.Advanced.Video.ColorSpace="YUV Color Space"
 Basic.Settings.Advanced.Video.ColorSpace="YUV Color Space"

+ 16 - 0
obs/forms/OBSBasicSettings.ui

@@ -2518,6 +2518,22 @@
                   <property name="text">
                   <property name="text">
                    <string notr="true"/>
                    <string notr="true"/>
                   </property>
                   </property>
+                  <property name="wordWrap">
+                   <bool>true</bool>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QLabel" name="advancedMsg2">
+                  <property name="styleSheet">
+                   <string notr="true">color: rgb(255, 0, 4);</string>
+                  </property>
+                  <property name="text">
+                   <string notr="true"/>
+                  </property>
+                  <property name="wordWrap">
+                   <bool>true</bool>
+                  </property>
                  </widget>
                  </widget>
                 </item>
                 </item>
                </layout>
                </layout>

+ 11 - 0
obs/window-basic-settings.cpp

@@ -1793,6 +1793,17 @@ void OBSBasicSettings::on_advOutFFVEncoder_currentIndexChanged(int idx)
 	}
 	}
 }
 }
 
 
+void OBSBasicSettings::on_colorFormat_currentIndexChanged(const QString &text)
+{
+	bool usingNV12 = text == "NV12";
+
+	if (usingNV12)
+		ui->advancedMsg2->setText(QString());
+	else
+		ui->advancedMsg2->setText(
+				QTStr("Basic.Settings.Advanced.FormatWarning"));
+}
+
 #define INVALID_RES_STR "Basic.Settings.Video.InvalidResolution"
 #define INVALID_RES_STR "Basic.Settings.Video.InvalidResolution"
 
 
 static bool ValidResolutions(Ui::OBSBasicSettings *ui)
 static bool ValidResolutions(Ui::OBSBasicSettings *ui)

+ 2 - 0
obs/window-basic-settings.hpp

@@ -187,6 +187,8 @@ private slots:
 	void on_advOutFFAEncoder_currentIndexChanged(int idx);
 	void on_advOutFFAEncoder_currentIndexChanged(int idx);
 	void on_advOutFFVEncoder_currentIndexChanged(int idx);
 	void on_advOutFFVEncoder_currentIndexChanged(int idx);
 
 
+	void on_colorFormat_currentIndexChanged(const QString &text);
+
 	void on_baseResolution_editTextChanged(const QString &text);
 	void on_baseResolution_editTextChanged(const QString &text);
 
 
 	void GeneralChanged();
 	void GeneralChanged();