driver/scanepg.cpp: fix wrong favorites adding in bouquet mode;

fix current bouquet check in case channel mode is changed;
save/restore live channel id in standby scan
This commit is contained in:
[CST] Focus
2013-10-11 17:03:01 +04:00
parent 857514a8cd
commit 3686c86232
2 changed files with 15 additions and 9 deletions

View File

@@ -43,11 +43,9 @@ extern CBouquetList * TVfavList;
CEpgScan::CEpgScan() CEpgScan::CEpgScan()
{ {
current_bnum = -1;
next_chid = 0;
current_mode = 0; current_mode = 0;
allfav_done = false;
standby = false; standby = false;
Clear();
} }
CEpgScan::~CEpgScan() CEpgScan::~CEpgScan()
@@ -66,6 +64,7 @@ void CEpgScan::Clear()
{ {
scanmap.clear(); scanmap.clear();
current_bnum = -1; current_bnum = -1;
current_bmode = -1;
next_chid = 0; next_chid = 0;
allfav_done = false; allfav_done = false;
} }
@@ -87,7 +86,7 @@ void CEpgScan::AddBouquet(CChannelList * clist)
bool CEpgScan::AddFavorites() bool CEpgScan::AddFavorites()
{ {
INFO("allfav_done: %d", allfav_done); INFO("allfav_done: %d", allfav_done);
if (allfav_done) if ((g_settings.epg_scan != 2) || allfav_done)
return false; return false;
allfav_done = true; allfav_done = true;
@@ -114,16 +113,19 @@ void CEpgScan::AddTransponders()
int mode = CNeutrinoApp::getInstance()->GetChannelMode(); int mode = CNeutrinoApp::getInstance()->GetChannelMode();
if ((g_settings.epg_scan == 1) || (mode == LIST_MODE_FAV)) { if ((g_settings.epg_scan == 1) || (mode == LIST_MODE_FAV)) {
/* current bouquet mode */ /* current bouquet mode */
if (current_bmode != mode) {
current_bmode = mode;
current_bnum = -1;
}
if (current_bnum != bouquetList->getActiveBouquetNumber()) { if (current_bnum != bouquetList->getActiveBouquetNumber()) {
allfav_done = false; allfav_done = false;
scanmap.clear(); scanmap.clear();
current_bnum = bouquetList->getActiveBouquetNumber(); current_bnum = bouquetList->getActiveBouquetNumber();
AddBouquet(bouquetList->Bouquets[current_bnum]->channelList); AddBouquet(bouquetList->Bouquets[current_bnum]->channelList);
INFO("EVT_ZAP_COMPLETE, scan map size: %d\n", scanmap.size()); INFO("Added bouquet #%d, scan map size: %d", current_bnum, scanmap.size());
} }
} else { } else {
AddFavorites(); AddFavorites();
INFO("EVT_ZAP_COMPLETE, scan map size: %d\n", scanmap.size());
} }
} }
@@ -132,6 +134,7 @@ void CEpgScan::StartStandby()
if (!g_settings.epg_scan) if (!g_settings.epg_scan)
return; return;
live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
AddTransponders(); AddTransponders();
INFO("starting standby scan, scan map size: %d", scanmap.size()); INFO("starting standby scan, scan map size: %d", scanmap.size());
if (!scanmap.empty()) { if (!scanmap.empty()) {
@@ -147,6 +150,7 @@ void CEpgScan::StopStandby()
INFO("stopping standby scan..."); INFO("stopping standby scan...");
standby = false; standby = false;
CZapit::getInstance()->SetCurrentChannelID(live_channel_id);
} }
void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data) void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
@@ -157,6 +161,7 @@ void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
CZapitChannel * newchan; CZapitChannel * newchan;
if(msg == NeutrinoMessages::EVT_ZAP_COMPLETE) { if(msg == NeutrinoMessages::EVT_ZAP_COMPLETE) {
AddTransponders(); AddTransponders();
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;
@@ -195,6 +200,7 @@ void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
void CEpgScan::EnterStandby() void CEpgScan::EnterStandby()
{ {
if (standby) { if (standby) {
CZapit::getInstance()->SetCurrentChannelID(live_channel_id);
g_Zapit->setStandby(true); g_Zapit->setStandby(true);
g_Sectionsd->setPauseScanning(true); g_Sectionsd->setPauseScanning(true);
} }
@@ -220,8 +226,6 @@ void CEpgScan::Next()
return; return;
} }
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
/* executed in neutrino thread - possible race with locks in zapit zap NOWAIT : /* executed in neutrino thread - possible race with locks in zapit zap NOWAIT :
send zapTo_NOWAIT -> EIT_COMPLETE from sectionsd -> zap and this at the same time send zapTo_NOWAIT -> EIT_COMPLETE from sectionsd -> zap and this at the same time
*/ */
@@ -240,7 +244,7 @@ void CEpgScan::Next()
_repeat: _repeat:
for (eit_scanmap_iterator_t it = scanmap.begin(); it != scanmap.end(); /* ++it*/) { for (eit_scanmap_iterator_t it = scanmap.begin(); it != scanmap.end(); /* ++it*/) {
CZapitChannel * newchan = CServiceManager::getInstance()->FindChannel(it->second); CZapitChannel * newchan = CServiceManager::getInstance()->FindChannel(it->second);
if ((newchan == NULL) || SAME_TRANSPONDER(live_channel_id, newchan->getChannelID())) { if (newchan == NULL) {
scanmap.erase(it++); scanmap.erase(it++);
continue; continue;
} }

View File

@@ -31,10 +31,12 @@ class CEpgScan
private: private:
int current_bnum; int current_bnum;
int current_mode; int current_mode;
int current_bmode;
bool allfav_done; bool allfav_done;
bool standby; bool standby;
eit_scanmap_t scanmap; eit_scanmap_t scanmap;
t_channel_id next_chid; t_channel_id next_chid;
t_channel_id live_channel_id;
std::set<transponder_id_t> scanned; std::set<transponder_id_t> scanned;
void AddBouquet(CChannelList * clist); void AddBouquet(CChannelList * clist);
bool AddFavorites(); bool AddFavorites();