| 125 | } |
| 126 | |
| 127 | static int decklink_select_input(AVFormatContext *avctx, BMDDeckLinkConfigurationID cfg_id) |
| 128 | { |
| 129 | struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data; |
| 130 | struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx; |
| 131 | BMDDeckLinkAttributeID attr_id = (cfg_id == bmdDeckLinkConfigAudioInputConnection) ? BMDDeckLinkAudioInputConnections : BMDDeckLinkVideoInputConnections; |
| 132 | int64_t bmd_input = (cfg_id == bmdDeckLinkConfigAudioInputConnection) ? (int64_t)ctx->audio_input : (int64_t)ctx->video_input; |
| 133 | const char *type_name = (cfg_id == bmdDeckLinkConfigAudioInputConnection) ? "audio" : "video"; |
| 134 | int64_t supported_connections = 0; |
| 135 | HRESULT res; |
| 136 | |
| 137 | if (bmd_input) { |
| 138 | res = ctx->attr->GetInt(attr_id, &supported_connections); |
| 139 | if (res != S_OK) { |
| 140 | av_log(avctx, AV_LOG_ERROR, "Failed to query supported %s inputs.\n", type_name); |
| 141 | return AVERROR_EXTERNAL; |
| 142 | } |
| 143 | if ((supported_connections & bmd_input) != bmd_input) { |
| 144 | av_log(avctx, AV_LOG_ERROR, "Device does not support selected %s input.\n", type_name); |
| 145 | return AVERROR(ENOSYS); |
| 146 | } |
| 147 | res = ctx->cfg->SetInt(cfg_id, bmd_input); |
| 148 | if (res != S_OK) { |
| 149 | av_log(avctx, AV_LOG_ERROR, "Failed to select %s input.\n", type_name); |
| 150 | return AVERROR_EXTERNAL; |
| 151 | } |
| 152 | } |
| 153 | return 0; |
| 154 | } |
| 155 | |
| 156 | static DECKLINK_BOOL field_order_eq(enum AVFieldOrder field_order, BMDFieldDominance bmd_field_order) |
| 157 | { |
no test coverage detected