diff --git a/lib/xmltree/xmlparse.cpp b/lib/xmltree/xmlparse.cpp index 95643c609..d0a531824 100644 --- a/lib/xmltree/xmlparse.cpp +++ b/lib/xmltree/xmlparse.cpp @@ -392,7 +392,8 @@ long XML_Parser::GetCurrentByteIndex() int XML_Parser::GetCurrentLineNumber() { - if (eventPtr) + /* at EOF positionPtr point to input, while eventPtr not updated -- focus */ + if (eventPtr && (positionPtr < eventPtr)) { XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); positionPtr=eventPtr; diff --git a/src/zapit/include/zapit/scannit.h b/src/zapit/include/zapit/scannit.h index 3dadda3ab..39e70ee37 100644 --- a/src/zapit/include/zapit/scannit.h +++ b/src/zapit/include/zapit/scannit.h @@ -45,6 +45,7 @@ class CNit : public OpenThreads::Thread freq_id_t freq_id; unsigned short nid; channel_number_map_t logical_map; + channel_number_map_t hd_logical_map; std::string networkName; NetworkInformationSectionList sections; @@ -54,7 +55,7 @@ class CNit : public OpenThreads::Thread bool ParseSatelliteDescriptor(SatelliteDeliverySystemDescriptor * sd, TransportStreamInfo * ts); bool ParseCableDescriptor(CableDeliverySystemDescriptor * sd, TransportStreamInfo * ts); bool ParseServiceList(ServiceListDescriptor * sd, TransportStreamInfo * ts); - bool ParseLogicalChannels(LogicalChannelDescriptor * ld, TransportStreamInfo * ts); + bool ParseLogicalChannels(LogicalChannelDescriptor * ld, TransportStreamInfo * ts, bool hd = false); public: CNit(t_satellite_position spos, freq_id_t frq, unsigned short pnid, int dnum = 0); @@ -63,6 +64,7 @@ class CNit : public OpenThreads::Thread bool Stop(); bool Parse(); channel_number_map_t & getLogicalMap() { return logical_map; }; + channel_number_map_t & getHDLogicalMap() { return hd_logical_map; }; std::string GetNetworkName() { return networkName; } }; diff --git a/src/zapit/src/frontend.cpp b/src/zapit/src/frontend.cpp index ef747a565..42d8fb60c 100644 --- a/src/zapit/src/frontend.cpp +++ b/src/zapit/src/frontend.cpp @@ -860,7 +860,7 @@ void CFrontend::sendDiseqcCommand(const struct dvb_diseqc_master_cmd *cmd, const for (int i = 0; i < cmd->msg_len; i++) printf("0x%X ", cmd->msg[i]); printf("\n"); - if(slave) + if (slave || info.type != FE_QPSK) return; if (fop(ioctl, FE_DISEQC_SEND_MASTER_CMD, cmd) == 0) usleep(1000 * ms); @@ -873,6 +873,8 @@ uint32_t CFrontend::getDiseqcReply(const int /*timeout_ms*/) const void CFrontend::sendToneBurst(const fe_sec_mini_cmd_t burst, const uint32_t ms) { + if (slave || info.type != FE_QPSK) + return; if (fop(ioctl, FE_DISEQC_SEND_BURST, burst) == 0) usleep(1000 * ms); } @@ -1065,17 +1067,19 @@ uint32_t CFrontend::sendEN50494TuningCommand(const uint32_t frequency, const int unsigned int t = (frequency / 1000 + bpf + 2) / 4 - 350; if (t < 1024 && config.uni_scr >= 0 && config.uni_scr < 8) { - fprintf(stderr, "VOLT18=%d TONE_ON=%d, freq=%d bpf=%d ret=%d\n", currentVoltage == SEC_VOLTAGE_18, currentToneMode == SEC_TONE_ON, frequency, bpf, (t + 350) * 4000 - frequency); - cmd.msg[3] = (t >> 8) | /* highest 3 bits of t */ - (config.uni_scr << 5) | /* adress */ - (bank << 4) | /* not implemented yet */ - (horizontal << 3) | /* horizontal == 0x08 */ - (high_band) << 2; /* high_band == 0x04 */ - cmd.msg[4] = t & 0xFF; - fop(ioctl, FE_SET_VOLTAGE, SEC_VOLTAGE_18); - usleep(15 * 1000); /* en50494 says: >4ms and < 22 ms */ - sendDiseqcCommand(&cmd, 50); /* en50494 says: >2ms and < 60 ms */ - fop(ioctl, FE_SET_VOLTAGE, SEC_VOLTAGE_13); + INFO("VOLT18=%d TONE_ON=%d, freq=%d bpf=%d ret=%d", currentVoltage == SEC_VOLTAGE_18, currentToneMode == SEC_TONE_ON, frequency, bpf, (t + 350) * 4000 - frequency); + if (!slave && info.type == FE_QPSK) { + cmd.msg[3] = (t >> 8) | /* highest 3 bits of t */ + (config.uni_scr << 5) | /* adress */ + (bank << 4) | /* not implemented yet */ + (horizontal << 3) | /* horizontal == 0x08 */ + (high_band) << 2; /* high_band == 0x04 */ + cmd.msg[4] = t & 0xFF; + fop(ioctl, FE_SET_VOLTAGE, SEC_VOLTAGE_18); + usleep(15 * 1000); /* en50494 says: >4ms and < 22 ms */ + sendDiseqcCommand(&cmd, 50); /* en50494 says: >2ms and < 60 ms */ + fop(ioctl, FE_SET_VOLTAGE, SEC_VOLTAGE_13); + } return (t + 350) * 4000 - frequency; } WARN("ooops. t > 1024? (%d) or uni_scr out of range? (%d)", t, config.uni_scr); diff --git a/src/zapit/src/scan.cpp b/src/zapit/src/scan.cpp index d081ff859..bc4084eb8 100644 --- a/src/zapit/src/scan.cpp +++ b/src/zapit/src/scan.cpp @@ -220,6 +220,7 @@ bool CServiceScan::ReadNitSdt(t_satellite_position satellitePosition) #endif std::string networkName; channel_number_map_t nit_logical_map; + channel_number_map_t nit_hd_logical_map; _repeat: found_transponders += scantransponders.size(); CZapit::getInstance()->SendEvent ( CZapitClient::EVT_SCAN_NUM_TRANSPONDERS, @@ -286,6 +287,8 @@ _repeat: networkName = nit.GetNetworkName(); channel_number_map_t &lcn = nit.getLogicalMap(); 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 @@ -320,7 +323,8 @@ _repeat: if (flags & (SCAN_NIT/*|SCAN_LOGICAL_NUMBERS*/) && !nit_logical_map.empty()) { 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); CZapitBouquet* bouquet; int bouquetId = g_bouquetManager->existsUBouquet(pname.c_str()); @@ -329,11 +333,21 @@ _repeat: else 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) { CZapitChannel * channel = CServiceManager::getInstance()->FindChannel48(cit->first); - if(channel && !bouquet->getChannelByChannelID(channel->getChannelID())) { + if (channel && !channel->number) { channel->number = cit->second; - bouquet->addService(channel); + if (!bouquet->getChannelByChannelID(channel->getChannelID())) + bouquet->addService(channel); } } bouquet->sortBouquetByNumber(); diff --git a/src/zapit/src/scannit.cpp b/src/zapit/src/scannit.cpp index 072d0a1eb..6cd1986fa 100644 --- a/src/zapit/src/scannit.cpp +++ b/src/zapit/src/scannit.cpp @@ -259,6 +259,10 @@ bool CNit::Parse() if(pdsd == 0x00000028) ParseLogicalChannels((LogicalChannelDescriptor *) d, tsinfo); break; + case HD_SIMULCAST_LOGICAL_CHANNEL_DESCRIPTOR: + if(pdsd == 0x00000028) + ParseLogicalChannels((LogicalChannelDescriptor *) d, tsinfo, true); + break; default: { #ifdef DEBUG_NIT_UNUSED @@ -359,7 +363,7 @@ bool CNit::ParseServiceList(ServiceListDescriptor * sd, TransportStreamInfo * ts return true; } -bool CNit::ParseLogicalChannels(LogicalChannelDescriptor * ld, TransportStreamInfo * tsinfo) +bool CNit::ParseLogicalChannels(LogicalChannelDescriptor * ld, TransportStreamInfo * tsinfo, bool hd) { t_transport_stream_id transport_stream_id = tsinfo->getTransportStreamId(); t_original_network_id original_network_id = tsinfo->getOriginalNetworkId(); @@ -373,10 +377,14 @@ bool CNit::ParseLogicalChannels(LogicalChannelDescriptor * ld, TransportStreamIn transport_stream_id, original_network_id, service_id); int visible = (*it)->getVisibleServiceFlag(); #ifdef DEBUG_LCN - printf("NIT: logical channel tsid %04x onid %04x %012llx -> %d (%d)\n", transport_stream_id, original_network_id, channel_id, lcn, visible); + printf("NIT: logical channel tsid %04x onid %04x %012llx -> %d (%s, %d)\n", transport_stream_id, original_network_id, channel_id, lcn, hd ? "hd", : "sd", visible); #endif - if (visible && lcn) - logical_map[channel_id] = lcn; + if (visible && lcn) { + if(hd) + hd_logical_map[channel_id] = lcn; + else + logical_map[channel_id] = lcn; + } } return true; }