diff options
| author | Fraxinas <andreas.frisch@multimedia-labs.de> | 2008-12-14 01:22:59 +0100 |
|---|---|---|
| committer | Fraxinas <andreas.frisch@multimedia-labs.de> | 2008-12-14 01:22:59 +0100 |
| commit | 56ac7a4a764a4251a851778df09967405aa9a930 (patch) | |
| tree | 43ec1be37fefc1ac4a6e03bb51e43b5f579ec9cc /lib/python/Plugins/Extensions | |
| parent | 5b4292943b2cf011b19929aa19c85a939cc72714 (diff) | |
| parent | b833353b5285a547eb18c079aa860c9ee2765d6e (diff) | |
| download | enigma2-56ac7a4a764a4251a851778df09967405aa9a930.tar.gz enigma2-56ac7a4a764a4251a851778df09967405aa9a930.zip | |
Merge branch 'master' of fraxinas@git.opendreambox.org:/git/enigma2
Diffstat (limited to 'lib/python/Plugins/Extensions')
| -rw-r--r-- | lib/python/Plugins/Extensions/DVDPlayer/plugin.py | 15 | ||||
| -rw-r--r-- | lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp | 65 |
2 files changed, 56 insertions, 24 deletions
diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index b7d66a82..29e69ee1 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -1,5 +1,5 @@ from os import path as os_path, remove as os_remove, listdir as os_listdir, system -from enigma import eTimer, iPlayableService, iServiceInformation, eServiceReference, iServiceKeys +from enigma import eTimer, iPlayableService, iServiceInformation, eServiceReference, iServiceKeys, getDesktop from Screens.Screen import Screen from Screens.MessageBox import MessageBox from Screens.ChoiceBox import ChoiceBox @@ -109,10 +109,11 @@ class DVDSummary(Screen): self["Title"].setText(title) class DVDOverlay(Screen): - skin = """<screen name="DVDOverlay" position="0,0" size="720,576" flags="wfNoBorder" zPosition="-1" backgroundColor="transparent" />""" def __init__(self, session, args = None): + desktop_size = getDesktop(0).size() + DVDOverlay.skin = """<screen name="DVDOverlay" position="0,0" size="%d,%d" flags="wfNoBorder" zPosition="-1" backgroundColor="transparent" />""" %(desktop_size.width(), desktop_size.height()) Screen.__init__(self, session) - + class ChapterZap(Screen): skin = """ <screen name="ChapterZap" position="235,255" size="250,60" title="Chapter" > @@ -352,7 +353,7 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP if file.mimetype == "video/x-dvd": self.dvd_device = devicepath print "physical dvd found:", self.dvd_device - self.physicalDVD = True + self.physicalDVD = True self.dvd_filelist = dvd_filelist self.onFirstExecBegin.append(self.showFileBrowser) @@ -387,9 +388,6 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP def serviceStarted(self): #override InfoBarShowHide function self.dvdScreen.show() - subs = self.getServiceInterface("subtitle") - if subs: - subs.enableSubtitles(self.dvdScreen.instance, None) def doEofInternal(self, playing): if self.in_menu: @@ -588,6 +586,9 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP self.service = self.session.nav.getCurrentService() print "self.service", self.service print "cur_dlg", self.session.current_dialog + subs = self.getServiceInterface("subtitle") + if subs: + subs.enableSubtitles(self.dvdScreen.instance, None) def exitCB(self, answer): if answer is not None: diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp index 1add04ab..d726be20 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp @@ -87,30 +87,48 @@ DEFINE_REF(eServiceDVD); eServiceDVD::eServiceDVD(const char *filename): m_filename(filename), m_ddvdconfig(ddvd_create()), - m_pixmap(new gPixmap(eSize(720, 576), 32)), m_subtitle_widget(0), m_state(stIdle), m_current_trick(0), m_pump(eApp, 1) { + int aspect = DDVD_16_9; + int policy = DDVD_PAN_SCAN; + + char tmp[255]; + ssize_t rd; + m_sn = eSocketNotifier::create(eApp, ddvd_get_messagepipe_fd(m_ddvdconfig), eSocketNotifier::Read|eSocketNotifier::Priority|eSocketNotifier::Error|eSocketNotifier::Hungup); - std::string aspect; eDebug("SERVICEDVD construct!"); // create handle ddvd_set_dvd_path(m_ddvdconfig, filename); ddvd_set_ac3thru(m_ddvdconfig, 0); ddvd_set_language(m_ddvdconfig, "de"); - if (ePythonConfigQuery::getConfigValue("config.av.aspect", aspect) != 0) - aspect = "16_9"; - if (aspect == "4_3_letterbox") - ddvd_set_video(m_ddvdconfig, DDVD_4_3_LETTERBOX, DDVD_PAL); - else if (aspect == "4_3_panscan") - ddvd_set_video(m_ddvdconfig, DDVD_4_3_PAN_SCAN, DDVD_PAL); - else - ddvd_set_video(m_ddvdconfig, DDVD_16_9, DDVD_PAL); + int fd = open("/proc/stb/video/aspect", O_RDONLY); + if (fd > -1) + { + rd = read(fd, tmp, 255); + if (rd > 2 && !strncmp(tmp, "4:3", 3)) + aspect = DDVD_4_3; + else if (rd > 4 && !strncmp(tmp, "16:10", 5)) + aspect = DDVD_16_10; + close(fd); + } + + fd = open("/proc/stb/video/policy", O_RDONLY); + if (fd > -1) + { + rd = read(fd, tmp, 255); + if (rd > 6 && !strncmp(tmp, "bestfit", 7)) + policy = DDVD_JUSTSCALE; + else if (rd > 8 && !strncmp(tmp, "letterbox", 9)) + policy = DDVD_LETTERBOX; + close(fd); + } + + ddvd_set_video(m_ddvdconfig, aspect, policy, DDVD_PAL /*unused*/); - ddvd_set_lfb(m_ddvdconfig, (unsigned char *)m_pixmap->surface->data, 720, 576, 4, 720*4); CONNECT(m_sn->activated, eServiceDVD::gotMessage); CONNECT(m_pump.recv_msg, eServiceDVD::gotThreadMessage); strcpy(m_ddvd_titlestring,""); @@ -158,8 +176,11 @@ void eServiceDVD::gotMessage(int /*what*/) } case DDVD_SCREEN_UPDATE: eDebug("DVD_SCREEN_UPDATE!"); - if (m_subtitle_widget) - m_subtitle_widget->setPixmap(m_pixmap, eRect(0, 0, 720, 576)); + if (m_subtitle_widget) { + int x1,x2,y1,y2; + ddvd_get_last_blit_area(m_ddvdconfig, &x1, &x2, &y1, &y2); + m_subtitle_widget->setPixmap(m_pixmap, eRect(x1, y1, x2-x1, y2-y1)); + } break; case DDVD_SHOWOSD_STATE_PLAY: { @@ -259,6 +280,7 @@ eServiceDVD::~eServiceDVD() kill(); saveCuesheet(); ddvd_close(m_ddvdconfig); + disableSubtitles(0); } RESULT eServiceDVD::connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection) @@ -272,7 +294,6 @@ RESULT eServiceDVD::start() assert(m_state == stIdle); m_state = stRunning; eDebug("eServiceDVD starting"); - run(); // m_event(this, evStart); return 0; } @@ -514,13 +535,23 @@ PyObject *eServiceDVD::getInfoObject(int w) RESULT eServiceDVD::enableSubtitles(eWidget *parent, SWIG_PYOBJECT(ePyObject) /*entry*/) { - if (m_subtitle_widget) - delete m_subtitle_widget; + delete m_subtitle_widget; + m_subtitle_widget = new eSubtitleWidget(parent); m_subtitle_widget->resize(parent->size()); - m_subtitle_widget->setPixmap(m_pixmap, eRect(0, 0, 720, 576)); + + eSize size = parent->size(); + + if (!m_pixmap) + { + m_pixmap = new gPixmap(size, 32); + ddvd_set_lfb(m_ddvdconfig, (unsigned char *)m_pixmap->surface->data, size.width(), size.height(), 4, size.width()*4); + run(); // start the thread + } + m_subtitle_widget->setZPosition(-1); m_subtitle_widget->show(); + return 0; } |
