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 | return false; | 148 | return false; |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | int ff_decklink_set_format(AVFormatContext *avctx, | 151 | int ff_decklink_set_configs(AVFormatContext *avctx, |
| 152 | int width, int height, | 152 | decklink_direction_t direction) { |
| 153 | int tb_num, int tb_den, | ||
| 154 | enum AVFieldOrder field_order, | ||
| 155 | decklink_direction_t direction, int num) | ||
| 156 | { | ||
| 157 | struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data; | 153 | struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data; |
| 158 | struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx; | 154 | struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx; |
| 159 | BMDDisplayModeSupport support; | ||
| 160 | IDeckLinkDisplayModeIterator *itermode; | ||
| 161 | IDeckLinkDisplayMode *mode; | ||
| 162 | int i = 1; | ||
| 163 | HRESULT res; | 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 | if (ctx->duplex_mode) { | 157 | if (ctx->duplex_mode) { |
| 169 | DECKLINK_BOOL duplex_supported = false; | 158 | DECKLINK_BOOL duplex_supported = false; |
| 170 | 159 | ||
| @@ -181,7 +170,6 @@ int ff_decklink_set_format(AVFormatContext *avctx, · 10 unmodified lines | |||
| 181 | av_log(avctx, AV_LOG_WARNING, "Unable to set duplex mode, because it is not supported.\n"); | 170 | av_log(avctx, AV_LOG_WARNING, "Unable to set duplex mode, because it is not supported.\n"); |
| 182 | } | 171 | } |
| 183 | } | 172 | } |
| 184 | |||
| 185 | if (direction == DIRECTION_IN) { | 173 | if (direction == DIRECTION_IN) { |
| 186 | int ret; | 174 | int ret; |
| 187 | ret = decklink_select_input(avctx, bmdDeckLinkConfigAudioInputConnection); | 175 | ret = decklink_select_input(avctx, bmdDeckLinkConfigAudioInputConnection); |
| @@ -190,6 +178,28 @@ int ff_decklink_set_format(AVFormatContext *avctx, · 2 unmodified lines | |||
| 190 | ret = decklink_select_input(avctx, bmdDeckLinkConfigVideoInputConnection); | 178 | ret = decklink_select_input(avctx, bmdDeckLinkConfigVideoInputConnection); |
| 191 | if (ret < 0) | 179 | if (ret < 0) |
| 192 | return ret; | 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 | res = ctx->dli->GetDisplayModeIterator (&itermode); | 203 | res = ctx->dli->GetDisplayModeIterator (&itermode); |
| 194 | } else { | 204 | } else { |
| 195 | res = ctx->dlo->GetDisplayModeIterator (&itermode); | 205 | res = ctx->dlo->GetDisplayModeIterator (&itermode); |