pts: as the decoding demux isn't stored in the dvbchannel (it could be shared, and...
authorFelix Domke <tmbinc@elitedvb.net>
Fri, 18 Nov 2005 02:52:38 +0000 (02:52 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Fri, 18 Nov 2005 02:52:38 +0000 (02:52 +0000)
lib/dvb/dvb.cpp
lib/dvb/dvb.h
lib/dvb/idvb.h
lib/dvb/pmt.cpp
lib/service/servicedvb.cpp

index 5ede1e3..04c2b40 100644 (file)
@@ -583,7 +583,7 @@ RESULT eDVBChannel::playFile(const char *file)
        m_pvr_fd_dst = open("/dev/misc/pvr", O_WRONLY);
        if (m_pvr_fd_dst < 0)
        {
-               eDebug("can't open /dev/misc/pvr - you need to buy the new(!) $$$ box! (%m)");
+               eDebug("can't open /dev/misc/pvr - you need to buy the new(!) $$$ box! (%m)"); // or wait for the driver to be improved.
                return -ENODEV;
        }
        
@@ -609,9 +609,9 @@ RESULT eDVBChannel::getLength(pts_t &len)
        return m_tstools.calcLen(len);
 }
 
-RESULT eDVBChannel::getCurrentPosition(pts_t &pos)
+RESULT eDVBChannel::getCurrentPosition(iDVBDemux *decoding_demux, pts_t &pos)
 {
-       if (!m_decoder_demux)
+       if (!decoding_demux)
                return -1;
        
        off_t begin = 0;
@@ -625,7 +625,7 @@ RESULT eDVBChannel::getCurrentPosition(pts_t &pos)
        
        pts_t now;
        
-       r = m_decoder_demux->get().getSTC(now);
+       r = decoding_demux->getSTC(now);
 
        if (r)
        {
@@ -650,7 +650,7 @@ RESULT eDVBChannel::getCurrentPosition(pts_t &pos)
        return 0;
 }
 
-RESULT eDVBChannel::seekTo(int relative, pts_t &pts)
+RESULT eDVBChannel::seekTo(iDVBDemux *decoding_demux, int relative, pts_t &pts)
 {
        int bitrate = m_tstools.calcBitrate(); /* in bits/s */
        
@@ -660,7 +660,7 @@ RESULT eDVBChannel::seekTo(int relative, pts_t &pts)
        if (relative)
        {
                pts_t now;
-               if (getCurrentPosition(now))
+               if (getCurrentPosition(decoding_demux, now))
                {
                        eDebug("seekTo: getCurrentPosition failed!");
                        return -1;
@@ -673,11 +673,11 @@ RESULT eDVBChannel::seekTo(int relative, pts_t &pts)
        
        off_t offset = (pts * (pts_t)bitrate) / 8ULL / 90000ULL;
        
-       seekToPosition(offset);
+       seekToPosition(decoding_demux, offset);
        return 0;
 }
 
-RESULT eDVBChannel::seekToPosition(const off_t &r)
+RESULT eDVBChannel::seekToPosition(iDVBDemux *decoding_demux, const off_t &r)
 {
                        /* when seeking, we have to ensure that all buffers are flushed.
                           there are basically 3 buffers:
@@ -699,8 +699,8 @@ RESULT eDVBChannel::seekToPosition(const off_t &r)
        ::ioctl(m_pvr_fd_dst, 0);
        
                /* flush ratebuffers (video, audio) */
-       if (m_decoder_demux)
-               m_decoder_demux->get().flush();
+       if (decoding_demux)
+               decoding_demux->flush();
 
                /* demux will also flush all decoder.. */
        m_pvr_thread->seek(SEEK_SET, r);
index 03702db..924d4e6 100644 (file)
@@ -191,11 +191,11 @@ public:
                /* iDVBPVRChannel */
        RESULT playFile(const char *file);
        RESULT getLength(pts_t &len);
-       RESULT getCurrentPosition(pts_t &pos);
-       RESULT seekTo(int relative, pts_t &pts);
+       RESULT getCurrentPosition(iDVBDemux *decoding_demux, pts_t &pos);
+       RESULT seekTo(iDVBDemux *decoding_demux, int relative, pts_t &pts);
                        /* seeking to relative positions won't work - 
                           there is an unknown amount of buffers in between */
-       RESULT seekToPosition(const off_t &off);
+       RESULT seekToPosition(iDVBDemux *decoding_demux, const off_t &off);
 
 private:
        ePtr<eDVBAllocatedFrontend> m_frontend;
index 483c395..699474d 100644 (file)
@@ -410,9 +410,14 @@ public:
        virtual RESULT playFile(const char *file) = 0;
        
        virtual RESULT getLength(pts_t &pts) = 0;
-       virtual RESULT getCurrentPosition(pts_t &pos) = 0;
-       virtual RESULT seekTo(int relative, pts_t &pts) = 0;
-       virtual RESULT seekToPosition(const off_t &pts) = 0;
+       
+               /* we explicitely ask for the decoding demux here because a channel
+                  can be shared between multiple decoders.
+                  Of couse skipping doesn't make much sense 
+                  then, but getCurrentPosition does. */
+       virtual RESULT getCurrentPosition(iDVBDemux *decoding_demux, pts_t &pos) = 0;
+       virtual RESULT seekTo(iDVBDemux *decoding_demux, int relative, pts_t &pts) = 0;
+       virtual RESULT seekToPosition(iDVBDemux *decoding_demux, const off_t &pts) = 0;
 };
 
 class iDVBSectionReader;
index e743d26..6fb2d1c 100644 (file)
@@ -12,10 +12,12 @@ eDVBServicePMTHandler::eDVBServicePMTHandler(int record)
        eDVBResourceManager::getInstance(m_resourceManager);
        CONNECT(m_PMT.tableReady, eDVBServicePMTHandler::PMTready);
        CONNECT(m_PAT.tableReady, eDVBServicePMTHandler::PATready);
+       eDebug("new PMT handler record: %d", m_record);
 }
 
 eDVBServicePMTHandler::~eDVBServicePMTHandler()
 {
+       eDebug("delete PMT handler record: %d", m_record);
        delete m_ca_servicePtr;
 }
 
index f805ee7..d8206b9 100644 (file)
@@ -654,7 +654,12 @@ RESULT eDVBServicePlay::seekRelative(int direction, pts_t to)
        
        to *= direction;
        
-       return pvr_channel->seekTo(1, to);
+       ePtr<iDVBDemux> demux;
+       m_service_handler.getDemux(demux);
+       if (!demux)
+               return -1;
+       
+       return pvr_channel->seekTo(demux, 1, to);
 }
 
 RESULT eDVBServicePlay::getPlayPosition(pts_t &pos)
@@ -664,7 +669,12 @@ RESULT eDVBServicePlay::getPlayPosition(pts_t &pos)
        if (m_service_handler.getPVRChannel(pvr_channel))
                return -1;
        
-       return pvr_channel->getCurrentPosition(pos);
+       ePtr<iDVBDemux> demux;
+       m_service_handler.getDemux(demux);
+       if (!demux)
+               return -1;
+       
+       return pvr_channel->getCurrentPosition(demux, pos);
 }
 
 RESULT eDVBServicePlay::info(ePtr<iServiceInformation> &ptr)