mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 08:21:07 +02:00
src/driver/scanepg.cpp: add support for standby epg scan;
block scan if recording is running;
experimental, needs more testing
Origin commit data
------------------
Commit: 201fb60262
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2013-10-10 (Thu, 10 Oct 2013)
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include <gui/channellist.h>
|
||||
|
||||
#include <driver/scanepg.h>
|
||||
#include <driver/record.h>
|
||||
|
||||
extern CBouquetList * bouquetList;
|
||||
extern CBouquetList * TVfavList;
|
||||
@@ -46,6 +47,7 @@ CEpgScan::CEpgScan()
|
||||
next_chid = 0;
|
||||
current_mode = 0;
|
||||
allfav_done = false;
|
||||
standby = false;
|
||||
}
|
||||
|
||||
CEpgScan::~CEpgScan()
|
||||
@@ -68,6 +70,11 @@ void CEpgScan::Clear()
|
||||
allfav_done = false;
|
||||
}
|
||||
|
||||
bool CEpgScan::Running()
|
||||
{
|
||||
return (g_settings.epg_scan && !scanmap.empty());
|
||||
}
|
||||
|
||||
void CEpgScan::AddBouquet(CChannelList * clist)
|
||||
{
|
||||
for (unsigned i = 0; i < clist->Size(); i++) {
|
||||
@@ -93,13 +100,8 @@ bool CEpgScan::AddFavorites()
|
||||
return (old_size != scanmap.size());
|
||||
}
|
||||
|
||||
void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
|
||||
void CEpgScan::AddTransponders()
|
||||
{
|
||||
if (!g_settings.epg_scan || CFEManager::getInstance()->getEnabledCount() <= 1)
|
||||
return;
|
||||
|
||||
CZapitChannel * newchan;
|
||||
if(msg == NeutrinoMessages::EVT_ZAP_COMPLETE) {
|
||||
if(bouquetList->Bouquets.empty())
|
||||
return;
|
||||
|
||||
@@ -124,6 +126,38 @@ void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
|
||||
INFO("EVT_ZAP_COMPLETE, scan map size: %d\n", scanmap.size());
|
||||
}
|
||||
}
|
||||
|
||||
void CEpgScan::StartStandby()
|
||||
{
|
||||
if (!g_settings.epg_scan)
|
||||
return;
|
||||
|
||||
AddTransponders();
|
||||
INFO("starting standby scan, scan map size: %d", scanmap.size());
|
||||
if (!scanmap.empty()) {
|
||||
standby = true;
|
||||
Next();
|
||||
}
|
||||
}
|
||||
|
||||
void CEpgScan::StopStandby()
|
||||
{
|
||||
if (!g_settings.epg_scan)
|
||||
return;
|
||||
|
||||
INFO("stopping standby scan...");
|
||||
standby = false;
|
||||
}
|
||||
|
||||
void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
|
||||
{
|
||||
if (!g_settings.epg_scan || (!standby && (CFEManager::getInstance()->getEnabledCount() <= 1)))
|
||||
return;
|
||||
|
||||
CZapitChannel * newchan;
|
||||
if(msg == NeutrinoMessages::EVT_ZAP_COMPLETE) {
|
||||
AddTransponders();
|
||||
}
|
||||
else if (msg == NeutrinoMessages::EVT_EIT_COMPLETE) {
|
||||
t_channel_id chid = *(t_channel_id *)data;
|
||||
newchan = CServiceManager::getInstance()->FindChannel(chid);
|
||||
@@ -142,8 +176,12 @@ void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
|
||||
newchan = CServiceManager::getInstance()->FindChannel(next_chid);
|
||||
if (newchan) {
|
||||
if(chid) {
|
||||
if (!CRecordManager::getInstance()->RecordingStatus()) {
|
||||
INFO("try to scan [%s]", newchan->getName().c_str());
|
||||
if (standby && !g_Sectionsd->getIsScanningActive())
|
||||
g_Sectionsd->setPauseScanning(false);
|
||||
g_Sectionsd->setServiceChanged(newchan->getChannelID(), false, newchan->getRecordDemux());
|
||||
}
|
||||
} else {
|
||||
INFO("tune failed [%s]", newchan->getName().c_str());
|
||||
scanmap.erase(newchan->getTransponderId());
|
||||
@@ -154,17 +192,33 @@ void CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data)
|
||||
}
|
||||
}
|
||||
|
||||
void CEpgScan::EnterStandby()
|
||||
{
|
||||
if (standby) {
|
||||
g_Zapit->setStandby(true);
|
||||
g_Sectionsd->setPauseScanning(true);
|
||||
}
|
||||
}
|
||||
|
||||
void CEpgScan::Next()
|
||||
{
|
||||
bool locked = false;
|
||||
|
||||
next_chid = 0;
|
||||
if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby)
|
||||
if (!g_settings.epg_scan)
|
||||
return;
|
||||
if (!standby && CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby)
|
||||
return;
|
||||
if (CRecordManager::getInstance()->RecordingStatus())
|
||||
return;
|
||||
|
||||
if (g_settings.epg_scan == 2 && scanmap.empty())
|
||||
AddFavorites();
|
||||
|
||||
if (scanmap.empty())
|
||||
if (scanmap.empty()) {
|
||||
EnterStandby();
|
||||
return;
|
||||
}
|
||||
|
||||
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
|
||||
|
||||
@@ -172,13 +226,17 @@ void CEpgScan::Next()
|
||||
send zapTo_NOWAIT -> EIT_COMPLETE from sectionsd -> zap and this at the same time
|
||||
*/
|
||||
CFEManager::getInstance()->Lock();
|
||||
CFrontend *live_fe = CZapit::getInstance()->GetLiveFrontend();
|
||||
CFrontend *live_fe, *pip_fe;
|
||||
if (!standby) {
|
||||
locked = true;
|
||||
live_fe = CZapit::getInstance()->GetLiveFrontend();
|
||||
CFEManager::getInstance()->lockFrontend(live_fe);
|
||||
#ifdef ENABLE_PIP
|
||||
CFrontend *pip_fe = CZapit::getInstance()->GetPipFrontend();
|
||||
pip_fe = CZapit::getInstance()->GetPipFrontend();
|
||||
if (pip_fe && pip_fe != live_fe)
|
||||
CFEManager::getInstance()->lockFrontend(pip_fe);
|
||||
#endif
|
||||
}
|
||||
_repeat:
|
||||
for (eit_scanmap_iterator_t it = scanmap.begin(); it != scanmap.end(); /* ++it*/) {
|
||||
CZapitChannel * newchan = CServiceManager::getInstance()->FindChannel(it->second);
|
||||
@@ -197,12 +255,16 @@ _repeat:
|
||||
if (!next_chid && AddFavorites())
|
||||
goto _repeat;
|
||||
|
||||
if (locked) {
|
||||
CFEManager::getInstance()->unlockFrontend(live_fe);
|
||||
#ifdef ENABLE_PIP
|
||||
if (pip_fe && pip_fe != live_fe)
|
||||
CFEManager::getInstance()->unlockFrontend(pip_fe);
|
||||
#endif
|
||||
}
|
||||
CFEManager::getInstance()->Unlock();
|
||||
if (next_chid)
|
||||
g_Zapit->zapTo_epg(next_chid);
|
||||
g_Zapit->zapTo_epg(next_chid, standby);
|
||||
else
|
||||
EnterStandby();
|
||||
}
|
||||
|
@@ -32,12 +32,14 @@ class CEpgScan
|
||||
int current_bnum;
|
||||
int current_mode;
|
||||
bool allfav_done;
|
||||
bool standby;
|
||||
eit_scanmap_t scanmap;
|
||||
t_channel_id next_chid;
|
||||
std::set<transponder_id_t> scanned;
|
||||
void Next();
|
||||
void AddBouquet(CChannelList * clist);
|
||||
bool AddFavorites();
|
||||
void AddTransponders();
|
||||
void EnterStandby();
|
||||
|
||||
CEpgScan();
|
||||
public:
|
||||
@@ -45,7 +47,11 @@ class CEpgScan
|
||||
static CEpgScan * getInstance();
|
||||
|
||||
void handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data);
|
||||
void Next();
|
||||
void Clear();
|
||||
void StartStandby();
|
||||
void StopStandby();
|
||||
bool Running();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user