reserve first two demuxes for decoder
authorFelix Domke <tmbinc@elitedvb.net>
Sat, 8 Apr 2006 00:55:32 +0000 (00:55 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Sat, 8 Apr 2006 00:55:32 +0000 (00:55 +0000)
lib/dvb/dvb.cpp

index 9d5a68aa225b974210d16136bd234b389697cd4a..18765ad3fb3cbce18b5d0fc8e916e5d7034fcba6 100644 (file)
@@ -273,12 +273,18 @@ RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr<eDVBA
        int n=0;
                /* FIXME: hardware demux policy */
        if (!(cap & iDVBChannel::capDecode))
        int n=0;
                /* FIXME: hardware demux policy */
        if (!(cap & iDVBChannel::capDecode))
-               ++i, ++n;
+       {
+               if (m_demux.size() > 2)  /* assumed to be true, otherwise we have lost anyway */
+               {
+                       ++i, ++n;
+                       ++i, ++n;
+               }
+       }
        
        for (; i != m_demux.end(); ++i, ++n)
                if ((!i->m_inuse) && ((!fe) || (i->m_adapter == fe->m_adapter)))
                {
        
        for (; i != m_demux.end(); ++i, ++n)
                if ((!i->m_inuse) && ((!fe) || (i->m_adapter == fe->m_adapter)))
                {
-                       if ((cap & iDVBChannel::capDecode) && n)
+                       if ((cap & iDVBChannel::capDecode) && (n >= 2))
                                continue;
                        
                        demux = new eDVBAllocatedDemux(i);
                                continue;
                        
                        demux = new eDVBAllocatedDemux(i);
@@ -997,6 +1003,11 @@ RESULT eDVBChannel::getDemux(ePtr<iDVBDemux> &demux, int cap)
        
        demux = *our_demux;
                /* don't hold a reference to the decoding demux, we don't need it. */
        
        demux = *our_demux;
                /* don't hold a reference to the decoding demux, we don't need it. */
+               
+               /* FIXME: by dropping the 'allocated demux' in favour of the 'iDVBDemux',
+                  the refcount is lost. thus, decoding demuxes are never allocated. 
+                  
+                  this poses a big problem for PiP. */
        if (cap & capDecode)
                our_demux = 0;
        return 0;
        if (cap & capDecode)
                our_demux = 0;
        return 0;