neutrino.cpp: add common code to partially neutrino wakeup / put to sleep;

process EVT_STREAM_START/STOP events


Origin commit data
------------------
Commit: f321f33b1c
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2014-03-26 (Wed, 26 Mar 2014)
This commit is contained in:
[CST] Focus
2014-03-26 13:50:27 +04:00
parent 2dcd1bfbc5
commit f8bb7affaf
2 changed files with 55 additions and 30 deletions

View File

@@ -2484,6 +2484,40 @@ void CNeutrinoApp::zapTo(t_channel_id channel_id)
}
}
void CNeutrinoApp::wakeupFromStandby(void)
{
bool alive = recordingstatus || CEpgScan::getInstance()->Running() ||
CStreamManager::getInstance()->StreamStatus();
if ((mode == mode_standby) && !alive) {
cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000);
if(g_settings.ci_standby_reset) {
g_CamHandler->exec(NULL, "ca_ci_reset0");
g_CamHandler->exec(NULL, "ca_ci_reset1");
}
g_Zapit->setStandby(false);
g_Zapit->getMode();
}
}
void CNeutrinoApp::standbyToStandby(void)
{
bool alive = recordingstatus || CEpgScan::getInstance()->Running() ||
CStreamManager::getInstance()->StreamStatus();
if ((mode == mode_standby) && !alive) {
// zap back to pre-recording channel if necessary
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
if (standby_channel_id && (live_channel_id != standby_channel_id)) {
live_channel_id = standby_channel_id;
channelList->zapTo_ChannelID(live_channel_id);
}
g_Zapit->setStandby(true);
g_Sectionsd->setPauseScanning(true);
cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000);
}
}
int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
{
int res = 0;
@@ -2726,27 +2760,9 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
/* sent by rcinput, when got msg from zapit about record activated/deactivated */
/* should be sent when no record running */
printf("NeutrinoMessages::EVT_RECORDMODE: %s\n", ( data ) ? "on" : "off");
//if(!CRecordManager::getInstance()->RecordingStatus() && was_record && (!data))
/* no records left and record mode off FIXME check !*/
if(!CRecordManager::getInstance()->RecordingStatus() && (!data))
{
if(mode == mode_standby) {
// zap back to pre-recording channel if necessary
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
if (standby_channel_id && (live_channel_id != standby_channel_id)) {
live_channel_id = standby_channel_id;
channelList->zapTo_ChannelID(live_channel_id);
}
/* do not put zapit to standby, if epg scan not finished */
if (!CEpgScan::getInstance()->Running())
g_Zapit->setStandby(true);
cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000);
}
/* try to wakeup epg scan */
CEpgScan::getInstance()->Next();
}
recordingstatus = data;
CEpgScan::getInstance()->Next();
standbyToStandby();
autoshift = CRecordManager::getInstance()->TimeshiftOnly();
CVFD::getInstance()->ShowIcon(FP_ICON_CAM1, recordingstatus != 0);
@@ -2756,15 +2772,8 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
return messages_return::handled;
}
else if (msg == NeutrinoMessages::RECORD_START) {
//FIXME better at announce ?
if( mode == mode_standby ) {
cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000);
if(!recordingstatus && g_settings.ci_standby_reset) {
g_CamHandler->exec(NULL, "ca_ci_reset0");
g_CamHandler->exec(NULL, "ca_ci_reset1");
}
}
wakeupFromStandby();
#if 0
//zap to rec channel if box start from deepstandby
if(timer_wakeup){
@@ -2801,11 +2810,25 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
delete[] (unsigned char*) data;
return messages_return::handled;
}
else if (msg == NeutrinoMessages::EVT_STREAM_START) {
int fd = (int) data;
printf("NeutrinoMessages::EVT_STREAM_START: fd %d\n", fd);
wakeupFromStandby();
if (!CStreamManager::getInstance()->AddClient(fd))
close(fd);
return messages_return::handled;
}
else if (msg == NeutrinoMessages::EVT_STREAM_STOP) {
printf("NeutrinoMessages::EVT_STREAM_STOP\n");
CEpgScan::getInstance()->Next();
standbyToStandby();
return messages_return::handled;
}
else if( msg == NeutrinoMessages::EVT_PMT_CHANGED) {
res = messages_return::handled;
t_channel_id channel_id = *(t_channel_id*) data;
CRecordManager::getInstance()->Update(channel_id);
return res;
return messages_return::handled;
}
else if( msg == NeutrinoMessages::ZAPTO) {

View File

@@ -213,6 +213,8 @@ public:
CPersonalizeGui & getPersonalizeGui() { return personalize; }
bool getChannellistIsVisible() { return channellist_visible; }
void zapTo(t_channel_id channel_id);
void wakeupFromStandby(void);
void standbyToStandby(void);
};
#endif