瀏覽代碼

UI: Add support for other codecs

This changes the logic to show all encoders in the Recording tab but
only show selected supported codecs in the Streaming tab (at least with
Advanced Output Mode).  The only (to my knowledge) streaming format that
supports other formats than H264 is WebRTC, which in theory should
support H264, VP8, VP9 and HEVC.  However I don't know about any ingest
server that works well with it yet.

Closes jp9000/obs-studio#794
Michael Fabian Dirks 8 年之前
父節點
當前提交
6539bacc4e
共有 1 個文件被更改,包括 15 次插入2 次删除
  1. 15 2
      UI/window-basic-settings.cpp

+ 15 - 2
UI/window-basic-settings.cpp

@@ -695,15 +695,28 @@ void OBSBasicSettings::LoadEncoderTypes()
 		const char *codec = obs_get_encoder_codec(type);
 		uint32_t caps = obs_get_encoder_caps(type);
 
-		if (strcmp(codec, "h264") != 0)
+		if (obs_get_encoder_type(type) != OBS_ENCODER_VIDEO)
 			continue;
+
+		const char* streaming_codecs[] = {
+			"h264",
+			//"hevc",
+		};
+		bool is_streaming_codec = false;
+		for (const char* test_codec : streaming_codecs) {
+			if (strcmp(codec, test_codec) == 0) {
+				is_streaming_codec = true;
+				break;
+			}
+		}
 		if ((caps & OBS_ENCODER_CAP_DEPRECATED) != 0)
 			continue;
 
 		QString qName = QT_UTF8(name);
 		QString qType = QT_UTF8(type);
 
-		ui->advOutEncoder->addItem(qName, qType);
+		if (is_streaming_codec)
+			ui->advOutEncoder->addItem(qName, qType);
 		ui->advOutRecEncoder->addItem(qName, qType);
 	}
 }