summaryrefslogtreecommitdiff
path: root/libavdevice/decklink_common.cpp
diff options
context:
space:
mode:
authorKarthick J <kjeyapal@akamai.com>2017-11-07 09:32:23 +0530
committerMarton Balint <cus@passwd.hu>2017-11-21 22:55:49 +0100
commitaa7b0329ff282ea8afb3c26dcbbc64209a280219 (patch)
tree4146710600547c5c2c321fca8eff5c8cbce9d54a /libavdevice/decklink_common.cpp
parent0e7865ce4152f8b04cda6a698bbee4fd4a94009d (diff)
avdevice/decklink: refactor ff_decklink_set_format function
This is done to enable input format autodetection in decklink_dec. Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavdevice/decklink_common.cpp')
-rw-r--r--libavdevice/decklink_common.cpp38
1 files changed, 24 insertions, 14 deletions
diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
index 2bd63ac820..b952e74955 100644
--- a/libavdevice/decklink_common.cpp
+++ b/libavdevice/decklink_common.cpp
@@ -148,23 +148,12 @@ static DECKLINK_BOOL field_order_eq(enum AVFieldOrder field_order, BMDFieldDomin
return false;
}
-int ff_decklink_set_format(AVFormatContext *avctx,
- int width, int height,
- int tb_num, int tb_den,
- enum AVFieldOrder field_order,
- decklink_direction_t direction, int num)
-{
+int ff_decklink_set_configs(AVFormatContext *avctx,
+ decklink_direction_t direction) {
struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
- BMDDisplayModeSupport support;
- IDeckLinkDisplayModeIterator *itermode;
- IDeckLinkDisplayMode *mode;
- int i = 1;
HRESULT res;
- av_log(avctx, AV_LOG_DEBUG, "Trying to find mode for frame size %dx%d, frame timing %d/%d, field order %d, direction %d, mode number %d, format code %s\n",
- width, height, tb_num, tb_den, field_order, direction, num, (cctx->format_code) ? cctx->format_code : "(unset)");
-
if (ctx->duplex_mode) {
DECKLINK_BOOL duplex_supported = false;
@@ -181,7 +170,6 @@ int ff_decklink_set_format(AVFormatContext *avctx,
av_log(avctx, AV_LOG_WARNING, "Unable to set duplex mode, because it is not supported.\n");
}
}
-
if (direction == DIRECTION_IN) {
int ret;
ret = decklink_select_input(avctx, bmdDeckLinkConfigAudioInputConnection);
@@ -190,6 +178,28 @@ int ff_decklink_set_format(AVFormatContext *avctx,
ret = decklink_select_input(avctx, bmdDeckLinkConfigVideoInputConnection);
if (ret < 0)
return ret;
+ }
+ return 0;
+}
+
+int ff_decklink_set_format(AVFormatContext *avctx,
+ int width, int height,
+ int tb_num, int tb_den,
+ enum AVFieldOrder field_order,
+ decklink_direction_t direction, int num)
+{
+ struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
+ struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
+ BMDDisplayModeSupport support;
+ IDeckLinkDisplayModeIterator *itermode;
+ IDeckLinkDisplayMode *mode;
+ int i = 1;
+ HRESULT res;
+
+ av_log(avctx, AV_LOG_DEBUG, "Trying to find mode for frame size %dx%d, frame timing %d/%d, field order %d, direction %d, mode number %d, format code %s\n",
+ width, height, tb_num, tb_den, field_order, direction, num, (cctx->format_code) ? cctx->format_code : "(unset)");
+
+ if (direction == DIRECTION_IN) {
res = ctx->dli->GetDisplayModeIterator (&itermode);
} else {
res = ctx->dlo->GetDisplayModeIterator (&itermode);