summaryrefslogtreecommitdiff
path: root/libavdevice/decklink_common.cpp
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2016-06-11 13:41:29 +0200
committerMarton Balint <cus@passwd.hu>2016-06-26 19:17:56 +0200
commit8f9fa49bd8bfd8cd2008da97eec7acf18873b960 (patch)
tree697e14f3ee0a4966f1e9862b09ef25fe54503cfb /libavdevice/decklink_common.cpp
parente22760aafd3048bcb006191d55432561b50070ea (diff)
avdevice/decklink: add support for setting duplex mode
This patch also makes BlackMagic drivers v10.6.1 a hard requirement. Reviewed-by: Deti Fliegl <deti@fliegl.de> Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavdevice/decklink_common.cpp')
-rw-r--r--libavdevice/decklink_common.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
index 2711fc1138..b6a2c96584 100644
--- a/libavdevice/decklink_common.cpp
+++ b/libavdevice/decklink_common.cpp
@@ -111,6 +111,23 @@ int ff_decklink_set_format(AVFormatContext *avctx,
int i = 1;
HRESULT res;
+ if (ctx->duplex_mode) {
+ bool duplex_supported = false;
+
+ if (ctx->attr->GetFlag(BMDDeckLinkSupportsDuplexModeConfiguration, &duplex_supported) != S_OK)
+ duplex_supported = false;
+
+ if (duplex_supported) {
+ res = ctx->cfg->SetInt(bmdDeckLinkConfigDuplexMode, ctx->duplex_mode == 2 ? bmdDuplexModeFull : bmdDuplexModeHalf);
+ if (res != S_OK)
+ av_log(avctx, AV_LOG_WARNING, "Setting duplex mode failed.\n");
+ else
+ av_log(avctx, AV_LOG_VERBOSE, "Succesfully set duplex mode to %s duplex.\n", ctx->duplex_mode == 2 ? "full" : "half");
+ } else {
+ av_log(avctx, AV_LOG_WARNING, "Unable to set duplex mode, because it is not supported.\n");
+ }
+ }
+
if (direction == DIRECTION_IN) {
res = ctx->dli->GetDisplayModeIterator (&itermode);
} else {
@@ -249,6 +266,10 @@ void ff_decklink_cleanup(AVFormatContext *avctx)
ctx->dli->Release();
if (ctx->dlo)
ctx->dlo->Release();
+ if (ctx->attr)
+ ctx->attr->Release();
+ if (ctx->cfg)
+ ctx->cfg->Release();
if (ctx->dl)
ctx->dl->Release();
}
@@ -279,5 +300,17 @@ int ff_decklink_init_device(AVFormatContext *avctx, const char* name)
if (!ctx->dl)
return AVERROR(ENXIO);
+ if (ctx->dl->QueryInterface(IID_IDeckLinkConfiguration, (void **)&ctx->cfg) != S_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Could not get configuration interface for '%s'\n", name);
+ ff_decklink_cleanup(avctx);
+ return AVERROR_EXTERNAL;
+ }
+
+ if (ctx->dl->QueryInterface(IID_IDeckLinkAttributes, (void **)&ctx->attr) != S_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Could not get attributes interface for '%s'\n", name);
+ ff_decklink_cleanup(avctx);
+ return AVERROR_EXTERNAL;
+ }
+
return 0;
}