zapit: consider sat pos in FindChannel48Pos()

Origin commit data
------------------
Branch: ni/coolstream
Commit: f1c60b376f
Author: TangoCash <eric@loxat.de>
Date: 2023-12-04 (Mon, 04 Dec 2023)

Origin message was:
------------------
- zapit: consider sat pos in FindChannel48Pos()

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
TangoCash
2023-12-04 22:51:06 +01:00
committed by vanhofen
parent b38647eff4
commit 60172157c6
3 changed files with 16 additions and 1 deletions

View File

@@ -473,7 +473,7 @@ bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid, CFro
if (sscanf(bp, "%X:0:%X:%X:%X:%X:%X:0:0:0:", &service, &i1, &i2, &i3, &i4, &satpos) == 6)
{
tmpid = (((t_channel_id)i3) << 32) | (((t_channel_id)i4) << 16) | (t_channel_id)i2;
tmp_channel = CServiceManager::getInstance()->FindChannel48(tmpid);
tmp_channel = CServiceManager::getInstance()->FindChannel48Pos(tmpid, satpos >> 16);
if (tmp_channel)
{
printf("CStreamManager::Parse:E: channel_id %" PRIx64 " [%s] \n", tmp_channel->getChannelID(), tmp_channel->getName().c_str());

View File

@@ -131,6 +131,8 @@ class CServiceManager
CZapitChannel* FindChannelByPattern(std::string pattern); //NI
CZapitChannel* FindCurrentChannel(const t_channel_id channel_id);
CZapitChannel* FindChannel48(const t_channel_id channel_id);
CZapitChannel* FindChannel48Pos(const t_channel_id channel_id,
const t_satellite_position pos);
CZapitChannel* FindChannelFuzzy(const t_channel_id channel_id,
const t_satellite_position pos, const freq_id_t freq);

View File

@@ -250,6 +250,19 @@ CZapitChannel * CServiceManager::FindChannel48(const t_channel_id channel_id)
return NULL;
}
CZapitChannel* CServiceManager::FindChannel48Pos(const t_channel_id channel_id,
const t_satellite_position pos)
{
for (channel_map_iterator_t it = allchans.begin(); it != allchans.end(); ++it) {
CZapitChannel *ret = &it->second;
if ((ret->getChannelID() & 0xFFFFFFFFFFFFULL) != (channel_id & 0xFFFFFFFFFFFFULL))
continue;
if (pos == ret->getSatellitePosition())
return ret;
}
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 */