eDVBResourceManager: Drop code for non supported DM7025
authorAthanasios Oikonomou <athoik@gmail.com>
Mon, 9 Nov 2015 19:49:23 +0000 (21:49 +0200)
committerErik Slagter <erik@openpli.org>
Tue, 10 Nov 2015 14:39:20 +0000 (15:39 +0100)
DM7025 is history, keeping ancient code for non supported boxes doesn't help when you read code.
Also drop (dream)box detection, it was only there only for DM7025.

(cherry picked from commit 736743c5f0d7f77d405e1781d93a9ee01687b079)
Signed-off-by: Erik Slagter <erik@openpli.org>

lib/dvb/dvb.cpp
lib/dvb/dvb.h

index 6fa0a2c..dd6966e 100644 (file)
@@ -97,45 +97,8 @@ eDVBResourceManager::eDVBResourceManager()
                addAdapter(adapter, true);
        }
 
-       m_boxtype = -1;
-       int fd = open("/proc/stb/info/model", O_RDONLY);
-       if (fd >= 0) {
-               char tmp[16];
-               int rd = read(fd, tmp, sizeof(tmp));
-               close(fd);
-
-               if (rd == 0)
-                       eDebug("[eDVBResourceManager] /proc/stb/info empty. Use fallback via demux count!");
-               else if (!strncmp(tmp, "dm7025\n", rd))
-                       m_boxtype = DM7025;
-               else if (!strncmp(tmp, "dm8000\n", rd))
-                       m_boxtype = DM8000;
-               else if (!strncmp(tmp, "dm800\n", rd))
-                       m_boxtype = DM800;
-               else if (!strncmp(tmp, "dm500hd\n", rd))
-                       m_boxtype = DM500HD;
-               else if (!strncmp(tmp, "dm800se\n", rd))
-                       m_boxtype = DM800SE;
-               else if (!strncmp(tmp, "dm7020hd\n", rd))
-                       m_boxtype = DM7020HD;
-               else
-                       eDebug("[eDVBResourceManager] boxtype detection via /proc/stb/info not possible. Use fallback via demux count!");
-       }
-       else {
-               eDebug("[eDVBResourceManager] cannot open /proc/stb/info. Use fallback via demux count!");
-       }
-
-       if (m_boxtype == -1) {
-               if (m_demux.size() == 3)
-                       m_boxtype = DM800;
-               else if (m_demux.size() < 5)
-                       m_boxtype = DM7025;
-               else
-                       m_boxtype = DM8000;
-       }
-
-       eDebug("[eDVBResourceManager] found %zd adapter, %zd frontends(%zd sim) and %zd demux, boxtype %d",
-               m_adapter.size(), m_frontend.size(), m_simulate_frontend.size(), m_demux.size(), m_boxtype);
+       eDebug("[eDVBResourceManager] found %zd adapter, %zd frontends(%zd sim) and %zd demux",
+               m_adapter.size(), m_frontend.size(), m_simulate_frontend.size(), m_demux.size());
 
        CONNECT(m_releaseCachedChannelTimer->timeout, eDVBResourceManager::releaseCachedChannel);
 }
@@ -909,84 +872,52 @@ RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr<eDVBA
 
        ePtr<eDVBRegisteredDemux> unused;
 
