mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
Merge pull request #1604 from DDRBoxman/keyerrgb
Decklink: only use RGBA when using keyer
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#include "decklink-device-instance.hpp"
|
#include "decklink-device-instance.hpp"
|
||||||
#include "audio-repack.hpp"
|
#include "audio-repack.hpp"
|
||||||
|
|
||||||
#include "DecklinkInput.hpp"
|
#include "DecklinkInput.hpp"
|
||||||
@@ -312,10 +312,10 @@ bool DeckLinkDeviceInstance::StartOutput(DeckLinkDeviceMode *mode_)
|
|||||||
|
|
||||||
mode = mode_;
|
mode = mode_;
|
||||||
|
|
||||||
|
int keyerMode = device->GetKeyerMode();
|
||||||
|
|
||||||
IDeckLinkKeyer *deckLinkKeyer = nullptr;
|
IDeckLinkKeyer *deckLinkKeyer = nullptr;
|
||||||
if (device->GetKeyer(&deckLinkKeyer)) {
|
if (device->GetKeyer(&deckLinkKeyer)) {
|
||||||
int keyerMode = device->GetKeyerMode();
|
|
||||||
if (keyerMode) {
|
if (keyerMode) {
|
||||||
deckLinkKeyer->Enable(keyerMode == 1);
|
deckLinkKeyer->Enable(keyerMode == 1);
|
||||||
deckLinkKeyer->SetLevel(255);
|
deckLinkKeyer->SetLevel(255);
|
||||||
@@ -328,11 +328,21 @@ bool DeckLinkDeviceInstance::StartOutput(DeckLinkDeviceMode *mode_)
|
|||||||
if (decklinkOutput == nullptr)
|
if (decklinkOutput == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
int rowBytes = decklinkOutput->GetWidth() * 2;
|
||||||
|
if (decklinkOutput->keyerMode != 0) {
|
||||||
|
rowBytes = decklinkOutput->GetWidth() * 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
BMDPixelFormat pixelFormat = bmdFormat8BitYUV;
|
||||||
|
if (keyerMode != 0) {
|
||||||
|
pixelFormat = bmdFormat8BitBGRA;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
result = output->CreateVideoFrame(decklinkOutput->GetWidth(),
|
result = output->CreateVideoFrame(decklinkOutput->GetWidth(),
|
||||||
decklinkOutput->GetHeight(),
|
decklinkOutput->GetHeight(),
|
||||||
decklinkOutput->GetWidth() * 4,
|
rowBytes,
|
||||||
bmdFormat8BitBGRA,
|
pixelFormat,
|
||||||
bmdFrameFlagDefault,
|
bmdFrameFlagDefault,
|
||||||
&decklinkOutputFrame);
|
&decklinkOutputFrame);
|
||||||
if (result != S_OK) {
|
if (result != S_OK) {
|
||||||
@@ -373,8 +383,13 @@ void DeckLinkDeviceInstance::DisplayVideoFrame(video_data *frame)
|
|||||||
|
|
||||||
uint8_t *outData = frame->data[0];
|
uint8_t *outData = frame->data[0];
|
||||||
|
|
||||||
std::copy(outData, outData + (decklinkOutput->GetWidth() *
|
int rowBytes = decklinkOutput->GetWidth() * 2;
|
||||||
decklinkOutput->GetHeight() * 4), destData);
|
if (device->GetKeyerMode()) {
|
||||||
|
rowBytes = decklinkOutput->GetWidth() * 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::copy(outData, outData + (decklinkOutput->GetHeight() *
|
||||||
|
rowBytes), destData);
|
||||||
|
|
||||||
output->DisplayVideoFrameSync(decklinkOutputFrame);
|
output->DisplayVideoFrameSync(decklinkOutputFrame);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,12 @@ static bool decklink_output_start(void *data)
|
|||||||
decklink->SetSize(mode->GetWidth(), mode->GetHeight());
|
decklink->SetSize(mode->GetWidth(), mode->GetHeight());
|
||||||
|
|
||||||
struct video_scale_info to = {};
|
struct video_scale_info to = {};
|
||||||
|
|
||||||
|
if (decklink->keyerMode != 0) {
|
||||||
to.format = VIDEO_FORMAT_BGRA;
|
to.format = VIDEO_FORMAT_BGRA;
|
||||||
|
} else {
|
||||||
|
to.format = VIDEO_FORMAT_UYVY;
|
||||||
|
}
|
||||||
to.width = mode->GetWidth();
|
to.width = mode->GetWidth();
|
||||||
to.height = mode->GetHeight();
|
to.height = mode->GetHeight();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user