From d732b430ccc1d1a78e666f16553b2e3c5dd131a8 Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 16 Nov 2008 13:12:56 +0100 Subject: work on asynchron pic loading... to get rid of spinning wheels --- lib/python/Components/AVSwitch.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/python/Components/AVSwitch.py') diff --git a/lib/python/Components/AVSwitch.py b/lib/python/Components/AVSwitch.py index 8f99b98e..7ac2bb98 100644 --- a/lib/python/Components/AVSwitch.py +++ b/lib/python/Components/AVSwitch.py @@ -28,6 +28,21 @@ class AVSwitch: def setSystem(self, value): eAVSwitch.getInstance().setVideomode(value) + def getOutputAspect(self): + if valstr in ("4_3_letterbox", "4_3_panscan"): # 4:3 + return 1.333333333 + elif valstr == "16_9": # auto ... 4:3 or 16:9 + # TODO: here we must retrieve the current video aspect ratio... + # because the TV can run in 4:3 or in 16:9 mode.. (switched by wss or scart pin8) + # until we have done this we always return the scale value for 16:9!! + return 1.777777778 + elif valstr in ("16_9_always", "16_9_letterbox"): # 16:9 + return 1.777777778 + elif valstr in ("16_10_letterbox", "16_10_panscan"): # 16:10 + return 1.6 + print "unknown output aspect!" + return 1.0000 + def getAspectRatioSetting(self): valstr = config.av.aspectratio.value if valstr == "4_3_letterbox": -- cgit v1.2.3 From 9ccb92fb3eaca35ec60c1a596db9620f9f302044 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 17 Nov 2008 21:17:34 +0100 Subject: more changes for async picture decode support --- lib/gdi/picload.cpp | 109 +++++++++++++++------ lib/gdi/picload.h | 5 + lib/python/Components/AVSwitch.py | 16 ++- .../SystemPlugins/Videomode/VideoHardware.py | 29 ++++++ 4 files changed, 125 insertions(+), 34 deletions(-) (limited to 'lib/python/Components/AVSwitch.py') diff --git a/lib/gdi/picload.cpp b/lib/gdi/picload.cpp index 2ef901f5..b1dfd1a1 100644 --- a/lib/gdi/picload.cpp +++ b/lib/gdi/picload.cpp @@ -569,19 +569,29 @@ ePicLoad::ePicLoad() m_conf.thumbnailsize = 180; } -ePicLoad::~ePicLoad() +void ePicLoad::waitFinished() { msg_thread.send(Message(Message::quit)); kill(); +} +ePicLoad::~ePicLoad() +{ + if (threadrunning) + waitFinished(); if(m_filepara != NULL) delete m_filepara; } +void ePicLoad::thread_finished() +{ + threadrunning=false; +} void ePicLoad::thread() { hasStarted(); + threadrunning=true; nice(4); runLoop(); } @@ -759,7 +769,6 @@ void ePicLoad::gotMessage(const Message &msg) break; case Message::decode_finished: // called from main thread //eDebug("[Picload] decode finished... %s", m_filepara->file); - threadrunning=false; if(m_filepara->callback) { PictureData(m_filepara->picinfo.c_str()); @@ -824,7 +833,6 @@ int ePicLoad::startThread(int what, const char *file, int x, int y) return 1; } - threadrunning=true; if(what==1) msg_thread.send(Message(Message::decode_Pic)); else @@ -843,33 +851,6 @@ RESULT ePicLoad::getThumbnail(const char *file, int x, int y) return startThread(0, file, x, y); } -RESULT ePicLoad::setPara(PyObject *val) -{ - if (!PyList_Check(val)) - return 0; - if (PyList_Size(val) < 6) - return 0; - - m_conf.max_x = PyInt_AsLong( PyList_GET_ITEM(val, 0)); - m_conf.max_y = PyInt_AsLong( PyList_GET_ITEM(val, 1)); - m_conf.aspect_ratio = PyFloat_AsDouble( PyList_GET_ITEM(val, 2)); - m_conf.usecache = PyInt_AsLong( PyList_GET_ITEM(val, 3)); - m_conf.resizetype = PyInt_AsLong( PyList_GET_ITEM(val, 4)); - const char *bg_str = PyString_AsString( PyList_GET_ITEM(val, 5)); - - if(bg_str[0] == '#' && strlen(bg_str)==9) - { - int bg = strtoul(bg_str+1, NULL, 16); - m_conf.background[0] = bg&0xFF; //BB - m_conf.background[1] = (bg>>8)&0xFF; //GG - m_conf.background[2] = (bg>>16)&0xFF; //RR - m_conf.background[3] = bg>>24; //AA - } - - eDebug("[Picload] setPara max-X=%d max-Y=%d aspect_ratio=%lf cache=%d resize=%d bg=#%02X%02X%02X%02X", m_conf.max_x, m_conf.max_y, m_conf.aspect_ratio, (int)m_conf.usecache, (int)m_conf.resizetype, m_conf.background[3], m_conf.background[2], m_conf.background[1], m_conf.background[0]); - return 1; -} - PyObject *ePicLoad::getInfo(const char *filename) { ePyObject list; @@ -935,6 +916,7 @@ PyObject *ePicLoad::getInfo(const char *filename) int ePicLoad::getData(ePtr &result) { + result = 0; if(m_filepara->pic_buffer == NULL) return 0; m_filepara->pic_buffer = conv24to32(m_filepara->pic_buffer, m_filepara->ox * m_filepara->oy); @@ -1015,3 +997,70 @@ int ePicLoad::getData(ePtr &result) return 0; } + +RESULT ePicLoad::setPara(PyObject *val) +{ + if (!PyList_Check(val)) + return 0; + if (PyList_Size(val) < 6) + return 0; + + m_conf.max_x = PyInt_AsLong( PyList_GET_ITEM(val, 0)); + m_conf.max_y = PyInt_AsLong( PyList_GET_ITEM(val, 1)); + m_conf.aspect_ratio = PyFloat_AsDouble( PyList_GET_ITEM(val, 2)); + m_conf.usecache = PyInt_AsLong( PyList_GET_ITEM(val, 3)); + m_conf.resizetype = PyInt_AsLong( PyList_GET_ITEM(val, 4)); + const char *bg_str = PyString_AsString( PyList_GET_ITEM(val, 5)); + + if(bg_str[0] == '#' && strlen(bg_str)==9) + { + int bg = strtoul(bg_str+1, NULL, 16); + m_conf.background[0] = bg&0xFF; //BB + m_conf.background[1] = (bg>>8)&0xFF; //GG + m_conf.background[2] = (bg>>16)&0xFF; //RR + m_conf.background[3] = bg>>24; //AA + } + + eDebug("[Picload] setPara max-X=%d max-Y=%d aspect_ratio=%lf cache=%d resize=%d bg=#%02X%02X%02X%02X", m_conf.max_x, m_conf.max_y, m_conf.aspect_ratio, (int)m_conf.usecache, (int)m_conf.resizetype, m_conf.background[3], m_conf.background[2], m_conf.background[1], m_conf.background[0]); + return 1; +} + +//------------------------------------------------------------------------------------ + +//for old plugins +SWIG_VOID(int) loadPic(ePtr &result, std::string filename, int x, int y, int aspect, int resize_mode, int rotate, int background, std::string cachefile) +{ + result = 0; + eDebug("deprecated loadPic function used!!! please use the non blocking version! you can see demo code in Pictureplayer plugin... this function is removed in the near future!"); + ePicLoad mPL; + + double aspect_ratio; + switch(aspect) + { + case 1: aspect_ratio = 1.778 / ((double)720/576); break; //16:9 + case 2: aspect_ratio = 1.600 / ((double)720/576); break; //16:10 + case 3: aspect_ratio = 1.250 / ((double)720/576); break; //5:4 + default: aspect_ratio = 1.333 / ((double)720/576); //4:3 + } + + ePyObject list = PyList_New(6); + PyList_SET_ITEM(list, 0, PyLong_FromLong(x)); + PyList_SET_ITEM(list, 1, PyLong_FromLong(y)); + PyList_SET_ITEM(list, 2, PyFloat_FromDouble(aspect_ratio)); + PyList_SET_ITEM(list, 3, PyLong_FromLong(0)); + PyList_SET_ITEM(list, 4, PyLong_FromLong(resize_mode)); + if(background) + PyList_SET_ITEM(list, 5, PyString_FromString("#ff000000")); + else + PyList_SET_ITEM(list, 5, PyString_FromString("#00000000")); + + mPL.setPara(list); + + if(!mPL.startDecode(filename.c_str())) + { + mPL.waitFinished(); // this blocks until the thread is finished + mPL.getData(result); + } + + return 0; +} diff --git a/lib/gdi/picload.h b/lib/gdi/picload.h index a85567c0..6a0f70b9 100644 --- a/lib/gdi/picload.h +++ b/lib/gdi/picload.h @@ -86,7 +86,9 @@ class ePicLoad: public eMainloop, public eThread, public Object, public iObject void gotMessage(const Message &message); void thread(); int startThread(int what, const char *file, int x, int y); + void thread_finished(); public: + void waitFinished(); PSignal1 PictureData; ePicLoad(); @@ -99,4 +101,7 @@ public: SWIG_VOID(int) getData(ePtr &SWIG_OUTPUT); }; +//for old plugins +SWIG_VOID(int) loadPic(ePtr &SWIG_OUTPUT, std::string filename, int x, int y, int aspect, int resize_mode=0, int rotate=0, int background=0, std::string cachefile=""); + #endif // __picload_h__ diff --git a/lib/python/Components/AVSwitch.py b/lib/python/Components/AVSwitch.py index 7ac2bb98..19aca24d 100644 --- a/lib/python/Components/AVSwitch.py +++ b/lib/python/Components/AVSwitch.py @@ -1,5 +1,5 @@ from config import config, ConfigSlider, ConfigSelection, ConfigYesNo, ConfigEnableDisable, ConfigSubsection, ConfigBoolean -from enigma import eAVSwitch +from enigma import eAVSwitch, getDesktop from SystemInfo import SystemInfo class AVSwitch: @@ -32,9 +32,12 @@ class AVSwitch: if valstr in ("4_3_letterbox", "4_3_panscan"): # 4:3 return 1.333333333 elif valstr == "16_9": # auto ... 4:3 or 16:9 - # TODO: here we must retrieve the current video aspect ratio... - # because the TV can run in 4:3 or in 16:9 mode.. (switched by wss or scart pin8) - # until we have done this we always return the scale value for 16:9!! + try: + aspect_str = open("/proc/stb/vmpeg/0/aspect", "r").read() + if aspect_str == "1": # 4:3 + return 1.333333333 + except IOError: + pass return 1.777777778 elif valstr in ("16_9_always", "16_9_letterbox"): # 16:9 return 1.777777778 @@ -43,6 +46,11 @@ class AVSwitch: print "unknown output aspect!" return 1.0000 + def getFramebufferScale(self): + aspect = self.getOutputAspect() + fb_size = getDesktop(0).size() + return aspect / ((1.0 * fb_size.width()) / fb_size.height()) + def getAspectRatioSetting(self): valstr = config.av.aspectratio.value if valstr == "4_3_letterbox": diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py index 2422475e..5e38f3e6 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py @@ -59,6 +59,34 @@ class VideoHardware: widescreen_modes = set(["720p", "1080i"]) + def getOutputAspect(self): + ret = 1.777777778 # 16:9 + port = config.av.videoport.value + if port not in config.av.videomode: + print "current port not available in getOutputAspect!!! force 16:9" + else: + mode = config.av.videomode[port].value + force_widescreen = self.isWidescreenMode(port, mode) + is_widescreen = force_widescreen or config.av.aspect.value in ["16_9", "16_10"] + is_auto = config.av.aspect.value == "auto" + if is_widescreen: + if force_widescreen: + pass + else: + aspect = {"16_9": "16:9", "16_10": "16:10"}[config.av.aspect.value] + if aspect == "16:10": + ret = 1.6 + elif is_auto: + try: + aspect_str = open("/proc/stb/vmpeg/0/aspect", "r").read() + if aspect_str == "1": # 4:3 + ret = 1.333333333 + except IOError: + pass + else: # 4:3 + ret = 1.333333333 + return ret + def __init__(self): self.last_modes_preferred = [ ] self.on_hotplug = CList() @@ -80,6 +108,7 @@ class VideoHardware: config.av.tvsystem.notifiers = [ ] config.av.wss.notifiers = [ ] AVSwitch.setInput = self.AVSwitchSetInput + AVSwitch.getOutputAspect = self.getOutputAspect config.av.aspect.addNotifier(self.updateAspect) config.av.wss.addNotifier(self.updateAspect) -- cgit v1.2.3 From 5aa89f34249397330995cc0ab1e080c1f567e174 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 17 Nov 2008 23:34:41 +0100 Subject: get rid of some floating point values --- lib/gdi/picload.cpp | 35 +++++++++++----------- lib/python/Components/AVSwitch.py | 14 ++++----- .../Plugins/Extensions/PicturePlayer/plugin.py | 14 +++++---- .../SystemPlugins/Videomode/VideoHardware.py | 8 ++--- 4 files changed, 36 insertions(+), 35 deletions(-) (limited to 'lib/python/Components/AVSwitch.py') diff --git a/lib/gdi/picload.cpp b/lib/gdi/picload.cpp index f67507ca..375f33fb 100644 --- a/lib/gdi/picload.cpp +++ b/lib/gdi/picload.cpp @@ -1011,16 +1011,16 @@ RESULT ePicLoad::setPara(PyObject *val) { if (!PySequence_Check(val)) return 0; - if (PySequence_Size(val) < 6) + if (PySequence_Size(val) < 7) return 0; else { ePyObject fast = PySequence_Fast(val, ""); m_conf.max_x = PyInt_AsLong( PySequence_Fast_GET_ITEM(val, 0)); m_conf.max_y = PyInt_AsLong( PySequence_Fast_GET_ITEM(val, 1)); - m_conf.aspect_ratio = PyFloat_AsDouble( PySequence_Fast_GET_ITEM(val, 2)); - m_conf.usecache = PyInt_AsLong( PySequence_Fast_GET_ITEM(val, 3)); - m_conf.resizetype = PyInt_AsLong( PySequence_Fast_GET_ITEM(val, 4)); - const char *bg_str = PyString_AsString( PySequence_Fast_GET_ITEM(val, 5)); + m_conf.aspect_ratio = (double)PyInt_AsLong( PySequence_Fast_GET_ITEM(val, 2)) / PyInt_AsLong(PySequence_Fast_GET_ITEM(val, 3)); + m_conf.usecache = PyInt_AsLong( PySequence_Fast_GET_ITEM(val, 4)); + m_conf.resizetype = PyInt_AsLong( PySequence_Fast_GET_ITEM(val, 5)); + const char *bg_str = PyString_AsString( PySequence_Fast_GET_ITEM(val, 6)); if(bg_str[0] == '#' && strlen(bg_str)==9) { @@ -1040,29 +1040,30 @@ RESULT ePicLoad::setPara(PyObject *val) //for old plugins SWIG_VOID(int) loadPic(ePtr &result, std::string filename, int x, int y, int aspect, int resize_mode, int rotate, int background, std::string cachefile) { + long asp1, asp2; result = 0; eDebug("deprecated loadPic function used!!! please use the non blocking version! you can see demo code in Pictureplayer plugin... this function is removed in the near future!"); ePicLoad mPL; - double aspect_ratio; switch(aspect) { - case 1: aspect_ratio = 1.778 / ((double)720/576); break; //16:9 - case 2: aspect_ratio = 1.600 / ((double)720/576); break; //16:10 - case 3: aspect_ratio = 1.250 / ((double)720/576); break; //5:4 - default: aspect_ratio = 1.333 / ((double)720/576); //4:3 + case 1: asp1 = 16*576, asp2 = 9*720; break; //16:9 + case 2: asp1 = 16*576, asp2 = 10*720; break; //16:10 + case 3: asp1 = 5*576, asp2 = 4*720; break; //5:4 + default: asp1 = 4*576, asp2 = 3*720; break; //4:3 } - - ePyObject tuple = PyTuple_New(6); + + ePyObject tuple = PyTuple_New(7); PyTuple_SET_ITEM(tuple, 0, PyLong_FromLong(x)); PyTuple_SET_ITEM(tuple, 1, PyLong_FromLong(y)); - PyTuple_SET_ITEM(tuple, 2, PyFloat_FromDouble(aspect_ratio)); - PyTuple_SET_ITEM(tuple, 3, PyLong_FromLong(0)); - PyTuple_SET_ITEM(tuple, 4, PyLong_FromLong(resize_mode)); + PyTuple_SET_ITEM(tuple, 2, PyLong_FromLong(asp1)); + PyTuple_SET_ITEM(tuple, 3, PyLong_FromLong(asp2)); + PyTuple_SET_ITEM(tuple, 4, PyLong_FromLong(0)); + PyTuple_SET_ITEM(tuple, 5, PyLong_FromLong(resize_mode)); if(background) - PyTuple_SET_ITEM(tuple, 5, PyString_FromString("#ff000000")); + PyTuple_SET_ITEM(tuple, 6, PyString_FromString("#ff000000")); else - PyTuple_SET_ITEM(tuple, 5, PyString_FromString("#00000000")); + PyTuple_SET_ITEM(tuple, 6, PyString_FromString("#00000000")); mPL.setPara(tuple); diff --git a/lib/python/Components/AVSwitch.py b/lib/python/Components/AVSwitch.py index 19aca24d..00350cbb 100644 --- a/lib/python/Components/AVSwitch.py +++ b/lib/python/Components/AVSwitch.py @@ -30,26 +30,24 @@ class AVSwitch: def getOutputAspect(self): if valstr in ("4_3_letterbox", "4_3_panscan"): # 4:3 - return 1.333333333 + return (4,3) elif valstr == "16_9": # auto ... 4:3 or 16:9 try: aspect_str = open("/proc/stb/vmpeg/0/aspect", "r").read() if aspect_str == "1": # 4:3 - return 1.333333333 + return (4,3) except IOError: pass - return 1.777777778 elif valstr in ("16_9_always", "16_9_letterbox"): # 16:9 - return 1.777777778 + pass elif valstr in ("16_10_letterbox", "16_10_panscan"): # 16:10 - return 1.6 - print "unknown output aspect!" - return 1.0000 + return (16,10) + return (16,9) def getFramebufferScale(self): aspect = self.getOutputAspect() fb_size = getDesktop(0).size() - return aspect / ((1.0 * fb_size.width()) / fb_size.height()) + return (aspect[0] * fb_size.height(), aspect[1] * fb_size.width()) def getAspectRatioSetting(self): valstr = config.av.aspectratio.value diff --git a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py index 7d62d2be..0cdab563 100644 --- a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py +++ b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py @@ -15,7 +15,7 @@ from Components.ConfigList import ConfigList from Components.config import config, ConfigSubsection, ConfigInteger, ConfigSelection, ConfigText, ConfigEnableDisable, KEY_LEFT, KEY_RIGHT, KEY_0, getConfigListEntry -def getAspectforPic(): +def getScale(): return AVSwitch().getFramebufferScale() config.pic = ConfigSubsection() @@ -119,8 +119,9 @@ class picshow(Screen): self.session.openWithCallback(self.callbackView, Pic_Full_View, self.filelist.getFileList(), self.filelist.getSelectionIndex(), self.filelist.getCurrentDirectory()) def setConf(self): + sc = getScale() #0=Width 1=Height 2=Aspect 3=use_cache 4=resize_type 5=Background(#AARRGGBB) - self.picload.setPara([self["thn"].instance.size().width(), self["thn"].instance.size().height(), getAspectforPic(), config.pic.cache.value, int(config.pic.resize.value), "#00000000"]) + self.picload.setPara((self["thn"].instance.size().width(), self["thn"].instance.size().height(), sc[0], sc[1], config.pic.cache.value, int(config.pic.resize.value), "#00000000")) def callbackView(self, val=0): if val > 0: @@ -311,10 +312,10 @@ class Pic_Thumb(Screen): self.ThumbTimer.callback.append(self.showPic) def setPicloadConf(self): - self.picload.setPara([self["thumb0"].instance.size().width(), self["thumb0"].instance.size().height(), getAspectforPic(), config.pic.cache.value, int(config.pic.resize.value), self.color]) + sc = getScale() + self.picload.setPara([self["thumb0"].instance.size().width(), self["thumb0"].instance.size().height(), sc[0], sc[1], config.pic.cache.value, int(config.pic.resize.value), self.color]) self.paintFrame() - - + def paintFrame(self): #print "index=" + str(self.index) if self.maxentry < self.index or self.index < 0: @@ -468,7 +469,8 @@ class Pic_Full_View(Screen): self.onLayoutFinish.append(self.setPicloadConf) def setPicloadConf(self): - self.picload.setPara([self["pic"].instance.size().width(), self["pic"].instance.size().height(), getAspectforPic(), 0, int(config.pic.resize.value), self.bgcolor]) + sc = getScale() + self.picload.setPara([self["pic"].instance.size().width(), self["pic"].instance.size().height(), sc[0], sc[1], 0, int(config.pic.resize.value), self.bgcolor]) self["play_icon"].hide() if config.pic.infoline.value == False: diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py index 5e38f3e6..02fdf9a5 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py @@ -60,7 +60,7 @@ class VideoHardware: widescreen_modes = set(["720p", "1080i"]) def getOutputAspect(self): - ret = 1.777777778 # 16:9 + ret = (16,9) port = config.av.videoport.value if port not in config.av.videomode: print "current port not available in getOutputAspect!!! force 16:9" @@ -75,16 +75,16 @@ class VideoHardware: else: aspect = {"16_9": "16:9", "16_10": "16:10"}[config.av.aspect.value] if aspect == "16:10": - ret = 1.6 + ret = (16,10) elif is_auto: try: aspect_str = open("/proc/stb/vmpeg/0/aspect", "r").read() if aspect_str == "1": # 4:3 - ret = 1.333333333 + ret = (4,3) except IOError: pass else: # 4:3 - ret = 1.333333333 + ret = (4,3) return ret def __init__(self): -- cgit v1.2.3 From 7b99a1af4abb7fdd77889feabe6bbd08d6c1d343 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 22 Nov 2008 09:23:16 +0100 Subject: AVSwitch.py: fix getOutputAspect function --- lib/python/Components/AVSwitch.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/python/Components/AVSwitch.py') diff --git a/lib/python/Components/AVSwitch.py b/lib/python/Components/AVSwitch.py index 00350cbb..1f529cfd 100644 --- a/lib/python/Components/AVSwitch.py +++ b/lib/python/Components/AVSwitch.py @@ -29,6 +29,7 @@ class AVSwitch: eAVSwitch.getInstance().setVideomode(value) def getOutputAspect(self): + valstr = config.av.aspectratio.value if valstr in ("4_3_letterbox", "4_3_panscan"): # 4:3 return (4,3) elif valstr == "16_9": # auto ... 4:3 or 16:9 -- cgit v1.2.3 From d00d32df526b88b146c711ce8951008d72ec6a56 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 6 Feb 2009 17:58:59 +0100 Subject: code cleanup ... use more /proc/stb/avs/0/* auto functions this change needs current drivers (SRCDATE >= 20090206) --- lib/driver/avswitch.cpp | 30 -------------- lib/driver/avswitch.h | 2 - lib/python/Components/AVSwitch.py | 47 +++------------------- .../SystemPlugins/Videomode/VideoHardware.py | 44 -------------------- 4 files changed, 6 insertions(+), 117 deletions(-) (limited to 'lib/python/Components/AVSwitch.py') diff --git a/lib/driver/avswitch.cpp b/lib/driver/avswitch.cpp index dbfebf5f..f05bdd95 100644 --- a/lib/driver/avswitch.cpp +++ b/lib/driver/avswitch.cpp @@ -132,23 +132,6 @@ void eAVSwitch::setInput(int val) write(fd, input[val], strlen(input[val])); close(fd); - - if (val == 1) - setFastBlank(2); -} - -void eAVSwitch::setFastBlank(int val) -{ - int fd; - const char *fb[] = {"low", "high", "vcr"}; - - if((fd = open("/proc/stb/avs/0/fb", O_WRONLY)) < 0) { - eDebug("cannot open /proc/stb/avs/0/fb"); - return; - } - - write(fd, fb[val], strlen(fb[0])); - close(fd); } void eAVSwitch::setColorFormat(int format) @@ -284,18 +267,5 @@ void eAVSwitch::setWSS(int val) // 0 = auto, 1 = auto(4:3_off) close(fd); } -void eAVSwitch::setSlowblank(int val) -{ - int fd; - if((fd = open("/proc/stb/avs/0/sb", O_WRONLY)) < 0) { - eDebug("cannot open /proc/stb/avs/0/sb"); - return; - } - const char *sb[] = {"0", "6", "12", "vcr", "auto"}; - write(fd, sb[val], strlen(sb[val])); -// eDebug("set slow blanking to %s", sb[val]); - close(fd); -} - //FIXME: correct "run/startlevel" eAutoInitP0 init_avswitch(eAutoInitNumbers::rc, "AVSwitch Driver"); diff --git a/lib/driver/avswitch.h b/lib/driver/avswitch.h index 8fdafdd1..bcb29c40 100644 --- a/lib/driver/avswitch.h +++ b/lib/driver/avswitch.h @@ -26,12 +26,10 @@ public: static eAVSwitch *getInstance(); bool haveScartSwitch(); int getVCRSlowBlanking(); - void setFastBlank(int val); void setColorFormat(int format); void setAspectRatio(int ratio); void setVideomode(int mode); void setInput(int val); - void setSlowblank(int val); void setWSS(int val); PSignal1 vcr_sb_notifier; }; diff --git a/lib/python/Components/AVSwitch.py b/lib/python/Components/AVSwitch.py index 1f529cfd..3188469a 100644 --- a/lib/python/Components/AVSwitch.py +++ b/lib/python/Components/AVSwitch.py @@ -3,27 +3,15 @@ from enigma import eAVSwitch, getDesktop from SystemInfo import SystemInfo class AVSwitch: - INPUT = { "ENCODER": (0, 4), "SCART": (1, 3), "AUX": (2, 4) } - def setInput(self, input): - eAVSwitch.getInstance().setInput(self.INPUT[input][0]) - if self.INPUT[input][1] == 4: - aspect = self.getAspectRatioSetting() - self.setAspectWSS(aspect) - self.setAspectSlowBlank(aspect) - else: - eAVSwitch.getInstance().setSlowblank(self.INPUT[input][1]) - # FIXME why do we have to reset the colorformat? bug in avs-driver? - map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3} - eAVSwitch.getInstance().setColorFormat(map[config.av.colorformat.value]) + INPUT = { "ENCODER": 0, "SCART": 1, "AUX": 2 } + eAVSwitch.getInstance().setInput(INPUT[input]) def setColorFormat(self, value): eAVSwitch.getInstance().setColorFormat(value) def setAspectRatio(self, value): eAVSwitch.getInstance().setAspectRatio(value) - self.setAspectWSS(value) - self.setAspectSlowBlank(value) def setSystem(self, value): eAVSwitch.getInstance().setVideomode(value) @@ -69,35 +57,12 @@ class AVSwitch: return val def setAspectWSS(self, aspect=None): - if aspect is None: - aspect = self.getAspectRatioSetting() - if aspect == 0 or aspect == 1: # letterbox or panscan - if not config.av.wss.value: - value = 0 # wss off - else: - value = 3 # 4:3_full_format - elif aspect == 2: # 16:9 - if not config.av.wss.value: - value = 2 # auto(4:3_off) - else: - value = 1 # auto - elif aspect == 3 or aspect == 6: # always 16:9 - value = 4 # 16:9_full_format - elif aspect == 4 or aspect == 5: # 16:10 - value = 10 # 14:9_full_format + if not config.av.wss.value: + value = 2 # auto(4:3_off) + else: + value = 1 # auto eAVSwitch.getInstance().setWSS(value) - def setAspectSlowBlank(self, aspect=None): - if aspect is None: - aspect = self.getAspectRatioSetting() - if aspect == 0 or aspect == 1: # letterbox or panscan - value = 2 # 12 V - elif aspect == 2: # 16:9 - value = 4 # auto - elif aspect == 3 or aspect == 4 or aspect == 5 or aspect == 6: # always 16:9 - value = 1 # 6V - eAVSwitch.getInstance().setSlowblank(value) - def InitAVSwitch(): config.av = ConfigSubsection() config.av.yuvenabled = ConfigBoolean(default=False) diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py index 7149504a..6a85c4da 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py @@ -90,7 +90,6 @@ class VideoHardware: def __init__(self): self.last_modes_preferred = [ ] self.on_hotplug = CList() - self.standby = False self.current_mode = None self.current_port = None @@ -107,7 +106,6 @@ class VideoHardware: config.av.aspectratio.notifiers = [ ] config.av.tvsystem.notifiers = [ ] config.av.wss.notifiers = [ ] - AVSwitch.setInput = self.AVSwitchSetInput AVSwitch.getOutputAspect = self.getOutputAspect config.av.aspect.addNotifier(self.updateAspect) @@ -120,12 +118,6 @@ class VideoHardware: # self.timer.callback.append(self.readPreferredModes) # self.timer.start(1000) - config.av.colorformat.addNotifier(self.updateFastblank) - - def AVSwitchSetInput(self, mode): - self.standby = mode == "SCART" - self.updateStandby() - def readAvailableModes(self): try: modes = open("/proc/stb/video/videomode_choices").read()[:-1] @@ -322,42 +314,6 @@ class VideoHardware: open("/proc/stb/video/policy2", "w").write(policy2) except IOError: pass - self.updateSlowblank() - self.updateFastblank() - - def updateSlowblank(self): - if self.standby: - from Components.SystemInfo import SystemInfo - if SystemInfo["ScartSwitch"]: - input = "scart" - sb = "vcr" - else: - input = "off" - sb = "0" - else: - input = "encoder" - sb = "auto" - - open("/proc/stb/avs/0/sb", "w").write(sb) - open("/proc/stb/avs/0/input", "w").write(input) - - def updateStandby(self): - self.updateSlowblank() - self.updateFastblank() - - def updateFastblank(self, *args): - if self.standby: - from Components.SystemInfo import SystemInfo - if SystemInfo["ScartSwitch"]: - fb = "vcr" - else: - fb = "low" - else: - if self.current_port == "Scart" and config.av.colorformat.value == "rgb": - fb = "high" - else: - fb = "low" - open("/proc/stb/avs/0/fb", "w").write(fb) config.av.edid_override = ConfigYesNo(default = False) video_hw = VideoHardware() -- cgit v1.2.3