Browse code

lavd/decklink_dec: add option to disable drawing bars on signal loss

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

Marton Balint authored on 2016/10/14 06:56:45
Showing 6 changed files
... ...
@@ -273,6 +273,10 @@ Sets the video packet timestamp source. Must be @samp{video}, @samp{audio},
273 273
 Sets the audio packet timestamp source. Must be @samp{video}, @samp{audio},
274 274
 @samp{reference} or @samp{wallclock}. Defaults to @samp{audio}.
275 275
 
276
+@item draw_bars
277
+If set to @samp{true}, color bars are drawn in the event of a signal loss.
278
+Defaults to @samp{true}.
279
+
276 280
 @end table
277 281
 
278 282
 @subsection Examples
... ...
@@ -84,6 +84,7 @@ struct decklink_ctx {
84 84
     int duplex_mode;
85 85
     DecklinkPtsSource audio_pts_source;
86 86
     DecklinkPtsSource video_pts_source;
87
+    int draw_bars;
87 88
 
88 89
     int frames_preroll;
89 90
     int frames_buffer;
... ...
@@ -46,6 +46,7 @@ struct decklink_cctx {
46 46
     DecklinkPtsSource video_pts_source;
47 47
     int audio_input;
48 48
     int video_input;
49
+    int draw_bars;
49 50
 };
50 51
 
51 52
 #endif /* AVDEVICE_DECKLINK_COMMON_C_H */
... ...
@@ -309,7 +309,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
309 309
                                   ctx->video_st->time_base.den);
310 310
 
311 311
         if (videoFrame->GetFlags() & bmdFrameHasNoInputSource) {
312
-            if (videoFrame->GetPixelFormat() == bmdFormat8BitYUV) {
312
+            if (ctx->draw_bars && videoFrame->GetPixelFormat() == bmdFormat8BitYUV) {
313 313
             unsigned bars[8] = {
314 314
                 0xEA80EA80, 0xD292D210, 0xA910A9A5, 0x90229035,
315 315
                 0x6ADD6ACA, 0x51EF515A, 0x286D28EF, 0x10801080 };
... ...
@@ -485,6 +485,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
485 485
         ctx->audio_input = decklink_audio_connection_map[cctx->audio_input];
486 486
     ctx->audio_pts_source = cctx->audio_pts_source;
487 487
     ctx->video_pts_source = cctx->video_pts_source;
488
+    ctx->draw_bars = cctx->draw_bars;
488 489
     cctx->ctx = ctx;
489 490
 
490 491
 #if !CONFIG_LIBZVBI
... ...
@@ -62,6 +62,7 @@ static const AVOption options[] = {
62 62
     { "video",         NULL,                                          0,  AV_OPT_TYPE_CONST, { .i64 = PTS_SRC_VIDEO    }, 0, 0, DEC, "pts_source"},
63 63
     { "reference",     NULL,                                          0,  AV_OPT_TYPE_CONST, { .i64 = PTS_SRC_REFERENCE}, 0, 0, DEC, "pts_source"},
64 64
     { "wallclock",     NULL,                                          0,  AV_OPT_TYPE_CONST, { .i64 = PTS_SRC_WALLCLOCK}, 0, 0, DEC, "pts_source"},
65
+    { "draw_bars",     "draw bars on signal loss" , OFFSET(draw_bars),    AV_OPT_TYPE_BOOL,  { .i64 = 1}, 0, 1, DEC },
65 66
     { NULL },
66 67
 };
67 68
 
... ...
@@ -29,7 +29,7 @@
29 29
 
30 30
 #define LIBAVDEVICE_VERSION_MAJOR  57
31 31
 #define LIBAVDEVICE_VERSION_MINOR   0
32
-#define LIBAVDEVICE_VERSION_MICRO 102
32
+#define LIBAVDEVICE_VERSION_MICRO 103
33 33
 
34 34
 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
35 35
                                                LIBAVDEVICE_VERSION_MINOR, \