From 60172157c6c045921ea1870f49aba29468e9128b Mon Sep 17 00:00:00 2001 From: TangoCash Date: Mon, 4 Dec 2023 22:51:06 +0100 Subject: [PATCH] zapit: consider sat pos in FindChannel48Pos() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f1c60b376f596ea4130c625df5766f915e4de275 Author: TangoCash 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 --- src/driver/streamts.cpp | 2 +- src/zapit/include/zapit/getservices.h | 2 ++ src/zapit/src/getservices.cpp | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index 7c24f3ab4..a216f1552 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -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()); diff --git a/src/zapit/include/zapit/getservices.h b/src/zapit/include/zapit/getservices.h index 4230200bf..15fbabf01 100644 --- a/src/zapit/include/zapit/getservices.h +++ b/src/zapit/include/zapit/getservices.h @@ -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); diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index cc26ee5d7..4d9a74937 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -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 */