From 2f3015c25aaecf0307a82e38099c04b783223013 Mon Sep 17 00:00:00 2001 From: Marton Balint Date: Thu, 13 Oct 2016 23:56:45 +0200 Subject: lavd/decklink_dec: add option to disable drawing bars on signal loss Signed-off-by: Marton Balint --- doc/indevs.texi | 4 ++++ libavdevice/decklink_common.h | 1 + libavdevice/decklink_common_c.h | 1 + libavdevice/decklink_dec.cpp | 3 ++- libavdevice/decklink_dec_c.c | 1 + libavdevice/version.h | 2 +- 6 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/indevs.texi b/doc/indevs.texi index f693d7ac83..54f270b0dc 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -273,6 +273,10 @@ Sets the video packet timestamp source. Must be @samp{video}, @samp{audio}, Sets the audio packet timestamp source. Must be @samp{video}, @samp{audio}, @samp{reference} or @samp{wallclock}. Defaults to @samp{audio}. +@item draw_bars +If set to @samp{true}, color bars are drawn in the event of a signal loss. +Defaults to @samp{true}. + @end table @subsection Examples diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h index d2d0ab26b7..bfa2b08484 100644 --- a/libavdevice/decklink_common.h +++ b/libavdevice/decklink_common.h @@ -84,6 +84,7 @@ struct decklink_ctx { int duplex_mode; DecklinkPtsSource audio_pts_source; DecklinkPtsSource video_pts_source; + int draw_bars; int frames_preroll; int frames_buffer; diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h index 3c5f218713..d5656317ae 100644 --- a/libavdevice/decklink_common_c.h +++ b/libavdevice/decklink_common_c.h @@ -46,6 +46,7 @@ struct decklink_cctx { DecklinkPtsSource video_pts_source; int audio_input; int video_input; + int draw_bars; }; #endif /* AVDEVICE_DECKLINK_COMMON_C_H */ diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp index 24b42e3eb0..5318bbe690 100644 --- a/libavdevice/decklink_dec.cpp +++ b/libavdevice/decklink_dec.cpp @@ -309,7 +309,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( ctx->video_st->time_base.den); if (videoFrame->GetFlags() & bmdFrameHasNoInputSource) { - if (videoFrame->GetPixelFormat() == bmdFormat8BitYUV) { + if (ctx->draw_bars && videoFrame->GetPixelFormat() == bmdFormat8BitYUV) { unsigned bars[8] = { 0xEA80EA80, 0xD292D210, 0xA910A9A5, 0x90229035, 0x6ADD6ACA, 0x51EF515A, 0x286D28EF, 0x10801080 }; @@ -485,6 +485,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) ctx->audio_input = decklink_audio_connection_map[cctx->audio_input]; ctx->audio_pts_source = cctx->audio_pts_source; ctx->video_pts_source = cctx->video_pts_source; + ctx->draw_bars = cctx->draw_bars; cctx->ctx = ctx; #if !CONFIG_LIBZVBI diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c index 56bc4394cf..543d16b396 100644 --- a/libavdevice/decklink_dec_c.c +++ b/libavdevice/decklink_dec_c.c @@ -62,6 +62,7 @@ static const AVOption options[] = { { "video", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PTS_SRC_VIDEO }, 0, 0, DEC, "pts_source"}, { "reference", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PTS_SRC_REFERENCE}, 0, 0, DEC, "pts_source"}, { "wallclock", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PTS_SRC_WALLCLOCK}, 0, 0, DEC, "pts_source"}, + { "draw_bars", "draw bars on signal loss" , OFFSET(draw_bars), AV_OPT_TYPE_BOOL, { .i64 = 1}, 0, 1, DEC }, { NULL }, }; diff --git a/libavdevice/version.h b/libavdevice/version.h index 94a34fd670..8603bb1261 100644 --- a/libavdevice/version.h +++ b/libavdevice/version.h @@ -29,7 +29,7 @@ #define LIBAVDEVICE_VERSION_MAJOR 57 #define LIBAVDEVICE_VERSION_MINOR 0 -#define LIBAVDEVICE_VERSION_MICRO 102 +#define LIBAVDEVICE_VERSION_MICRO 103 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ LIBAVDEVICE_VERSION_MINOR, \ -- cgit v1.2.3