mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
getservices: fix FindChannelFuzzy()
* for services with duplicate tsid/onid/sid, not all channels were found (function returned NULL if the first match was not the correct one) * add compatibility with "wrong" ubouquets.xml for non-sat boxes: the position parameter was ignored before and is not too useful outside sat anyway
This commit is contained in:
@@ -223,15 +223,27 @@ CZapitChannel * CServiceManager::FindChannel48(const t_channel_id channel_id)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: those FindChannel* functions are naive at best. By using a different construction
|
||||||
|
* scheme for the channel_id,they could easily be made much more efficient. Side effects would
|
||||||
|
* need to be checked first, though */
|
||||||
CZapitChannel* CServiceManager::FindChannelFuzzy(const t_channel_id channel_id,
|
CZapitChannel* CServiceManager::FindChannelFuzzy(const t_channel_id channel_id,
|
||||||
const t_satellite_position pos, const freq_id_t freq)
|
const t_satellite_position pos, const freq_id_t freq)
|
||||||
{
|
{
|
||||||
CZapitChannel *ret;
|
for (channel_map_iterator_t it = allchans.begin(); it != allchans.end(); ++it) {
|
||||||
ret = FindChannel48(channel_id);
|
CZapitChannel *ret = &it->second;
|
||||||
if (!ret || !(pos == ret->getSatellitePosition()))
|
if ((ret->getChannelID() & 0xFFFFFFFFFFFFULL) != (channel_id & 0xFFFFFFFFFFFFULL))
|
||||||
return NULL;
|
continue;
|
||||||
if (abs((int)ret->getFreqId() - (int)freq) < 3)
|
/* use position only on SAT boxes.
|
||||||
return ret;
|
* Cable/terr does not need thix: There usually is no second cable provider
|
||||||
|
* to choose from and people are wondering why their ubouquets are no longer
|
||||||
|
* working => because they had the wrong 's="x"' attribute.
|
||||||
|
* TODO: think about mixed-mode (sat/cable/terrestrial) operation */
|
||||||
|
if (frontendType == FE_QPSK && pos != ret->getSatellitePosition())
|
||||||
|
continue;
|
||||||
|
/* match +-2MHz to make old ubouquets work with updated satellites.xml */
|
||||||
|
if (abs((int)ret->getFreqId() - (int)freq) < 3)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user