History

avdevice/decklink: refactor ff_decklink_set_format function

This is done to enable input format autodetection in decklink_dec.

Karthick J committed 9 years ago

Commit aa7b0321 parent 0e7865c4 files · +35 −14Browse files

Showing the changes to libavdevice/decklink_common.cpp (1 of 4 files). Show all

Unified · Split

libavdevice/decklink_common.cpp+24−14
@@ -148,23 +148,12 @@ static DECKLINK_BOOL field_order_eq(enum AVFieldOrder field_order, BMDFieldDomin · 147 unmodified lines
148148 return false;
149149 }
150150
151−int ff_decklink_set_format(AVFormatContext *avctx,
152− int width, int height,
153− int tb_num, int tb_den,
154− enum AVFieldOrder field_order,
155− decklink_direction_t direction, int num)
156−{
151+int ff_decklink_set_configs(AVFormatContext *avctx,
152+ decklink_direction_t direction) {
157153 struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
158154 struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
159− BMDDisplayModeSupport support;
160− IDeckLinkDisplayModeIterator *itermode;
161− IDeckLinkDisplayMode *mode;
162− int i = 1;
163155 HRESULT res;
164156
165− 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",
166− width, height, tb_num, tb_den, field_order, direction, num, (cctx->format_code) ? cctx->format_code : "(unset)");
167−
168157 if (ctx->duplex_mode) {
169158 DECKLINK_BOOL duplex_supported = false;
170159
@@ -181,7 +170,6 @@ int ff_decklink_set_format(AVFormatContext *avctx, · 10 unmodified lines
181170 av_log(avctx, AV_LOG_WARNING, "Unable to set duplex mode, because it is not supported.\n");
182171 }
183172 }
184−
185173 if (direction == DIRECTION_IN) {
186174 int ret;
187175 ret = decklink_select_input(avctx, bmdDeckLinkConfigAudioInputConnection);
@@ -190,6 +178,28 @@ int ff_decklink_set_format(AVFormatContext *avctx, · 2 unmodified lines
190178 ret = decklink_select_input(avctx, bmdDeckLinkConfigVideoInputConnection);
191179 if (ret < 0)
192180 return ret;
181+ }
182+ return 0;
183+}
184+
185+int ff_decklink_set_format(AVFormatContext *avctx,
186+ int width, int height,
187+ int tb_num, int tb_den,
188+ enum AVFieldOrder field_order,
189+ decklink_direction_t direction, int num)
190+{
191+ struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
192+ struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
193+ BMDDisplayModeSupport support;
194+ IDeckLinkDisplayModeIterator *itermode;
195+ IDeckLinkDisplayMode *mode;
196+ int i = 1;
197+ HRESULT res;
198+
199+ 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",
200+ width, height, tb_num, tb_den, field_order, direction, num, (cctx->format_code) ? cctx->format_code : "(unset)");
201+
202+ if (direction == DIRECTION_IN) {
193203 res = ctx->dli->GetDisplayModeIterator (&itermode);
194204 } else {
195205 res = ctx->dlo->GetDisplayModeIterator (&itermode);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t