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

Function ff_decklink_list_formats

libavdevice/decklink_common.cpp:602–651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

600}
601
602int ff_decklink_list_formats(AVFormatContext *avctx, decklink_direction_t direction)
603{
604 struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
605 struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
606 IDeckLinkDisplayModeIterator *itermode;
607 IDeckLinkDisplayMode *mode;
608 uint32_t format_code;
609 HRESULT res;
610
611 if (direction == DIRECTION_IN) {
612 int ret;
613 ret = decklink_select_input(avctx, bmdDeckLinkConfigAudioInputConnection);
614 if (ret < 0)
615 return ret;
616 ret = decklink_select_input(avctx, bmdDeckLinkConfigVideoInputConnection);
617 if (ret < 0)
618 return ret;
619 res = ctx->dli->GetDisplayModeIterator (&itermode);
620 } else {
621 res = ctx->dlo->GetDisplayModeIterator (&itermode);
622 }
623
624 if (res!= S_OK) {
625 av_log(avctx, AV_LOG_ERROR, "Could not get Display Mode Iterator\n");
626 return AVERROR(EIO);
627 }
628
629 av_log(avctx, AV_LOG_INFO, "Supported formats for '%s':\n\tformat_code\tdescription",
630 avctx->url);
631 while (itermode->Next(&mode) == S_OK) {
632 BMDTimeValue tb_num, tb_den;
633 mode->GetFrameRate(&tb_num, &tb_den);
634 format_code = av_bswap32(mode->GetDisplayMode());
635 av_log(avctx, AV_LOG_INFO, "\n\t%.4s\t\t%ldx%ld at %d/%d fps",
636 (char*) &format_code, mode->GetWidth(), mode->GetHeight(),
637 (int) tb_den, (int) tb_num);
638 switch (mode->GetFieldDominance()) {
639 case bmdLowerFieldFirst:
640 av_log(avctx, AV_LOG_INFO, " (interlaced, lower field first)"); break;
641 case bmdUpperFieldFirst:
642 av_log(avctx, AV_LOG_INFO, " (interlaced, upper field first)"); break;
643 }
644 mode->Release();
645 }
646 av_log(avctx, AV_LOG_INFO, "\n");
647
648 itermode->Release();
649
650 return 0;
651}
652
653void ff_decklink_cleanup(AVFormatContext *avctx)
654{

Callers 2

ff_decklink_read_headerFunction · 0.85
ff_decklink_write_headerFunction · 0.85

Calls 6

decklink_select_inputFunction · 0.85
av_logFunction · 0.85
GetWidthMethod · 0.80
GetHeightMethod · 0.80
av_bswap32Function · 0.50
ReleaseMethod · 0.45

Tested by

no test coverage detected