use stride, allocate accel surface
[enigma2.git] / lib / dvb / scan.cpp
index 71893f95ef1dc58fa5d65194fadc52397909a4a1..0948c503102278afe280ce972d2640c13b89281a 100644 (file)
@@ -40,10 +40,14 @@ int eDVBScan::isValidONIDTSID(int orbital_position, eOriginalNetworkID onid, eTr
        case 0:
        case 0x1111:
                return 0;
        case 0:
        case 0x1111:
                return 0;
+       case 0x13E:  // workaround for 11258H and 11470V on hotbird with same ONID/TSID (0x13E/0x578)
+               return orbital_position != 130 || tsid != 0x578;
        case 1:
                return orbital_position == 192;
        case 0x00B1:
                return tsid != 0x00B0;
        case 1:
                return orbital_position == 192;
        case 0x00B1:
                return tsid != 0x00B0;
+       case 0x00eb:
+               return tsid != 0x4321;
        case 0x0002:
                return abs(orbital_position-282) < 6;
        default:
        case 0x0002:
                return abs(orbital_position-282) < 6;
        default:
@@ -135,7 +139,7 @@ RESULT eDVBScan::nextChannel()
 RESULT eDVBScan::startFilter()
 {
        bool startSDT=true;
 RESULT eDVBScan::startFilter()
 {
        bool startSDT=true;
-       assert(m_demux);
+       ASSERT(m_demux);
 
                        /* only start required filters filter */
 
 
                        /* only start required filters filter */
 
@@ -161,7 +165,7 @@ RESULT eDVBScan::startFilter()
                {
                        std::vector<ProgramAssociationSection*>::const_iterator i =
                                m_PAT->getSections().begin();
                {
                        std::vector<ProgramAssociationSection*>::const_iterator i =
                                m_PAT->getSections().begin();
-                       assert(i != m_PAT->getSections().end());
+                       ASSERT(i != m_PAT->getSections().end());
                        tsid = (*i)->getTableIdExtension(); // in PAT this is the transport stream id
                        m_pat_tsid = eTransportStreamID(tsid);
                        for (; i != m_PAT->getSections().end(); ++i)
                        tsid = (*i)->getTableIdExtension(); // in PAT this is the transport stream id
                        m_pat_tsid = eTransportStreamID(tsid);
                        for (; i != m_PAT->getSections().end(); ++i)
@@ -738,11 +742,20 @@ void eDVBScan::channelDone()
                                }
                                case iDVBFrontend::feTerrestrial:
                                {
                                }
                                case iDVBFrontend::feTerrestrial:
                                {
+                                       ePtr<iDVBFrontend> fe;
                                        eDVBFrontendParametersTerrestrial parm;
                                        m_ch_current->getDVBT(parm);
                                        snprintf(sname, 255, "%d SID 0x%02x",
                                                parm.frequency/1000,
                                                m_pmt_in_progress->first);
                                        eDVBFrontendParametersTerrestrial parm;
                                        m_ch_current->getDVBT(parm);
                                        snprintf(sname, 255, "%d SID 0x%02x",
                                                parm.frequency/1000,
                                                m_pmt_in_progress->first);
+                                       if (!m_channel->getFrontend(fe))
+                                       {
+                                               ePyObject tp_dict = PyDict_New();
+                                               fe->getTransponderData(tp_dict, false);
+                                               m_corrected_frequencys[m_chid_current] =
+                                                       PyInt_AsLong(PyDict_GetItemString(tp_dict, "frequency"));
+                                               Py_DECREF(tp_dict);
+                                       }
                                        break;
                                }
                                case iDVBFrontend::feCable:
                                        break;
                                }
                                case iDVBFrontend::feCable:
@@ -763,7 +776,8 @@ void eDVBScan::channelDone()
 
                if (!(m_flags & scanOnlyFree) || !m_pmt_in_progress->second.scrambled) {
                        SCAN_eDebug("add not scrambled!");
 
                if (!(m_flags & scanOnlyFree) || !m_pmt_in_progress->second.scrambled) {
                        SCAN_eDebug("add not scrambled!");
-                       std::pair<std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator, bool> i = m_new_services.insert(std::pair<eServiceReferenceDVB, ePtr<eDVBService> >(ref, service));
+                       std::pair<std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator, bool> i =
+                               m_new_services.insert(std::pair<eServiceReferenceDVB, ePtr<eDVBService> >(ref, service));
                        if (i.second)
                        {
                                m_last_service = i.first;
                        if (i.second)
                        {
                                m_last_service = i.first;
@@ -920,6 +934,24 @@ void eDVBScan::insertInto(iDVBChannelList *db, bool dontRemoveOldFlags)
        for (std::map<eDVBChannelID, ePtr<iDVBFrontendParameters> >::const_iterator 
                        ch(m_new_channels.begin()); ch != m_new_channels.end(); ++ch)
        {
        for (std::map<eDVBChannelID, ePtr<iDVBFrontendParameters> >::const_iterator 
                        ch(m_new_channels.begin()); ch != m_new_channels.end(); ++ch)
        {
+               int system;
+               ch->second->getSystem(system);
+               if (system == iDVBFrontend::feTerrestrial)
+               {
+                       std::map<eDVBChannelID, unsigned int>::iterator it = m_corrected_frequencys.find(ch->first);
+                       if (it != m_corrected_frequencys.end())
+                       {
+                               eDVBFrontendParameters *p = (eDVBFrontendParameters*)&(*ch->second);
+                               eDVBFrontendParametersTerrestrial parm;
+                               p->getDVBT(parm);
+                               eDebug("corrected freq for tsid %04x, onid %04x, ns %08x is %d, old was %d",
+                                       ch->first.transport_stream_id.get(), ch->first.original_network_id.get(),
+                                       ch->first.dvbnamespace.get(), it->second, parm.frequency);
+                               parm.frequency = it->second;
+                               p->setDVBT(parm);
+                               m_corrected_frequencys.erase(it);
+                       }
+               }
                if (m_flags & scanOnlyFree)
                {
                        eDVBFrontendParameters *ptr = (eDVBFrontendParameters*)&(*ch->second);
                if (m_flags & scanOnlyFree)
                {
                        eDVBFrontendParameters *ptr = (eDVBFrontendParameters*)&(*ch->second);
@@ -1034,7 +1066,8 @@ RESULT eDVBScan::processSDT(eDVBNamespace dvbnamespace, const ServiceDescription
                                }
                        }
 
                                }
                        }
 
-                       std::pair<std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator, bool> i = m_new_services.insert(std::pair<eServiceReferenceDVB, ePtr<eDVBService> >(ref, service));
+                       std::pair<std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator, bool> i =
+                               m_new_services.insert(std::pair<eServiceReferenceDVB, ePtr<eDVBService> >(ref, service));
 
                        if (i.second)
                        {
 
                        if (i.second)
                        {