[FFmpeg-cvslog] avdevice/decklink_dec: use decklink_ctx->raw_format as bmdPixelFormat

Marton Balint git at videolan.org
Sun Sep 13 19:50:53 EEST 2020


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Wed Jul 15 20:23:12 2020 +0200| [e33c0d8c69a2760f228237f9c4d091987382ed5a] | committer: Marton Balint

avdevice/decklink_dec: use decklink_ctx->raw_format as bmdPixelFormat

Signed-off-by: Marton Balint <cus at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e33c0d8c69a2760f228237f9c4d091987382ed5a
---

 libavdevice/decklink_common.cpp | 6 +++---
 libavdevice/decklink_dec.cpp    | 9 ++++++---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
index 53b57ffe4e..8b58ede1ef 100644
--- a/libavdevice/decklink_common.cpp
+++ b/libavdevice/decklink_common.cpp
@@ -272,7 +272,7 @@ int ff_decklink_set_format(AVFormatContext *avctx,
 #if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b050000
     if (direction == DIRECTION_IN) {
         BMDDisplayMode actualMode = ctx->bmd_mode;
-        if (ctx->dli->DoesSupportVideoMode(ctx->video_input, ctx->bmd_mode, (BMDPixelFormat) cctx->raw_format,
+        if (ctx->dli->DoesSupportVideoMode(ctx->video_input, ctx->bmd_mode, ctx->raw_format,
                                            bmdNoVideoInputConversion, bmdSupportedVideoModeDefault,
                                            &actualMode, &support) != S_OK || !support || ctx->bmd_mode != actualMode)
             return -1;
@@ -286,7 +286,7 @@ int ff_decklink_set_format(AVFormatContext *avctx,
     return 0;
 #elif BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000
     if (direction == DIRECTION_IN) {
-        if (ctx->dli->DoesSupportVideoMode(ctx->video_input, ctx->bmd_mode, (BMDPixelFormat) cctx->raw_format,
+        if (ctx->dli->DoesSupportVideoMode(ctx->video_input, ctx->bmd_mode, ctx->raw_format,
                                            bmdSupportedVideoModeDefault,
                                            &support) != S_OK)
             return -1;
@@ -303,7 +303,7 @@ int ff_decklink_set_format(AVFormatContext *avctx,
         return 0;
 #else
     if (direction == DIRECTION_IN) {
-        if (ctx->dli->DoesSupportVideoMode(ctx->bmd_mode, (BMDPixelFormat) cctx->raw_format,
+        if (ctx->dli->DoesSupportVideoMode(ctx->bmd_mode, ctx->raw_format,
                                            bmdVideoOutputFlagDefault,
                                            &support, NULL) != S_OK)
             return -1;
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index dde68ffddc..af0ef04c56 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -1148,6 +1148,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
     ctx->video_pts_source = cctx->video_pts_source;
     ctx->draw_bars = cctx->draw_bars;
     ctx->audio_depth = cctx->audio_depth;
+    ctx->raw_format = (BMDPixelFormat)cctx->raw_format;
     cctx->ctx = ctx;
 
     /* Check audio channel option for valid values: 2, 8 or 16 */
@@ -1270,7 +1271,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
     st->time_base.num      = ctx->bmd_tb_num;
     st->r_frame_rate       = av_make_q(st->time_base.den, st->time_base.num);
 
-    switch((BMDPixelFormat)cctx->raw_format) {
+    switch(ctx->raw_format) {
     case bmdFormat8BitYUV:
         st->codecpar->codec_id    = AV_CODEC_ID_RAWVIDEO;
         st->codecpar->codec_tag   = MKTAG('U', 'Y', 'V', 'Y');
@@ -1303,7 +1304,9 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
         st->codecpar->bits_per_coded_sample = 10;
         break;
     default:
-        av_log(avctx, AV_LOG_ERROR, "Raw Format %.4s not supported\n", (char*) &cctx->raw_format);
+        char fourcc_str[AV_FOURCC_MAX_STRING_SIZE] = {0};
+        av_fourcc_make_string(fourcc_str, ctx->raw_format);
+        av_log(avctx, AV_LOG_ERROR, "Raw Format %s not supported\n", fourcc_str);
         ret = AVERROR(EINVAL);
         goto error;
     }
@@ -1364,7 +1367,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
     }
 
     result = ctx->dli->EnableVideoInput(ctx->bmd_mode,
-                                        (BMDPixelFormat) cctx->raw_format,
+                                        ctx->raw_format,
                                         bmdVideoInputFlagDefault);
 
     if (result != S_OK) {



More information about the ffmpeg-cvslog mailing list