getservices: add FindChannelFuzzy() function

Add a function that returns a channel if tsid, onid, sid and
satellite position matches and the frequency matches +-2MHz.
(This frequency tolerance allows ubouquets to be used after
updates to satellites.xml)
This commit is contained in:
Stefan Seyfried
2013-01-29 21:01:35 +01:00
committed by micha-bbg
parent 1320462626
commit 536484f698
2 changed files with 16 additions and 0 deletions

View File

@@ -128,6 +128,8 @@ class CServiceManager
CZapitChannel* FindChannelByName(std::string name);
CZapitChannel* FindCurrentChannel(const t_channel_id channel_id);
CZapitChannel* FindChannel48(const t_channel_id channel_id);
CZapitChannel* FindChannelFuzzy(const t_channel_id channel_id,
const t_satellite_position pos, const freq_id_t freq);
std::string GetServiceName(t_channel_id channel_id);

View File

@@ -3,6 +3,8 @@
*
* (C) 2002, 2003 by Andreas Oberritter <obi@tuxbox.org>
*
* (C) 2007-2009, 2013 Stefan Seyfried
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -220,6 +222,18 @@ CZapitChannel * CServiceManager::FindChannel48(const t_channel_id channel_id)
return NULL;
}
CZapitChannel* CServiceManager::FindChannelFuzzy(const t_channel_id channel_id,
const t_satellite_position pos, const freq_id_t freq)
{
CZapitChannel *ret;
ret = FindChannel48(channel_id);
if (!ret || !(pos == ret->getSatellitePosition()))
return NULL;
if (abs((int)ret->getFreqId() - (int)freq) < 3)
return ret;
return NULL;
}
bool CServiceManager::GetAllRadioChannels(ZapitChannelList &list, int flags)
{
list.clear();