Browse Source

aja: Fix capturing UHD/4K YUV on Kona HDMI.

Added missing routing preset for KonaHDMI UHD/4K.

Calculate framebuffer index based on framestore index.
Paul Hindt 3 years ago
parent
commit
d851f1d916
3 changed files with 26 additions and 4 deletions
  1. 21 0
      plugins/aja/aja-presets.cpp
  2. 1 1
      plugins/aja/aja-props.cpp
  3. 4 3
      plugins/aja/aja-source.cpp

+ 21 - 0
plugins/aja/aja-presets.cpp

@@ -187,6 +187,27 @@ void RoutingConfigurator::build_preset_table()
 		  {DEVICE_ID_IO4KPLUS},
 		  false,
 		  false}},
+		{"HDMI_UHD_4K_YCbCr_Capture",
+		 {"HDMI_UHD_4K_YCbCr_Capture",
+		  ConnectionKind::HDMI,
+		  NTV2_MODE_CAPTURE,
+		  RasterDefinition::UHD_4K,
+		  HDMIWireFormat::UHD_4K_YCBCR,
+		  VPIDStandard_Unknown,
+		  1,
+		  2,
+		  kEnable4KTSI,
+		  "hdmi[{ch1}][0]->tsi[{ch1}][0];"
+		  "hdmi[{ch1}][1]->tsi[{ch1}][1];"
+		  "hdmi[{ch1}][2]->tsi[{ch2}][0];"
+		  "hdmi[{ch1}][3]->tsi[{ch2}][1];"
+		  "tsi[{ch1}][0]->fb[{ch1}][0];"
+		  "tsi[{ch1}][1]->fb[{ch1}][1];"
+		  "tsi[{ch2}][0]->fb[{ch2}][0];"
+		  "tsi[{ch2}][1]->fb[{ch2}][1];",
+		  {},
+		  false,
+		  false}},
 		/*
 		 * HDMI YCbCr Display
 		 */

+ 1 - 1
plugins/aja/aja-props.cpp

@@ -155,7 +155,7 @@ NTV2Channel SourceProps::Framestore() const
 	    NTV2_IS_4K_VIDEO_FORMAT(videoFormat)) {
 		return NTV2_CHANNEL3;
 	}
-	return NTV2InputSourceToChannel(InitialInputSource());
+	return Channel();
 }
 
 NTV2AudioSystem SourceProps::AudioSystem() const

+ 4 - 3
plugins/aja/aja-source.cpp

@@ -269,6 +269,7 @@ void AJASource::CaptureThread(AJAThread *thread, void *data)
 				    sourceProps.pixelFormat);
 	auto inputSource = sourceProps.InitialInputSource();
 	auto channel = sourceProps.Channel();
+	auto framestore = sourceProps.Framestore();
 	auto audioSystem = sourceProps.AudioSystem();
 	// Current "on-air" frame on the card. The capture thread "Ping-pongs" between
 	// two frames, starting at an index corresponding to the framestore channel.
@@ -278,12 +279,12 @@ void AJASource::CaptureThread(AJAThread *thread, void *data)
 	// Channel 3 (index 2) = frames 4/5
 	// Channel 4 (index 3) = frames 6/7
 	// etc...
-	ULWord currentCardFrame = (uint32_t)channel * 2;
+	ULWord currentCardFrame = GetIndexForNTV2Channel(framestore) * 2;
 	card->WaitForInputFieldID(NTV2_FIELD0, channel);
 
 	currentCardFrame ^= 1;
 
-	card->SetInputFrame(channel, currentCardFrame);
+	card->SetInputFrame(framestore, currentCardFrame);
 
 	AudioOffsets offsets;
 	ResetAudioBufferOffsets(card, audioSystem, offsets);
@@ -388,7 +389,7 @@ void AJASource::CaptureThread(AJAThread *thread, void *data)
 
 		obs_source_output_video2(ajaSource->mSource, &obsFrame);
 
-		card->SetInputFrame(channel, currentCardFrame);
+		card->SetInputFrame(framestore, currentCardFrame);
 	}
 
 	blog(LOG_INFO, "AJASource::Capturethread: Thread loop stopped");