mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-10-26 15:58:51 -04:00
decklink: Add option to select pixel format
This replaces the name-based detection of the 4K intensity pro, and allows other devices to be able to use the BGRA pixel format, if the user so chooses.
This commit is contained in:
1 parent
2e93772339
commit
c77544f546
6 files changed
+43
-13
No files matched your search
@@ -8,21 +8,22 @@
|
||||
#define LOG(level, message, ...) blog(level, "%s: " message, \
|
||||
obs_source_get_name(this->decklink->GetSource()), ##__VA_ARGS__)
|
||||
|
||||
static inline enum video_format ConvertPixelFormat(BMDPixelFormat format)
|
||||
{
|
||||
switch (format) {
|
||||
case bmdFormat8BitBGRA: return VIDEO_FORMAT_BGRX;
|
||||
|
||||
default:
|
||||
case bmdFormat8BitYUV:;
|
||||
}
|
||||
|
||||
return VIDEO_FORMAT_UYVY;
|
||||
}
|
||||
|
||||
DeckLinkDeviceInstance::DeckLinkDeviceInstance(DeckLink *decklink_,
|
||||
DeckLinkDevice *device_) :
|
||||
currentFrame(), currentPacket(), decklink(decklink_), device(device_)
|
||||
{
|
||||
// use BGRA mode if the device is a BMI intensity pro 4K... wish there
|
||||
// was a better way to check the device model, but older cards don't
|
||||
// implement BMDDeckLinkPersistentID
|
||||
if (std::string("Intensity Pro 4K").compare(device_->GetName()) == 0) {
|
||||
currentFrame.format = VIDEO_FORMAT_BGRX;
|
||||
pixelFormat = bmdFormat8BitBGRA;
|
||||
} else {
|
||||
currentFrame.format = VIDEO_FORMAT_UYVY;
|
||||
pixelFormat = bmdFormat8BitYUV;
|
||||
}
|
||||
|
||||
currentPacket.samples_per_sec = 48000;
|
||||
currentPacket.speakers = SPEAKERS_STEREO;
|
||||
currentPacket.format = AUDIO_FORMAT_16BIT;
|
||||
@@ -89,6 +90,9 @@ bool DeckLinkDeviceInstance::StartCapture(DeckLinkDeviceMode *mode_)
|
||||
if (!device->GetInput(&input))
|
||||
return false;
|
||||
|
||||
pixelFormat = decklink->GetPixelFormat();
|
||||
currentFrame.format = ConvertPixelFormat(pixelFormat);
|
||||
|
||||
input->SetCallback(this);
|
||||
|
||||
const BMDDisplayMode displayMode = mode_->GetDisplayMode();
|
||||
|
||||
Reference in new issue
Block a user