From b19b6c15482681e331f346acb56b1566102e1418 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 17 Nov 2008 10:10:39 +0100 Subject: actually exit dvd player on pressing exit key in exit choicebox --- lib/python/Plugins/Extensions/DVDPlayer/plugin.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'lib/python/Plugins/Extensions/DVDPlayer/plugin.py') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index cb5f0e0d..593d4d2e 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -491,7 +491,7 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP def askLeavePlayer(self): choices = [(_("Continue playing"), "play"), (_("Exit"), "exit")] if not self.physicalDVD: - choices.insert(1,(_("Return to file browser"), "browser")) + choices.insert(1,(_("Return to file browser"), "browser")) self.session.openWithCallback(self.exitCB, ChoiceBox, title=_("Leave DVD Player?"), list = choices) def sendKey(self, key): @@ -590,19 +590,16 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP print "cur_dlg", self.session.current_dialog def exitCB(self, answer): - if answer is not None: - if answer[1] == "exit": - if self.service: - self.service = None - self.close() - if answer[1] == "browser": + if not answer or answer and answer[1] == "exit": + if self.service: + self.service = None + self.close() + if answer and answer[1] == "browser": #TODO check here if a paused dvd playback is already running... then re-start it... #else - if self.service: - self.service = None - self.showFileBrowser() - else: - pass + if self.service: + self.service = None + self.showFileBrowser() def __onClose(self): for i in (("/proc/stb/video/aspect", self.old_aspect), ("/proc/stb/video/policy", self.old_policy), ("/proc/stb/denc/0/wss", self.old_wss)): -- cgit v1.2.3 From 74837aa1b9a2d0ee3cd630b74abcb224272290ab Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 24 Nov 2008 09:57:14 +0100 Subject: re-introduce consistent EXIT key behaviour. sort "quit" entry to the top though. --- lib/python/Plugins/Extensions/DVDPlayer/plugin.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'lib/python/Plugins/Extensions/DVDPlayer/plugin.py') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index 593d4d2e..b7d66a82 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -489,7 +489,7 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP self.doShow() def askLeavePlayer(self): - choices = [(_("Continue playing"), "play"), (_("Exit"), "exit")] + choices = [(_("Exit"), "exit"), (_("Continue playing"), "play")] if not self.physicalDVD: choices.insert(1,(_("Return to file browser"), "browser")) self.session.openWithCallback(self.exitCB, ChoiceBox, title=_("Leave DVD Player?"), list = choices) @@ -590,16 +590,19 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP print "cur_dlg", self.session.current_dialog def exitCB(self, answer): - if not answer or answer and answer[1] == "exit": - if self.service: - self.service = None - self.close() - if answer and answer[1] == "browser": + if answer is not None: + if answer[1] == "exit": + if self.service: + self.service = None + self.close() + if answer[1] == "browser": #TODO check here if a paused dvd playback is already running... then re-start it... #else - if self.service: - self.service = None - self.showFileBrowser() + if self.service: + self.service = None + self.showFileBrowser() + else: + pass def __onClose(self): for i in (("/proc/stb/video/aspect", self.old_aspect), ("/proc/stb/video/policy", self.old_policy), ("/proc/stb/denc/0/wss", self.old_wss)): -- cgit v1.2.3 From 5b37109a8002420247a5abf46841c95365e88036 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 8 Dec 2008 13:10:44 +0100 Subject: follow libdreamdvd changes to support scaling (needs libdreamdvd >= 20081208) --- lib/python/Plugins/Extensions/DVDPlayer/plugin.py | 8 ++-- .../Extensions/DVDPlayer/src/servicedvd.cpp | 56 ++++++++++++++++------ 2 files changed, 46 insertions(+), 18 deletions(-) (limited to 'lib/python/Plugins/Extensions/DVDPlayer/plugin.py') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index b7d66a82..40feaffe 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -352,7 +352,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 +387,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 +585,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..0a3d0359 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", 3)) + aspect = DDVD_JUSTSCALE; + else if (rd > 8 && !strncmp(tmp, "letterbox", 5)) + aspect = 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,""); @@ -159,7 +177,7 @@ 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)); + m_subtitle_widget->setPixmap(m_pixmap, eRect(ePoint(0, 0), m_pixmap->size())); break; case DDVD_SHOWOSD_STATE_PLAY: { @@ -272,7 +290,6 @@ RESULT eServiceDVD::start() assert(m_state == stIdle); m_state = stRunning; eDebug("eServiceDVD starting"); - run(); // m_event(this, evStart); return 0; } @@ -516,11 +533,22 @@ RESULT eServiceDVD::enableSubtitles(eWidget *parent, SWIG_PYOBJECT(ePyObject) /* { if (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; } -- cgit v1.2.3 From 8e5c4dddb513786c7a558a88da25c3e9cddc8964 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Dec 2008 23:07:03 +0100 Subject: DVDPlayer/plugin.py: set size of overlay screen depended to desktop size --- lib/python/Plugins/Extensions/DVDPlayer/plugin.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/python/Plugins/Extensions/DVDPlayer/plugin.py') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index 40feaffe..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 = """""" def __init__(self, session, args = None): + desktop_size = getDesktop(0).size() + DVDOverlay.skin = """""" %(desktop_size.width(), desktop_size.height()) Screen.__init__(self, session) - + class ChapterZap(Screen): skin = """ -- cgit v1.2.3 From 0992c994772460cf53e0a30450dc467dddb87d4c Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 2 Jan 2009 17:15:20 +0100 Subject: add support for multi angle dvds this needs a current libdreamdvd (SRCDATE >= 20090102) --- lib/python/Plugins/Extensions/DVDPlayer/keymap.xml | 3 +- lib/python/Plugins/Extensions/DVDPlayer/plugin.py | 39 +++++++++++++++++++--- .../Extensions/DVDPlayer/src/servicedvd.cpp | 24 ++++++++++++- 3 files changed, 59 insertions(+), 7 deletions(-) (limited to 'lib/python/Plugins/Extensions/DVDPlayer/plugin.py') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/keymap.xml b/lib/python/Plugins/Extensions/DVDPlayer/keymap.xml index 2a872c21..7b7f2054 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/keymap.xml +++ b/lib/python/Plugins/Extensions/DVDPlayer/keymap.xml @@ -11,7 +11,7 @@ - + @@ -21,6 +21,7 @@ + - - + + - + HasTelext - + + + + Position,ShowHours @@ -252,9 +256,13 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP self.session.nav.stopService() self["audioLabel"] = Label("n/a") self["subtitleLabel"] = Label("") + self["angleLabel"] = Label("") self["chapterLabel"] = Label("") + self["anglePix"] = Pixmap() + self["anglePix"].hide() self.last_audioTuple = None self.last_subtitleTuple = None + self.last_angleTuple = None self.totalChapters = 0 self.currentChapter = 0 self.totalTitles = 0 @@ -274,7 +282,8 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP iPlayableService.evUser+8: self.__chapterUpdated, iPlayableService.evUser+9: self.__titleUpdated, iPlayableService.evUser+11: self.__menuOpened, - iPlayableService.evUser+12: self.__menuClosed + iPlayableService.evUser+12: self.__menuClosed, + iPlayableService.evUser+13: self.__osdAngleInfoAvail }) self["DVDPlayerDirectionActions"] = ActionMap(["DirectionActions"], @@ -317,6 +326,7 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP "dvdAudioMenu": (self.enterDVDAudioMenu, _("(show optional DVD audio menu)")), "nextAudioTrack": (self.nextAudioTrack, _("switch to the next audio track")), "nextSubtitleTrack": (self.nextSubtitleTrack, _("switch to the next subtitle language")), + "nextAngle": (self.nextAngle, _("switch to the next angle")), "seekBeginning": self.seekBeginning, }, -2) @@ -467,6 +477,22 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP if subtitleTuple != self.last_subtitleTuple and not self.in_menu: self.doShow() self.last_subtitleTuple = subtitleTuple + + def __osdAngleInfoAvail(self): + info = self.getServiceInterface("info") + angleTuple = info and info.getInfoObject(iServiceInformation.sUser+8) + print "AngleInfoAvail ", repr(angleTuple) + if angleTuple: + angleString = "" + if angleTuple[1] > 1: + angleString = "%d / %d" % (angleTuple[0],angleTuple[1]) + self["anglePix"].show() + else: + self["anglePix"].hide() + self["angleLabel"].setText(angleString) + if angleTuple != self.last_angleTuple and not self.in_menu: + self.doShow() + self.last_angleTuple = angleTuple def __chapterUpdated(self): info = self.getServiceInterface("info") @@ -521,6 +547,9 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP def enterDVDMenu(self): self.sendKey(iServiceKeys.keyUser+7) + + def nextAngle(self): + self.sendKey(iServiceKeys.keyUser+8) def seekBeginning(self): if self.service: diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp index d726be20..c2590af5 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp @@ -179,7 +179,7 @@ void eServiceDVD::gotMessage(int /*what*/) 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)); + m_subtitle_widget->setPixmap(m_pixmap, eRect(x1, y1, (x2-x1)+1, (y2-y1)+1)); } break; case DDVD_SHOWOSD_STATE_PLAY: @@ -234,6 +234,14 @@ void eServiceDVD::gotMessage(int /*what*/) eDebug("DVD_SOF_REACHED!"); m_event(this, evSOF); break; + case DDVD_SHOWOSD_ANGLE: + { + int current, num; + ddvd_get_angle_info(m_ddvdconfig, ¤t, &num); + eDebug("DVD_ANGLE_INFO: %d / %d", current, num); + m_event(this, evUser+13); + break; + } case DDVD_SHOWOSD_TIME: { static struct ddvd_time last_info; @@ -458,6 +466,7 @@ int eServiceDVD::getInfo(int w) } case sUser+6: case sUser+7: + case sUser+8: return resIsPyObject; default: return resNA; @@ -527,6 +536,16 @@ PyObject *eServiceDVD::getInfoObject(int w) } return tuple; } + case sUser+8: + { + ePyObject tuple = PyTuple_New(2); + int current, num; + ddvd_get_angle_info(m_ddvdconfig, ¤t, &num); + PyTuple_SetItem(tuple, 0, PyInt_FromLong(current)); + PyTuple_SetItem(tuple, 1, PyInt_FromLong(num)); + + return tuple; + } default: eDebug("unhandled getInfoObject(%d)", w); } @@ -686,6 +705,9 @@ RESULT eServiceDVD::keyPressed(int key) case iServiceKeys::keyUser+7: ddvd_send_key(m_ddvdconfig, DDVD_KEY_MENU); break; + case iServiceKeys::keyUser+8: + ddvd_send_key(m_ddvdconfig, DDVD_KEY_ANGLE); + break; default: return -1; } -- cgit v1.2.3