From c00f7315677296c83bce237fc6087dd07f22ec4e Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 13 Mar 2014 15:52:33 +0400 Subject: [PATCH] zapit/src/getservices.cpp: add code to remove channels for the given satellite position, current live channel skipped to prevent neutrino crashes Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/c5e1ab04e6b761aeee25a095d22552bf673a274d Author: [CST] Focus Date: 2014-03-13 (Thu, 13 Mar 2014) --- src/zapit/include/zapit/getservices.h | 1 + src/zapit/src/getservices.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/zapit/include/zapit/getservices.h b/src/zapit/include/zapit/getservices.h index 2dc1cd0dc..bfc4e0014 100644 --- a/src/zapit/include/zapit/getservices.h +++ b/src/zapit/include/zapit/getservices.h @@ -123,6 +123,7 @@ class CServiceManager void ResetChannelNumbers(bool bouquets = true, bool numbers = false); void RemoveChannel(const t_channel_id channel_id); + void RemovePosition(t_satellite_position satellitePosition); void RemoveAllChannels(); void RemoveCurrentChannels(); void RemoveNVODChannels(); diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index 289e2f67b..af134fa52 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -164,6 +164,21 @@ void CServiceManager::RemoveAllChannels() { allchans.clear(); } + +void CServiceManager::RemovePosition(t_satellite_position satellitePosition) +{ + INFO("delete %d, size before: %d", satellitePosition, allchans.size()); + t_channel_id live_id = CZapit::getInstance()->GetCurrentChannelID(); + for (channel_map_iterator_t it = allchans.begin(); it != allchans.end();) { + if (it->second.getSatellitePosition() == satellitePosition && live_id != it->first) + allchans.erase(it++); + else + ++it; + } + services_changed = true; + INFO("delete %d, size after: %d", satellitePosition, allchans.size()); +} + #if 0 //never used void CServiceManager::RemoveNVODChannels()