MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / ff_decklink_init_device

Function ff_decklink_init_device

libavdevice/decklink_common.cpp:670–711  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

668}
669
670int ff_decklink_init_device(AVFormatContext *avctx, const char* name)
671{
672 struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
673 struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
674 IDeckLink *dl = NULL;
675 IDeckLinkIterator *iter = decklink_create_iterator(avctx);
676 if (!iter)
677 return AVERROR_EXTERNAL;
678
679 while (iter->Next(&dl) == S_OK) {
680 const char *display_name = NULL;
681 const char *unique_name = NULL;
682 decklink_get_attr_string(dl, BMDDeckLinkDisplayName, &display_name);
683 decklink_get_attr_string(dl, BMDDeckLinkDeviceHandle, &unique_name);
684 if (display_name && !strcmp(name, display_name) || unique_name && !strcmp(name, unique_name)) {
685 av_free((void *)unique_name);
686 av_free((void *)display_name);
687 ctx->dl = dl;
688 break;
689 }
690 av_free((void *)display_name);
691 av_free((void *)unique_name);
692 dl->Release();
693 }
694 iter->Release();
695 if (!ctx->dl)
696 return AVERROR(ENXIO);
697
698 if (ctx->dl->QueryInterface(IID_IDeckLinkConfiguration, (void **)&ctx->cfg) != S_OK) {
699 av_log(avctx, AV_LOG_ERROR, "Could not get configuration interface for '%s'\n", name);
700 ff_decklink_cleanup(avctx);
701 return AVERROR_EXTERNAL;
702 }
703
704 if (ctx->dl->QueryInterface(IID_IDeckLinkProfileAttributes, (void **)&ctx->attr) != S_OK) {
705 av_log(avctx, AV_LOG_ERROR, "Could not get attributes interface for '%s'\n", name);
706 ff_decklink_cleanup(avctx);
707 return AVERROR_EXTERNAL;
708 }
709
710 return 0;
711}

Callers 2

ff_decklink_read_headerFunction · 0.85
ff_decklink_write_headerFunction · 0.85

Calls 7

decklink_create_iteratorFunction · 0.85
decklink_get_attr_stringFunction · 0.85
av_logFunction · 0.85
ff_decklink_cleanupFunction · 0.85
av_freeFunction · 0.50
ReleaseMethod · 0.45
QueryInterfaceMethod · 0.45

Tested by

no test coverage detected