some fixes
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#include <mxl/mxl.h>
|
||||
#include <mxl/time.h>
|
||||
|
||||
#include <DeckLinkAPIConfiguration.h>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include <cstring>
|
||||
@@ -32,6 +34,18 @@ void DeckLinkInNode::configure(const nlohmann::json& params) {
|
||||
spdlog::warn("DeckLink-in: unknown mode '{}', defaulting to 1080i50", mode_str);
|
||||
}
|
||||
}
|
||||
if (params.contains("input_connection")) {
|
||||
auto conn_str = params["input_connection"].get<std::string>();
|
||||
if (conn_str == "sdi") input_connection_ = bmdVideoConnectionSDI;
|
||||
else if (conn_str == "hdmi") input_connection_ = bmdVideoConnectionHDMI;
|
||||
else if (conn_str == "optical_sdi") input_connection_ = bmdVideoConnectionOpticalSDI;
|
||||
else if (conn_str == "component") input_connection_ = bmdVideoConnectionComponent;
|
||||
else if (conn_str == "composite") input_connection_ = bmdVideoConnectionComposite;
|
||||
else if (conn_str == "svideo") input_connection_ = bmdVideoConnectionSVideo;
|
||||
else {
|
||||
spdlog::warn("DeckLink-in: unknown input_connection '{}', defaulting to auto", conn_str);
|
||||
}
|
||||
}
|
||||
|
||||
if (!open_device()) {
|
||||
spdlog::error("DeckLink-in: failed to open device during configure");
|
||||
@@ -90,6 +104,18 @@ bool DeckLinkInNode::open_device() {
|
||||
device->GetModelName(&model_name);
|
||||
spdlog::info("DeckLink-in: opened device '{}'", model_name ? model_name : "unknown");
|
||||
|
||||
if (input_connection_ != bmdVideoConnectionUnspecified) {
|
||||
IDeckLinkConfiguration* config = nullptr;
|
||||
if (device->QueryInterface(IID_IDeckLinkConfiguration, (void**)&config) == S_OK && config) {
|
||||
if (config->SetInt(bmdDeckLinkConfigVideoInputConnection, input_connection_) != S_OK) {
|
||||
spdlog::warn("DeckLink-in: failed to set input connection");
|
||||
} else {
|
||||
spdlog::info("DeckLink-in: input connection configured");
|
||||
}
|
||||
config->Release();
|
||||
}
|
||||
}
|
||||
|
||||
if (device->QueryInterface(IID_IDeckLinkInput, (void**)&input_) != S_OK) {
|
||||
spdlog::error("DeckLink-in: device has no input interface");
|
||||
device->Release();
|
||||
@@ -119,13 +145,8 @@ bool DeckLinkInNode::open_device() {
|
||||
is_interlaced_ = (display_mode_ == bmdModeHD1080i50 ||
|
||||
display_mode_ == bmdModeHD1080i5994);
|
||||
|
||||
if (is_interlaced_) {
|
||||
grain_rate_.numerator = static_cast<int32_t>(2 * scale);
|
||||
grain_rate_.denominator = static_cast<int32_t>(duration);
|
||||
} else {
|
||||
grain_rate_.numerator = static_cast<int32_t>(scale);
|
||||
grain_rate_.denominator = static_cast<int32_t>(duration);
|
||||
}
|
||||
grain_rate_.numerator = static_cast<int32_t>(scale);
|
||||
grain_rate_.denominator = static_cast<int32_t>(duration);
|
||||
|
||||
auto g = std::__gcd(grain_rate_.numerator, grain_rate_.denominator);
|
||||
grain_rate_.numerator /= g;
|
||||
|
||||
@@ -46,6 +46,7 @@ private:
|
||||
|
||||
int device_index_ = 0;
|
||||
BMDDisplayMode display_mode_ = bmdModeHD1080i50;
|
||||
BMDVideoConnection input_connection_ = bmdVideoConnectionUnspecified;
|
||||
|
||||
IDeckLink* decklink_ = nullptr;
|
||||
IDeckLinkInput* input_ = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user