1 from enigma import eTimer
2 from Components.config import config, ConfigSubsection, ConfigSlider, ConfigSelection,ConfigYesNo
3 from Tools.CList import CList
4 from Tools.HardwareInfo import HardwareInfo
6 # The "VideoEnhancement" is the interface to /proc/stb/vmpeg/0.
8 class VideoEnhancement:
13 self.last_modes_preferred = [ ]
14 self.on_hotplug = CList()
17 def createConfig(self, *args):
18 hw_type = HardwareInfo().get_device_name()
19 config.pep = ConfigSubsection()
21 def setContrast(config):
22 myval = int(config.value*256)
24 print "--> setting contrast to: %0.8X" % myval
25 open("/proc/stb/vmpeg/0/pep_contrast", "w").write("%0.8X" % myval)
27 print "couldn't write pep_contrast."
29 if VideoEnhancement.firstRun is False:
30 self.setConfiguredValues()
32 config.pep.contrast = ConfigSlider(default=128, limits=(0,256))
33 config.pep.contrast.addNotifier(setContrast)
35 def setSaturation(config):
36 myval = int(config.value*256)
38 print "--> setting saturation to: %0.8X" % myval
39 open("/proc/stb/vmpeg/0/pep_saturation", "w").write("%0.8X" % myval)
41 print "couldn't write pep_saturaion."
43 if VideoEnhancement.firstRun is False:
44 self.setConfiguredValues()
46 config.pep.saturation = ConfigSlider(default=128, limits=(0,256))
47 config.pep.saturation.addNotifier(setSaturation)
50 myval = int(config.value*256)
52 print "--> setting hue to: %0.8X" % myval
53 open("/proc/stb/vmpeg/0/pep_hue", "w").write("%0.8X" % myval)
55 print "couldn't write pep_hue."
57 if VideoEnhancement.firstRun is False:
58 self.setConfiguredValues()
60 config.pep.hue = ConfigSlider(default=128, limits=(0,256))
61 config.pep.hue.addNotifier(setHue)
63 def setBrightness(config):
64 myval = int(config.value*256)
66 print "--> setting brightness to: %0.8X" % myval
67 open("/proc/stb/vmpeg/0/pep_brightness", "w").write("%0.8X" % myval)
69 print "couldn't write pep_brightness."
71 if VideoEnhancement.firstRun is False:
72 self.setConfiguredValues()
74 config.pep.brightness = ConfigSlider(default=128, limits=(0,256))
75 config.pep.brightness.addNotifier(setBrightness)
77 if hw_type == 'dm8000':
78 def setSplitMode(config):
80 print "--> setting splitmode to:",str(config.value)
81 open("/proc/stb/vmpeg/0/pep_split", "w").write(str(config.value))
83 print "couldn't write pep_split."
85 if VideoEnhancement.firstRun is False:
86 self.setConfiguredValues()
88 config.pep.split = ConfigSelection(choices={
93 config.pep.split.addNotifier(setSplitMode)
95 def setSharpness(config):
96 myval = int(config.value*256)
98 print "--> setting sharpness to: %0.8X" % myval
99 open("/proc/stb/vmpeg/0/pep_sharpness", "w").write("%0.8X" % myval)
101 print "couldn't write pep_sharpness."
103 if VideoEnhancement.firstRun is False:
104 self.setConfiguredValues()
106 config.pep.sharpness = ConfigSlider(default=0, limits=(0,256))
107 config.pep.sharpness.addNotifier(setSharpness)
109 def setAutoflesh(config):
110 myval = int(config.value)
112 print "--> setting auto_flesh to: %0.8X" % myval
113 open("/proc/stb/vmpeg/0/pep_auto_flesh", "w").write("%0.8X" % myval)
115 print "couldn't write pep_auto_flesh."
117 if VideoEnhancement.firstRun is False:
118 self.setConfiguredValues()
120 config.pep.auto_flesh = ConfigSlider(default=0, limits=(0,4))
121 config.pep.auto_flesh.addNotifier(setAutoflesh)
123 def setGreenboost(config):
124 myval = int(config.value)
126 print "--> setting green_boost to: %0.8X" % myval
127 open("/proc/stb/vmpeg/0/pep_green_boost", "w").write("%0.8X" % myval)
129 print "couldn't write pep_green_boost."
131 if VideoEnhancement.firstRun is False:
132 self.setConfiguredValues()
134 config.pep.green_boost = ConfigSlider(default=0, limits=(0,4))
135 config.pep.green_boost.addNotifier(setGreenboost)
137 def setBlueboost(config):
138 myval = int(config.value)
140 print "--> setting blue_boost to: %0.8X" % myval
141 open("/proc/stb/vmpeg/0/pep_blue_boost", "w").write("%0.8X" % myval)
143 print "couldn't write pep_blue_boost."
145 if VideoEnhancement.firstRun is False:
146 self.setConfiguredValues()
148 config.pep.blue_boost = ConfigSlider(default=0, limits=(0,4))
149 config.pep.blue_boost.addNotifier(setBlueboost)
151 def setBlock_noise_reduction(config):
152 myval = int(config.value)
154 print "--> setting block_noise_reduction to: %0.8X" % myval
155 open("/proc/stb/vmpeg/0/pep_block_noise_reduction", "w").write("%0.8X" % myval)
157 print "couldn't write pep_block_noise_reduction."
159 if VideoEnhancement.firstRun is False:
160 self.setConfiguredValues()
162 config.pep.block_noise_reduction = ConfigSlider(default=0, limits=(0,5))
163 config.pep.block_noise_reduction.addNotifier(setBlock_noise_reduction)
165 def setMosquito_noise_reduction(config):
166 myval = int(config.value)
168 print "--> setting mosquito_noise_reduction to: %0.8X" % myval
169 open("/proc/stb/vmpeg/0/pep_mosquito_noise_reduction", "w").write("%0.8X" % myval)
171 print "couldn't write pep_mosquito_noise_reduction."
173 if VideoEnhancement.firstRun is False:
174 self.setConfiguredValues()
176 config.pep.mosquito_noise_reduction = ConfigSlider(default=0, limits=(0,5))
177 config.pep.mosquito_noise_reduction.addNotifier(setMosquito_noise_reduction)
179 def setDigital_contour_removal(config):
180 myval = int(config.value)
182 print "--> setting digital_contour_removal to: %0.8X" % myval
183 open("/proc/stb/vmpeg/0/pep_digital_contour_removal", "w").write("%0.8X" % myval)
185 print "couldn't write pep_digital_contour_removal."
187 if VideoEnhancement.firstRun is False:
188 self.setConfiguredValues()
190 config.pep.digital_contour_removal = ConfigSlider(default=0, limits=(0,5))
191 config.pep.digital_contour_removal.addNotifier(setDigital_contour_removal)
193 def setDynamic_contrast(config):
194 myval = int(config.value)
196 print "--> setting dynamic_contrast to: %0.8X" % myval
197 open("/proc/stb/vmpeg/0/pep_dynamic_contrast", "w").write("%0.8X" % myval)
199 print "couldn't write pep_dynamic_contrast."
201 if VideoEnhancement.firstRun is False:
202 self.setConfiguredValues()
204 config.pep.dynamic_contrast = ConfigSlider(default=0, limits=(0,256))
205 config.pep.dynamic_contrast.addNotifier(setDynamic_contrast)
207 VideoEnhancement.firstRun = True
209 def setConfiguredValues(self):
211 print "--> applying pep values"
212 open("/proc/stb/vmpeg/0/pep_apply", "w").write("1")
213 VideoEnhancement.firstRun = False
215 print "couldn't apply pep values."
218 if config.usage.setup_level.index >= 2: # expert+
219 hw_type = HardwareInfo().get_device_name()
220 if hw_type == 'dm8000' or hw_type == 'dm800':
221 video_enhancement = VideoEnhancement()
222 if video_enhancement.firstRun == True:
223 video_enhancement.setConfiguredValues()