revert last revision (workaround no longer needed)
[enigma2.git] / lib / python / Plugins / Extensions / DVDPlayer / src / servicedvd.cpp
index 12d1405..bbcb1f2 100644 (file)
@@ -3,6 +3,7 @@
 #include <lib/base/eerror.h>
 #include <lib/base/object.h>
 #include <lib/base/ebase.h>
+#include <lib/base/nconfig.h>
 #include <string>
 #include <lib/service/service.h>
 #include <lib/base/init_num.h>
@@ -54,7 +55,7 @@ RESULT eServiceFactoryDVD::play(const eServiceReference &ref, ePtr<iPlayableServ
        return 0;
 }
 
-RESULT eServiceFactoryDVD::record(const eServiceReference &ref, ePtr<iRecordableService> &ptr)
+RESULT eServiceFactoryDVD::record(const eServiceReference &/*ref*/, ePtr<iRecordableService> &ptr)
 {
        ptr=0;
        return -1;
@@ -67,7 +68,7 @@ RESULT eServiceFactoryDVD::list(const eServiceReference &, ePtr<iListableService
 }
 
 
-RESULT eServiceFactoryDVD::info(const eServiceReference &ref, ePtr<iStaticServiceInformation> &ptr)
+RESULT eServiceFactoryDVD::info(const eServiceReference &/*ref*/, ePtr<iStaticServiceInformation> &ptr)
 {
        ptr=0;
        return -1;
@@ -93,12 +94,22 @@ eServiceDVD::eServiceDVD(const char *filename):
        m_sn(eApp, ddvd_get_messagepipe_fd(m_ddvdconfig), eSocketNotifier::Read|eSocketNotifier::Priority|eSocketNotifier::Error|eSocketNotifier::Hungup),
        m_pump(eApp, 1)
 {
+       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");
-       ddvd_set_video(m_ddvdconfig, DDVD_16_9, DDVD_PAL);
+
+       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);
+
        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);
@@ -117,7 +128,7 @@ void eServiceDVD::gotThreadMessage(const int &msg)
        }
 }
 
-void eServiceDVD::gotMessage(int what)
+void eServiceDVD::gotMessage(int /*what*/)
 {
        switch(ddvd_get_next_message(m_ddvdconfig,1))
        {
@@ -205,20 +216,13 @@ void eServiceDVD::gotMessage(int what)
                {
                        static struct ddvd_time last_info;
                        struct ddvd_time info;
-                       eDebug("DVD_SHOWOSD_TIME!");
+//                     eDebug("DVD_SHOWOSD_TIME!");
                        ddvd_get_last_time(m_ddvdconfig, &info);
-                       int spu_id;
-                       uint16_t spu_lang;
-                       ddvd_get_last_spu(m_ddvdconfig, &spu_id, &spu_lang);
                        if ( info.pos_chapter != last_info.pos_chapter )
-                       {
                                m_event(this, evUser+8); // chapterUpdated
-                       }
                        if ( info.pos_title != last_info.pos_title )
-                       {
                                m_event(this, evUser+9); // titleUpdated
-                       }
-                       ddvd_get_last_time(m_ddvdconfig, &last_info);
+                       memcpy(&last_info, &info, sizeof(struct ddvd_time));
                        break;
                }
                case DDVD_SHOWOSD_TITLESTRING:
@@ -286,13 +290,16 @@ RESULT eServiceDVD::stop()
                pos += info.pos_minutes * 60;
                pos += info.pos_seconds;
                pos *= 90000;
+               pos += info.pos_title * 256;
+               pos += info.pos_chapter;
                m_cue_pts = pos;
+               eDebug("POS %llu\n", m_cue_pts);
        }
        saveCuesheet();
        return 0;
 }
 
-RESULT eServiceDVD::setTarget(int target)
+RESULT eServiceDVD::setTarget(int /*target*/)
 {
        return -1;
 }
@@ -322,7 +329,7 @@ RESULT eServiceDVD::keys(ePtr<iServiceKeys> &ptr)
 }
 
        // iPausableService
