zapit/src/scan.cpp: prefer logical numbers from hd descriptors

Origin commit data
------------------
Commit: 630d9892e5
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-05-14 (Mon, 14 May 2012)
This commit is contained in:
[CST] Focus
2012-05-14 15:24:01 +04:00
parent 91a0084089
commit ee5a6fd94a

View File

@@ -220,6 +220,7 @@ bool CServiceScan::ReadNitSdt(t_satellite_position satellitePosition)
#endif #endif
std::string networkName; std::string networkName;
channel_number_map_t nit_logical_map; channel_number_map_t nit_logical_map;
channel_number_map_t nit_hd_logical_map;
_repeat: _repeat:
found_transponders += scantransponders.size(); found_transponders += scantransponders.size();
CZapit::getInstance()->SendEvent ( CZapitClient::EVT_SCAN_NUM_TRANSPONDERS, CZapit::getInstance()->SendEvent ( CZapitClient::EVT_SCAN_NUM_TRANSPONDERS,
@@ -286,6 +287,8 @@ _repeat:
networkName = nit.GetNetworkName(); networkName = nit.GetNetworkName();
channel_number_map_t &lcn = nit.getLogicalMap(); channel_number_map_t &lcn = nit.getLogicalMap();
nit_logical_map.insert(lcn.begin(), lcn.end()); nit_logical_map.insert(lcn.begin(), lcn.end());
channel_number_map_t &hdlcn = nit.getHDLogicalMap();
nit_hd_logical_map.insert(hdlcn.begin(), hdlcn.end());
} }
#ifdef USE_BAT #ifdef USE_BAT
@@ -320,7 +323,8 @@ _repeat:
if (flags & (SCAN_NIT/*|SCAN_LOGICAL_NUMBERS*/) && !nit_logical_map.empty()) { if (flags & (SCAN_NIT/*|SCAN_LOGICAL_NUMBERS*/) && !nit_logical_map.empty()) {
std::string pname = networkName; std::string pname = networkName;
INFO("network [%s] %d logical channels\n", pname.c_str(), nit_logical_map.size()); INFO("network [%s] %d logical channels (%d hd)\n", pname.c_str(), nit_logical_map.size(), nit_hd_logical_map.size());
CServiceManager::getInstance()->ResetChannelNumbers(true, true);
g_bouquetManager->loadBouquets(true); g_bouquetManager->loadBouquets(true);
CZapitBouquet* bouquet; CZapitBouquet* bouquet;
int bouquetId = g_bouquetManager->existsUBouquet(pname.c_str()); int bouquetId = g_bouquetManager->existsUBouquet(pname.c_str());
@@ -329,11 +333,21 @@ _repeat:
else else
bouquet = g_bouquetManager->Bouquets[bouquetId]; bouquet = g_bouquetManager->Bouquets[bouquetId];
for(channel_number_map_t::iterator cit = nit_hd_logical_map.begin(); cit != nit_hd_logical_map.end(); ++cit) {
//nit_logical_map.erase(cit->first);
CZapitChannel * channel = CServiceManager::getInstance()->FindChannel48(cit->first);
if (channel) {
channel->number = cit->second;
if (!bouquet->getChannelByChannelID(channel->getChannelID()))
bouquet->addService(channel);
}
}
for(channel_number_map_t::iterator cit = nit_logical_map.begin(); cit != nit_logical_map.end(); ++cit) { for(channel_number_map_t::iterator cit = nit_logical_map.begin(); cit != nit_logical_map.end(); ++cit) {
CZapitChannel * channel = CServiceManager::getInstance()->FindChannel48(cit->first); CZapitChannel * channel = CServiceManager::getInstance()->FindChannel48(cit->first);
if(channel && !bouquet->getChannelByChannelID(channel->getChannelID())) { if (channel && !channel->number) {
channel->number = cit->second; channel->number = cit->second;
bouquet->addService(channel); if (!bouquet->getChannelByChannelID(channel->getChannelID()))
bouquet->addService(channel);
} }
} }
bouquet->sortBouquetByNumber(); bouquet->sortBouquetByNumber();