From 53f22a2ed263ba504c4b984faf886c24f66c04d3 Mon Sep 17 00:00:00 2001 From: Johns Date: Fri, 20 Apr 2012 15:40:14 +0200 Subject: [PATCH] Made showing black picture configurable. --- ChangeLog | 1 + README.txt | 4 ++++ softhddevice.cpp | 11 +++++++++++ video.c | 26 ++++++++++++++++++++------ video.h | 3 +++ 5 files changed, 39 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index e6d0ecb..bca69c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ User johns Date: + Made showing black picture configurable. Show black picture, if no video stream is available. Setup split into foldable sections. Adds show cursor on pointer move and hide after 200ms. diff --git a/README.txt b/README.txt index 8ac6d08..34ab5a0 100644 --- a/README.txt +++ b/README.txt @@ -219,6 +219,10 @@ Setup: /etc/vdr/setup.conf 0 disable soft start of audio/video sync 1 enable soft start of audio/video sync + softhddevice.BlackPicture = 0 + 0 disable black picture during channel switch + 1 enable black picture during channel switch + VideoDisplayFormat = ? 0 pan and scan 1 letter box diff --git a/softhddevice.cpp b/softhddevice.cpp index 21a4996..608edac 100644 --- a/softhddevice.cpp +++ b/softhddevice.cpp @@ -82,6 +82,7 @@ static uint32_t ConfigVideoBackground; ///< config video background color static char ConfigVideoStudioLevels; ///< config use studio levels static char ConfigVideo60HzMode; ///< config use 60Hz display mode static char ConfigVideoSoftStartSync; ///< config use softstart sync +static char ConfigVideoBlackPicture; ///< config enable black picture mode /// config deinterlace static int ConfigVideoDeinterlace[RESOLUTIONS]; @@ -490,6 +491,7 @@ class cMenuSetupSoft:public cMenuSetupPage int StudioLevels; int _60HzMode; int SoftStartSync; + int BlackPicture; int ResolutionShown[RESOLUTIONS]; int Scaling[RESOLUTIONS]; @@ -639,6 +641,8 @@ void cMenuSetupSoft::Create(void) trVDR("no"), trVDR("yes"))); Add(new cMenuEditBoolItem(tr("Soft start a/v sync"), &SoftStartSync, trVDR("no"), trVDR("yes"))); + Add(new cMenuEditBoolItem(tr("Black during channel switch"), + &BlackPicture, trVDR("no"), trVDR("yes"))); for (i = 0; i < RESOLUTIONS; ++i) { Add(CollapsedItem(resolution[i], ResolutionShown[i])); @@ -779,6 +783,7 @@ cMenuSetupSoft::cMenuSetupSoft(void) StudioLevels = ConfigVideoStudioLevels; _60HzMode = ConfigVideo60HzMode; SoftStartSync = ConfigVideoSoftStartSync; + BlackPicture = ConfigVideoBlackPicture; for (i = 0; i < RESOLUTIONS; ++i) { ResolutionShown[i] = 0; @@ -853,6 +858,8 @@ void cMenuSetupSoft::Store(void) VideoSet60HzMode(ConfigVideo60HzMode); SetupStore("SoftStartSync", ConfigVideoSoftStartSync = SoftStartSync); VideoSetSoftStartSync(ConfigVideoSoftStartSync); + SetupStore("BlackPicture", ConfigVideoBlackPicture = BlackPicture); + VideoSetBlackPicture(ConfigVideoBlackPicture); for (i = 0; i < RESOLUTIONS; ++i) { char buf[128]; @@ -1923,6 +1930,10 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value) VideoSetSoftStartSync(ConfigVideoSoftStartSync = atoi(value)); return true; } + if (!strcasecmp(name, "BlackPicture")) { + VideoSetBlackPicture(ConfigVideoBlackPicture = atoi(value)); + return true; + } for (i = 0; i < RESOLUTIONS; ++i) { char buf[128]; diff --git a/video.c b/video.c index 47d72db..762036b 100644 --- a/video.c +++ b/video.c @@ -348,6 +348,8 @@ static VideoZoomModes Video4to3ZoomMode; static char Video60HzMode; ///< handle 60hz displays static char VideoSoftStartSync; ///< soft start sync audio/video +static const int VideoSoftStartFrames = 120; ///< soft start frames +static char VideoShowBlackPicture; ///< flag show black picture static xcb_atom_t WmDeleteWindowAtom; ///< WM delete message atom static xcb_atom_t NetWmState; ///< wm-state message atom @@ -4459,7 +4461,7 @@ static void VaapiSyncDecoder(VaapiDecoder * decoder) decoder->TrickCounter = decoder->TrickSpeed; } // at start of new video stream, soft or hard sync video to audio - if (!VideoSoftStartSync && decoder->FramesDisplayed < 60 + if (!VideoSoftStartSync && decoder->FramesDisplayed < VideoSoftStartFrames && (audio_clock == (int64_t) AV_NOPTS_VALUE || video_clock > audio_clock + VideoAudioDelay + 120 * 90)) { err = @@ -4510,7 +4512,7 @@ static void VaapiSyncDecoder(VaapiDecoder * decoder) "duping frame (%d/%d) %d v-buf\n"), decoder->FramesDuped, decoder->FrameCounter, VideoGetBuffers()); if (decoder->Closing < -300) { - atomic_set(&decoder->SurfacesFilled, 0); + atomic_set(&decoder->SurfacesFilled, 1); } } goto out; @@ -7545,8 +7547,10 @@ static void VdpauDisplayFrame(void) // need 1 frame for progressive, 3 frames for interlaced if (filled < 1 + 2 * decoder->Interlaced) { // FIXME: rewrite MixVideo to support less surfaces - VdpauBlackSurface(decoder); - VdpauMessage(3, "video/vdpau: black surface displayed\n"); + if (VideoShowBlackPicture || decoder->Closing < -300) { + VdpauBlackSurface(decoder); + VdpauMessage(3, "video/vdpau: black surface displayed\n"); + } continue; } @@ -7681,7 +7685,7 @@ static void VdpauSyncDecoder(VdpauDecoder * decoder) decoder->TrickCounter = decoder->TrickSpeed; } // at start of new video stream, soft or hard sync video to audio - if (!VideoSoftStartSync && decoder->FramesDisplayed < 60 + if (!VideoSoftStartSync && decoder->FramesDisplayed < VideoSoftStartFrames && (audio_clock == (int64_t) AV_NOPTS_VALUE || video_clock > audio_clock + VideoAudioDelay + 120 * 90)) { err = @@ -7732,7 +7736,7 @@ static void VdpauSyncDecoder(VdpauDecoder * decoder) "duping frame (%d/%d) %d v-buf\n"), decoder->FramesDuped, decoder->FrameCounter, VideoGetBuffers()); if (decoder->Closing < -300) { - atomic_set(&decoder->SurfacesFilled, 0); + atomic_set(&decoder->SurfacesFilled, 1); } } goto out; @@ -9608,6 +9612,16 @@ void VideoSetSoftStartSync(int onoff) VideoSoftStartSync = onoff; } +/// +/// Set show black picture during channel switch. +/// +/// @param onoff enable / disable black picture. +/// +void VideoSetBlackPicture(int onoff) +{ + VideoShowBlackPicture = onoff; +} + /// /// Set video output position. /// diff --git a/video.h b/video.h index 20e016d..5780d61 100644 --- a/video.h +++ b/video.h @@ -90,6 +90,9 @@ extern void VideoSet60HzMode(int); /// Set soft start audio/video sync. extern void VideoSetSoftStartSync(int); + /// Set show black picture during channel switch. +extern void VideoSetBlackPicture(int); + /// Set video output position. extern void VideoSetOutputPosition(int, int, int, int);