Explorar o código

decklink: Set video conversion earlier

Owner needs this info set sooner to move rescale from CPU to GPU.
jpark37 %!s(int64=3) %!d(string=hai) anos
pai
achega
06b8cef665
Modificáronse 1 ficheiros con 16 adicións e 9 borrados
  1. 16 9
      plugins/decklink/decklink-output.cpp

+ 16 - 9
plugins/decklink/decklink-output.cpp

@@ -25,6 +25,22 @@ static void *decklink_output_create(obs_data_t *settings, obs_output_t *output)
 	decklinkOutput->modeID = obs_data_get_int(settings, MODE_ID);
 	decklinkOutput->keyerMode = (int)obs_data_get_int(settings, KEYER);
 
+	ComPtr<DeckLinkDevice> device;
+	device.Set(deviceEnum->FindByHash(decklinkOutput->deviceHash));
+	if (device) {
+		DeckLinkDeviceMode *mode =
+			device->FindOutputMode(decklinkOutput->modeID);
+
+		struct video_scale_info to = {};
+		to.format = VIDEO_FORMAT_BGRA;
+		to.width = mode->GetWidth();
+		to.height = mode->GetHeight();
+		to.range = VIDEO_RANGE_FULL;
+		to.colorspace = VIDEO_CS_709;
+
+		obs_output_set_video_conversion(output, &to);
+	}
+
 	return decklinkOutput;
 }
 
@@ -80,15 +96,6 @@ static bool decklink_output_start(void *data)
 
 	decklink->SetSize(mode->GetWidth(), mode->GetHeight());
 
-	struct video_scale_info to = {};
-	to.format = VIDEO_FORMAT_BGRA;
-	to.width = mode->GetWidth();
-	to.height = mode->GetHeight();
-	to.range = VIDEO_RANGE_FULL;
-	to.colorspace = VIDEO_CS_709;
-
-	obs_output_set_video_conversion(decklink->GetOutput(), &to);
-
 	device->SetKeyerMode(decklink->keyerMode);
 
 	if (!decklink->Activate(device, decklink->modeID))