{
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)
{
//for old plugins
SWIG_VOID(int) loadPic(ePtr<gPixmap> &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);
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
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()
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:
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:
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:
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"
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):