This is done to enable input format autodetection in decklink_dec.
Showing the changes to libavdevice/decklink_common.cpp (1 of 4 files). Show all
Unified · Split
| @@ -148,23 +148,12 @@ static DECKLINK_BOOL field_order_eq(enum AVFieldOrder field_order, BMDFieldDomin · 147 unmodified lines | ||
| 148 | 148 | return false; |
| 149 | 149 | } |
| 150 | 150 | |
| 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) { | |
| 157 | 153 | struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data; |
| 158 | 154 | struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx; |
| 159 | − BMDDisplayModeSupport support; | |
| 160 | − IDeckLinkDisplayModeIterator *itermode; | |
| 161 | − IDeckLinkDisplayMode *mode; | |
| 162 | − int i = 1; | |
| 163 | 155 | HRESULT res; |
| 164 | 156 | |
| 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 | − | |
| 168 | 157 | if (ctx->duplex_mode) { |
| 169 | 158 | DECKLINK_BOOL duplex_supported = false; |
| 170 | 159 | |
| @@ -181,7 +170,6 @@ int ff_decklink_set_format(AVFormatContext *avctx, · 10 unmodified lines | ||
| 181 | 170 | av_log(avctx, AV_LOG_WARNING, "Unable to set duplex mode, because it is not supported.\n"); |
| 182 | 171 | } |
| 183 | 172 | } |
| 184 | − | |
| 185 | 173 | if (direction == DIRECTION_IN) { |
| 186 | 174 | int ret; |
| 187 | 175 | ret = decklink_select_input(avctx, bmdDeckLinkConfigAudioInputConnection); |
| @@ -190,6 +178,28 @@ int ff_decklink_set_format(AVFormatContext *avctx, · 2 unmodified lines | ||
| 190 | 178 | ret = decklink_select_input(avctx, bmdDeckLinkConfigVideoInputConnection); |
| 191 | 179 | if (ret < 0) |
| 192 | 180 | 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) { | |
| 193 | 203 | res = ctx->dli->GetDisplayModeIterator (&itermode); |
| 194 | 204 | } else { |
| 195 | 205 | res = ctx->dlo->GetDisplayModeIterator (&itermode); |