X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fpython%2FPlugins%2FExtensions%2FDVDPlayer%2Fsrc%2Fservicedvd.cpp;h=2ba53927f6b62a89afd4cdf540aeb6bcea4db6b3;hp=0a3d035912770a3b76634510932045b0a0d800b1;hb=37727defa26822965967c2f26b5e181f19ba7e64;hpb=6df771b5f7e744c650b73f8548ab41152c0185eb diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp index 0a3d035..2ba5392 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp @@ -51,7 +51,7 @@ DEFINE_REF(eServiceFactoryDVD) RESULT eServiceFactoryDVD::play(const eServiceReference &ref, ePtr &ptr) { // check resources... - ptr = new eServiceDVD(ref.path.c_str()); + ptr = new eServiceDVD(ref); return 0; } @@ -84,16 +84,14 @@ RESULT eServiceFactoryDVD::offlineOperations(const eServiceReference &, ePtr -1) @@ -120,14 +121,29 @@ eServiceDVD::eServiceDVD(const char *filename): 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; + if (rd > 6 && !strncmp(tmp, "bestfit", 7)) + policy = DDVD_JUSTSCALE; + else if (rd > 8 && !strncmp(tmp, "letterbox", 9)) + policy = DDVD_LETTERBOX; close(fd); } +#ifdef DDVD_SUPPORTS_16_10_SCALING + fd = open("/proc/stb/video/policy2", O_RDONLY); + if (fd > -1) + { + rd = read(fd, tmp, 255); + if (rd > 6 && !strncmp(tmp, "bestfit", 7)) + policy2 = DDVD_JUSTSCALE; + else if (rd > 8 && !strncmp(tmp, "letterbox", 9)) + policy2 = DDVD_LETTERBOX; + close(fd); + } + ddvd_set_video_ex(m_ddvdconfig, aspect, policy, policy2, DDVD_PAL /*unused*/); +#else ddvd_set_video(m_ddvdconfig, aspect, policy, DDVD_PAL /*unused*/); +#warning please update libdreamdvd for 16:10 scaling support! +#endif CONNECT(m_sn->activated, eServiceDVD::gotMessage); CONNECT(m_pump.recv_msg, eServiceDVD::gotThreadMessage); @@ -176,8 +192,24 @@ void eServiceDVD::gotMessage(int /*what*/) } case DDVD_SCREEN_UPDATE: eDebug("DVD_SCREEN_UPDATE!"); - if (m_subtitle_widget) - m_subtitle_widget->setPixmap(m_pixmap, eRect(ePoint(0, 0), m_pixmap->size())); + if (m_subtitle_widget) { + int x1,x2,y1,y2; + ddvd_get_last_blit_area(m_ddvdconfig, &x1, &x2, &y1, &y2); + + int x_offset = 0, y_offset = 0, width = 720, height = 576; + +#ifdef DDVD_SUPPORTS_GET_BLIT_DESTINATION + ddvd_get_blit_destination(m_ddvdconfig, &x_offset, &y_offset, &width, &height); + eDebug("values got from ddvd: %d %d %d %d", x_offset, y_offset, width, height); + y_offset = -y_offset; + width -= x_offset * 2; + height -= y_offset * 2; +#endif + eRect dest(x_offset, y_offset, width, height); + + if (dest.width() && dest.height()) + m_subtitle_widget->setPixmap(m_pixmap, eRect(x1, y1, (x2-x1)+1, (y2-y1)+1), dest); + } break; case DDVD_SHOWOSD_STATE_PLAY: { @@ -231,6 +263,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; @@ -266,6 +306,32 @@ void eServiceDVD::gotMessage(int /*what*/) m_event(this, evSeekableStatusChanged); m_event(this, evUser+12); break; +#ifdef DDVD_SUPPORTS_PICTURE_INFO + case DDVD_SIZE_CHANGED: + { + int changed = m_width != -1 && m_height != -1 && m_aspect != -1; + ddvd_get_last_size(m_ddvdconfig, &m_width, &m_height, &m_aspect); + if (changed) + m_event((iPlayableService*)this, evVideoSizeChanged); + break; + } + case DDVD_PROGRESSIVE_CHANGED: + { + int changed = m_progressive != -1; + ddvd_get_last_progressive(m_ddvdconfig, &m_progressive); + if (changed) + m_event((iPlayableService*)this, evVideoProgressiveChanged); + break; + } + case DDVD_FRAMERATE_CHANGED: + { + int changed = m_framerate != -1; + ddvd_get_last_framerate(m_ddvdconfig, &m_framerate); + if (changed) + m_event((iPlayableService*)this, evVideoFramerateChanged); + break; + } +#endif default: break; } @@ -277,6 +343,7 @@ eServiceDVD::~eServiceDVD() kill(); saveCuesheet(); ddvd_close(m_ddvdconfig); + disableSubtitles(0); } RESULT eServiceDVD::connectEvent(const Slot2 &event, ePtr &connection) @@ -287,7 +354,7 @@ RESULT eServiceDVD::connectEvent(const Slot2 &event, RESULT eServiceDVD::start() { - assert(m_state == stIdle); + ASSERT(m_state == stIdle); m_state = stRunning; eDebug("eServiceDVD starting"); // m_event(this, evStart); @@ -296,10 +363,10 @@ RESULT eServiceDVD::start() RESULT eServiceDVD::stop() { - assert(m_state != stIdle); + ASSERT(m_state != stIdle); if (m_state == stStopped) return -1; - eDebug("DVD: stop %s", m_filename.c_str()); + eDebug("DVD: stop %s", m_ref.path.c_str()); m_state = stStopped; ddvd_send_key(m_ddvdconfig, DDVD_KEY_EXIT); @@ -413,7 +480,7 @@ RESULT eServiceDVD::getName(std::string &name) if ( m_ddvd_titlestring[0] != '\0' ) name = m_ddvd_titlestring; else - name = m_filename; + name = m_ref.path; return 0; } @@ -454,7 +521,20 @@ int eServiceDVD::getInfo(int w) } case sUser+6: case sUser+7: + case sUser+8: return resIsPyObject; +#ifdef DDVD_SUPPORTS_PICTURE_INFO + case sVideoWidth: + return m_width; + case sVideoHeight: + return m_height; + case sAspect: + return m_aspect; + case sProgressive: + return m_progressive; + case sFrameRate: + return m_framerate; +#endif default: return resNA; } @@ -465,7 +545,7 @@ std::string eServiceDVD::getInfoString(int w) switch(w) { case sServiceref: - break; + return m_ref.toString(); default: eDebug("unhandled getInfoString(%d)", w); } @@ -523,6 +603,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); } @@ -531,18 +621,22 @@ 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()); - eSize size = parent->size(); + eSize size = eSize(720, 576); if (!m_pixmap) { - m_pixmap = new gPixmap(size, 32); + m_pixmap = new gPixmap(size, 32, 1); /* allocate accel surface (if possible) */ +#ifdef DDVD_SUPPORTS_GET_BLIT_DESTINATION + ddvd_set_lfb_ex(m_ddvdconfig, (unsigned char *)m_pixmap->surface->data, size.width(), size.height(), 4, size.width()*4, 1); +#else ddvd_set_lfb(m_ddvdconfig, (unsigned char *)m_pixmap->surface->data, size.width(), size.height(), 4, size.width()*4); +#warning please update libdreamdvd for fast scaling +#endif run(); // start the thread } @@ -637,7 +731,7 @@ RESULT eServiceDVD::setTrickmode(int /*trick*/) RESULT eServiceDVD::isCurrentlySeekable() { - return m_state == stRunning; + return m_state == stRunning ? 3 : 0; } RESULT eServiceDVD::keyPressed(int key) @@ -683,6 +777,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; } @@ -724,7 +821,7 @@ void eServiceDVD::loadCuesheet() if ( m_ddvd_titlestring[0] != '\0' ) snprintf(filename, 128, "/home/root/dvd-%s.cuts", m_ddvd_titlestring); else - snprintf(filename, 128, "%s/dvd.cuts", m_filename.c_str()); + snprintf(filename, 128, "%s/dvd.cuts", m_ref.path.c_str()); eDebug("eServiceDVD::loadCuesheet() filename=%s",filename); @@ -795,7 +892,7 @@ void eServiceDVD::saveCuesheet() if ( m_ddvd_titlestring[0] != '\0' ) snprintf(filename, 128, "/home/root/dvd-%s.cuts", m_ddvd_titlestring); else - snprintf(filename, 128, "%s/dvd.cuts", m_filename.c_str()); + snprintf(filename, 128, "%s/dvd.cuts", m_ref.path.c_str()); FILE *f = fopen(filename, "wb");