From eeb21f6510a4a168c564ef330f285b3b861e2d3f Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 20 Nov 2017 15:19:06 +0100 Subject: [PATCH 01/14] neutrino: unify modes handling; ... remove double enum from CNeutrinoApp and move mostly used enum from NeutrinoMessages to new NeutrinoModes Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0fc3e793a4fa3ddcdc22a4c667be140e5d2e919c Author: vanhofen Date: 2017-11-20 (Mon, 20 Nov 2017) Origin message was: ------------------ - neutrino: unify modes handling; ... remove double enum from CNeutrinoApp and move mostly used enum from NeutrinoMessages to new NeutrinoModes Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/driver/record.cpp | 18 +-- src/driver/scanepg.cpp | 2 +- src/driver/shutdown_count.cpp | 2 +- src/gui/audiomute.cpp | 2 +- src/gui/audioplayer.cpp | 6 +- src/gui/channellist.cpp | 8 +- src/gui/components/cc_item_tvpic.cpp | 2 +- src/gui/infoviewer.cpp | 26 ++-- src/gui/infoviewer_bb.cpp | 20 +-- src/gui/lua/lua_video.cpp | 2 +- src/gui/lua/luainstance.cpp | 26 ++-- src/gui/mediaplayer.cpp | 4 +- src/gui/moviebrowser/mb.cpp | 4 +- src/gui/movieplayer.cpp | 18 +-- src/gui/osd_setup.cpp | 2 +- src/gui/pictureviewer.cpp | 6 +- src/gui/pipsetup.cpp | 2 +- src/gui/streaminfo1.cpp | 8 +- src/gui/streaminfo2.cpp | 10 +- src/gui/upnpbrowser.cpp | 18 +-- src/gui/user_menue.cpp | 10 +- src/gui/volumebar.cpp | 2 +- src/gui/webtv_setup.cpp | 4 +- src/gui/widget/menue.cpp | 6 +- src/neutrino.cpp | 218 +++++++++++++-------------- src/neutrino.h | 20 +-- src/neutrinoMessages.h | 8 +- src/nhttpd/tuxboxapi/controlapi.cpp | 26 ++-- 28 files changed, 233 insertions(+), 247 deletions(-) diff --git a/src/driver/record.cpp b/src/driver/record.cpp index ba6301286..b1c08a661 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -1321,7 +1321,7 @@ int CRecordManager::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data return messages_return::handled; } else if(data == check_timer) { - if(CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_standby) { + if(CNeutrinoApp::getInstance()->getMode() != NeutrinoModes::mode_standby) { mutex.lock(); int have_err = 0; for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) @@ -1633,12 +1633,12 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, CFrontend * return false; int mode = channel->getServiceType() != ST_DIGITAL_RADIO_SOUND_SERVICE ? - NeutrinoMessages::mode_tv : NeutrinoMessages::mode_radio; + NeutrinoModes::mode_tv : NeutrinoModes::mode_radio; printf("%s channel_id %" PRIx64 " mode %d\n", __func__, channel_id, mode); last_mode = CNeutrinoApp::getInstance()->getMode(); - if(last_mode == NeutrinoMessages::mode_standby && recmap.empty()) { + if(last_mode == NeutrinoModes::mode_standby && recmap.empty()) { g_Zapit->setStandby(false); // this zap to live_channel_id /* wait for zapit wakeup */ g_Zapit->getMode(); @@ -1682,8 +1682,8 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, CFrontend * else { printf("%s mode %d last_mode %d getLastMode %d\n", __FUNCTION__, mode, last_mode, CNeutrinoApp::getInstance()->getLastMode()); StopAutoRecord(false); - if (mode != last_mode && (last_mode != NeutrinoMessages::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) { - CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoMessages::norezap ); + if (mode != last_mode && (last_mode != NeutrinoModes::mode_standby || mode != CNeutrinoApp::getInstance()->getLastMode())) { + CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , mode | NeutrinoModes::norezap ); mode_changed = true; } @@ -1716,15 +1716,15 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, CFrontend * /* after this zapit send EVT_RECORDMODE_ACTIVATED, so neutrino getting NeutrinoMessages::EVT_RECORDMODE */ g_Zapit->setRecordMode( true ); - if(last_mode == NeutrinoMessages::mode_standby) + if(last_mode == NeutrinoModes::mode_standby) g_Zapit->stopPlayBack(); if ((live_channel_id == channel_id) && g_Radiotext) g_Radiotext->radiotext_stop(); /* in case channel_id == live_channel_id */ CStreamManager::getInstance()->StopStream(channel_id); } - if(last_mode == NeutrinoMessages::mode_standby) { - //CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_standby); + if(last_mode == NeutrinoModes::mode_standby) { + //CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , NeutrinoModes::mode_standby); g_RCInput->postMsg( NeutrinoMessages::CHANGEMODE , last_mode); } else if(!ret && mode_changed /*mode != last_mode*/) CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , last_mode); @@ -1741,7 +1741,7 @@ void CRecordManager::RestoreNeutrino(void) /* after this zapit send EVT_RECORDMODE_DEACTIVATED, so neutrino getting NeutrinoMessages::EVT_RECORDMODE */ g_Zapit->setRecordMode( false ); - if((CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_standby) && StopSectionsd) + if((CNeutrinoApp::getInstance()->getMode() != NeutrinoModes::mode_standby) && StopSectionsd) g_Sectionsd->setPauseScanning(false); } diff --git a/src/driver/scanepg.cpp b/src/driver/scanepg.cpp index 4f993a52c..0314bcd0a 100644 --- a/src/driver/scanepg.cpp +++ b/src/driver/scanepg.cpp @@ -344,7 +344,7 @@ void CEpgScan::Next() #endif next_chid = 0; - if (!standby && CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby) + if (!standby && CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_standby) return; if (CRecordManager::getInstance()->RecordingStatus() || CStreamManager::getInstance()->StreamStatus()) return; diff --git a/src/driver/shutdown_count.cpp b/src/driver/shutdown_count.cpp index e8e4ac9ce..3fd2c5585 100644 --- a/src/driver/shutdown_count.cpp +++ b/src/driver/shutdown_count.cpp @@ -96,7 +96,7 @@ void SHTDCNT::shutdown_counter() static bool sleeptimer_active = true; if (g_settings.shutdown_count > 0) { - if ((CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby) && (!CNeutrinoApp::getInstance ()->recordingstatus)) + if ((CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_standby) && (!CNeutrinoApp::getInstance ()->recordingstatus)) { if (shutdown_cnt > 0 ) { diff --git a/src/gui/audiomute.cpp b/src/gui/audiomute.cpp index d1c1885bf..47723052c 100644 --- a/src/gui/audiomute.cpp +++ b/src/gui/audiomute.cpp @@ -63,7 +63,7 @@ void CAudioMute::AudioMute(int newValue, bool isEvent) neutrino->setCurrentMuted(newValue); g_Zapit->muteAudio(newValue); - if( isEvent && ( neutrino->getMode() != CNeutrinoApp::mode_scart ) && ( neutrino->getMode() != CNeutrinoApp::mode_pic)) + if( isEvent && ( neutrino->getMode() != NeutrinoModes::mode_scart ) && ( neutrino->getMode() != NeutrinoModes::mode_pic)) { if (doInit) CVolumeHelper::getInstance()->refresh(); diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index be972239e..bcf70e4ae 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -327,7 +327,7 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey) // tell neutrino we're in audio mode m_LastMode = CNeutrinoApp::getInstance()->getMode(); - CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_audio); + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE , NeutrinoModes::mode_audio); puts("[audioplayer.cpp] executing " AUDIOPLAYER_START_SCRIPT "."); if (my_system(AUDIOPLAYER_START_SCRIPT) != 0) @@ -383,7 +383,7 @@ int CAudioPlayerGui::show() updateTimes(); // stop if mode was changed in another thread - if (CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_audio) + if (CNeutrinoApp::getInstance()->getMode() != NeutrinoModes::mode_audio) loop = false; if ( @@ -865,7 +865,7 @@ int CAudioPlayerGui::show() #endif else if (msg == NeutrinoMessages::CHANGEMODE) { - if ((data & NeutrinoMessages::mode_mask) != NeutrinoMessages::mode_audio) + if ((data & NeutrinoModes::mode_mask) != NeutrinoModes::mode_audio) { loop = false; m_LastMode=data; diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 846f69c35..91be050da 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -492,7 +492,7 @@ void CChannelList::calcSize() fheight = 1; /* avoid div-by-zero crash on invalid font */ footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getHeight()+6; - minitv_is_active = ( (g_settings.channellist_additional == SNeutrinoSettings::CHANNELLIST_ADDITIONAL_MODE_MINITV) && (CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_ts) ); + minitv_is_active = ( (g_settings.channellist_additional == SNeutrinoSettings::CHANNELLIST_ADDITIONAL_MODE_MINITV) && (CNeutrinoApp::getInstance()->getMode() != NeutrinoModes::mode_ts) ); // calculate width full_width = minitv_is_active ? (frameBuffer->getScreenWidth()-2*DETAILSLINE_WIDTH) : frameBuffer->getScreenWidthRel(); @@ -784,7 +784,7 @@ int CChannelList::show() } } else if (!edit_state && ( msg == CRCInput::RC_spkr ) && new_zap_mode ) { - if(CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_ts) { + if(CNeutrinoApp::getInstance()->getMode() != NeutrinoModes::mode_ts) { switch (new_zap_mode) { case 2: /* active */ new_zap_mode = 1; /* allow */ @@ -947,7 +947,7 @@ int CChannelList::show() } - if(NeutrinoMessages::mode_ts == CNeutrinoApp::getInstance()->getMode()) + if(NeutrinoModes::mode_ts == CNeutrinoApp::getInstance()->getMode()) return -1; if(zapOnExit) @@ -1203,7 +1203,7 @@ void CChannelList::zapToChannel(CZapitChannel *channel, bool force) selected_chid = (*chanlist)[tuned]->getChannelID(); if(force || (selected_chid != channel->getChannelID())) { - if ((g_settings.radiotext_enable) && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoMessages::mode_radio) && (g_Radiotext)) + if ((g_settings.radiotext_enable) && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoModes::mode_radio) && (g_Radiotext)) { // stop radiotext PES decoding before zapping g_Radiotext->radiotext_stop(); diff --git a/src/gui/components/cc_item_tvpic.cpp b/src/gui/components/cc_item_tvpic.cpp index 96597b620..87e8d5415 100644 --- a/src/gui/components/cc_item_tvpic.cpp +++ b/src/gui/components/cc_item_tvpic.cpp @@ -96,7 +96,7 @@ void CComponentsPIP::paint(bool do_save_bg) return; int mode = CNeutrinoApp::getInstance()->getMode(); - if(mode == NeutrinoMessages::mode_tv || mode == NeutrinoMessages::mode_webtv || mode == NeutrinoMessages::mode_ts) { + if(mode == NeutrinoModes::mode_tv || mode == NeutrinoModes::mode_webtv || mode == NeutrinoModes::mode_ts) { videoDecoder->Pig(pig_x, pig_y, pig_w, pig_h, screen_w, screen_h); } else{ //paint an alternate image if no tv mode available diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 132945603..e2bbbcd5a 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -901,7 +901,7 @@ void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap showInfoFile(); // Radiotext - if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio || CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webradio) + if (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_radio || CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio) { if ((g_settings.radiotext_enable) && (!recordModeActive) && (!calledFromNumZap)) showRadiotext(); @@ -922,15 +922,15 @@ void CInfoViewer::setInfobarTimeout(int timeout_ext) //define timeouts switch (mode) { - case NeutrinoMessages::mode_radio: - case NeutrinoMessages::mode_webradio: + case NeutrinoModes::mode_radio: + case NeutrinoModes::mode_webradio: timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR_RADIO] + timeout_ext); break; - case NeutrinoMessages::mode_ts: + case NeutrinoModes::mode_ts: timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR_MOVIE] + timeout_ext); break; - case NeutrinoMessages::mode_tv: - case NeutrinoMessages::mode_webtv: + case NeutrinoModes::mode_tv: + case NeutrinoModes::mode_webtv: default: timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] + timeout_ext); break; @@ -940,7 +940,7 @@ void CInfoViewer::setInfobarTimeout(int timeout_ext) bool CInfoViewer::showLivestreamInfo() { CZapitChannel * cc = CZapit::getInstance()->GetCurrentChannel(); - bool web_mode = (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webradio); + bool web_mode = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio); if (web_mode && cc->getEpgID() == 0) { std::string livestreamInfo1 = ""; @@ -1127,7 +1127,7 @@ void CInfoViewer::loop(bool show_dot) showRecordIcon (show_dot); show_dot = !show_dot; showInfoFile(); - if ((g_settings.radiotext_enable) && (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio)) + if ((g_settings.radiotext_enable) && (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_radio)) showRadiotext(); infoViewerBB->showIcon_16_9(); @@ -1140,7 +1140,7 @@ void CInfoViewer::loop(bool show_dot) CNeutrinoApp *neutrino = CNeutrinoApp::getInstance (); if ((msg == (neutrino_msg_t) g_settings.key_quickzap_up) || (msg == (neutrino_msg_t) g_settings.key_quickzap_down) || (msg == CRCInput::RC_0) || (msg == NeutrinoMessages::SHOW_INFOBAR)) { hideIt = false; // default - if ((g_settings.radiotext_enable) && (neutrino->getMode() == NeutrinoMessages::mode_radio)) + if ((g_settings.radiotext_enable) && (neutrino->getMode() == NeutrinoModes::mode_radio)) hideIt = true; int rec_mode = CRecordManager::getInstance()->GetRecordMode(); @@ -1557,7 +1557,7 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) showLivestreamInfo(); infoViewerBB->showBBButtons(true /*paintFooter*/); // in case button text has changed } - if (g_settings.radiotext_enable && g_Radiotext && !g_RemoteControl->current_PIDs.APIDs.empty() && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoMessages::mode_radio)) + if (g_settings.radiotext_enable && g_Radiotext && !g_RemoteControl->current_PIDs.APIDs.empty() && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoModes::mode_radio)) g_Radiotext->setPid(g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].pid); } return messages_return::handled; @@ -2359,7 +2359,7 @@ void CInfoViewer::showLcdPercentOver() { if (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME] != 1) { - if (fileplay || NeutrinoMessages::mode_ts == CNeutrinoApp::getInstance()->getMode()) { + if (fileplay || NeutrinoModes::mode_ts == CNeutrinoApp::getInstance()->getMode()) { CVFD::getInstance()->showPercentOver(CMoviePlayerGui::getInstance().file_prozent); return; } @@ -2391,7 +2391,7 @@ void CInfoViewer::showLcdPercentOver() } CLCD::getInstance()->showPercentOver(runningPercent); int mode = CNeutrinoApp::getInstance()->getMode(); - if ((mode == NeutrinoMessages::mode_radio || mode == NeutrinoMessages::mode_tv)) + if ((mode == NeutrinoModes::mode_radio || mode == NeutrinoModes::mode_tv)) CVFD::getInstance()->setEPGTitle(info_CurrentNext.current_name); } } @@ -2399,7 +2399,7 @@ void CInfoViewer::showLcdPercentOver() void CInfoViewer::showLcdPercentOver () { if (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME] != 1) { - if (fileplay || (NeutrinoMessages::mode_ts == CNeutrinoApp::getInstance()->getMode())) { + if (fileplay || (NeutrinoModes::mode_ts == CNeutrinoApp::getInstance()->getMode())) { CVFD::getInstance ()->showPercentOver (CMoviePlayerGui::getInstance().file_prozent); return; } diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index 0d3540aab..5e95ba823 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -149,7 +149,7 @@ void CInfoViewerBB::getBBIconInfo() BBarY = g_InfoViewer->BoxEndY + bottom_bar_offset; BBarFontY = BBarY + InfoHeightY_Info - (InfoHeightY_Info - g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getHeight()) / 2; /* center in buttonbar */ bbIconMinX = g_InfoViewer->BoxEndX - OFFSET_INNER_MID; - bool isRadioMode = (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio || CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webradio); + bool isRadioMode = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_radio || CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio); for (int i = 0; i < CInfoViewerBB::ICON_MAX; i++) { int w = 0, h = 0; @@ -213,7 +213,7 @@ void CInfoViewerBB::getBBButtonInfo() bbButtonMaxH = 0; bbButtonMaxX = g_InfoViewer->ChanInfoX; int bbButtonMaxW = 0; - int mode = NeutrinoMessages::mode_unknown; + int mode = NeutrinoModes::mode_unknown; int pers = -1; for (int i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) { int w = 0, h = 0; @@ -225,7 +225,7 @@ void CInfoViewerBB::getBBButtonInfo() icon = NEUTRINO_ICON_BUTTON_RED; frameBuffer->getIconSize(icon.c_str(), &w, &h); mode = CNeutrinoApp::getInstance()->getMode(); - if (mode == NeutrinoMessages::mode_ts) { + if (mode == NeutrinoModes::mode_ts) { text = CKeybindSetup::getMoviePlayerButtonName(CRCInput::RC_red, active, g_settings.infobar_buttons_usertitle); if (!text.empty()) break; @@ -240,7 +240,7 @@ void CInfoViewerBB::getBBButtonInfo() icon = NEUTRINO_ICON_BUTTON_GREEN; frameBuffer->getIconSize(icon.c_str(), &w, &h); mode = CNeutrinoApp::getInstance()->getMode(); - if (mode == NeutrinoMessages::mode_ts) { + if (mode == NeutrinoModes::mode_ts) { text = CKeybindSetup::getMoviePlayerButtonName(CRCInput::RC_green, active, g_settings.infobar_buttons_usertitle); if (!text.empty()) break; @@ -255,7 +255,7 @@ void CInfoViewerBB::getBBButtonInfo() icon = NEUTRINO_ICON_BUTTON_YELLOW; frameBuffer->getIconSize(icon.c_str(), &w, &h); mode = CNeutrinoApp::getInstance()->getMode(); - if (mode == NeutrinoMessages::mode_ts) { + if (mode == NeutrinoModes::mode_ts) { text = CKeybindSetup::getMoviePlayerButtonName(CRCInput::RC_yellow, active, g_settings.infobar_buttons_usertitle); if (!text.empty()) break; @@ -270,7 +270,7 @@ void CInfoViewerBB::getBBButtonInfo() icon = NEUTRINO_ICON_BUTTON_BLUE; frameBuffer->getIconSize(icon.c_str(), &w, &h); mode = CNeutrinoApp::getInstance()->getMode(); - if (mode == NeutrinoMessages::mode_ts) { + if (mode == NeutrinoModes::mode_ts) { text = CKeybindSetup::getMoviePlayerButtonName(CRCInput::RC_blue, active, g_settings.infobar_buttons_usertitle); if (!text.empty()) break; @@ -284,7 +284,7 @@ void CInfoViewerBB::getBBButtonInfo() break; } //label audio control button in movieplayer mode - if (mode == NeutrinoMessages::mode_ts && !CMoviePlayerGui::getInstance().timeshift) + if (mode == NeutrinoModes::mode_ts && !CMoviePlayerGui::getInstance().timeshift) { if (text == g_Locale->getText(LOCALE_MPKEY_AUDIO) && !g_settings.infobar_buttons_usertitle) text = CMoviePlayerGui::getInstance(false).CurrentAudioName(); // use instance_mp @@ -575,7 +575,7 @@ void CInfoViewerBB::showIcon_Resolution() { if ((!is_visible) || (g_settings.infobar_show_res == 2)) //show resolution icon is off return; - if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio || CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webradio) + if (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_radio || CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio) return; const char *icon_name = NULL; #if 0 @@ -660,7 +660,7 @@ void CInfoViewerBB::showOne_CAIcon() { std::string sIcon = ""; #if 0 - if (CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_radio) { + if (CNeutrinoApp::getInstance()->getMode() != NeutrinoModes::mode_radio) { if (scrambledNoSig) sIcon = NEUTRINO_ICON_SCRAMBLED2_BLANK; else { @@ -807,7 +807,7 @@ void CInfoViewerBB::showIcon_CA_Status(int notfirst) { if (g_settings.infobar_casystem_display == 3) return; - if(NeutrinoMessages::mode_ts == CNeutrinoApp::getInstance()->getMode() && !CMoviePlayerGui::getInstance().timeshift){ + if(NeutrinoModes::mode_ts == CNeutrinoApp::getInstance()->getMode() && !CMoviePlayerGui::getInstance().timeshift){ if (g_settings.infobar_casystem_display == 2) { fta = true; showOne_CAIcon(); diff --git a/src/gui/lua/lua_video.cpp b/src/gui/lua/lua_video.cpp index 9e1b6774c..cf7af409f 100644 --- a/src/gui/lua/lua_video.cpp +++ b/src/gui/lua/lua_video.cpp @@ -282,7 +282,7 @@ int CLuaInstVideo::channelRezap(lua_State *L) /* CLuaVideo *D = VideoCheckData(L, 1); if (!D) return 0; */ CNeutrinoApp::getInstance()->channelRezap(); - if (CNeutrinoApp::getInstance()->getMode() == CNeutrinoApp::mode_radio) + if (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_radio) CFrameBuffer::getInstance()->showFrame("radiomode.jpg"); return 0; } diff --git a/src/gui/lua/luainstance.cpp b/src/gui/lua/luainstance.cpp index c5291fa1d..a8b2e60ec 100644 --- a/src/gui/lua/luainstance.cpp +++ b/src/gui/lua/luainstance.cpp @@ -370,19 +370,19 @@ static void set_lua_variables(lua_State *L) table_key neutrino_mode[] = { - { "UNKNOWN", (lua_Integer)CNeutrinoApp::mode_unknown }, - { "TV", (lua_Integer)CNeutrinoApp::mode_tv }, - { "RADIO", (lua_Integer)CNeutrinoApp::mode_radio }, - { "SCART", (lua_Integer)CNeutrinoApp::mode_scart }, - { "STANDBY", (lua_Integer)CNeutrinoApp::mode_standby }, - { "AUDIO", (lua_Integer)CNeutrinoApp::mode_audio }, - { "PIC", (lua_Integer)CNeutrinoApp::mode_pic }, - { "TS", (lua_Integer)CNeutrinoApp::mode_ts }, - { "OFF", (lua_Integer)CNeutrinoApp::mode_off }, - { "WEBTV", (lua_Integer)CNeutrinoApp::mode_webtv }, - { "WEBRADIO", (lua_Integer)CNeutrinoApp::mode_webradio }, - { "MASK", (lua_Integer)CNeutrinoApp::mode_mask }, - { "NOREZAP", (lua_Integer)CNeutrinoApp::norezap }, + { "UNKNOWN", (lua_Integer)NeutrinoModes::mode_unknown }, + { "TV", (lua_Integer)NeutrinoModes::mode_tv }, + { "RADIO", (lua_Integer)NeutrinoModes::mode_radio }, + { "SCART", (lua_Integer)NeutrinoModes::mode_scart }, + { "STANDBY", (lua_Integer)NeutrinoModes::mode_standby }, + { "AUDIO", (lua_Integer)NeutrinoModes::mode_audio }, + { "PIC", (lua_Integer)NeutrinoModes::mode_pic }, + { "TS", (lua_Integer)NeutrinoModes::mode_ts }, + { "OFF", (lua_Integer)NeutrinoModes::mode_off }, + { "WEBTV", (lua_Integer)NeutrinoModes::mode_webtv }, + { "WEBRADIO", (lua_Integer)NeutrinoModes::mode_webradio }, + { "MASK", (lua_Integer)NeutrinoModes::mode_mask }, + { "NOREZAP", (lua_Integer)NeutrinoModes::norezap }, { NULL, 0 } }; diff --git a/src/gui/mediaplayer.cpp b/src/gui/mediaplayer.cpp index a29fae57c..548b1a1a3 100644 --- a/src/gui/mediaplayer.cpp +++ b/src/gui/mediaplayer.cpp @@ -105,10 +105,10 @@ int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey) audiomute->enableMuteIcon(false); CInfoClock::getInstance()->enableInfoClock(false); int mode = CNeutrinoApp::getInstance()->getMode(); - if( mode == NeutrinoMessages::mode_radio ) + if( mode == NeutrinoModes::mode_radio ) CFrameBuffer::getInstance()->stopFrame(); int res = CMoviePlayerGui::getInstance().exec(NULL, "tsmoviebrowser"); - if( mode == NeutrinoMessages::mode_radio ) + if( mode == NeutrinoModes::mode_radio ) CFrameBuffer::getInstance()->showFrame("radiomode.jpg"); audiomute->enableMuteIcon(true); CInfoClock::getInstance()->enableInfoClock(true); diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 353f7707a..7b9e34e6e 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -865,7 +865,7 @@ int CMovieBrowser::exec(CMenuTarget* parent, const std::string & actionKey) else if (actionKey == "cut") { #if 0 - if ((m_movieSelectionHandler == playing_info) && (NeutrinoMessages::mode_ts == CNeutrinoApp::getInstance()->getMode())) + if ((m_movieSelectionHandler == playing_info) && (NeutrinoModes::mode_ts == CNeutrinoApp::getInstance()->getMode())) ShowMsg(LOCALE_MESSAGEBOX_ERROR, "Impossible to cut playing movie.", CMsgBox::mbrCancel, CMsgBox::mbCancel, NEUTRINO_ICON_ERROR); else #endif @@ -891,7 +891,7 @@ int CMovieBrowser::exec(CMenuTarget* parent, const std::string & actionKey) { if ((show_mode == MB_SHOW_RECORDS) && m_movieSelectionHandler != NULL) { - if ((m_movieSelectionHandler == playing_info) && (NeutrinoMessages::mode_ts == CNeutrinoApp::getInstance()->getMode())) + if ((m_movieSelectionHandler == playing_info) && (NeutrinoModes::mode_ts == CNeutrinoApp::getInstance()->getMode())) ShowMsg(LOCALE_MESSAGEBOX_ERROR, LOCALE_MOVIEBROWSER_TRUNCATE_FAILED_PLAYING, CMsgBox::mbrCancel, CMsgBox::mbCancel, NEUTRINO_ICON_ERROR); else if (m_movieSelectionHandler->bookmarks.end == 0) ShowMsg(LOCALE_MESSAGEBOX_ERROR, LOCALE_MOVIEBROWSER_BOOK_NO_END, CMsgBox::mbrCancel, CMsgBox::mbCancel, NEUTRINO_ICON_ERROR); diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index bb4f582ed..4764c9f57 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -296,22 +296,22 @@ void CMoviePlayerGui::cutNeutrino() g_Zapit->setStandby(true); #endif - int new_mode = NeutrinoMessages::mode_unknown; + int new_mode = NeutrinoModes::mode_unknown; m_LastMode = CNeutrinoApp::getInstance()->getMode(); printf("%s: old mode %d\n", __func__, m_LastMode);fflush(stdout); if (isWebChannel) { - bool isRadioMode = (m_LastMode == NeutrinoMessages::mode_radio || m_LastMode == NeutrinoMessages::mode_webradio); - new_mode = (isRadioMode) ? NeutrinoMessages::mode_webradio : NeutrinoMessages::mode_webtv; - m_LastMode |= NeutrinoMessages::norezap; + bool isRadioMode = (m_LastMode == NeutrinoModes::mode_radio || m_LastMode == NeutrinoModes::mode_webradio); + new_mode = (isRadioMode) ? NeutrinoModes::mode_webradio : NeutrinoModes::mode_webtv; + m_LastMode |= NeutrinoModes::norezap; } else { - new_mode = NeutrinoMessages::mode_ts; + new_mode = NeutrinoModes::mode_ts; } printf("%s: new mode %d\n", __func__, new_mode);fflush(stdout); printf("%s: save mode %x\n", __func__, m_LastMode);fflush(stdout); - CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::norezap | new_mode); + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoModes::norezap | new_mode); } void CMoviePlayerGui::restoreNeutrino() @@ -348,14 +348,14 @@ void CMoviePlayerGui::restoreNeutrino() #endif printf("%s: restore mode %x\n", __func__, m_LastMode);fflush(stdout); #if 0 - if (m_LastMode == NeutrinoMessages::mode_tv) + if (m_LastMode == NeutrinoModes::mode_tv) g_RCInput->postMsg(NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, 0x200, false); #endif - if (m_LastMode != NeutrinoMessages::mode_unknown) + if (m_LastMode != NeutrinoModes::mode_unknown) CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, m_LastMode); #if 0 - if (m_LastMode == NeutrinoMessages::mode_tv) { + if (m_LastMode == NeutrinoModes::mode_tv) { CZapitChannel *channel = CZapit::getInstance()->GetCurrentChannel(); if (channel && channel->scrambled) CZapit::getInstance()->Rezap(); diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index de70d8ff5..aec366533 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -1481,7 +1481,7 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data) if (g_settings.radiotext_enable) { if (g_Radiotext == NULL) g_Radiotext = new CRadioText; - if (g_Radiotext && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoMessages::mode_radio)) + if (g_Radiotext && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoModes::mode_radio)) g_Radiotext->setPid(g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].pid); } else { if (g_Radiotext) diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index e1e330b00..f251f8647 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -191,7 +191,7 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & actionKey) // remember last mode m_LastMode = CNeutrinoApp::getInstance()->getMode(); // tell neutrino we're in pic_mode - CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_pic ); + CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , NeutrinoModes::mode_pic ); if (!audioplayer) { // !!! why? !!! CNeutrinoApp::getInstance()->stopPlayBack(true); @@ -226,7 +226,7 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & actionKey) // Restore last mode CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , m_LastMode ); - if (m_LastMode == NeutrinoMessages::mode_ts) + if (m_LastMode == NeutrinoModes::mode_ts) videoDecoder->setBlank(false); // always exit all @@ -608,7 +608,7 @@ int CPictureViewerGui::show() } else if (msg == NeutrinoMessages::CHANGEMODE) { - if ((data & NeutrinoMessages::mode_mask) !=NeutrinoMessages::mode_pic) + if ((data & NeutrinoModes::mode_mask) !=NeutrinoModes::mode_pic) { loop = false; m_LastMode=data; diff --git a/src/gui/pipsetup.cpp b/src/gui/pipsetup.cpp index 32365e019..5e5935961 100644 --- a/src/gui/pipsetup.cpp +++ b/src/gui/pipsetup.cpp @@ -26,7 +26,7 @@ CPipSetup::CPipSetup() { frameBuffer = CFrameBuffer::getInstance(); - if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio) { + if(CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_radio) { gx = &g_settings.pip_radio_x; gy = &g_settings.pip_radio_y; gw = &g_settings.pip_radio_width; diff --git a/src/gui/streaminfo1.cpp b/src/gui/streaminfo1.cpp index 7f35072e0..494cbe8b9 100644 --- a/src/gui/streaminfo1.cpp +++ b/src/gui/streaminfo1.cpp @@ -116,7 +116,7 @@ int CStreamInfo2::exec (CMenuTarget * parent, const std::string &) if (parent) parent->hide (); - if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webradio) + if (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio) mp = &CMoviePlayerGui::getInstance(true); else mp = &CMoviePlayerGui::getInstance(); @@ -313,7 +313,7 @@ void CStreamInfo2::paint_signal_fe_box(int _x, int _y, int w, int h) tname += ": "; if (mp) { - if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webradio) + if (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio) tname += "Web-Channel"; // TODO split into WebTV/WebRadio else tname += g_Locale->getText(LOCALE_MAINMENU_MOVIEPLAYER); @@ -549,7 +549,7 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) average_bitrate_offset = spaceoffset; int box_width2 = box_width-(spaceoffset+xpos); - if((channel->getVideoPid() || (IS_WEBCHAN(channel->getChannelID()) && CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv)) && !(videoDecoder->getBlank())){ + if((channel->getVideoPid() || (IS_WEBCHAN(channel->getChannelID()) && CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv)) && !(videoDecoder->getBlank())){ videoDecoder->getPictureInfo(xres, yres, framerate); if (yres == 1088) yres = 1080; @@ -728,7 +728,7 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) if (mp) { //channel ypos += iheight; - if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webradio) { + if (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio) { snprintf(buf, sizeof(buf), "%s:",g_Locale->getText (LOCALE_TIMERLIST_CHANNEL));//swiped locale g_Font[font_info]->RenderString(xpos, ypos, box_width, buf , COL_MENUCONTENT_TEXT); snprintf(buf, sizeof(buf), "%s", channel->getName().c_str()); diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 4ed37e0f5..0e666d11a 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -354,7 +354,7 @@ int CStreamInfo2::exec (CMenuTarget * parent, const std::string &) if (parent) parent->hide (); - if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webradio) + if (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio) mp = &CMoviePlayerGui::getInstance(true); else mp = &CMoviePlayerGui::getInstance(); @@ -579,7 +579,7 @@ void CStreamInfo2::paint_signal_fe_box(int _x, int _y, int w, int h) tname += ": "; if (mp) { - if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webradio) + if (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio) tname += "Web-Channel"; // TODO split into WebTV/WebRadio else tname += g_Locale->getText(LOCALE_MAINMENU_MOVIEPLAYER); @@ -826,7 +826,7 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) if (mp) { - if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webradio) + if (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio) { // channel r.key = g_Locale->getText (LOCALE_TIMERLIST_CHANNEL); @@ -929,7 +929,7 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) } } - if (((mp && IS_WEBCHAN(channel->getChannelID()) && CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv) || channel->getVideoPid()) && !(videoDecoder->getBlank())) + if (((mp && IS_WEBCHAN(channel->getChannelID()) && CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv) || channel->getVideoPid()) && !(videoDecoder->getBlank())) { videoDecoder->getPictureInfo(xres, yres, framerate); if (yres == 1088) @@ -1065,7 +1065,7 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) v.push_back(r); // picon - if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webradio) + if (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv || CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio) { r.key = "Picon"; r.key += ": "; diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index e358b54e8..c042df621 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -181,7 +181,7 @@ int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/ m_frameBuffer->showFrame("mp3.jpg"); // tell neutrino we're in upnp mode - CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_upnp); + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE , NeutrinoModes::mode_upnp); // remember last mode m_LastMode=(CNeutrinoApp::getInstance()->getLastMode()); @@ -1293,15 +1293,15 @@ void CUpnpBrowserGui::updateTimes(const bool force) void CUpnpBrowserGui::updateMode() { /* switch back to mode_upnp if audio has stopped automatically */ - if ((CAudioPlayer::getInstance()->getState() == CBaseDec::STOP) && (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_audio)) + if ((CAudioPlayer::getInstance()->getState() == CBaseDec::STOP) && (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_audio)) { - CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_upnp | NeutrinoMessages::norezap); + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoModes::mode_upnp | NeutrinoModes::norezap); } } void CUpnpBrowserGui::playAudio(std::string name, int type) { - CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_audio); + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoModes::mode_audio); CAudiofile mp3(name, (CFile::FileType) type); CAudioPlayer::getInstance()->play(&mp3, g_settings.audioplayer_highprio == 1); @@ -1314,12 +1314,12 @@ void CUpnpBrowserGui::stopAudio() CAudioPlayer::getInstance()->stop(); } - CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_upnp | NeutrinoMessages::norezap); + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoModes::mode_upnp | NeutrinoModes::norezap); } void CUpnpBrowserGui::showPicture(std::string name) { - CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_pic); + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoModes::mode_pic); g_PicViewer->SetScaling((CPictureViewer::ScalingMode)g_settings.picviewer_scaling); g_PicViewer->SetVisible(g_settings.screen_StartX, g_settings.screen_EndX, g_settings.screen_StartY, g_settings.screen_EndY); @@ -1332,19 +1332,19 @@ void CUpnpBrowserGui::showPicture(std::string name) g_PicViewer->ShowImage(name, false); g_PicViewer->Cleanup(); - CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_upnp | NeutrinoMessages::norezap); + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoModes::mode_upnp | NeutrinoModes::norezap); } void CUpnpBrowserGui::playVideo(std::string name, std::string url) { stopAudio(); - CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_ts); + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoModes::mode_ts); m_frameBuffer->stopFrame(); CMoviePlayerGui::getInstance().SetFile(name, url); CMoviePlayerGui::getInstance().exec(NULL, "upnp"); video_key_msg = CMoviePlayerGui::getInstance().getKeyPressed(); - CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_upnp | NeutrinoMessages::norezap); + CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoModes::mode_upnp | NeutrinoModes::norezap); } diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index 8646ac926..65bbca3be 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -184,8 +184,8 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg) else menu->addItem(GenericMenuSeparator); - bool _mode_ts = CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_ts; - bool _mode_webtv = (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv) && + bool _mode_ts = CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_ts; + bool _mode_webtv = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv) && (!CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()); bool adzap_active = CAdZapMenu::getInstance()->isActive(); @@ -567,7 +567,7 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu case SNeutrinoSettings::ITEM_NONE: case SNeutrinoSettings::ITEM_BAR: case SNeutrinoSettings::ITEM_LIVESTREAM_RESOLUTION: - if (mode == NeutrinoMessages::mode_webtv && !CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()) { + if (mode == NeutrinoModes::mode_webtv && !CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()) { if(loc == NONEXISTANT_LOCALE && !text) { CWebTVResolution webtvres; std::string tmp = webtvres.getResolutionValue(); @@ -617,7 +617,7 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu continue; case SNeutrinoSettings::ITEM_AUDIO_SELECT: if(loc == NONEXISTANT_LOCALE && !text) { - if (mode == NeutrinoMessages::mode_webtv) + if (mode == NeutrinoModes::mode_webtv) text = CMoviePlayerGui::getInstance(true).CurrentAudioName().c_str(); // use instance_bg else if (!g_RemoteControl->current_PIDs.APIDs.empty()) text = g_RemoteControl->current_PIDs.APIDs[ @@ -628,7 +628,7 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu continue; #if 0 case SNeutrinoSettings::ITEM_RASS: - if (!(CNeutrinoApp::getInstance()->getMode() == CNeutrinoApp::mode_radio && g_Radiotext && g_Radiotext->haveRASS())) + if (!(CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_radio && g_Radiotext && g_Radiotext->haveRASS())) continue; #endif default: diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index 27c66fa6e..34925f0c8 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -124,7 +124,7 @@ void CVolumeBar::initVolumeBarPosition() { case VOLUMEBAR_POS_TOP_RIGHT:{ int x_corr = 0; - if (( neutrino->getMode() != CNeutrinoApp::mode_scart ) && ( neutrino->getMode() != CNeutrinoApp::mode_audio) && ( neutrino->getMode() != CNeutrinoApp::mode_pic)) { + if (( neutrino->getMode() != NeutrinoModes::mode_scart ) && ( neutrino->getMode() != NeutrinoModes::mode_audio) && ( neutrino->getMode() != NeutrinoModes::mode_pic)) { if ((neutrino->isMuted()) && (!g_settings.mode_clock)) x_corr = mute_dx + h_spacer; if (CNeutrinoApp::getInstance()->getChannellistIsVisible() == true) diff --git a/src/gui/webtv_setup.cpp b/src/gui/webtv_setup.cpp index b110419e9..568bd02d6 100644 --- a/src/gui/webtv_setup.cpp +++ b/src/gui/webtv_setup.cpp @@ -128,7 +128,7 @@ int CWebTVSetup::Show() m->addIntroItems(LOCALE_WEBTV_HEAD, LOCALE_LIVESTREAM_HEAD); - bool _mode_webtv = (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv) && + bool _mode_webtv = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv) && (!CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()); CMenuForwarder *mf; @@ -197,7 +197,7 @@ int CWebTVResolution::Show() m->hide(); delete m; - bool _mode_webtv = (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv) && + bool _mode_webtv = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv) && (!CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()); if (oldRes != g_settings.livestreamResolution && _mode_webtv) { CZapitChannel * cc = CZapit::getInstance()->GetCurrentChannel(); diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 85d55e317..343efb2a5 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -129,17 +129,17 @@ void CMenuItem::disableByCondition(const menu_item_disable_cond_t& condition) int stb_mode = CNeutrinoApp::getInstance()->getMode(); if (condition & DCOND_MODE_TS){ - if (stb_mode == CNeutrinoApp::mode_ts) + if (stb_mode == NeutrinoModes::mode_ts) if (initModeCondition(stb_mode)) return; } if (condition & DCOND_MODE_RADIO){ - if (stb_mode == CNeutrinoApp::mode_radio) + if (stb_mode == NeutrinoModes::mode_radio) if (initModeCondition(stb_mode)) return; } if (condition & DCOND_MODE_TV){ - if (stb_mode == CNeutrinoApp::mode_tv) + if (stb_mode == NeutrinoModes::mode_tv) if (initModeCondition(stb_mode)) return; } diff --git a/src/neutrino.cpp b/src/neutrino.cpp index aad13ec60..8750307e8 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -238,8 +238,8 @@ CNeutrinoApp::CNeutrinoApp() frameBuffer->setIconBasePath(ICONSDIR); SetupFrameBuffer(); - mode = mode_unknown; - lastMode = mode_unknown; + mode = NeutrinoModes::mode_unknown; + lastMode = NeutrinoModes::mode_unknown; channelList = NULL; TVchannelList = NULL; RADIOchannelList = NULL; @@ -1806,7 +1806,7 @@ void CNeutrinoApp::channelsInit(bool bOnly) void CNeutrinoApp::SetChannelMode(int newmode) { - bool isRadioMode = (mode == mode_radio || mode == mode_webradio); + bool isRadioMode = (mode == NeutrinoModes::mode_radio || mode == NeutrinoModes::mode_webradio); printf("CNeutrinoApp::SetChannelMode %d [%s]\n", newmode, isRadioMode ? "radio" : "tv"); int *sortmode; @@ -2046,7 +2046,7 @@ void CNeutrinoApp::InitZapper() } int tvmode = CZapit::getInstance()->getMode() & CZapitClient::MODE_TV; lastChannelMode = tvmode ? g_settings.channel_mode : g_settings.channel_mode_radio; - mode = tvmode ? mode_tv : mode_radio; + mode = tvmode ? NeutrinoModes::mode_tv : NeutrinoModes::mode_radio; lastMode = mode; SDTreloadChannels = false; @@ -2607,7 +2607,7 @@ void CNeutrinoApp::RealRun() continue; #endif - if (mode == mode_radio) { + if (mode == NeutrinoModes::mode_radio) { bool ignored_msg = ( /* radio screensaver will ignore this msgs */ msg == NeutrinoMessages::EVT_CURRENTEPG @@ -2646,7 +2646,7 @@ void CNeutrinoApp::RealRun() } } - if( ( mode == mode_tv ) || ( mode == mode_radio ) || ( mode == mode_webtv ) || ( mode == mode_webradio ) ) { + if( ( mode == NeutrinoModes::mode_tv ) || ( mode == NeutrinoModes::mode_radio ) || ( mode == NeutrinoModes::mode_webtv ) || ( mode == NeutrinoModes::mode_webradio ) ) { if( (msg == NeutrinoMessages::SHOW_EPG) /* || (msg == CRCInput::RC_info) */ ) { InfoClock->enableInfoClock(false); StopSubtitles(); @@ -2717,7 +2717,7 @@ void CNeutrinoApp::RealRun() } else if(msg == (neutrino_msg_t) g_settings.key_timeshift) { #if 0 - if (mode == mode_webtv) { + if (mode == NeutrinoModes::mode_webtv) { CMoviePlayerGui::getInstance().Pause(); } else #endif @@ -2750,12 +2750,12 @@ void CNeutrinoApp::RealRun() } } #endif - else if( msg == (neutrino_msg_t) g_settings.key_record /* && (mode != mode_webtv) */) { + else if( msg == (neutrino_msg_t) g_settings.key_record /* && (mode != NeutrinoModes::mode_webtv) */) { if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) CRecordManager::getInstance()->exec(NULL, "Record"); } #if 0 - else if ((mode == mode_webtv) && msg == (neutrino_msg_t) g_settings.mpkey_subtitle) { + else if ((mode == NeutrinoModes::mode_webtv) && msg == (neutrino_msg_t) g_settings.mpkey_subtitle) { CMoviePlayerGui::getInstance(true).selectSubtitle(); } #endif @@ -2782,12 +2782,12 @@ void CNeutrinoApp::RealRun() #if HAVE_ARM_HARDWARE if (msg == CRCInput::RC_tv) { - if (mode == mode_radio || mode == mode_webradio) + if (mode == NeutrinoModes::mode_radio || mode == NeutrinoModes::mode_webradio) tvMode(); } else if (msg == CRCInput::RC_radio) { - if (mode == mode_tv || mode == mode_webtv) + if (mode == NeutrinoModes::mode_tv || mode == NeutrinoModes::mode_webtv) radioMode(); } else @@ -2831,7 +2831,7 @@ void CNeutrinoApp::RealRun() else if( msg == CRCInput::RC_page_up || msg == CRCInput::RC_page_down) { quickZap(msg == CRCInput::RC_page_up ? CRCInput::RC_right : CRCInput::RC_left); } - else if(msg == CRCInput::RC_rewind /* && (mode != mode_webtv) */) { + else if(msg == CRCInput::RC_rewind /* && (mode != NeutrinoModes::mode_webtv) */) { if(g_RemoteControl->is_video_started) { t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); if(CRecordManager::getInstance()->RecordingStatus(live_channel_id)) @@ -2860,8 +2860,8 @@ void CNeutrinoApp::RealRun() ( msg == NeutrinoMessages::SHOW_INFOBAR ) ) { bool enabled_by_timing = ( - ((mode == mode_tv || mode == mode_webtv) && g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] != 0) - || ((mode == mode_radio || mode == mode_webradio) && g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR_RADIO] != 0) + ((mode == NeutrinoModes::mode_tv || mode == NeutrinoModes::mode_webtv) && g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] != 0) + || ((mode == NeutrinoModes::mode_radio || mode == NeutrinoModes::mode_webradio) && g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR_RADIO] != 0) ); bool show_info = ((msg != NeutrinoMessages::SHOW_INFOBAR) || (g_InfoViewer->is_visible || enabled_by_timing)); @@ -2889,9 +2889,9 @@ void CNeutrinoApp::RealRun() } } else { - // mode == mode_scart + // mode == NeutrinoModes::mode_scart if (msg == CRCInput::RC_home || msg == CRCInput::RC_aux) { - if( mode == mode_scart ) { + if( mode == NeutrinoModes::mode_scart ) { // Scart-Mode verlassen scartMode( false ); } @@ -2964,7 +2964,7 @@ _repeat: if(!bouquetList->Bouquets.empty()) bouquetList->Bouquets[bouquetList->getActiveBouquetNumber()]->channelList->adjustToChannelID(old_id); - StartSubtitles(mode == mode_tv); + StartSubtitles(mode == NeutrinoModes::mode_tv); } else if(nNewChannel == CHANLIST_CHANGE_MODE) { // list mode changed printf("CNeutrinoApp::showChannelList: newmode: bouquetList %p size %d\n", bouquetList, (int)bouquetList->Bouquets.size());fflush(stdout); @@ -3029,7 +3029,7 @@ bool CNeutrinoApp::wakeupFromStandby(void) bool alive = recordingstatus || CEpgScan::getInstance()->Running() || CStreamManager::getInstance()->StreamStatus(); - if ((mode == mode_standby) && !alive) { + if ((mode == NeutrinoModes::mode_standby) && !alive) { cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000); if(g_settings.ci_standby_reset) { g_CamHandler->exec(NULL, "ca_ci_reset0"); @@ -3047,7 +3047,7 @@ void CNeutrinoApp::standbyToStandby(void) bool alive = recordingstatus || CEpgScan::getInstance()->Running() || CStreamManager::getInstance()->StreamStatus(); - if ((mode == mode_standby) && !alive) { + if ((mode == NeutrinoModes::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)) { @@ -3096,7 +3096,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) if(msg == NeutrinoMessages::EVT_WEBTV_ZAP_COMPLETE) { t_channel_id chid = *(t_channel_id *) data; printf("EVT_WEBTV_ZAP_COMPLETE: %" PRIx64 "\n", chid); - if (mode == mode_standby) { + if (mode == NeutrinoModes::mode_standby) { delete [] (unsigned char*) data; } else { CZapitChannel * cc = CZapit::getInstance()->GetCurrentChannel(); @@ -3106,7 +3106,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) delete [] (unsigned char*) data; else { - if (mode == mode_webtv || mode == mode_webradio) + if (mode == NeutrinoModes::mode_webtv || mode == NeutrinoModes::mode_webradio) videoDecoder->setBlank(true); g_RCInput->postMsg(NeutrinoMessages::EVT_ZAP_FAILED, data); } @@ -3116,7 +3116,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) return messages_return::handled; } #if 0 - if (mode == mode_webtv && msg == NeutrinoMessages::EVT_SUBT_MESSAGE) { + if (mode == NeutrinoModes::mode_webtv && msg == NeutrinoMessages::EVT_SUBT_MESSAGE) { CMoviePlayerGui::getInstance(true).showSubtitle(data); return messages_return::handled; } @@ -3140,7 +3140,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) CVFD::getInstance()->UpdateIcons(); g_RCInput->killTimer(scrambled_timer); - if (mode != mode_webtv) { + if (mode != NeutrinoModes::mode_webtv) { scrambled_timer = g_RCInput->addTimer(10*1000*1000, true); SelectSubtitles(); //StartSubtitles(!g_InfoViewer->is_visible); @@ -3163,7 +3163,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) if (wakeupFromStandby()) { CheckFastScan(true); standbyToStandby(); - } else if (mode == mode_standby) { + } else if (mode == NeutrinoModes::mode_standby) { fst_timer = g_RCInput->addTimer(30*1000*1000, true); } return messages_return::handled; @@ -3199,7 +3199,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) /* ================================== KEYS ================================================ */ if( msg == CRCInput::RC_ok || (!g_InfoViewer->getSwitchMode() && CNeutrinoApp::getInstance()->listModeKey(msg))) { - if( (mode == mode_tv) || (mode == mode_radio) || (mode == mode_ts) || (mode == mode_webtv) || (mode == mode_webradio)) { + if( (mode == NeutrinoModes::mode_tv) || (mode == NeutrinoModes::mode_radio) || (mode == NeutrinoModes::mode_ts) || (mode == NeutrinoModes::mode_webtv) || (mode == NeutrinoModes::mode_webradio)) { showChannelList(msg); return messages_return::handled; } @@ -3231,7 +3231,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) /* shuts down the system even if !g_settings.shutdown_real_rcdelay (see below) */ gettimeofday(&standby_pressed_at, NULL); - if ((mode != mode_standby) && (g_settings.shutdown_real)) { + if ((mode != NeutrinoModes::mode_standby) && (g_settings.shutdown_real)) { CRecordManager::getInstance()->StopAutoRecord(); if(CRecordManager::getInstance()->RecordingStatus()) { new_msg = NeutrinoMessages::STANDBY_ON; @@ -3241,7 +3241,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) new_msg = NeutrinoMessages::SHUTDOWN; } else { - new_msg = (mode == mode_standby) ? NeutrinoMessages::STANDBY_OFF : NeutrinoMessages::STANDBY_ON; + new_msg = (mode == NeutrinoModes::mode_standby) ? NeutrinoMessages::STANDBY_OFF : NeutrinoMessages::STANDBY_ON; //printf("standby: new msg %X\n", new_msg); if ((g_settings.shutdown_real_rcdelay)) { neutrino_msg_t _msg_; @@ -3305,7 +3305,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) return messages_return::handled; } else if( msg == CRCInput::RC_spkr ) { - if( mode == mode_standby ) { + if( mode == NeutrinoModes::mode_standby ) { //switch lcd off/on CVFD::getInstance()->togglePower(); } @@ -3439,7 +3439,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) delete[] (unsigned char*) data; return messages_return::handled; } - if(mode == mode_standby){ + if(mode == NeutrinoModes::mode_standby){ if((eventinfo->channel_id != live_channel_id) && !(SAME_TRANSPONDER(live_channel_id, eventinfo->channel_id))) zapTo(eventinfo->channel_id); } @@ -3495,10 +3495,10 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) dvbsub_stop(); - if ((!isTVMode) && (mode != mode_radio) && (mode != mode_webradio)) { + if ((!isTVMode) && (mode != NeutrinoModes::mode_radio) && (mode != NeutrinoModes::mode_webradio)) { radioMode(true); } - else if (isTVMode && (mode != mode_tv) && (mode != mode_webtv)) { + else if (isTVMode && (mode != NeutrinoModes::mode_tv) && (mode != NeutrinoModes::mode_webtv)) { tvMode(true); } @@ -3510,10 +3510,10 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) return messages_return::handled; } else if( msg == NeutrinoMessages::ANNOUNCE_ZAPTO) { - if( mode == mode_standby ) { + if( mode == NeutrinoModes::mode_standby ) { standbyMode( false ); } - if( mode != mode_scart ) { + if( mode != NeutrinoModes::mode_scart ) { CTimerd::RecordingInfo * eventinfo = (CTimerd::RecordingInfo *) data; std::string name = g_Locale->getText(LOCALE_ZAPTOTIMER_ANNOUNCE); getAnnounceEpgName( eventinfo, name); @@ -3538,11 +3538,11 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) wakeup_hdd(recordingDir); } - if( g_settings.recording_zap_on_announce && (mode != mode_standby) && (eventinfo->channel_id != CZapit::getInstance()->GetCurrentChannelID())) { + if( g_settings.recording_zap_on_announce && (mode != NeutrinoModes::mode_standby) && (eventinfo->channel_id != CZapit::getInstance()->GetCurrentChannelID())) { CRecordManager::getInstance()->StopAutoRecord(); zapTo(eventinfo->channel_id); } - if(( mode != mode_scart ) && ( mode != mode_standby ) && g_settings.recording_startstop_msg) { + if(( mode != NeutrinoModes::mode_scart ) && ( mode != NeutrinoModes::mode_standby ) && g_settings.recording_startstop_msg) { std::string name = g_Locale->getText(LOCALE_RECORDTIMER_ANNOUNCE); getAnnounceEpgName(eventinfo, name); ShowHint(LOCALE_MESSAGEBOX_INFO, name.c_str()); @@ -3551,7 +3551,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) return messages_return::handled; } else if( msg == NeutrinoMessages::ANNOUNCE_SLEEPTIMER) { - if( mode != mode_scart && mode != mode_standby) + if( mode != NeutrinoModes::mode_scart && mode != NeutrinoModes::mode_standby) skipSleepTimer = (ShowMsg(LOCALE_MESSAGEBOX_INFO, g_settings.shutdown_real ? LOCALE_SHUTDOWNTIMER_ANNOUNCE:LOCALE_SLEEPTIMERBOX_ANNOUNCE,CMsgBox::mbrNo, CMsgBox::mbYes | CMsgBox::mbNo, NULL, 450, 30, true) == CMsgBox::mbrYes); return messages_return::handled; } @@ -3590,7 +3590,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) return messages_return::handled; } else if( msg == NeutrinoMessages::STANDBY_TOGGLE ) { - standbyMode( !(mode & mode_standby) ); + standbyMode( !(mode & NeutrinoModes::mode_standby) ); g_RCInput->clearRCMsg(); return messages_return::handled; } @@ -3599,21 +3599,21 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) return messages_return::handled; } else if( msg == NeutrinoMessages::STANDBY_ON ) { - if( mode != mode_standby ) { + if( mode != NeutrinoModes::mode_standby ) { standbyMode( true ); } g_RCInput->clearRCMsg(); return messages_return::handled; } else if( msg == NeutrinoMessages::STANDBY_OFF ) { - if( mode == mode_standby ) { + if( mode == NeutrinoModes::mode_standby ) { standbyMode( false ); } g_RCInput->clearRCMsg(); return messages_return::handled; } else if( msg == NeutrinoMessages::ANNOUNCE_SHUTDOWN) { - if( mode != mode_scart ) + if( mode != NeutrinoModes::mode_scart ) skipShutdownTimer = (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_SHUTDOWNTIMER_ANNOUNCE, CMsgBox::mbrNo, CMsgBox::mbYes | CMsgBox::mbNo, NULL, 450, 5) == CMsgBox::mbrYes); } else if( msg == NeutrinoMessages::SHUTDOWN ) { @@ -3633,7 +3633,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) ExitRun(); } else if (msg == NeutrinoMessages::EVT_POPUP || msg == NeutrinoMessages::EVT_EXTMSG) { - if (mode != mode_scart && mode != mode_standby) { + if (mode != NeutrinoModes::mode_scart && mode != NeutrinoModes::mode_standby) { int timeout = DEFAULT_TIMEOUT; std::string text = (char*)data; std::string::size_type pos; @@ -3668,7 +3668,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) { text[pos] = '\n'; } - if( mode != mode_scart ) + if( mode != NeutrinoModes::mode_scart ) ShowMsg(LOCALE_TIMERLIST_TYPE_REMIND, text, CMsgBox::mbrBack, CMsgBox::mbBack, NEUTRINO_ICON_INFO); // UTF-8 delete[] (unsigned char*) data; return messages_return::handled; @@ -3684,46 +3684,46 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) return messages_return::handled; } else if( msg == NeutrinoMessages::CHANGEMODE ) { - printf("CNeutrinoApp::handleMsg: CHANGEMODE to %d rezap %d\n", (int)(data & mode_mask), (data & norezap) != norezap); - if((data & mode_mask)== mode_radio) { - if( mode != mode_radio ) { - radioMode((data & norezap) != norezap); + printf("CNeutrinoApp::handleMsg: CHANGEMODE to %d rezap %d\n", (int)(data & NeutrinoModes::mode_mask), (data & NeutrinoModes::norezap) != NeutrinoModes::norezap); + if((data & NeutrinoModes::mode_mask)== NeutrinoModes::mode_radio) { + if( mode != NeutrinoModes::mode_radio ) { + radioMode((data & NeutrinoModes::norezap) != NeutrinoModes::norezap); } } - if((data & mode_mask)== mode_tv) { - if( mode != mode_tv ) { - tvMode((data & norezap) != norezap); + if((data & NeutrinoModes::mode_mask)== NeutrinoModes::mode_tv) { + if( mode != NeutrinoModes::mode_tv ) { + tvMode((data & NeutrinoModes::norezap) != NeutrinoModes::norezap); } } - if((data & mode_mask)== mode_standby) { - if(mode != mode_standby) + if((data & NeutrinoModes::mode_mask)== NeutrinoModes::mode_standby) { + if(mode != NeutrinoModes::mode_standby) standbyMode( true ); } - if((data & mode_mask)== mode_upnp) { + if((data & NeutrinoModes::mode_mask)== NeutrinoModes::mode_upnp) { lastMode=mode; - mode=mode_upnp; + mode=NeutrinoModes::mode_upnp; } - if((data & mode_mask)== mode_audio) { + if((data & NeutrinoModes::mode_mask)== NeutrinoModes::mode_audio) { lastMode=mode; - mode=mode_audio; + mode=NeutrinoModes::mode_audio; } - if((data & mode_mask)== mode_pic) { + if((data & NeutrinoModes::mode_mask)== NeutrinoModes::mode_pic) { lastMode=mode; - mode=mode_pic; + mode=NeutrinoModes::mode_pic; } - if((data & mode_mask)== mode_ts) { - if(mode == mode_radio) + if((data & NeutrinoModes::mode_mask)== NeutrinoModes::mode_ts) { + if(mode == NeutrinoModes::mode_radio) frameBuffer->stopFrame(); lastMode=mode; - mode=mode_ts; + mode=NeutrinoModes::mode_ts; } - if((data & mode_mask)== mode_webtv || (data & mode_mask)== mode_webradio) { + if((data & NeutrinoModes::mode_mask)== NeutrinoModes::mode_webtv || (data & NeutrinoModes::mode_mask)== NeutrinoModes::mode_webradio) { lastMode=mode; - if ((data & mode_mask) == mode_webtv) - mode=mode_webtv; + if ((data & NeutrinoModes::mode_mask) == NeutrinoModes::mode_webtv) + mode=NeutrinoModes::mode_webtv; else - mode=mode_webradio; - if ((data & norezap) != norezap) { + mode=NeutrinoModes::mode_webradio; + if ((data & NeutrinoModes::norezap) != NeutrinoModes::norezap) { CZapitChannel * cc = CZapit::getInstance()->GetCurrentChannel(); if (cc && IS_WEBCHAN(cc->getChannelID())) { CMoviePlayerGui::getInstance().stopPlayBack(); @@ -3734,7 +3734,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) } } else if( msg == NeutrinoMessages::VCR_ON ) { - if( mode != mode_scart ) { + if( mode != NeutrinoModes::mode_scart ) { scartMode( true ); } else @@ -3742,7 +3742,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) } else if( msg == NeutrinoMessages::VCR_OFF ) { - if( mode == mode_scart ) { + if( mode == NeutrinoModes::mode_scart ) { scartMode( false ); } } @@ -3852,7 +3852,7 @@ void CNeutrinoApp::ExitRun(int can_shutdown) printf("entering off state\n"); printf("timer_minutes: %ld\n", timer_minutes); - mode = mode_off; + mode = NeutrinoModes::mode_off; //CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_MAINMENU_SHUTDOWN)); #if 0 @@ -4062,14 +4062,14 @@ void CNeutrinoApp::saveEpg(bool cvfd_mode) void CNeutrinoApp::tvMode( bool rezap ) { - if (mode == mode_webradio) { - CMoviePlayerGui::getInstance().setLastMode(mode_unknown); + if (mode == NeutrinoModes::mode_webradio) { + CMoviePlayerGui::getInstance().setLastMode(NeutrinoModes::mode_unknown); CMoviePlayerGui::getInstance().stopPlayBack(); CVFD::getInstance()->ShowIcon(FP_ICON_TV, false); rezap = true; } INFO("rezap %d current mode %d", rezap, mode); - if (mode == mode_radio || mode == mode_webradio) { + if (mode == NeutrinoModes::mode_radio || mode == NeutrinoModes::mode_webradio) { if (g_settings.radiotext_enable && g_Radiotext) { delete g_Radiotext; g_Radiotext = NULL; @@ -4084,7 +4084,7 @@ void CNeutrinoApp::tvMode( bool rezap ) CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); CVFD::getInstance()->ShowIcon(FP_ICON_TV, true); - if( mode == mode_standby ) { + if( mode == NeutrinoModes::mode_standby ) { CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); videoDecoder->Standby(false); } @@ -4095,16 +4095,16 @@ void CNeutrinoApp::tvMode( bool rezap ) frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true)); #endif #if 0 - if(mode != mode_ts /*&& autoshift*/) { + if(mode != NeutrinoModes::mode_ts /*&& autoshift*/) { //printf("standby on: autoshift ! stopping ...\n"); CRecordManager::getInstance()->StopAutoRecord(); } #endif - if (mode != mode_webtv) { + if (mode != NeutrinoModes::mode_webtv) { frameBuffer->useBackground(false); frameBuffer->paintBackground(); } - mode = mode_tv; + mode = NeutrinoModes::mode_tv; g_RemoteControl->tvMode(); SetChannelMode(g_settings.channel_mode); @@ -4132,7 +4132,7 @@ void CNeutrinoApp::scartMode( bool bOnOff ) #endif CVFD::getInstance()->setMode(CVFD::MODE_SCART); lastMode = mode; - mode = mode_scart; + mode = NeutrinoModes::mode_scart; } else { // SCART AUS //g_Controld->setScartMode( 0 ); @@ -4141,15 +4141,15 @@ void CNeutrinoApp::scartMode( bool bOnOff ) videoDecoder->Standby(false); videoDecoder->Start(); #endif - mode = mode_unknown; + mode = NeutrinoModes::mode_unknown; //re-set mode - if( lastMode == mode_radio || lastMode == mode_webradio) { + if( lastMode == NeutrinoModes::mode_radio || lastMode == NeutrinoModes::mode_webradio) { radioMode( false ); } - else if( lastMode == mode_tv || lastMode == mode_webtv) { + else if( lastMode == NeutrinoModes::mode_tv || lastMode == NeutrinoModes::mode_webtv) { tvMode( false ); } - else if( lastMode == mode_standby ) { + else if( lastMode == NeutrinoModes::mode_standby ) { standbyMode( true ); } } @@ -4167,7 +4167,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) if( bOnOff ) { CVFD::getInstance()->ShowText("standby... "); - if( mode == mode_scart ) { + if( mode == NeutrinoModes::mode_scart ) { //g_Controld->setScartMode( 0 ); } g_InfoViewer->setUpdateTimer(0); // delete timer @@ -4181,7 +4181,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) /* wasshift = */ CRecordManager::getInstance()->StopAutoRecord(); - if(mode == mode_radio && g_Radiotext) + if(mode == NeutrinoModes::mode_radio && g_Radiotext) g_Radiotext->radiotext_stop(); #ifdef ENABLE_PIP @@ -4203,7 +4203,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) g_Sectionsd->setPauseScanning(!fromDeepStandby); lastMode = mode; - mode = mode_standby; + mode = NeutrinoModes::mode_standby; if(!CRecordManager::getInstance()->RecordingStatus() ) { //only save epg when not recording @@ -4289,8 +4289,8 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) If the channel is the same (as during a recording), then it will only check PIN and not zap, so we should be fine here */ - mode = mode_unknown; - if (lastMode == mode_radio || lastMode == mode_webradio) { + mode = NeutrinoModes::mode_unknown; + if (lastMode == NeutrinoModes::mode_radio || lastMode == NeutrinoModes::mode_webradio) { radioMode( false ); } else { /* for standby -> tv mode from radio mode in case of record */ @@ -4323,12 +4323,12 @@ void CNeutrinoApp::radioMode( bool rezap) { //printf("radioMode: rezap %s\n", rezap ? "yes" : "no"); INFO("rezap %d current mode %d", rezap, mode); - if (mode == mode_webtv) { - CMoviePlayerGui::getInstance().setLastMode(mode_unknown); + if (mode == NeutrinoModes::mode_webtv) { + CMoviePlayerGui::getInstance().setLastMode(NeutrinoModes::mode_unknown); CMoviePlayerGui::getInstance().stopPlayBack(); CVFD::getInstance()->ShowIcon(FP_ICON_TV, false); } - if (mode == mode_tv) { + if (mode == NeutrinoModes::mode_tv) { CVFD::getInstance()->ShowIcon(FP_ICON_TV, false); StopSubtitles(); } @@ -4336,7 +4336,7 @@ void CNeutrinoApp::radioMode( bool rezap) CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); CVFD::getInstance()->ShowIcon(FP_ICON_RADIO, true); - if( mode == mode_standby ) { + if( mode == NeutrinoModes::mode_standby ) { CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); videoDecoder->Standby(false); } @@ -4348,7 +4348,7 @@ void CNeutrinoApp::radioMode( bool rezap) #endif CRecordManager::getInstance()->StopAutoRecord(); - if (mode != mode_webtv && mode != mode_webradio) { + if (mode != NeutrinoModes::mode_webtv && mode != NeutrinoModes::mode_webradio) { /* FIXME: frameBuffer->paintBackground() is clearing display. @@ -4357,7 +4357,7 @@ void CNeutrinoApp::radioMode( bool rezap) frameBuffer->useBackground(false); frameBuffer->paintBackground(); } - mode = mode_radio; + mode = NeutrinoModes::mode_radio; g_RemoteControl->radioMode(); SetChannelMode(g_settings.channel_mode_radio); @@ -4373,9 +4373,9 @@ void CNeutrinoApp::radioMode( bool rezap) void CNeutrinoApp::channelRezap() { t_channel_id last_chid = 0; - if (mode == mode_tv) + if (mode == NeutrinoModes::mode_tv) last_chid = CZapit::getInstance()->GetLastTVChannel(); - else if (mode == mode_radio) + else if (mode == NeutrinoModes::mode_radio) last_chid = CZapit::getInstance()->GetLastRADIOChannel(); else return; @@ -4389,15 +4389,15 @@ void CNeutrinoApp::channelRezap() //switching from current mode to tv or radio mode or to optional parameter prev_mode void CNeutrinoApp::switchTvRadioMode(const int prev_mode) { - if (prev_mode != mode_unknown){ - if (prev_mode == mode_tv && mode != mode_tv ) + if (prev_mode != NeutrinoModes::mode_unknown){ + if (prev_mode == NeutrinoModes::mode_tv && mode != NeutrinoModes::mode_tv ) tvMode(); - else if(prev_mode == mode_radio && mode != mode_radio) + else if(prev_mode == NeutrinoModes::mode_radio && mode != NeutrinoModes::mode_radio) radioMode(); } else { - if (mode == mode_radio || mode == mode_webradio) + if (mode == NeutrinoModes::mode_radio || mode == NeutrinoModes::mode_webradio) tvMode(); - else if(mode == mode_tv || mode == mode_webtv) + else if(mode == NeutrinoModes::mode_tv || mode == NeutrinoModes::mode_webtv) radioMode(); } } @@ -4447,12 +4447,12 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) } else if (actionKey=="tv")//used in mainmenu { - switchTvRadioMode(mode_tv); + switchTvRadioMode(NeutrinoModes::mode_tv); returnval = menu_return::RETURN_EXIT_ALL; } else if (actionKey=="radio")//used in mainmenu { - switchTvRadioMode(mode_radio); + switchTvRadioMode(NeutrinoModes::mode_radio); returnval = menu_return::RETURN_EXIT_ALL; } else if(actionKey=="scart") { @@ -4488,15 +4488,15 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) } else if(actionKey=="ytplayback" || actionKey=="tsmoviebrowser" || actionKey=="fileplayback") { frameBuffer->Clear(); - if (mode == NeutrinoMessages::mode_radio || mode == NeutrinoMessages::mode_webradio) + if (mode == NeutrinoModes::NeutrinoModes::mode_radio || mode == NeutrinoModes::NeutrinoModes::mode_webradio) frameBuffer->stopFrame(); int prev_mode = mode; // FIXME CMediaPlayerMenu::getInstance()->exec(NULL, actionKey); ?? CMoviePlayerGui::getInstance().exec(NULL, actionKey); - if (prev_mode == NeutrinoMessages::mode_radio || prev_mode == NeutrinoMessages::mode_webradio) + if (prev_mode == NeutrinoModes::NeutrinoModes::mode_radio || prev_mode == NeutrinoModes::NeutrinoModes::mode_webradio) frameBuffer->showFrame("radiomode.jpg"); #if 0 - else if (prev_mode == mode_webtv) + else if (prev_mode == NeutrinoModes::mode_webtv) tvMode(true); #endif return menu_return::RETURN_EXIT_ALL; @@ -4903,7 +4903,7 @@ void CNeutrinoApp::StopSubtitles() frameBuffer->paintBackground(); } #if 0 - if (mode == mode_webtv) + if (mode == NeutrinoModes::mode_webtv) CMoviePlayerGui::getInstance(true).clearSubtitle(true); #endif } @@ -4916,7 +4916,7 @@ void CNeutrinoApp::StartSubtitles(bool show) dvbsub_start(0); tuxtx_pause_subtitle(false); #if 0 - if (mode == mode_webtv) + if (mode == NeutrinoModes::mode_webtv) CMoviePlayerGui::getInstance(true).clearSubtitle(false); #endif } @@ -5162,8 +5162,8 @@ bool CNeutrinoApp::adjustToChannelID(const t_channel_id channel_id) return false; channelList->getLastChannels().store (channel_id); - if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_tv - || CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv) { + if(CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_tv + || CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv) { has_channel = TVfavList->adjustToChannelID(channel_id); if (has_channel && first_mode_found < 0) first_mode_found = LIST_MODE_FAV; @@ -5190,8 +5190,8 @@ bool CNeutrinoApp::adjustToChannelID(const t_channel_id channel_id) TVallList->adjustToChannelID(channel_id); } - else if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio - || CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webradio) { + else if(CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_radio + || CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio) { has_channel = RADIOfavList->adjustToChannelID(channel_id); if (has_channel && first_mode_found < 0) first_mode_found = LIST_MODE_FAV; diff --git a/src/neutrino.h b/src/neutrino.h index 7b99b3612..90847e2af 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -143,24 +143,6 @@ private: CNeutrinoApp(); public: - enum - { - mode_unknown = -1, - mode_tv = 1, - mode_radio = 2, - mode_scart = 3, - mode_standby = 4, - mode_audio = 5, - mode_pic = 6, - mode_ts = 7, - mode_off = 8, - mode_webtv = 9, - mode_upnp = 10, - mode_webradio = 11, - mode_mask = 0xFF, - norezap = 0x100 - }; - CUserMenu usermenu; void saveSetup(const char * fname); @@ -202,7 +184,7 @@ public: int getLastMode() { return lastMode; } - void switchTvRadioMode(const int prev_mode = mode_unknown); + void switchTvRadioMode(const int prev_mode = NeutrinoModes::mode_unknown); bool isMuted() {return current_muted; } diff --git a/src/neutrinoMessages.h b/src/neutrinoMessages.h index d0fa25562..808218986 100644 --- a/src/neutrinoMessages.h +++ b/src/neutrinoMessages.h @@ -170,16 +170,21 @@ struct NeutrinoMessages { EVT_WEBTV_ZAP_COMPLETE = CRCInput::RC_WithData + 28, /* data: (t_channel_id *) */ EVT_SCAN_REPORT_FREQUENCYP = CRCInput::RC_WithData + 29 }; +}; + +struct NeutrinoModes +{ enum { mode_unknown = -1, - mode_tv = 1, + mode_tv = 1, mode_radio = 2, mode_scart = 3, mode_standby = 4, mode_audio = 5, mode_pic = 6, mode_ts = 7, + mode_off = 8, mode_webtv = 9, mode_upnp = 10, mode_webradio = 11, @@ -188,5 +193,4 @@ struct NeutrinoMessages { }; }; - #endif diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index aae45af24..09e374a73 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -379,8 +379,8 @@ void CControlAPI::SetModeCGI(CyhookHandler *hh) if (hh->ParamList["1"] == "radio") // switch to radio mode { - if(CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_standby){ - neutrino_msg_data_t mode = NeutrinoMessages::mode_radio; + if(CNeutrinoApp::getInstance()->getMode() != NeutrinoModes::mode_standby){ + neutrino_msg_data_t mode = NeutrinoModes::mode_radio; NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::CHANGEMODE, CEventServer::INITID_HTTPD, (void *)&mode,sizeof(neutrino_msg_data_t)); sleep(1); NeutrinoAPI->UpdateBouquets(); @@ -391,8 +391,8 @@ void CControlAPI::SetModeCGI(CyhookHandler *hh) } else if (hh->ParamList["1"] == "tv") // switch to tv mode { - if(CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_standby){ - neutrino_msg_data_t mode = NeutrinoMessages::mode_tv; + if(CNeutrinoApp::getInstance()->getMode() != NeutrinoModes::mode_standby){ + neutrino_msg_data_t mode = NeutrinoModes::mode_tv; NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::CHANGEMODE, CEventServer::INITID_HTTPD, (void *)&mode,sizeof(neutrino_msg_data_t)); sleep(1); NeutrinoAPI->UpdateBouquets(); @@ -452,23 +452,23 @@ void CControlAPI::GetModeCGI(CyhookHandler *hh) else { int mode = CNeutrinoApp::getInstance()->getMode(); - if (mode == NeutrinoMessages::mode_tv) + if (mode == NeutrinoModes::mode_tv) result = "tv"; - else if (mode == NeutrinoMessages::mode_radio) + else if (mode == NeutrinoModes::mode_radio) result = "radio"; - else if (mode == NeutrinoMessages::mode_scart) + else if (mode == NeutrinoModes::mode_scart) result = "scart"; - else if (mode == NeutrinoMessages::mode_standby) + else if (mode == NeutrinoModes::mode_standby) result = "standby"; - else if (mode == NeutrinoMessages::mode_audio) + else if (mode == NeutrinoModes::mode_audio) result = "audio"; - else if (mode == NeutrinoMessages::mode_pic) + else if (mode == NeutrinoModes::mode_pic) result = "pic"; - else if (mode == NeutrinoMessages::mode_ts) + else if (mode == NeutrinoModes::mode_ts) result = "ts"; - else if (mode == NeutrinoMessages::mode_webtv) + else if (mode == NeutrinoModes::mode_webtv) result = "webtv"; - else if (mode == NeutrinoMessages::mode_upnp) + else if (mode == NeutrinoModes::mode_upnp) result = "upnp"; else result = "unknown"; From 7baaedf34d69872ba8e134535e810e386e1f79f0 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 20 Nov 2017 15:19:06 +0100 Subject: [PATCH 02/14] neutrino: clearify mode handling in saveEpg() function Conflicts: src/driver/scanepg.cpp src/neutrino.cpp Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/9645cb24d17417962e598dfca6b0220e45e818b6 Author: vanhofen Date: 2017-11-20 (Mon, 20 Nov 2017) Origin message was: ------------------ - neutrino: clearify mode handling in saveEpg() function Conflicts: src/driver/scanepg.cpp src/neutrino.cpp Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/driver/scanepg.cpp | 3 +++ src/neutrino.cpp | 39 +++++++++++++++++++++++---------------- src/neutrino.h | 2 +- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/driver/scanepg.cpp b/src/driver/scanepg.cpp index 0314bcd0a..a9921dd93 100644 --- a/src/driver/scanepg.cpp +++ b/src/driver/scanepg.cpp @@ -333,6 +333,9 @@ void CEpgScan::EnterStandby() if (standby) { CZapit::getInstance()->SetCurrentChannelID(live_channel_id); CNeutrinoApp::getInstance()->standbyToStandby(); + + if (g_settings.epg_save && g_settings.epg_save_standby) + CNeutrinoApp::getInstance()->saveEpg(NeutrinoModes::mode_standby); } } diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 8750307e8..300ec42db 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3829,7 +3829,7 @@ void CNeutrinoApp::ExitRun(int can_shutdown) if(g_settings.epg_save /* && timeset && g_Sectionsd->getIsTimeSet ()*/) { g_Sectionsd->setPauseScanning(true); - saveEpg(true);// true CVFD::MODE_SHUTDOWN + saveEpg(NeutrinoModes::mode_off); } /* on shutdown force load new fst */ @@ -4020,40 +4020,47 @@ void CNeutrinoApp::ExitRun(int can_shutdown) #endif } -void CNeutrinoApp::saveEpg(bool cvfd_mode) +void CNeutrinoApp::saveEpg(int _mode) { struct stat my_stat; - if(stat(g_settings.epg_dir.c_str(), &my_stat) == 0){ - if(!cvfd_mode){//skip saveepg in standby mode, if last saveepg time < 15 Min. + if (stat(g_settings.epg_dir.c_str(), &my_stat) == 0) + { + if (_mode == NeutrinoModes::mode_standby) + { + // skip save epg in standby mode, if last saveepg time < 15 Min. std::string index_xml = g_settings.epg_dir.c_str(); index_xml += "/index.xml"; time_t t=0; - if(stat(index_xml.c_str(), &my_stat) == 0){ - if(difftime(time(&t), my_stat.st_ctime) < 900){ + if (stat(index_xml.c_str(), &my_stat) == 0) + { + if (difftime(time(&t), my_stat.st_ctime) < 900) return; - } } } - printf("[neutrino] Saving EPG to %s...\n", g_settings.epg_dir.c_str()); - CVFD::getInstance()->Clear(); CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_EPG_SAVING)); + printf("[neutrino] Saving EPG to %s...\n", g_settings.epg_dir.c_str()); g_Sectionsd->writeSI2XML(g_settings.epg_dir.c_str()); - neutrino_msg_t msg; + neutrino_msg_t msg; neutrino_msg_data_t data; - while( true ) { + while(true) + { g_RCInput->getMsg(&msg, &data, 1200); // 120 secs.. - if (( msg == CRCInput::RC_timeout ) || (msg == NeutrinoMessages::EVT_SI_FINISHED)) { + if ((msg == CRCInput::RC_timeout) || (msg == NeutrinoMessages::EVT_SI_FINISHED)) + { //printf("Msg %x timeout %d EVT_SI_FINISHED %x\n", msg, CRCInput::RC_timeout, NeutrinoMessages::EVT_SI_FINISHED); CVFD::getInstance()->Clear(); - CVFD::getInstance()->setMode(cvfd_mode ? CVFD::MODE_SHUTDOWN : CVFD::MODE_STANDBY);// true CVFD::MODE_SHUTDOWN , false CVFD::MODE_STANDBY + // do we really have to change VFD-mode here again? + CVFD::getInstance()->setMode((_mode == NeutrinoModes::mode_standby) ? CVFD::MODE_STANDBY : CVFD::MODE_SHUTDOWN); delete [] (unsigned char*) data; break; - } else if (!cvfd_mode){ - printf("wait for epg saving, Msg %x \n", (int) msg); + } + else if (_mode == NeutrinoModes::mode_standby) + { + printf("wait for epg saving, msg %x \n", (int) msg); handleMsg(msg, data); } } @@ -4208,7 +4215,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) if(!CRecordManager::getInstance()->RecordingStatus() ) { //only save epg when not recording if(g_settings.epg_save && !fromDeepStandby && g_settings.epg_save_standby) { - saveEpg(false);//false CVFD::MODE_STANDBY + saveEpg(NeutrinoModes::mode_standby); } } diff --git a/src/neutrino.h b/src/neutrino.h index 90847e2af..f0bc6d2b3 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -211,7 +211,7 @@ public: CConfigFile* getConfigFile() {return &configfile;}; bool SDTreloadChannels; - void saveEpg(bool cvfd_mode); + void saveEpg(int _mode); void stopDaemonsForFlash(); int showChannelList(const neutrino_msg_t msg, bool from_menu = false); void allowChannelList(bool allow){channelList_allowed = allow;} From 3ef2c7e028180b8d8a60e99fb7aa1e2500d9a3c4 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 20 Nov 2017 15:19:06 +0100 Subject: [PATCH 03/14] controlapi: add mode_webradio to GetModeCGI() Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/fe35b42a3b3c3560001f9abf142e1c3e29c2f46f Author: vanhofen Date: 2017-11-20 (Mon, 20 Nov 2017) Origin message was: ------------------ - controlapi: add mode_webradio to GetModeCGI() Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/nhttpd/tuxboxapi/controlapi.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index 09e374a73..b8f3cc973 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -470,6 +470,8 @@ void CControlAPI::GetModeCGI(CyhookHandler *hh) result = "webtv"; else if (mode == NeutrinoModes::mode_upnp) result = "upnp"; + else if (mode == NeutrinoModes::mode_radio) + result = "webradio"; else result = "unknown"; } From ba000a4491eaf55322c331e75ea3cef129a481a1 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 20 Nov 2017 15:19:06 +0100 Subject: [PATCH 04/14] neutrino: cleanup ExitRun() function from unused code Conflicts: src/neutrino.cpp Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f128d38ad350d8813c2e175a8de5a9f4c740d30d Author: vanhofen Date: 2017-11-20 (Mon, 20 Nov 2017) Origin message was: ------------------ - neutrino: cleanup ExitRun() function from unused code Conflicts: src/neutrino.cpp Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/neutrino.cpp | 97 ++++-------------------------------------------- 1 file changed, 8 insertions(+), 89 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 300ec42db..6a7e0db00 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3826,7 +3826,7 @@ void CNeutrinoApp::ExitRun(int can_shutdown) delete CRecordManager::getInstance(); CEpgScan::getInstance()->Stop(); - if(g_settings.epg_save /* && timeset && g_Sectionsd->getIsTimeSet ()*/) + if (g_settings.epg_save) { g_Sectionsd->setPauseScanning(true); saveEpg(NeutrinoModes::mode_off); @@ -3838,7 +3838,7 @@ void CNeutrinoApp::ExitRun(int can_shutdown) CVFD::getInstance()->setMode(CVFD::MODE_SHUTDOWN); - stop_daemons(true /*can_shutdown*/); //need here for timer_is_rec before saveSetup + stop_daemons(true); // need here for timer_is_rec before saveSetup g_settings.shutdown_timer_record_type = timer_is_rec; saveSetup(NEUTRINO_SETTINGS_FILE); @@ -3853,88 +3853,7 @@ void CNeutrinoApp::ExitRun(int can_shutdown) printf("entering off state\n"); printf("timer_minutes: %ld\n", timer_minutes); mode = NeutrinoModes::mode_off; - //CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_MAINMENU_SHUTDOWN)); - #if 0 - fp_standby_data_t standby; - time_t mtime = time(NULL); - struct tm *tmtime = localtime(&mtime); - time_t fp_timer = 0; - - if (timer_minutes) - { - fp_timer = timer_minutes - mtime/60; - if (fp_timer < 1) - fp_timer = 1; - } - printf("now: %ld, timer %ld, FP timer %ldmin\n", mtime/60, timer_minutes, fp_timer);fflush(stdout); - int leds = 0x40; - switch (g_settings.led_deep_mode) - { - case 0: - leds = 0x0; //off leds - break; - case 1: - leds = 0x60; //on led1 & 2 - break; - case 2: - leds = 0x20; //led1 on , 2 off - break; - case 3: - leds = 0x40; //led2 off, 2 on - break; - default: - break; - } - if (leds && g_settings.led_blink && fp_timer) - leds |= 0x80; - - standby.brightness = cs_get_revision() == 10 ? 0 : g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS]; - standby.flags = leds; - standby.current_hour = tmtime->tm_hour; - standby.current_minute = tmtime->tm_min; - standby.timer_minutes_hi = fp_timer >> 8;; - standby.timer_minutes_lo = fp_timer & 0xFF; - - my_system("/etc/init.d/rcK"); - sync(); - CFSMounter::umount(); // unreachable NFS server - my_system(2,"/bin/umount", "-a"); - sleep(1); - - stop_video(); - - int fd = open("/dev/display", O_RDONLY); - if (fd < 0) - { - perror("/dev/display"); - reboot(LINUX_REBOOT_CMD_RESTART); - } - else - { - if (ioctl(fd, IOC_FP_STANDBY, (fp_standby_data_t *) &standby)) - { - perror("IOC_FP_STANDBY"); - reboot(LINUX_REBOOT_CMD_RESTART); - } - else - { - while (true) - sleep(1); - } - } - } - else - { - delete g_RCInput; - my_system("/etc/init.d/rcK"); - //fan speed - if (g_info.hw_caps->has_fan) - CFanControlNotifier::setSpeed(0); - stop_video(); - Cleanup(); - //_exit(0); - exit(0); } #endif int leds = 0; @@ -3944,16 +3863,16 @@ void CNeutrinoApp::ExitRun(int can_shutdown) leds = 0x40; switch (g_settings.led_deep_mode){ case 0: - leds = 0x0;//off leds + leds = 0x0; // leds off break; case 1: - leds = 0x60;//on led1 & 2 + leds = 0x60; // led1 on, led2 on break; case 2: - leds = 0x20;//led1 on , 2 off + leds = 0x20; // led1 on, led2 off break; case 3: - leds = 0x40;//led2 off, 2 on + leds = 0x40; // led1 off, led2 on break; default: break; @@ -4002,10 +3921,10 @@ void CNeutrinoApp::ExitRun(int can_shutdown) delete g_RCInput; g_RCInput = NULL; - //fan speed + if (g_info.hw_caps->has_fan) CFanControlNotifier::setSpeed(0); - //CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_MAINMENU_REBOOT)); + delete CVFD::getInstance(); delete SHTDCNT::getInstance(); stop_video(); From 1ad37d2f722028ed0253a05f73cc0b9efc57cae9 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 20 Nov 2017 15:19:06 +0100 Subject: [PATCH 05/14] neutrino: more small cleanups in ExitRun() Conflicts: src/neutrino.cpp Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c95d5118eff02a87a2db8f54bd7526e7f73d5de1 Author: vanhofen Date: 2017-11-20 (Mon, 20 Nov 2017) Origin message was: ------------------ - neutrino: more small cleanups in ExitRun() Conflicts: src/neutrino.cpp Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/neutrino.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 6a7e0db00..1c479157b 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3842,20 +3842,14 @@ void CNeutrinoApp::ExitRun(int can_shutdown) g_settings.shutdown_timer_record_type = timer_is_rec; saveSetup(NEUTRINO_SETTINGS_FILE); -#if 0 - if (can_shutdown) - { -#endif - puts("[neutrino.cpp] executing " NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT "."); - if (my_system(NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT) != 0) - perror(NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT " failed"); + puts("[neutrino.cpp] executing " NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT "."); + if (my_system(NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT) != 0) + perror(NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT " failed"); + + printf("entering off state\n"); + printf("timer_minutes: %ld\n", timer_minutes); + mode = NeutrinoModes::mode_off; - printf("entering off state\n"); - printf("timer_minutes: %ld\n", timer_minutes); - mode = NeutrinoModes::mode_off; -#if 0 - } -#endif int leds = 0; int bright = 0; #if HAVE_COOL_HARDWARE From ec64f5096f53ce31f38fc037fc5fbb4fb8c27355 Mon Sep 17 00:00:00 2001 From: gixxpunk Date: Sat, 18 Nov 2017 22:28:46 +0100 Subject: [PATCH 06/14] rename uncooloff workaround to something less idiotic Signed-off-by: J. Krieg Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/490d46ec8dba4f6ec93a879779395184ce0e82c0 Author: gixxpunk Date: 2017-11-18 (Sat, 18 Nov 2017) Origin message was: ------------------ - rename uncooloff workaround to something less idiotic Signed-off-by: J. Krieg Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/Makefile.am | 4 ++-- src/{uncooloff.c => shutdown_helper.c} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/{uncooloff.c => shutdown_helper.c} (95%) diff --git a/src/Makefile.am b/src/Makefile.am index f29ffed37..7737ff9b3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -204,8 +204,8 @@ neutrino_LDADD += \ endif if BOXTYPE_COOL -bin_PROGRAMS += uncooloff -uncooloff_SOURCES = uncooloff.c +bin_PROGRAMS += shutdown_helper +shutdown_helper_SOURCES = shutdown_helper.c # if BOXMODEL_CS_HD2 # else # noinst_PROGRAMS = uncoolinit diff --git a/src/uncooloff.c b/src/shutdown_helper.c similarity index 95% rename from src/uncooloff.c rename to src/shutdown_helper.c index 8441cf1bd..55fb76739 100644 --- a/src/uncooloff.c +++ b/src/shutdown_helper.c @@ -1,5 +1,5 @@ /* - * uncooloff - switch off the box with a possible timer wakeup + * shutdown_helper - switch off the box with a possible timer wakeup * this is needed because the drivers do not implement a proper * hwclock interface :-( * From c81c628e59e19229d73d9fc6aad1661af1ca0f13 Mon Sep 17 00:00:00 2001 From: "J. Krieg" Date: Sat, 18 Nov 2017 22:32:28 +0100 Subject: [PATCH 07/14] shutdown_helper: add calling '/etc/init.d/rcK' ...to prevent possible file system corruption prior shutting down Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/6709ae0feb9544a1cc4f45a982f9f7bd0f131ec8 Author: J. Krieg Date: 2017-11-18 (Sat, 18 Nov 2017) ------------------ This commit was generated by Migit --- src/shutdown_helper.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/shutdown_helper.c b/src/shutdown_helper.c index 55fb76739..52acdfb93 100644 --- a/src/shutdown_helper.c +++ b/src/shutdown_helper.c @@ -55,6 +55,8 @@ int main(int argc, char **argv) fp.timer_minutes_hi = fp_timer >> 8;; fp.timer_minutes_lo = fp_timer & 0xFF; + system("/etc/init.d/rcK"); + fd = open("/dev/display", O_RDONLY); if (fd < 0) perror("/dev/display"); From b52d6225d51163e65896ba8be054e11dfd2ff157 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 20 Nov 2017 23:22:43 +0100 Subject: [PATCH 08/14] neutrino: fix file-check in ExitRun() ... was a c/p error Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/3f60582c786e470b5ab1364ea542e94b73939c57 Author: vanhofen Date: 2017-11-20 (Mon, 20 Nov 2017) Origin message was: ------------------ - neutrino: fix file-check in ExitRun() ... was a c/p error Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/neutrino.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 1c479157b..210c61a5b 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3880,7 +3880,7 @@ void CNeutrinoApp::ExitRun(int can_shutdown) if (timer_minutes || leds) { /* prioritize proc filesystem */ - if (access("/proc/stb/fp/was_timer_wakeup", F_OK) == 0) + if (access("/proc/stb/fp/wakeup_time", F_OK) == 0) { FILE *f = fopen("/proc/stb/fp/wakeup_time","w"); if (f) From a5971e029641ccfc67a39c4bb1087ada2dcff4b3 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 20 Nov 2017 23:22:43 +0100 Subject: [PATCH 09/14] neutrino: unify console-output for different conditions in ExitRun() Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/14fafa30598efc28b71f3056458169aa2119665c Author: vanhofen Date: 2017-11-20 (Mon, 20 Nov 2017) Origin message was: ------------------ - neutrino: unify console-output for different conditions in ExitRun() Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/neutrino.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 210c61a5b..4b0c1a683 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3879,17 +3879,18 @@ void CNeutrinoApp::ExitRun(int can_shutdown) #endif if (timer_minutes || leds) { + time_t t = timer_minutes * 60; + struct tm *tm = localtime(&t); + char date[30]; + strftime(date, sizeof(date), "%c", tm); + printf("timer_wakeup: %s (%ld)\n", date, timer_minutes * 60); + /* prioritize proc filesystem */ if (access("/proc/stb/fp/wakeup_time", F_OK) == 0) { FILE *f = fopen("/proc/stb/fp/wakeup_time","w"); if (f) { - time_t t = timer_minutes * 60; - struct tm *tm = localtime(&t); - char date[30]; - strftime(date, sizeof(date), "%c", tm); - fprintf(stderr, "timer_wakeup: %s (%ld)\n", date, timer_minutes * 60); fprintf(f, "%ld\n", timer_minutes * 60); fclose(f); } @@ -3902,7 +3903,6 @@ void CNeutrinoApp::ExitRun(int can_shutdown) FILE *f = fopen("/tmp/.timer", "w"); if (f) { - fprintf(stderr, "timer_wakeup: %ld\n", timer_minutes * 60); fprintf(f, "%ld\n", timer_minutes * 60); fprintf(f, "%d\n", leds); fprintf(f, "%d\n", bright); From 7b44fbc3496e75145276663901ffcf14623d9483 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 20 Nov 2017 23:30:56 +0100 Subject: [PATCH 10/14] neutrino: always write /tmp/.timer ... otherwise the vfd stays blank in deepstandby, if leds are configured off and no timer is set. HD2's vfd urgently needs the fp.brightness value which is not written to frontpanel in this case. Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f67ddda1f7f6a4de546b9b64b7c1fdf964f80c38 Author: vanhofen Date: 2017-11-20 (Mon, 20 Nov 2017) Origin message was: ------------------ - neutrino: always write /tmp/.timer ... otherwise the vfd stays blank in deepstandby, if leds are configured off and no timer is set. HD2's vfd urgently needs the fp.brightness value which is not written to frontpanel in this case. Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/neutrino.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 4b0c1a683..f8e0b6221 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3877,7 +3877,7 @@ void CNeutrinoApp::ExitRun(int can_shutdown) if (cs_get_revision() != 10) bright = g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS]; #endif - if (timer_minutes || leds) + if (timer_minutes) { time_t t = timer_minutes * 60; struct tm *tm = localtime(&t); @@ -3897,22 +3897,20 @@ void CNeutrinoApp::ExitRun(int can_shutdown) else perror("fopen /proc/stb/fp/wakeup_time"); } - /* not platform specific */ - else - { - FILE *f = fopen("/tmp/.timer", "w"); - if (f) - { - fprintf(f, "%ld\n", timer_minutes * 60); - fprintf(f, "%d\n", leds); - fprintf(f, "%d\n", bright); - fclose(f); - } - else - perror("fopen /tmp/.timer"); - } } + /* not platform specific */ + FILE *f = fopen("/tmp/.timer", "w"); + if (f) + { + fprintf(f, "%ld\n", timer_minutes ? timer_minutes * 60 : 0); + fprintf(f, "%d\n", leds); + fprintf(f, "%d\n", bright); + fclose(f); + } + else + perror("fopen /tmp/.timer"); + delete g_RCInput; g_RCInput = NULL; From 588a7d7ed63d3b9bd603238f81f63074433e5f19 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 21 Nov 2017 11:58:25 +0100 Subject: [PATCH 11/14] neutrino: add exit codes to handle some actions in neutrino's start script EXIT_REBOOT is inactive yet; see comment in ExitRun() Conflicts: src/neutrino.cpp Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/d6bba3e4883b0f01cfe1dc6542d032ab441168d2 Author: vanhofen Date: 2017-11-21 (Tue, 21 Nov 2017) Origin message was: ------------------ - neutrino: add exit codes to handle some actions in neutrino's start script EXIT_REBOOT is inactive yet; see comment in ExitRun() Conflicts: src/neutrino.cpp Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/neutrino.cpp | 85 ++++++++++++++++++++++++++---------------------- src/neutrino.h | 10 ++++-- 2 files changed, 55 insertions(+), 40 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index f8e0b6221..d0c389739 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -137,6 +137,11 @@ #include #include +#ifdef __sh__ +/* the sh4 gcc seems to dislike someting about openthreads... */ +#define exit _exit +#endif + #include #include @@ -1929,7 +1934,7 @@ void CNeutrinoApp::CmdParser(int argc, char **argv) else { dprintf(DEBUG_NORMAL, "Usage: neutrino [-u | --enable-update] " "[-v | --verbose 0..3]\n"); - exit(1); + exit(CNeutrinoApp::EXIT_ERROR); } } } @@ -1947,7 +1952,7 @@ void CNeutrinoApp::SetupFrameBuffer() frameBuffer->setOsdResolutions(); if (frameBuffer->osd_resolutions.empty()) { dprintf(DEBUG_NORMAL, "Error while setting framebuffer mode\n"); - exit(-1); + exit(CNeutrinoApp::EXIT_ERROR); } uint32_t ort; @@ -1977,7 +1982,7 @@ void CNeutrinoApp::SetupFrameBuffer() if (setFbMode == -1) { dprintf(DEBUG_NORMAL, "Error while setting framebuffer mode\n"); - exit(-1); + exit(CNeutrinoApp::EXIT_ERROR); } frameBuffer->Clear(); frameBufferInitialized = true; @@ -2483,8 +2488,8 @@ TIMER_STOP("################################## after all ####################### hintBox->hide(); delete hintBox; } - RealRun(); + RealRun(); ExitRun(g_info.hw_caps->can_shutdown); return 0; @@ -3628,9 +3633,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) return messages_return::handled; } else if( msg == NeutrinoMessages::REBOOT ) { - FILE *f = fopen("/tmp/.reboot", "w"); - fclose(f); - ExitRun(); + ExitRun(CNeutrinoApp::EXIT_REBOOT); } else if (msg == NeutrinoMessages::EVT_POPUP || msg == NeutrinoMessages::EVT_EXTMSG) { if (mode != NeutrinoModes::mode_scart && mode != NeutrinoModes::mode_standby) { @@ -3796,22 +3799,35 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) extern time_t timer_minutes;//timermanager.cpp extern bool timer_is_rec;//timermanager.cpp -void CNeutrinoApp::ExitRun(int can_shutdown) +void CNeutrinoApp::ExitRun(int exit_code) { - /* can_shutdown is actually our exit code */ - printf("[neutrino] %s can_shutdown: %d\n", __func__, can_shutdown); - - bool do_shutdown = true; + bool do_exiting = true; CRecordManager::getInstance()->StopAutoRecord(); if(CRecordManager::getInstance()->RecordingStatus() || cYTCache::getInstance()->isActive()) { - do_shutdown = - (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_SHUTDOWN_RECORDING_QUERY, CMsgBox::mbrNo, + do_exiting = (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_SHUTDOWN_RECORDING_QUERY, CMsgBox::mbrNo, CMsgBox::mbYes | CMsgBox::mbNo, NULL, 450, DEFAULT_TIMEOUT, true) == CMsgBox::mbrYes); } - if (!do_shutdown) + if (!do_exiting) return; + /* + For compatibility: /tmp/.reboot is not really needed anymore + if we use the defined exit code 2 instead of this flagfile. + Next block is just to avoid force changes in start scripts. + */ + if (exit_code == CNeutrinoApp::EXIT_REBOOT) + { + exit_code = CNeutrinoApp::EXIT_NORMAL; + FILE *f = fopen("/tmp/.reboot", "w"); + fclose(f); + } + else + unlink("/tmp/.reboot"); + + printf("[neutrino] %s(int %d)\n", __func__, exit_code); + printf("[neutrino] hw_caps->can_shutdown: %d\n", g_info.hw_caps->can_shutdown); + if (SDTreloadChannels) SDT_ReloadChannels(); @@ -3833,7 +3849,7 @@ void CNeutrinoApp::ExitRun(int can_shutdown) } /* on shutdown force load new fst */ - if (can_shutdown) + if (exit_code == CNeutrinoApp::EXIT_SHUTDOWN) CheckFastScan(true, false); CVFD::getInstance()->setMode(CVFD::MODE_SHUTDOWN); @@ -3847,15 +3863,17 @@ void CNeutrinoApp::ExitRun(int can_shutdown) perror(NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT " failed"); printf("entering off state\n"); - printf("timer_minutes: %ld\n", timer_minutes); mode = NeutrinoModes::mode_off; + printf("timer_minutes: %ld\n", timer_minutes); int leds = 0; int bright = 0; #if HAVE_COOL_HARDWARE - if (can_shutdown) { + if (exit_code == CNeutrinoApp::EXIT_SHUTDOWN) + { leds = 0x40; - switch (g_settings.led_deep_mode){ + switch (g_settings.led_deep_mode) + { case 0: leds = 0x0; // leds off break; @@ -3921,14 +3939,10 @@ void CNeutrinoApp::ExitRun(int can_shutdown) delete SHTDCNT::getInstance(); stop_video(); - printf("[neutrino] This is the end. exiting with code %d\n", can_shutdown); Cleanup(); -#ifdef __sh__ - /* the sh4 gcc seems to dislike someting about openthreads... */ - _exit(can_shutdown); -#else - exit(can_shutdown); -#endif + + printf("[neutrino] This is the end. Exiting with code %d\n", exit_code); + exit(exit_code); } void CNeutrinoApp::saveEpg(int _mode) @@ -4333,15 +4347,13 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) if(actionKey == "help_recording") { ShowMsg(LOCALE_SETTINGS_HELP, LOCALE_RECORDINGMENU_HELP, CMsgBox::mbrBack, CMsgBox::mbBack); } - else if(actionKey=="shutdown") { - ExitRun(1); + else if(actionKey=="shutdown") + { + ExitRun(g_info.hw_caps->can_shutdown); } else if(actionKey=="reboot") { - FILE *f = fopen("/tmp/.reboot", "w"); - fclose(f); - ExitRun(); - unlink("/tmp/.reboot"); + ExitRun(CNeutrinoApp::EXIT_REBOOT); returnval = menu_return::RETURN_NONE; } else if (actionKey=="clock_switch") @@ -4457,7 +4469,8 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) for(int i = 3; i < 256; i++) close(i); execvp(global_argv[0], global_argv); // no return if successful - exit(1); + + exit(CNeutrinoApp::EXIT_REBOOT); // should never be reached } } else if(actionKey == "moviedir") { @@ -4605,11 +4618,7 @@ void sighandler (int signum) delete CVFD::getInstance(); delete SHTDCNT::getInstance(); stop_video(); -#ifdef __sh__ - _exit(0); -#else - exit(0); -#endif + exit(CNeutrinoApp::EXIT_NORMAL); default: break; } diff --git a/src/neutrino.h b/src/neutrino.h index f0bc6d2b3..ee02dd4b5 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -60,6 +60,14 @@ class CScanSettings; class CNeutrinoApp : public CMenuTarget, CChangeObserver, public sigc::trackable { public: + enum // Neutrino's exit codes to be handled in it's start script + { + EXIT_ERROR = -1, + EXIT_NORMAL = 0, // g_info.hw_caps->can_shutdown == 0 + EXIT_SHUTDOWN = 1, // g_info.hw_caps->can_shutdown == 1 + EXIT_REBOOT = 2 + }; + enum { RECORDING_OFF = 0, @@ -67,8 +75,6 @@ public: RECORDING_VCR = 2, RECORDING_FILE = 3 }; - - private: CFrameBuffer * frameBuffer; From 8b8ec439fa00a0119e548f435c37f0cfd8e66673 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 21 Nov 2017 11:58:25 +0100 Subject: [PATCH 12/14] neutrino: deactivate compatibility code in ExitRun(); ... our start script is aligned to new exit code 2 see https://bitbucket.org/neutrino-images/ni-buildsystem/commits/cd1328c41cb642c141b58d001dce06a96eff0a1c Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/a857be6cc382553b3888b45cc8a856ab75fa8942 Author: vanhofen Date: 2017-11-21 (Tue, 21 Nov 2017) Origin message was: ------------------ - neutrino: deactivate compatibility code in ExitRun(); ... our start script is aligned to new exit code 2 see https://bitbucket.org/neutrino-images/ni-buildsystem/commits/cd1328c41cb642c141b58d001dce06a96eff0a1c Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/neutrino.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index d0c389739..3e0f8832c 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3811,6 +3811,7 @@ void CNeutrinoApp::ExitRun(int exit_code) if (!do_exiting) return; +#if 0 /* For compatibility: /tmp/.reboot is not really needed anymore if we use the defined exit code 2 instead of this flagfile. @@ -3824,6 +3825,7 @@ void CNeutrinoApp::ExitRun(int exit_code) } else unlink("/tmp/.reboot"); +#endif printf("[neutrino] %s(int %d)\n", __func__, exit_code); printf("[neutrino] hw_caps->can_shutdown: %d\n", g_info.hw_caps->can_shutdown); From 2271dab2ab525ec48fc10793e6898c059abb86d2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 23 Nov 2017 16:35:07 +0100 Subject: [PATCH 13/14] CComponentsTimer: try to fix timing on non cst hardware On hd51 and pc hardware was observed full visual timeout progress in message boxes. Timeoout was displayed always without visible progress. This should fix this. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/caface0a8817e3228af2c53910fe89ffcad59527 Author: Thilo Graf Date: 2017-11-23 (Thu, 23 Nov 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_timer.cpp | 29 ++++++++++++++++++++++++++--- src/gui/components/cc_timer.h | 3 +++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_timer.cpp b/src/gui/components/cc_timer.cpp index 738f2d01f..4283a6f14 100644 --- a/src/gui/components/cc_timer.cpp +++ b/src/gui/components/cc_timer.cpp @@ -55,6 +55,21 @@ CComponentsTimer::~CComponentsTimer() stopTimer(); } +int CComponentsTimer::getSleep(long miliseconds) +{ + struct timespec req, rem; + + if(miliseconds > 999){ + req.tv_sec = (time_t)(miliseconds / 1000); + req.tv_nsec = (miliseconds - ((long)req.tv_sec * 1000)) * 1000000; + }else{ + req.tv_sec = 0; + req.tv_nsec = miliseconds * 1000000; + } + + return nanosleep(&req , &rem); +} + void CComponentsTimer::runSharedTimerAction() { //start loop @@ -63,10 +78,18 @@ void CComponentsTimer::runSharedTimerAction() while(tm_enable && tm_interval > 0) { tm_mutex.lock(); OnTimer(); - if (!tm_enable_nano) + if (!tm_enable_nano){ sleep(tm_interval); - else - usleep((useconds_t)tm_interval); + }else{ + //behavior is different on cst hardware + long corr_factor = 1; +#if ! HAVE_COOL_HARDWARE + corr_factor = 10; +#endif + int res = getSleep(tm_interval * corr_factor); + if (res != 0) + dprintf(DEBUG_NORMAL,"\033[33m[CComponentsTimer] [%s - %d] ERROR: returns [%d] \033[0m\n", __func__, __LINE__, res); + } tm_mutex.unlock(); } diff --git a/src/gui/components/cc_timer.h b/src/gui/components/cc_timer.h index dc6d090c7..61623d474 100644 --- a/src/gui/components/cc_timer.h +++ b/src/gui/components/cc_timer.h @@ -70,6 +70,9 @@ class CComponentsTimer : public sigc::trackable OpenThreads::Mutex tm_mutex; ///slot for restart signals sigc::slot0 sl_stop_timer; + + ///sleep generated with nanosleep + int getSleep(long miliseconds); public: /**Constructor for timer class * From 2d416c2c199f01dd9006b2b0a225f77693200800 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Thu, 23 Nov 2017 16:58:19 +0100 Subject: [PATCH 14/14] fix webtv script path Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c88120cc034fa65ac03421965414325ec3db74a7 Author: Jacek Jendrzej Date: 2017-11-23 (Thu, 23 Nov 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/movieplayer.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 4764c9f57..7b3665e76 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -1108,7 +1108,6 @@ bool CMoviePlayerGui::getLiveUrl(const std::string &url, const std::string &scri } std::string _script = script; -#if 0 if (_script.find("/") == std::string::npos) { std::string _s = g_settings.livestreamScriptPath + "/" + _script; @@ -1125,7 +1124,6 @@ bool CMoviePlayerGui::getLiveUrl(const std::string &url, const std::string &scri } _script = _s; } -#endif size_t pos = _script.find(".lua"); if (!file_exists(_script.c_str()) || (pos == std::string::npos) || (_script.length()-pos != 4)) { printf(">>>>> [%s:%s:%d] script error\n", __file__, __func__, __LINE__);