-RESULT eServiceDVD::setSlowMotion(int ratio)
+RESULT eServiceDVD::setSlowMotion(int /*ratio*/)
 {
        return -1;
 }
@@ -415,32 +422,30 @@ int eServiceDVD::getInfo(int w)
                case sTracknumber:
                case sGenre:
                        return resIsString;  // then getInfoString should be called
-               case evUser+8:
+               case sUser+8:
                {
                        struct ddvd_time info;
                        ddvd_get_last_time(m_ddvdconfig, &info);
                        return info.pos_chapter;
                }
-               case evUser+80:
+               case sUser+80:
                {
                        struct ddvd_time info;
                        ddvd_get_last_time(m_ddvdconfig, &info);
                        return info.end_chapter;
                }
-
-               case evUser+9:
+               case sUser+9:
                {
                        struct ddvd_time info;
                        ddvd_get_last_time(m_ddvdconfig, &info);
                        return info.pos_title;
                }
-               case evUser+90:
+               case sUser+90:
                {
                        struct ddvd_time info;
                        ddvd_get_last_time(m_ddvdconfig, &info);
                        return info.end_title;
                }
-
                case sTXTPID:   // we abuse HAS_TELEXT icon in InfoBar to signalize subtitles status
                {
                        int spu_id;
@@ -457,7 +462,7 @@ std::string eServiceDVD::getInfoString(int w)
 {
        switch(w)
        {
-               case evUser+7: {
+               case sUser+7: {
                        int spu_id;
                        uint16_t spu_lang;
                        ddvd_get_last_spu(m_ddvdconfig, &spu_id, &spu_lang);
@@ -470,7 +475,7 @@ std::string eServiceDVD::getInfoString(int w)
 //                     lbo_changed=1;
                        return osd;
                        }
-               case evUser+6:
+               case sUser+6:
                        {
                        int audio_id,audio_type;
                        uint16_t audio_lang;
@@ -514,7 +519,7 @@ PyObject *eServiceDVD::getInfoObject(int w)
        Py_RETURN_NONE;
 }
 
-RESULT eServiceDVD::enableSubtitles(eWidget *parent, SWIG_PYOBJECT(ePyObject) entry)
+RESULT eServiceDVD::enableSubtitles(eWidget *parent, SWIG_PYOBJECT(ePyObject) /*entry*/)
 {
        if (m_subtitle_widget)
                delete m_subtitle_widget;
@@ -526,7 +531,7 @@ RESULT eServiceDVD::enableSubtitles(eWidget *parent, SWIG_PYOBJECT(ePyObject) en
        return 0;
 }
 
-RESULT eServiceDVD::disableSubtitles(eWidget *parent)
+RESULT eServiceDVD::disableSubtitles(eWidget */*parent*/)
 {
        delete m_subtitle_widget;
        m_subtitle_widget = 0;
@@ -566,8 +571,8 @@ RESULT eServiceDVD::seekTo(pts_t to)
        cur = info.pos_hours * 3600;
        cur += info.pos_minutes * 60;
        cur += info.pos_seconds;
-       eDebug("seekTo %lld, cur %d, diff %lld", to, cur, cur - to);
-       ddvd_skip_seconds(m_ddvdconfig, cur - to);
+       eDebug("seekTo %lld, cur %d, diff %lld", to, cur, to - cur);
+       ddvd_skip_seconds(m_ddvdconfig, to - cur);
        return 0;
 }
 
@@ -607,7 +612,7 @@ RESULT eServiceDVD::seekChapter(int chapter)
        return 0;
 }
 
-RESULT eServiceDVD::setTrickmode(int trick)
+RESULT eServiceDVD::setTrickmode(int /*trick*/)
 {
        return -1;
 }
@@ -687,11 +692,11 @@ PyObject *eServiceDVD::getCutList()
        return list;
 }
 
-void eServiceDVD::setCutList(ePyObject list)
+void eServiceDVD::setCutList(ePyObject /*list*/)
 {
 }
 
-void eServiceDVD::setCutListEnable(int enable)
+void eServiceDVD::setCutListEnable(int /*enable*/)
 {
 }