From c5e9c66d00e481493bbc3f63f98e57ac68962ce0 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Wed, 11 Mar 2009 08:06:04 +0100 Subject: Patch by Moritz Venn: The current implementation of ConfigNumber.isChanged (the one inherited from ConfigElement) does not work properly as it will - at least for unsaved values - always returns True. This is obvious if you just take a look at the datatypes since value is an int and default is a string (because ConfigNumber is a modified ConfigText). To resolve this issue one can either compare self.tostring(self.value) or self.text to self.default but the former seems to be the more logical approach. The attached patch does override the method in ConfigNumber with the proposed fix. --- lib/python/Components/config.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/python/Components') diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index 4cc40633..24d39cba 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -1029,6 +1029,13 @@ class ConfigNumber(ConfigText): value = property(getValue, setValue) _value = property(getValue, setValue) + def isChanged(self): + sv = self.saved_value + strv = self.tostring(self.value) + if sv is None and strv == self.default: + return False + return strv != sv + def conform(self): pos = len(self.text) - self.marked_pos self.text = self.text.lstrip("0") -- cgit v1.2.3 From 4531ea135c84d78d96d66a08b67f1f5e09475c55 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Wed, 11 Mar 2009 08:12:01 +0100 Subject: Patch by Moritz Venn: Allow to set an additional delay via config. Note that this requires driver support, which is not necessarily complete. --- data/setup.xml | 2 ++ lib/python/Components/AVSwitch.py | 5 ++++- lib/python/Plugins/SystemPlugins/Videomode/plugin.py | 4 ++++ lib/service/servicedvb.cpp | 14 ++++++++++++-- 4 files changed, 22 insertions(+), 3 deletions(-) (limited to 'lib/python/Components') diff --git a/data/setup.xml b/data/setup.xml index e2ab09b1..17301f23 100644 --- a/data/setup.xml +++ b/data/setup.xml @@ -13,6 +13,8 @@ config.av.tvsystem config.av.wss config.av.defaultac3 + config.av.generalAC3delay + config.av.generalPCMdelay config.av.downmix_ac3 config.av.vcrswitch diff --git a/lib/python/Components/AVSwitch.py b/lib/python/Components/AVSwitch.py index 3188469a..8f4255b8 100644 --- a/lib/python/Components/AVSwitch.py +++ b/lib/python/Components/AVSwitch.py @@ -1,4 +1,5 @@ -from config import config, ConfigSlider, ConfigSelection, ConfigYesNo, ConfigEnableDisable, ConfigSubsection, ConfigBoolean +from config import config, ConfigSlider, ConfigSelection, ConfigYesNo, \ + ConfigEnableDisable, ConfigSubsection, ConfigBoolean, ConfigNumber from enigma import eAVSwitch, getDesktop from SystemInfo import SystemInfo @@ -110,6 +111,8 @@ def InitAVSwitch(): config.av.tvsystem = ConfigSelection(choices = {"pal": _("PAL"), "ntsc": _("NTSC"), "multinorm": _("multinorm")}, default="pal") config.av.wss = ConfigEnableDisable(default = True) config.av.defaultac3 = ConfigYesNo(default = False) + config.av.generalAC3delay = ConfigNumber(default = 0) + config.av.generalPCMdelay = ConfigNumber(default = 0) config.av.vcrswitch = ConfigEnableDisable(default = False) iAVSwitch = AVSwitch() diff --git a/lib/python/Plugins/SystemPlugins/Videomode/plugin.py b/lib/python/Plugins/SystemPlugins/Videomode/plugin.py index 5a7dfd1b..6b6d5045 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/plugin.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/plugin.py @@ -98,6 +98,10 @@ class VideoSetup(Screen, ConfigListScreen): self.list.append(getConfigListEntry(_("AC3 default"), config.av.defaultac3)) if SystemInfo["CanDownmixAC3"]: self.list.append(getConfigListEntry(_("AC3 downmix"), config.av.downmix_ac3)) + self.list.extend(( + getConfigListEntry(_("General AC3 Delay"), config.av.generalAC3delay), + getConfigListEntry(_("General PCM Delay"), config.av.generalPCMdelay) + )) if SystemInfo["CanChangeOsdAlpha"]: self.list.append(getConfigListEntry(_("OSD visibility"), config.av.osd_alpha)) diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 12b75f80..012493fa 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -2267,8 +2267,18 @@ void eDVBServicePlay::updateDecoder() } } } - m_decoder->setAC3Delay(ac3_delay == -1 ? 0 : ac3_delay); - m_decoder->setPCMDelay(pcm_delay == -1 ? 0 : pcm_delay); + + std::string config_delay; + int config_delay_int = 0; + if(ePythonConfigQuery::getConfigValue("config.av.generalAC3delay", config_delay) == 0) + config_delay_int = atoi(config_delay.c_str()); + m_decoder->setAC3Delay(ac3_delay == -1 ? config_delay_int : ac3_delay + config_delay_int); + + if(ePythonConfigQuery::getConfigValue("config.av.generalPCMdelay", config_delay) == 0) + config_delay_int = atoi(config_delay.c_str()); + else + config_delay_int = 0; + m_decoder->setPCMDelay(pcm_delay == -1 ? config_delay_int : pcm_delay + config_delay_int); m_decoder->setVideoPID(vpid, vpidtype); selectAudioStream(); -- cgit v1.2.3