decoder: switch off audio in trickmodes
authorFelix Domke <tmbinc@elitedvb.net>
Mon, 19 Dec 2005 14:47:54 +0000 (14:47 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Mon, 19 Dec 2005 14:47:54 +0000 (14:47 +0000)
lib/dvb/decoder.cpp
lib/dvb/decoder.h
lib/dvb/idvb.h
lib/python/Screens/InfoBarGenerics.py
lib/service/iservice.h
lib/service/servicedvb.cpp
lib/service/servicedvb.h

index 6794a056865e6062aebe5b8d9509dd1d391ed949..7bdb3062b97dcdd4bcfce17bc532a47300c32f08 100644 (file)
@@ -306,6 +306,12 @@ DEFINE_REF(eTSMPEGDecoder);
 int eTSMPEGDecoder::setState()
 {
        int res = 0;
+       
+       int noaudio = m_is_sm || m_is_ff || m_is_trickmode;
+       
+       if ((noaudio && m_audio) || (!m_audio && !noaudio))
+               m_changed |= changeAudio;
+       
 #if HAVE_DVB_API_VERSION < 3
        if (m_changed & changeAudio && m_audio)
                m_audio->stopPid();
@@ -399,7 +405,7 @@ int eTSMPEGDecoder::setState()
                if (m_audio)
                        m_audio->stop();
                m_audio = 0;
-               if ((m_apid >= 0) && (m_apid < 0x1FFF))
+               if ((m_apid >= 0) && (m_apid < 0x1FFF) && !noaudio)
                {
                        m_audio = new eDVBAudio(m_demux, 0);
                        if (m_audio->startPid(m_apid, m_atype))
@@ -417,7 +423,7 @@ int eTSMPEGDecoder::setState()
 eTSMPEGDecoder::eTSMPEGDecoder(eDVBDemux *demux, int decoder): m_demux(demux), m_changed(0)
 {
        demux->connectEvent(slot(*this, &eTSMPEGDecoder::demux_event), m_demux_event);
-       eDebug("eTSMPEGDecoder::eTSMPEGDecoder %p", this);
+       m_is_ff = m_is_sm = m_is_trickmode = 0;
 }
 
 eTSMPEGDecoder::~eTSMPEGDecoder()
@@ -425,7 +431,6 @@ eTSMPEGDecoder::~eTSMPEGDecoder()
        m_vpid = m_apid = m_pcrpid = pidNone;
        m_changed = -1;
        setState();
-       eDebug("~eTSMPEGDecoder %p", this);
 }
 
 RESULT eTSMPEGDecoder::setVideoPID(int vpid)
@@ -503,6 +508,10 @@ RESULT eTSMPEGDecoder::setPictureSkipMode(int what)
 
 RESULT eTSMPEGDecoder::setFastForward(int frames_to_skip)
 {
+       m_is_ff = frames_to_skip != 0;
+       
+       setState();
+       
        if (m_video)
                return m_video->setFastForward(frames_to_skip);
        else
@@ -511,6 +520,10 @@ RESULT eTSMPEGDecoder::setFastForward(int frames_to_skip)
 
 RESULT eTSMPEGDecoder::setSlowMotion(int repeat)
 {
+       m_is_sm = repeat != 0;
+       
+       setState();
+       
        if (m_video)
                return m_video->setSlowMotion(repeat);
        else
@@ -542,3 +555,10 @@ void eTSMPEGDecoder::demux_event(int event)
                break;
        }
 }
+
+RESULT eTSMPEGDecoder::setTrickmode(int what)
+{
+       m_is_trickmode = what;
+       setState();
+       return 0;
+}
index d1f040ec180852f8d2abacbefd5c1ebd1cdae0e1..fb543feda783a803ad8551fc5eb32156922f5034 100644 (file)
@@ -78,6 +78,7 @@ private:
                changePCR   = 4
        };
        int m_changed;
+       int m_is_ff, m_is_sm, m_is_trickmode;
        int setState();
        ePtr<eConnection> m_demux_event;
        
@@ -99,5 +100,6 @@ public:
        RESULT setSlowMotion(int repeat);
        RESULT setZoom(int what);
        RESULT flush();
+       RESULT setTrickmode(int what);
 };
 #endif
index c60f5698debcf6f0bd0f577bccdb56a62c2c231d..6c45bb2909d0ed0d10cada59976b86ad0137b23d 100644 (file)
@@ -492,6 +492,8 @@ public:
        enum { zoom_Normal, zoom_PanScan, zoom_Letterbox, zoom_Fullscreen };
                /** Set Zoom. mode *must* be fitting. */
        virtual RESULT setZoom(int what)=0;
+       
+       virtual RESULT setTrickmode(int what) = 0;
 };
 
 #endif
index 77c4a41581447ab7aea40b6948a2af4bc49496d6..5eda3381ecc92aa1a23e9cdf1b60a412602af59a 100644 (file)
@@ -509,6 +509,20 @@ class InfoBarPVR:
                        self.seekTimer.stop()
                else:
                        self.seekTimer.start(500)
+               
+               service = self.session.nav.getCurrentService()
+               if service is None:
+                       return
+               
+               seekable = service.seek()
+               if seekable is None:
+                       return
+
+               if skipmode:
+                       seekable.setTrickmode(1)
+               else:
+                       seekable.setTrickmode(0)
+               
        
        def pauseService(self):
                self.setSeekState(self.SEEK_STATE_PAUSE);
index ed1cf3a5a7765a7955a21333db45934f73643c23..378bdcc9e27c1fbcff94ece51413a7dfd4ec67ea 100644 (file)
@@ -278,6 +278,9 @@ public:
        enum { dirForward = +1, dirBackward = -1 };
        virtual RESULT seekRelative(int direction, pts_t to)=0;
        virtual RESULT getPlayPosition(pts_t &SWIG_OUTPUT)=0;
+               /* if you want to do several seeks in a row, you can enable the trickmode. 
+                  audio will be switched off, sync will be disabled etc. */
+       virtual RESULT setTrickmode(int trick=0)=0;
 };
 
 TEMPLATE_TYPEDEF(ePtr<iSeekableService>, iSeekableServicePtr);
index 790bfca62bb4feef05b43aaff98ed7d0760541b7..fc35b5217e0952ca7707ae513fdbbc8c39e35a46 100644 (file)
@@ -669,7 +669,7 @@ RESULT eDVBServicePlay::setSlowMotion(int ratio)
 RESULT eDVBServicePlay::setFastForward(int ratio)
 {
        if (m_decoder)
-               m_decoder->setFastForward(ratio);
+               return m_decoder->setFastForward(ratio);
        else
                return -1;
 }
@@ -758,6 +758,13 @@ RESULT eDVBServicePlay::getPlayPosition(pts_t &pos)
        return pvr_channel->getCurrentPosition(demux, pos);
 }
 
+RESULT eDVBServicePlay::setTrickmode(int trick=0)
+{
+       if (m_decoder)
+               m_decoder->setTrickmode(trick);
+       return 0;
+}
+
 RESULT eDVBServicePlay::frontendStatusInfo(ePtr<iFrontendStatusInformation> &ptr)
 {
        ptr = this;
index e99faffd510db0c348ae99b0ecd01b77170f09ad..b1df4cb78169a60af637d39c2fcba9ea332c9080 100644 (file)
@@ -84,6 +84,7 @@ public:
        RESULT seekTo(pts_t to);
        RESULT seekRelative(int direction, pts_t to);
        RESULT getPlayPosition(pts_t &pos);
+       RESULT setTrickmode(int trick=0);
 
                // iServiceInformation
        RESULT getName(std::string &name);