Merge branch 'dvbsi++' of coolstreamtech.de:cst-public-gui-neutrino into dvbsi++

This commit is contained in:
[CST] Bas
2012-05-14 23:57:50 +08:00
5 changed files with 50 additions and 21 deletions

View File

@@ -392,7 +392,8 @@ long XML_Parser::GetCurrentByteIndex()
int XML_Parser::GetCurrentLineNumber() 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); XmlUpdatePosition(encoding, positionPtr, eventPtr, &position);
positionPtr=eventPtr; positionPtr=eventPtr;

View File

@@ -45,6 +45,7 @@ class CNit : public OpenThreads::Thread
freq_id_t freq_id; freq_id_t freq_id;
unsigned short nid; unsigned short nid;
channel_number_map_t logical_map; channel_number_map_t logical_map;
channel_number_map_t hd_logical_map;
std::string networkName; std::string networkName;
NetworkInformationSectionList sections; NetworkInformationSectionList sections;
@@ -54,7 +55,7 @@ class CNit : public OpenThreads::Thread
bool ParseSatelliteDescriptor(SatelliteDeliverySystemDescriptor * sd, TransportStreamInfo * ts); bool ParseSatelliteDescriptor(SatelliteDeliverySystemDescriptor * sd, TransportStreamInfo * ts);
bool ParseCableDescriptor(CableDeliverySystemDescriptor * sd, TransportStreamInfo * ts); bool ParseCableDescriptor(CableDeliverySystemDescriptor * sd, TransportStreamInfo * ts);
bool ParseServiceList(ServiceListDescriptor * 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: public:
CNit(t_satellite_position spos, freq_id_t frq, unsigned short pnid, int dnum = 0); 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 Stop();
bool Parse(); bool Parse();
channel_number_map_t & getLogicalMap() { return logical_map; }; channel_number_map_t & getLogicalMap() { return logical_map; };
channel_number_map_t & getHDLogicalMap() { return hd_logical_map; };
std::string GetNetworkName() { return networkName; } std::string GetNetworkName() { return networkName; }
}; };

View File

@@ -860,7 +860,7 @@ void CFrontend::sendDiseqcCommand(const struct dvb_diseqc_master_cmd *cmd, const
for (int i = 0; i < cmd->msg_len; i++) for (int i = 0; i < cmd->msg_len; i++)
printf("0x%X ", cmd->msg[i]); printf("0x%X ", cmd->msg[i]);
printf("\n"); printf("\n");
if(slave) if (slave || info.type != FE_QPSK)
return; return;
if (fop(ioctl, FE_DISEQC_SEND_MASTER_CMD, cmd) == 0) if (fop(ioctl, FE_DISEQC_SEND_MASTER_CMD, cmd) == 0)
usleep(1000 * ms); 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) 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) if (fop(ioctl, FE_DISEQC_SEND_BURST, burst) == 0)
usleep(1000 * ms); 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; unsigned int t = (frequency / 1000 + bpf + 2) / 4 - 350;
if (t < 1024 && config.uni_scr >= 0 && config.uni_scr < 8) 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); 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);
cmd.msg[3] = (t >> 8) | /* highest 3 bits of t */ if (!slave && info.type == FE_QPSK) {
(config.uni_scr << 5) | /* adress */ cmd.msg[3] = (t >> 8) | /* highest 3 bits of t */
(bank << 4) | /* not implemented yet */ (config.uni_scr << 5) | /* adress */
(horizontal << 3) | /* horizontal == 0x08 */ (bank << 4) | /* not implemented yet */
(high_band) << 2; /* high_band == 0x04 */ (horizontal << 3) | /* horizontal == 0x08 */
cmd.msg[4] = t & 0xFF; (high_band) << 2; /* high_band == 0x04 */
fop(ioctl, FE_SET_VOLTAGE, SEC_VOLTAGE_18); cmd.msg[4] = t & 0xFF;
usleep(15 * 1000); /* en50494 says: >4ms and < 22 ms */ fop(ioctl, FE_SET_VOLTAGE, SEC_VOLTAGE_18);
sendDiseqcCommand(&cmd, 50); /* en50494 says: >2ms and < 60 ms */ usleep(15 * 1000); /* en50494 says: >4ms and < 22 ms */
fop(ioctl, FE_SET_VOLTAGE, SEC_VOLTAGE_13); sendDiseqcCommand(&cmd, 50); /* en50494 says: >2ms and < 60 ms */
fop(ioctl, FE_SET_VOLTAGE, SEC_VOLTAGE_13);
}
return (t + 350) * 4000 - frequency; return (t + 350) * 4000 - frequency;
} }
WARN("ooops. t > 1024? (%d) or uni_scr out of range? (%d)", t, config.uni_scr); WARN("ooops. t > 1024? (%d) or uni_scr out of range? (%d)", t, config.uni_scr);

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();

View File

@@ -259,6 +259,10 @@ bool CNit::Parse()
if(pdsd == 0x00000028) if(pdsd == 0x00000028)
ParseLogicalChannels((LogicalChannelDescriptor *) d, tsinfo); ParseLogicalChannels((LogicalChannelDescriptor *) d, tsinfo);
break; break;
case HD_SIMULCAST_LOGICAL_CHANNEL_DESCRIPTOR:
if(pdsd == 0x00000028)
ParseLogicalChannels((LogicalChannelDescriptor *) d, tsinfo, true);
break;
default: default:
{ {
#ifdef DEBUG_NIT_UNUSED #ifdef DEBUG_NIT_UNUSED
@@ -359,7 +363,7 @@ bool CNit::ParseServiceList(ServiceListDescriptor * sd, TransportStreamInfo * ts
return true; 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_transport_stream_id transport_stream_id = tsinfo->getTransportStreamId();
t_original_network_id original_network_id = tsinfo->getOriginalNetworkId(); 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); transport_stream_id, original_network_id, service_id);
int visible = (*it)->getVisibleServiceFlag(); int visible = (*it)->getVisibleServiceFlag();
#ifdef DEBUG_LCN #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 #endif
if (visible && lcn) if (visible && lcn) {
logical_map[channel_id] = lcn; if(hd)
hd_logical_map[channel_id] = lcn;
else
logical_map[channel_id] = lcn;
}
} }
return true; return true;
} }