| 167 | } |
| 168 | |
| 169 | int ff_decklink_set_configs(AVFormatContext *avctx, |
| 170 | decklink_direction_t direction) { |
| 171 | struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data; |
| 172 | struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx; |
| 173 | HRESULT res; |
| 174 | |
| 175 | if (ctx->duplex_mode) { |
| 176 | DECKLINK_BOOL duplex_supported = false; |
| 177 | |
| 178 | #if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000 |
| 179 | IDeckLinkProfileManager *manager = NULL; |
| 180 | if (ctx->dl->QueryInterface(IID_IDeckLinkProfileManager, (void **)&manager) == S_OK) |
| 181 | duplex_supported = true; |
| 182 | #else |
| 183 | if (ctx->attr->GetFlag(BMDDeckLinkSupportsDuplexModeConfiguration, &duplex_supported) != S_OK) |
| 184 | duplex_supported = false; |
| 185 | #endif |
| 186 | |
| 187 | if (duplex_supported) { |
| 188 | #if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000 |
| 189 | IDeckLinkProfile *profile = NULL; |
| 190 | BMDProfileID bmd_profile_id; |
| 191 | |
| 192 | if (ctx->duplex_mode < 0 || ctx->duplex_mode >= FF_ARRAY_ELEMS(decklink_profile_id_map)) |
| 193 | return EINVAL; |
| 194 | bmd_profile_id = decklink_profile_id_map[ctx->duplex_mode]; |
| 195 | res = manager->GetProfile(bmd_profile_id, &profile); |
| 196 | if (res == S_OK) { |
| 197 | res = profile->SetActive(); |
| 198 | profile->Release(); |
| 199 | } |
| 200 | manager->Release(); |
| 201 | #else |
| 202 | res = ctx->cfg->SetInt(bmdDeckLinkConfigDuplexMode, ctx->duplex_mode == 2 ? bmdDuplexModeFull : bmdDuplexModeHalf); |
| 203 | #endif |
| 204 | if (res != S_OK) |
| 205 | av_log(avctx, AV_LOG_WARNING, "Setting duplex mode failed.\n"); |
| 206 | else |
| 207 | av_log(avctx, AV_LOG_VERBOSE, "Successfully set duplex mode to %s duplex.\n", ctx->duplex_mode == 2 || ctx->duplex_mode == 4 ? "full" : "half"); |
| 208 | } else { |
| 209 | av_log(avctx, AV_LOG_WARNING, "Unable to set duplex mode, because it is not supported.\n"); |
| 210 | } |
| 211 | } |
| 212 | if (direction == DIRECTION_IN) { |
| 213 | int ret; |
| 214 | ret = decklink_select_input(avctx, bmdDeckLinkConfigAudioInputConnection); |
| 215 | if (ret < 0) |
| 216 | return ret; |
| 217 | ret = decklink_select_input(avctx, bmdDeckLinkConfigVideoInputConnection); |
| 218 | if (ret < 0) |
| 219 | return ret; |
| 220 | } |
| 221 | if (direction == DIRECTION_OUT && cctx->timing_offset != INT_MIN) { |
| 222 | res = ctx->cfg->SetInt(bmdDeckLinkConfigReferenceInputTimingOffset, cctx->timing_offset); |
| 223 | if (res != S_OK) |
| 224 | av_log(avctx, AV_LOG_WARNING, "Setting timing offset failed.\n"); |
| 225 | } |
| 226 |
no test coverage detected