+ for (m_pmt_in_progress = m_pmts_to_read.begin(); m_pmt_in_progress != m_pmts_to_read.end();)
+ {
+ int type;
+ eServiceReferenceDVB ref;
+ ePtr<eDVBService> service = new eDVBService;
+
+ if (!m_chid_current)
+ {
+ unsigned long hash = 0;
+
+ m_ch_current->getHash(hash);
+
+ m_chid_current = eDVBChannelID(
+ buildNamespace(eOriginalNetworkID(0), m_pat_tsid, hash),
+ m_pat_tsid, eOriginalNetworkID(0));
+ }
+
+ if (m_pmt_in_progress->second.serviceType == 1)
+ SCAN_eDebug("SID %04x is VIDEO", m_pmt_in_progress->first);
+ else if (m_pmt_in_progress->second.serviceType == 2)
+ SCAN_eDebug("SID %04x is AUDIO", m_pmt_in_progress->first);
+ else
+ SCAN_eDebug("SID %04x is DATA", m_pmt_in_progress->first);
+
+ ref.set(m_chid_current);
+ ref.setServiceID(m_pmt_in_progress->first);
+ ref.setServiceType(m_pmt_in_progress->second.serviceType);
+
+ if (!m_ch_current->getSystem(type))
+ {
+ char sname[255];
+ char pname[255];
+ memset(pname, 0, sizeof(pname));
+ memset(sname, 0, sizeof(sname));
+ switch(type)
+ {
+ case iDVBFrontend::feSatellite:
+ {
+ eDVBFrontendParametersSatellite parm;
+ m_ch_current->getDVBS(parm);
+ snprintf(sname, 255, "%d%c SID 0x%02x",
+ parm.frequency/1000,
+ parm.polarisation ? 'V' : 'H',
+ m_pmt_in_progress->first);
+ snprintf(pname, 255, "%s %s %d%c %d.%d°%c",
+ parm.system ? "DVB-S2" : "DVB-S",
+ parm.modulation == 1 ? "QPSK" : "8PSK",
+ parm.frequency/1000,
+ parm.polarisation ? 'V' : 'H',
+ parm.orbital_position/10,
+ parm.orbital_position%10,
+ parm.orbital_position > 0 ? 'E' : 'W');
+ break;
+ }
+ 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);
+ 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:
+ {
+ eDVBFrontendParametersCable parm;
+ m_ch_current->getDVBC(parm);
+ snprintf(sname, 255, "%d SID 0x%02x",
+ parm.frequency/1000,
+ m_pmt_in_progress->first);
+ break;
+ }
+ }
+ SCAN_eDebug("name '%s', provider_name '%s'", sname, pname);
+ service->m_service_name = convertDVBUTF8(sname);
+ service->genSortName();
+ service->m_provider_name = convertDVBUTF8(pname);
+ }
+
+ 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));
+ if (i.second)
+ {
+ m_last_service = i.first;
+ m_event(evtNewService);
+ }
+ }
+ else
+ SCAN_eDebug("dont add... is scrambled!");
+ m_pmts_to_read.erase(m_pmt_in_progress++);
+ }
+