-       if (m_boxtype == DM7025) // ATI
+       iDVBAdapter *adapter = fe ? fe->m_adapter : m_adapter.begin(); /* look for a demux on the same adapter as the frontend, or the first adapter for dvr playback */
+       int source = fe ? fe->m_frontend->getDVBID() : -1;
+       cap |= capHoldDecodeReference; // this is checked in eDVBChannel::getDemux
+       if (!fe && !(cap & iDVBChannel::capDecode))
+       {
+               eDebug("[eDVBResourceManager] pvr playback, start with last demux");
+               /*
+                * For pvr playback, start with the last demux.
+                * On some hardware, we have less ca devices than demuxes,
+                * so we should try to leave the first demuxes for live tv,
+                * and start with the last for pvr playback
+                */
+               i = m_demux.end();
+               --i;
+       }
+       while (i != m_demux.end())
        {
-               /* FIXME: hardware demux policy */
-               int n=0;
-               if (!(cap & iDVBChannel::capDecode))
+               if (i->m_adapter == adapter)
                {
-                       if (m_demux.size() > 2)  /* assumed to be true, otherwise we have lost anyway */
+                       if (!i->m_inuse)
                        {
-                               ++i, ++n;
-                               ++i, ++n;
-                       }
-               }
-
-               for (; i != m_demux.end(); ++i, ++n)
-               {
-                       int is_decode = n < 2;
-
-                       int in_use = is_decode ? (i->m_demux->getRefCount() != 2) : i->m_inuse;
-
-                       //eDebug("[eDVBResourceManager] for DM7025 n=%d, is_decode=%d, in_use=%d refcnt=%d, m_inuse=%d", n, is_decode, in_use, i->m_demux->getRefCount(), i->m_inuse);
-                       if ((!in_use) && ((!fe) || (i->m_adapter == fe->m_adapter)))
+                               /* mark the first unused demux, we'll use that when we do not find a better match */
+                               if (!unused) unused = i;
+                       }                               else
+                       else
                        {
-                               if ((cap & iDVBChannel::capDecode) && !is_decode)
-                                       continue;
-                               unused = i;
-                               break;
+                               /* demux is in use, see if we can share it */
+                               if (source >= 0 && i->m_demux->getSource() == source)
+                               {
+                                       i->m_demux->getCAAdapterID(a);
+                                       i->m_demux->getCADemuxID(d);
+                                       eDebug("[eDVBResourceManager] allocating shared demux adapter=%d, demux=%d, source=%d", a, d, i->m_demux->getSource());
+                                       demux = new eDVBAllocatedDemux(i);
+                                       return 0;
+                               }
                        }
                }
-       }
-       else
-       {
-               iDVBAdapter *adapter = fe ? fe->m_adapter : m_adapter.begin(); /* look for a demux on the same adapter as the frontend, or the first adapter for dvr playback */
-               int source = fe ? fe->m_frontend->getDVBID() : -1;
-               cap |= capHoldDecodeReference; // this is checked in eDVBChannel::getDemux
-               if (!fe && !(cap & iDVBChannel::capDecode))
+               if (fe || (cap & iDVBChannel::capDecode))
                {
-                       eDebug("[eDVBResourceManager] pvr playback, start with last demux");
-                       /*
-                        * For pvr playback, start with the last demux.
-                        * On some hardware, we have less ca devices than demuxes,
-                        * so we should try to leave the first demuxes for live tv,
-                        * and start with the last for pvr playback
-                        */
-                       i = m_demux.end();
-                       --i;
+                       ++i;
                }
-               while (i != m_demux.end())
+               else
                {
-                       if (i->m_adapter == adapter)
-                       {
-                               if (!i->m_inuse)
-                               {
-                                       /* mark the first unused demux, we'll use that when we do not find a better match */
-                                       if (!unused) unused = i;
-                               }
-                               else
-                               {
-                                       /* demux is in use, see if we can share it */
-                                       if (source >= 0 && i->m_demux->getSource() == source)
-                                       {
-                                               i->m_demux->getCAAdapterID(a);
-                                               i->m_demux->getCADemuxID(d);
-                                               eDebug("[eDVBResourceManager] allocating shared demux adapter=%d, demux=%d, source=%d", a, d, i->m_demux->getSource());
-                                               demux = new eDVBAllocatedDemux(i);
-                                               return 0;
-                                       }
-                               }
-                       }
-                       if (fe || (cap & iDVBChannel::capDecode))
-                       {
-                               ++i;
-                       }
-                       else
-                       {
-                               if (i == m_demux.begin())
-                                       break;
-                               --i;
-                       }
+                       if (i == m_demux.begin())
+                               break;
+                       --i;
                }
        }
 
index ad1060c..0c81455 100644 (file)
@@ -161,10 +161,6 @@ class eDVBResourceManager: public iObject, public Object
        DECLARE_REF(eDVBResourceManager);
        int avail, busy;
 
-       enum { DM7025, DM800, DM500HD, DM800SE, DM8000, DM7020HD };
-
-       int m_boxtype;
-
        eSmartPtrList<iDVBAdapter> m_adapter;
        eSmartPtrList<eDVBRegisteredDemux> m_demux;
        eSmartPtrList<eDVBRegisteredFrontend> m_frontend, m_simulate_frontend;