Showing the changes to libavdevice/decklink_common.cpp (1 of 7 files). Show all
Unified · Split
| @@ -182,7 +182,11 @@ int ff_decklink_set_configs(AVFormatContext *avctx, · 181 unmodified lines | ||
| 182 | 182 | if (duplex_supported) { |
| 183 | 183 | #if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000 |
| 184 | 184 | IDeckLinkProfile *profile = NULL; |
| 185 | − BMDProfileID bmd_profile_id = ctx->duplex_mode == 2 ? bmdProfileOneSubDeviceFullDuplex : bmdProfileTwoSubDevicesHalfDuplex; | |
| 185 | + BMDProfileID bmd_profile_id; | |
| 186 | + | |
| 187 | + if (ctx->duplex_mode < 0 || ctx->duplex_mode >= FF_ARRAY_ELEMS(decklink_profile_id_map)) | |
| 188 | + return EINVAL; | |
| 189 | + bmd_profile_id = decklink_profile_id_map[ctx->duplex_mode]; | |
| 186 | 190 | res = manager->GetProfile(bmd_profile_id, &profile); |
| 187 | 191 | if (res == S_OK) { |
| 188 | 192 | res = profile->SetActive(); |
| @@ -195,7 +199,7 @@ int ff_decklink_set_configs(AVFormatContext *avctx, · 6 unmodified lines | ||
| 195 | 199 | if (res != S_OK) |
| 196 | 200 | av_log(avctx, AV_LOG_WARNING, "Setting duplex mode failed.\n"); |
| 197 | 201 | else |
| 198 | − av_log(avctx, AV_LOG_VERBOSE, "Successfully set duplex mode to %s duplex.\n", ctx->duplex_mode == 2 ? "full" : "half"); | |
| 202 | + av_log(avctx, AV_LOG_VERBOSE, "Successfully set duplex mode to %s duplex.\n", ctx->duplex_mode == 2 || ctx->duplex_mode == 4 ? "full" : "half"); | |
| 199 | 203 | } else { |
| 200 | 204 | av_log(avctx, AV_LOG_WARNING, "Unable to set duplex mode, because it is not supported.\n"); |
| 201 | 205 | } |