driver/scanepg.cpp: add support to scan all favorites

This commit is contained in:
[CST] Focus
2013-10-02 15:29:38 +04:00
parent 30c7010c6b
commit 3ccd5cca68
2 changed files with 35 additions and 13 deletions

View File

@@ -38,11 +38,13 @@
#include <driver/scanepg.h> #include <driver/scanepg.h>
extern CBouquetList * bouquetList; extern CBouquetList * bouquetList;
extern CBouquetList * TVfavList;
CEpgScan::CEpgScan() CEpgScan::CEpgScan()
{ {
current_bnum = -1; current_bnum = -1;
next_chid = 0; next_chid = 0;
current_mode = 0;
} }
CEpgScan::~CEpgScan() CEpgScan::~CEpgScan()
@@ -74,12 +76,17 @@ void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
if(bouquetList->Bouquets.empty()) if(bouquetList->Bouquets.empty())
return; return;
if (current_mode != g_settings.epg_scan) {
current_mode = g_settings.epg_scan;
Clear();
}
if (g_settings.epg_scan == 1) {
/* current bouquet mode */
if (current_bnum != bouquetList->getActiveBouquetNumber()) { if (current_bnum != bouquetList->getActiveBouquetNumber()) {
scanmap.clear(); scanmap.clear();
current_bnum = bouquetList->getActiveBouquetNumber(); current_bnum = bouquetList->getActiveBouquetNumber();
CChannelList * clist = bouquetList->Bouquets[current_bnum]->channelList; CChannelList * clist = bouquetList->Bouquets[current_bnum]->channelList;
int lsize = clist->Size(); for (unsigned i = 0; i < clist->Size(); i++) {
for (int i = 0; i < lsize; i++) {
CZapitChannel * chan = clist->getChannelFromIndex(i); CZapitChannel * chan = clist->getChannelFromIndex(i);
/* TODO: add interval check to clear scanned ? */ /* TODO: add interval check to clear scanned ? */
if (scanned.find(chan->getTransponderId()) == scanned.end()) if (scanned.find(chan->getTransponderId()) == scanned.end())
@@ -87,6 +94,20 @@ void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
} }
INFO("EVT_ZAP_COMPLETE, scan map size: %d\n", scanmap.size()); INFO("EVT_ZAP_COMPLETE, scan map size: %d\n", scanmap.size());
} }
} else {
/* all favorites mode */
if (scanmap.empty()) {
for (unsigned j = 0; j < TVfavList->Bouquets.size(); ++j) {
CChannelList * clist = TVfavList->Bouquets[j]->channelList;
for (unsigned i = 0; i < clist->Size(); i++) {
CZapitChannel * chan = clist->getChannelFromIndex(i);
if (scanned.find(chan->getTransponderId()) == scanned.end())
scanmap.insert(eit_scanmap_pair_t(chan->getTransponderId(), chan->getChannelID()));
}
}
INFO("EVT_ZAP_COMPLETE, scan map size: %d\n", scanmap.size());
}
}
} }
else if (msg == NeutrinoMessages::EVT_EIT_COMPLETE) { else if (msg == NeutrinoMessages::EVT_EIT_COMPLETE) {
t_channel_id chid = *(t_channel_id *)data; t_channel_id chid = *(t_channel_id *)data;

View File

@@ -30,6 +30,7 @@ class CEpgScan
{ {
private: private:
int current_bnum; int current_bnum;
int current_mode;
eit_scanmap_t scanmap; eit_scanmap_t scanmap;
t_channel_id next_chid; t_channel_id next_chid;
std::set<transponder_id_t> scanned; std::set<transponder_id_t> scanned;