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 6794a05..7bdb306 100644 (file)
@@ -306,6 +306,12 @@ DEFINE_REF(eTSMPEGDecoder);
 int eTSMPEGDecoder::setState()
 {
        int res = 0;
 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();
 #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_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))
                {
                        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);
 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()
 }
 
 eTSMPEGDecoder::~eTSMPEGDecoder()
@@ -425,7 +431,6 @@ eTSMPEGDecoder::~eTSMPEGDecoder()
        m_vpid = m_apid = m_pcrpid = pidNone;
        m_changed = -1;
        setState();
        m_vpid = m_apid = m_pcrpid = pidNone;
        m_changed = -1;
        setState();
-       eDebug("~eTSMPEGDecoder %p", this);
 }
 
 RESULT eTSMPEGDecoder::setVideoPID(int vpid)
 }
 
 RESULT eTSMPEGDecoder::setVideoPID(int vpid)
@@ -503,6 +508,10 @@ RESULT eTSMPEGDecoder::setPictureSkipMode(int what)
 
 RESULT eTSMPEGDecoder::setFastForward(int frames_to_skip)
 {
 
 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
        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)
 {
 
 RESULT eTSMPEGDecoder::setSlowMotion(int repeat)
 {
+       m_is_sm = repeat != 0;
+       
+       setState();
+       
        if (m_video)
                return m_video->setSlowMotion(repeat);
        else
        if (m_video)
                return m_video->setSlowMotion(repeat);
        else
@@ -542,3 +555,10 @@ void eTSMPEGDecoder::demux_event(int event)
                break;
        }
 }
                break;
        }
 }
+
+RESULT eTSMPEGDecoder::setTrickmode(int what)
+{
+       m_is_trickmode = what;
+       setState();
+       return 0;
+}
index d1f040e..fb543fe 100644 (file)
@@ -78,6 +78,7 @@ private:
                changePCR   = 4
        };
        int m_changed;
                changePCR   = 4
        };
        int m_changed;
+       int m_is_ff, m_is_sm, m_is_trickmode;
        int setState();
        ePtr<eConnection> m_demux_event;
        
        int setState();
        ePtr<eConnection> m_demux_event;
        
@@ -99,5 +100,6 @@ public:
        RESULT setSlowMotion(int repeat);
        RESULT setZoom(int what);
        RESULT flush();
        RESULT setSlowMotion(int repeat);
        RESULT setZoom(int what);
        RESULT flush();
+       RESULT setTrickmode(int what);
 };
 #endif
 };
 #endif
index c60f569..6c45bb2 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;
        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
 };
 
 #endif
index 77c4a41..5eda338 100644 (file)
@@ -509,6 +509,20 @@ class InfoBarPVR:
                        self.seekTimer.stop()
                else:
                        self.seekTimer.start(500)
                        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);
        
        def pauseService(self):
                self.setSeekState(self.SEEK_STATE_PAUSE);
index ed1cf3a..378bdcc 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;
        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);
 };
 
 TEMPLATE_TYPEDEF(ePtr<iSeekableService>, iSeekableServicePtr);
index 790bfca..fc35b52 100644 (file)
@@ -669,7 +669,7 @@ RESULT eDVBServicePlay::setSlowMotion(int ratio)
 RESULT eDVBServicePlay::setFastForward(int ratio)
 {
        if (m_decoder)
 RESULT eDVBServicePlay::setFastForward(int ratio)
 {
        if (m_decoder)
-               m_decoder->setFastForward(ratio);
+               return m_decoder->setFastForward(ratio);
        else
                return -1;
 }
        else
                return -1;
 }
@@ -758,6 +758,13 @@ RESULT eDVBServicePlay::getPlayPosition(pts_t &pos)
        return pvr_channel->getCurrentPosition(demux, 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;
 RESULT eDVBServicePlay::frontendStatusInfo(ePtr<iFrontendStatusInformation> &ptr)
 {
        ptr = this;
index e99faff..b1df4cb 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 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);
 
                // iServiceInformation
        RESULT getName(std::string &name);