reenable channelAdded signal
[enigma2.git] / lib / dvb / dvb.cpp
index 32c7ea31a67d1b06e9ca9e68a996e71cd188e28e..bd3571a6d446e39cd2df5278c322fae007e2719e 100644 (file)
@@ -225,19 +225,22 @@ RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr<eDVBA
        if (i == m_demux.end())
                return -1;
                
+       int n=0;
                /* FIXME: hardware demux policy */
        if (!(cap & iDVBChannel::capDecode))
-               ++i;
+               ++i, ++n;
        
-       for (; i != m_demux.end(); ++i)
+       for (; i != m_demux.end(); ++i, ++n)
                if ((!i->m_inuse) && ((!fe) || (i->m_adapter == fe->m_adapter)))
                {
+                       if ((cap & iDVBChannel::capDecode) && n)
+                               continue;
+                       
                        demux = new eDVBAllocatedDemux(i);
                        if (fe)
                                demux->get().setSourceFrontend(fe->m_frontend->getID());
                        else
                                demux->get().setSourcePVR(0);
-                       eDebug("demux found");
                        return 0;
                }
        eDebug("demux not found");
@@ -524,6 +527,7 @@ RESULT eDVBChannel::setCIRouting(const eDVBCIRouting &routing)
 
 RESULT eDVBChannel::getDemux(ePtr<iDVBDemux> &demux, int cap)
 {
+       eDebug("get %d demux", cap);
        ePtr<eDVBAllocatedDemux> &our_demux = (cap & capDecode) ? m_decoder_demux : m_demux;
        
        if (!our_demux)
@@ -531,10 +535,15 @@ RESULT eDVBChannel::getDemux(ePtr<iDVBDemux> &demux, int cap)
                demux = 0;
                
                if (m_mgr->allocateDemux(m_frontend ? (eDVBRegisteredFrontend*)*m_frontend : (eDVBRegisteredFrontend*)0, our_demux, cap))
-                       return 0;
+                       return -1;
+               
        }
        
        demux = *our_demux;
+       if (cap & capDecode)
+       {
+               our_demux = 0;
+       }
        return 0;
 }