fix relative jumps
authorFelix Domke <tmbinc@elitedvb.net>
Fri, 17 Feb 2006 16:59:54 +0000 (16:59 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Fri, 17 Feb 2006 16:59:54 +0000 (16:59 +0000)
lib/dvb/dvb.cpp
lib/dvb/idvb.h
lib/service/servicedvb.cpp

index 4a3adf5..a126aae 100644 (file)
@@ -766,8 +766,16 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off
                if (relative)
                {
                        pts_t now;
-                                       /* we're using the decoder's timestamp here. this 
-                                          won't work for radio (ouch). */
+                       if (!m_cue->m_decoder)
+                       {
+                               eDebug("no decoder - can't seek relative");
+                               continue;
+                       }
+                       if (m_cue->m_decoder->getPTS(0, now))
+                       {
+                               eDebug("decoder getPTS failed, can't seek relative");
+                               continue;
+                       }
                        if (getCurrentPosition(m_cue->m_decoding_demux, now, 1))
                        {
                                eDebug("seekTo: getCurrentPosition failed!");
@@ -1092,9 +1100,10 @@ void eCueSheet::setSkipmode(const pts_t &ratio)
        m_event(evtSkipmode);
 }
 
-void eCueSheet::setDecodingDemux(iDVBDemux *demux)
+void eCueSheet::setDecodingDemux(iDVBDemux *demux, iTSMPEGDecoder *decoder)
 {
        m_decoding_demux = demux;
+       m_decoder = decoder;
 }
 
 RESULT eCueSheet::connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &connection)
index 2f9d7d9..2090d18 100644 (file)
@@ -426,6 +426,7 @@ public:
 typedef long long pts_t;
 
 class iFilePushScatterGather;
+class iTSMPEGDecoder;
 
        /* note that a cue sheet describes the logical positions. thus 
           everything is specified in pts and not file positions */
@@ -444,7 +445,7 @@ public:
        void addSourceSpan(const pts_t &begin, const pts_t &end);
        
        void setSkipmode(const pts_t &ratio); /* 90000 is 1:1 */
-       void setDecodingDemux(iDVBDemux *demux);
+       void setDecodingDemux(iDVBDemux *demux, iTSMPEGDecoder *decoder);
        
                        /* frontend and backend */
        eSingleLock m_lock;
@@ -458,6 +459,7 @@ public:
        pts_t m_skipmode_ratio;
        Signal1<void,int> m_event;
        ePtr<iDVBDemux> m_decoding_demux;
+       ePtr<iTSMPEGDecoder> m_decoder;
 };
 
 class iDVBPVRChannel: public iDVBChannel
index 5f5aae6..248a548 100644 (file)
@@ -1399,7 +1399,7 @@ void eDVBServicePlay::updateDecoder()
                if (m_decode_demux)
                        m_decode_demux->getMPEGDecoder(m_decoder);
                if (m_cue)
-                       m_cue->setDecodingDemux(m_decode_demux);
+                       m_cue->setDecodingDemux(m_decode_demux, m_decoder);
        }
 
        if (m_decoder)