neutrino.cpp: add zapTo(), reuse common code for zap without wait

This commit is contained in:
[CST] Focus
2014-01-28 16:10:19 +04:00
parent 65859318d0
commit 02cb09ce7e
2 changed files with 17 additions and 24 deletions

View File

@@ -2003,15 +2003,6 @@ void CNeutrinoApp::quickZap(int msg)
int res; int res;
StopSubtitles(); StopSubtitles();
printf("CNeutrinoApp::quickZap haveFreeFrontend %d\n", CFEManager::getInstance()->haveFreeFrontend());
#if 0
if(!CFEManager::getInstance()->haveFreeFrontend())
{
res = channelList->numericZap(g_settings.key_zaphistory);
StartSubtitles(res < 0);
return;
}
#endif
bool ret; bool ret;
if(!bouquetList->Bouquets.empty()) if(!bouquetList->Bouquets.empty())
ret = bouquetList->Bouquets[bouquetList->getActiveBouquetNumber()]->channelList->quickZap(msg, g_settings.zap_cycle); ret = bouquetList->Bouquets[bouquetList->getActiveBouquetNumber()]->channelList->quickZap(msg, g_settings.zap_cycle);
@@ -2457,6 +2448,17 @@ _repeat:
return ((nNewChannel >= 0) ? menu_return::RETURN_EXIT_ALL : menu_return::RETURN_REPAINT); return ((nNewChannel >= 0) ? menu_return::RETURN_EXIT_ALL : menu_return::RETURN_REPAINT);
} }
void CNeutrinoApp::zapTo(t_channel_id channel_id)
{
bool recordingStatus = CRecordManager::getInstance()->RecordingStatus(channel_id);
if (!recordingStatus || (recordingStatus && CRecordManager::getInstance()->TimeshiftOnly()) ||
(recordingStatus && channelList->SameTP(channel_id))) {
dvbsub_stop();
g_Zapit->zapTo_serviceID_NOWAIT(channel_id);
}
}
int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
{ {
int res = 0; int res = 0;
@@ -2751,14 +2753,10 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
//zap to rec channel in standby-mode //zap to rec channel in standby-mode
if(mode == mode_standby){ if(mode == mode_standby){
CTimerd::RecordingInfo * eventinfo = (CTimerd::RecordingInfo *) data; CTimerd::RecordingInfo * eventinfo = (CTimerd::RecordingInfo *) data;
bool recordingStatus = CRecordManager::getInstance()->RecordingStatus(eventinfo->channel_id);
t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID();
if( !recordingStatus && (eventinfo->channel_id != live_channel_id) && channelList->SameTP(eventinfo->channel_id) && !(SAME_TRANSPONDER(live_channel_id, eventinfo->channel_id)) ){ if((eventinfo->channel_id != live_channel_id) && !(SAME_TRANSPONDER(live_channel_id, eventinfo->channel_id)))
dvbsub_stop(); zapTo(eventinfo->channel_id);
t_channel_id channel_id=eventinfo->channel_id;
g_Zapit->zapTo_serviceID_NOWAIT(channel_id);
}
} }
if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) { if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) {
@@ -2788,7 +2786,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
else if( msg == NeutrinoMessages::ZAPTO) { else if( msg == NeutrinoMessages::ZAPTO) {
CTimerd::EventInfo * eventinfo = (CTimerd::EventInfo *) data; CTimerd::EventInfo * eventinfo = (CTimerd::EventInfo *) data;
if (eventinfo->channel_id != CZapit::getInstance()->GetCurrentChannelID()){ if (eventinfo->channel_id != CZapit::getInstance()->GetCurrentChannelID()){
if( (recordingstatus == 0) || (recordingstatus && CRecordManager::getInstance()->TimeshiftOnly()) || (recordingstatus && CFEManager::getInstance()->haveFreeFrontend()) || if( (recordingstatus == 0) || (recordingstatus && CRecordManager::getInstance()->TimeshiftOnly()) ||
(recordingstatus && channelList->SameTP(eventinfo->channel_id)) ) { (recordingstatus && channelList->SameTP(eventinfo->channel_id)) ) {
bool isTVMode = CServiceManager::getInstance()->IsChannelTVChannel(eventinfo->channel_id); bool isTVMode = CServiceManager::getInstance()->IsChannelTVChannel(eventinfo->channel_id);
@@ -2839,13 +2837,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
if( g_settings.recording_zap_on_announce && (mode != mode_standby) && (eventinfo->channel_id != CZapit::getInstance()->GetCurrentChannelID())) { if( g_settings.recording_zap_on_announce && (mode != mode_standby) && (eventinfo->channel_id != CZapit::getInstance()->GetCurrentChannelID())) {
CRecordManager::getInstance()->StopAutoRecord(); CRecordManager::getInstance()->StopAutoRecord();
bool recordingStatus = CRecordManager::getInstance()->RecordingStatus(); zapTo(eventinfo->channel_id);
if ( !recordingStatus || (recordingStatus && CRecordManager::getInstance()->TimeshiftOnly()) || (recordingStatus && CFEManager::getInstance()->haveFreeFrontend()) ||
(recordingStatus && channelList->SameTP(eventinfo->channel_id)) ){
dvbsub_stop();
t_channel_id channel_id=eventinfo->channel_id;
g_Zapit->zapTo_serviceID_NOWAIT(channel_id);
}
} }
if(( mode != mode_scart ) && ( mode != mode_standby ) && g_settings.recording_startstop_msg) { if(( mode != mode_scart ) && ( mode != mode_standby ) && g_settings.recording_startstop_msg) {
std::string name = g_Locale->getText(LOCALE_RECORDTIMER_ANNOUNCE); std::string name = g_Locale->getText(LOCALE_RECORDTIMER_ANNOUNCE);

View File

@@ -213,6 +213,7 @@ public:
int showChannelList(const neutrino_msg_t msg, bool from_menu = false); int showChannelList(const neutrino_msg_t msg, bool from_menu = false);
CPersonalizeGui & getPersonalizeGui() { return personalize; } CPersonalizeGui & getPersonalizeGui() { return personalize; }
bool getChannellistIsVisible() { return channellist_visible; } bool getChannellistIsVisible() { return channellist_visible; }
void zapTo(t_channel_id channel_id);
}; };
#endif #endif