diff options
author | Marton Balint <cus@passwd.hu> | 2020-07-15 20:45:22 +0200 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2020-09-13 17:59:30 +0200 |
commit | f1b908d20a8800add3db281623eb9d8fb97162e5 (patch) | |
tree | 805d2a04c027e3bb88db92f32c95bd9f169c792c /libavdevice/decklink_dec.cpp | |
parent | e33c0d8c69a2760f228237f9c4d091987382ed5a (diff) | |
download | ffmpeg-f1b908d20a8800add3db281623eb9d8fb97162e5.tar.gz |
avdevice/decklink_dec: add support for rgb/yuv pixel format autodetection
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavdevice/decklink_dec.cpp')
-rw-r--r-- | libavdevice/decklink_dec.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp index af0ef04c56..92b8feed14 100644 --- a/libavdevice/decklink_dec.cpp +++ b/libavdevice/decklink_dec.cpp @@ -1044,9 +1044,13 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( HRESULT decklink_input_callback::VideoInputFormatChanged( BMDVideoInputFormatChangedEvents events, IDeckLinkDisplayMode *mode, - BMDDetectedVideoInputFormatFlags) + BMDDetectedVideoInputFormatFlags formatFlags) { + struct decklink_cctx *cctx = (struct decklink_cctx *) avctx->priv_data; ctx->bmd_mode = mode->GetDisplayMode(); + // check the C context member to make sure we set both raw_format and bmd_mode with data from the same format change callback + if (!cctx->raw_format) + ctx->raw_format = (formatFlags & bmdDetectedVideoInputRGB444) ? bmdFormat8BitARGB : bmdFormat8BitYUV; return S_OK; } @@ -1228,6 +1232,8 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) } av_log(avctx, AV_LOG_INFO, "Autodetected the input mode\n"); } + if (ctx->raw_format == bmdFormatUnspecified) + ctx->raw_format = bmdFormat8BitYUV; if (ff_decklink_set_format(avctx, DIRECTION_IN) < 0) { av_log(avctx, AV_LOG_ERROR, "Could not set format code %s for %s\n", cctx->format_code ? cctx->format_code : "(unset)", avctx->url); |