From 0e40f5f8723951b731cfb56f66947141d18f1526 Mon Sep 17 00:00:00 2001 From: "Dr. Seltsam" <> Date: Tue, 5 Nov 2013 16:46:46 +0100 Subject: [PATCH] Add support to configure and clear buffers on channel switch. --- ChangeLog | 7 ++++- po/de_DE.po | 5 +++- softhddev.c | 67 +++++++++++++++++++++++++----------------------- softhddevice.cpp | 10 ++++++++ 4 files changed, 55 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index 782ac89..a6e4255 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ +User Dr. Seltsam +Date: Tue Nov 5 16:46:34 CET 2013 + + Add support to configure and clear buffers on channel switch. + User johns -Date: +Date: Tue Oct 8 10:18:04 CET 2013 CLOCK_REALTIME -> CLOCK_MONOTONIC to allow time changes. Add function VideoStreamOpen and always use VideoStreamClose. diff --git a/po/de_DE.po b/po/de_DE.po index 91867ef..7edfebb 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: VDR \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-08-03 17:21+0200\n" +"POT-Creation-Date: 2013-10-06 22:20+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -510,6 +510,9 @@ msgstr "Sanftanlauf A/V Sync" msgid "Black during channel switch" msgstr "Schwarz während Kanalwechsel" +msgid "Clear decoder on channel switch" +msgstr "Decoder bei Kanalwechsel leeren" + msgid "Brightness (-1000..1000) (vdpau)" msgstr "Helligkeit (-1000..1000) (vdpau)" diff --git a/softhddev.c b/softhddev.c index 91a031a..ce032f5 100644 --- a/softhddev.c +++ b/softhddev.c @@ -83,6 +83,7 @@ static char VdpauDecoder = 1; ///< vdpau decoder used #endif extern int ConfigAudioBufferTime; ///< config size ms of audio buffer +extern int ConfigVideoClearOnSwitch; //< clear decoder on channel switch char ConfigStartX11Server; ///< flag start the x11 server static char ConfigStartSuspended; ///< flag to start in suspend mode static char ConfigFullscreen; ///< fullscreen modus @@ -2465,45 +2466,47 @@ uint8_t *GrabImage(int *size, int jpeg, int quality, int width, int height) */ int SetPlayMode(int play_mode) { - VideoDisplayWakeup(); - // tell video parser we have new stream - if (MyVideoStream->Decoder && !MyVideoStream->SkipStream) { - if (MyVideoStream->ClearClose) { // replay clear buffers on close - Clear(); // flush all buffers - MyVideoStream->ClearClose = 0; - } - if (MyVideoStream->CodecID != AV_CODEC_ID_NONE) { - MyVideoStream->NewStream = 1; - MyVideoStream->InvalidPesCounter = 0; - // tell hw decoder we are closing stream - VideoSetClosing(MyVideoStream->HwDecoder); - VideoResetStart(MyVideoStream->HwDecoder); -#ifdef DEBUG - VideoSwitch = GetMsTicks(); -#endif - } - } - if (MyAudioDecoder) { // tell audio parser we have new stream - if (AudioCodecID != AV_CODEC_ID_NONE) { - NewAudioStream = 1; - } - } switch (play_mode) { - case 0: // nothing + case 0: // audio/video from decoder + // tell video parser we get new stream + if (MyVideoStream->Decoder && !MyVideoStream->SkipStream) { + // clear buffers on close configured always or replay only + if (ConfigVideoClearOnSwitch || MyVideoStream->ClearClose) { + Clear(); // flush all buffers + MyVideoStream->ClearClose = 0; + } + if (MyVideoStream->CodecID != AV_CODEC_ID_NONE) { + MyVideoStream->NewStream = 1; + MyVideoStream->InvalidPesCounter = 0; + // tell hw decoder we are closing stream + VideoSetClosing(MyVideoStream->HwDecoder); + VideoResetStart(MyVideoStream->HwDecoder); +#ifdef DEBUG + VideoSwitch = GetMsTicks(); +#endif + } + } + if (MyAudioDecoder) { // tell audio parser we have new stream + if (AudioCodecID != AV_CODEC_ID_NONE) { + NewAudioStream = 1; + } + } + break; case 1: // audio/video from player + VideoDisplayWakeup(); + Play(); break; - case 2: // audio only + case 2: // audio only from player, video from decoder + case 3: // audio only from player, no video (black screen) Debug(3, "softhddev: FIXME: audio only, silence video errors\n"); + VideoDisplayWakeup(); + Play(); break; - case 3: // audio only, black screen - Debug(3, "softhddev: FIXME: audio only, silence video errors\n"); - break; - case 4: // video only + case 4: // video only from player, audio from decoder + VideoDisplayWakeup(); + Play(); break; } - - Play(); - return 1; } diff --git a/softhddevice.cpp b/softhddevice.cpp index c2839ce..76d924d 100644 --- a/softhddevice.cpp +++ b/softhddevice.cpp @@ -91,6 +91,7 @@ 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 +char ConfigVideoClearOnSwitch; ///< config enable Clear on channel switch static int ConfigVideoBrightness; ///< config video brightness static int ConfigVideoContrast = 1000; ///< config video contrast @@ -595,6 +596,7 @@ class cMenuSetupSoft:public cMenuSetupPage int _60HzMode; int SoftStartSync; int BlackPicture; + int ClearOnSwitch; int Brightness; int Contrast; @@ -785,6 +787,8 @@ void cMenuSetupSoft::Create(void) trVDR("no"), trVDR("yes"))); Add(new cMenuEditBoolItem(tr("Black during channel switch"), &BlackPicture, trVDR("no"), trVDR("yes"))); + Add(new cMenuEditBoolItem(tr("Clear decoder on channel switch"), + &ClearOnSwitch, trVDR("no"), trVDR("yes"))); Add(new cMenuEditIntItem(tr("Brightness (-1000..1000) (vdpau)"), &Brightness, -1000, 1000, tr("min"), tr("max"))); @@ -1010,6 +1014,7 @@ cMenuSetupSoft::cMenuSetupSoft(void) _60HzMode = ConfigVideo60HzMode; SoftStartSync = ConfigVideoSoftStartSync; BlackPicture = ConfigVideoBlackPicture; + ClearOnSwitch = ConfigVideoClearOnSwitch; Brightness = ConfigVideoBrightness; Contrast = ConfigVideoContrast; @@ -1133,6 +1138,7 @@ void cMenuSetupSoft::Store(void) VideoSetSoftStartSync(ConfigVideoSoftStartSync); SetupStore("BlackPicture", ConfigVideoBlackPicture = BlackPicture); VideoSetBlackPicture(ConfigVideoBlackPicture); + SetupStore("ClearOnSwitch", ConfigVideoClearOnSwitch = ClearOnSwitch); SetupStore("Brightness", ConfigVideoBrightness = Brightness); VideoSetBrightness(ConfigVideoBrightness); @@ -2852,6 +2858,10 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value) VideoSetBlackPicture(ConfigVideoBlackPicture = atoi(value)); return true; } + if (!strcasecmp(name, "ClearOnSwitch")) { + ConfigVideoClearOnSwitch = atoi(value); + return true; + } if (!strcasecmp(name, "Brightness")) { VideoSetBrightness(ConfigVideoBrightness = atoi(value)); return true;