From a76872f8e3cbcbb42396ca8f2219bfef95b5b985 Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Thu, 8 Mar 2012 08:24:04 +0000 Subject: [PATCH 1/6] * Neutrino optimized shutdown - Display the screen to complete shutdown of the box. - Saving EPG extending the timeout to 120 seconds. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2140 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/neutrino.cpp | 6 ++++-- src/zapit/src/zapit.cpp | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 91071a59c..8e1fd16d6 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2969,6 +2969,9 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) standby.timer_minutes_hi = fp_timer >> 8;; standby.timer_minutes_lo = fp_timer & 0xFF; + delete videoDecoder; + cs_api_exit(); + int fd = open("/dev/display", O_RDONLY); if (fd < 0) { perror("/dev/display"); @@ -3057,7 +3060,7 @@ void CNeutrinoApp::saveEpg() neutrino_msg_data_t data; g_Sectionsd->writeSI2XML(g_settings.epg_dir.c_str()); while( true ) { - g_RCInput->getMsg(&msg, &data, 300); // 30 secs.. + g_RCInput->getMsg(&msg, &data, 1200); // 120 secs.. 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); break; @@ -3729,7 +3732,6 @@ void stop_daemons(bool stopall) delete powerManager; } cs_deregister_messenger(); - cs_api_exit(); } } diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index c2764aef5..c7eee7c5a 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -2121,7 +2121,6 @@ void CZapit::run() delete pcrDemux; delete pmtDemux; delete audioDecoder; - delete videoDecoder; delete videoDemux; delete audioDemux; From 5b458045cf46ab63ff3a7603b4eb9d6c3fd3aebc Mon Sep 17 00:00:00 2001 From: focus Date: Thu, 8 Mar 2012 14:23:55 +0000 Subject: [PATCH 2/6] neutrino.cpp: fix sighandler after rev.2140 git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2141 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/neutrino.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 8e1fd16d6..72435138c 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3743,6 +3743,8 @@ void sighandler (int signum) case SIGINT: delete CRecordManager::getInstance(); stop_daemons(); + delete videoDecoder; + cs_api_exit(); _exit(0); default: break; From d1fd82053c4d0c4ce086b7d996aa507941f7aa27 Mon Sep 17 00:00:00 2001 From: focus Date: Thu, 8 Mar 2012 15:00:20 +0000 Subject: [PATCH 3/6] system/localize.cpp: remove old code; dont load default locale twice git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2142 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/system/localize.cpp | 121 ++++------------------------------------ 1 file changed, 10 insertions(+), 111 deletions(-) diff --git a/src/system/localize.cpp b/src/system/localize.cpp index 9e594c754..40f55c79c 100644 --- a/src/system/localize.cpp +++ b/src/system/localize.cpp @@ -47,91 +47,7 @@ //static const char * iso639filename = "/usr/share/iso-codes/iso-639.tab"; static const char * iso639filename = "/share/iso-codes/iso-639.tab"; -#if 0 -#include -#include - -#define ISO639_TABLE_SIZE 489 -typedef struct -{ - char * iso_639_2_code; - char * name; -} iso639_t; - -iso639_t iso639[ISO639_TABLE_SIZE]; - -int mycompare(const void * a, const void * b) -{ - return strcmp(((iso639_t *)a)->iso_639_2_code, ((iso639_t *)b)->iso_639_2_code); -} - -void initialize_iso639_map(void) -{ - unsigned i = 0; - std::string s, t, v; - std::ifstream in(iso639filename); - if (in.is_open()) - { - while (in.peek() == '#') - getline(in, s); - while (in >> s >> t >> v >> std::ws) - { - getline(in, v); - - if (i == ISO639_TABLE_SIZE) - { - printf("ISO639 table overflow\n"); - goto do_sorting; - } - - iso639[i].iso_639_2_code = strdup(s.c_str()); - iso639[i].name = strdup(v.c_str()); - - i++; - - if (s != t) - { - if (i == ISO639_TABLE_SIZE) - { - printf("ISO639 table overflow\n"); - goto do_sorting; - } - - iso639[i].iso_639_2_code = strdup(t.c_str()); -// iso639[i].name = strdup(v.c_str()); - iso639[i].name = iso639[i - 1].name; - - i++; - } - } - if (i != ISO639_TABLE_SIZE) - { - printf("ISO639 table underflow\n"); - while(i < ISO639_TABLE_SIZE) - { - iso639[i].iso_639_2_code = iso639[i].name = (char *)iso639filename; // fill with junk - i++; - } - } - do_sorting: - qsort(iso639, ISO639_TABLE_SIZE, sizeof(iso639_t), mycompare); - } - else - printf("Loading %s failed.\n", iso639filename); -} - -const char * getISO639Description(const char * const iso) -{ - iso639_t tmp; - tmp.iso_639_2_code = (char *)iso; - - void * value = bsearch(&tmp, iso639, ISO639_TABLE_SIZE, sizeof(iso639_t), mycompare); - if (value == NULL) - return iso; - else - return ((iso639_t *)value)->name; -} -#else +#define DEFAULT_LOCALE "english" std::map iso639; std::map iso639rev; @@ -166,7 +82,6 @@ const char * getISO639Description(const char * const iso) else return it->second.c_str(); } -#endif CLocaleManager::CLocaleManager() { @@ -178,7 +93,7 @@ CLocaleManager::CLocaleManager() for (unsigned int i = 0; i < (sizeof(locale_real_names)/sizeof(const char *)); i++) defaultData[i] = (char *)locale_real_names[i]; - loadLocale("english", true); + loadLocale(DEFAULT_LOCALE, true); } CLocaleManager::~CLocaleManager() @@ -198,7 +113,14 @@ CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const l FILE * fd; char ** loadData = asdefault ? defaultData : localeData; - //initialize_iso639_map(); + if(!asdefault && !strcmp(locale, DEFAULT_LOCALE)) { + for (unsigned j = 0; j < (sizeof(locale_real_names)/sizeof(const char *)); j++) { + if (loadData[j] != locale_real_names[j] && loadData[j] != defaultData[j]) + free(loadData[j]); + loadData[j] = defaultData[j]; + } + return UNICODE_FONT; + } for (i = 0; i < 2; i++) { @@ -278,29 +200,6 @@ CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const l // printf("i=%d\n", i); if(i == sizeof(locale_real_names)/sizeof(const char *)) printf("[%s.locale] superfluous entry: %s\n", locale, buf); -#if 0 - - while (1) - { - j = (i >= (sizeof(locale_real_names)/sizeof(const char *))) ? -1 : strcmp(buf, locale_real_names[i]); - if (j > 0) - { - printf("[%s.locale] missing entry: %s\n", locale, locale_real_names[i]); - i++; - } - else - break; - } - if (j == 0) - { - localeData[i] = strdup(text.c_str()); - i++; - } - else - { - printf("[%s.locale] superfluous entry: %s\n", locale, buf); - } -#endif } } fclose(fd); From bf2593efc30711171b67d082ec830bdc979534b8 Mon Sep 17 00:00:00 2001 From: focus Date: Fri, 9 Mar 2012 11:31:57 +0000 Subject: [PATCH 4/6] neutrino.cpp: fix soft-restart git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2143 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/neutrino.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 72435138c..df89fe861 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3618,6 +3618,8 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) delete frameBuffer; stop_daemons(true); + delete videoDecoder; + cs_api_exit(); /* g_Timerd, g_Zapit and CVFD are used in stop_daemons */ delete g_Timerd; delete g_Zapit; //do we really need this? From 4710b5b41d5bc11a03d5e6209bf39f6955f171cb Mon Sep 17 00:00:00 2001 From: focus Date: Fri, 9 Mar 2012 13:43:39 +0000 Subject: [PATCH 5/6] gui/streaminfo2.cpp: unify hex numbers to upper case git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2144 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/gui/streaminfo2.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 38eda5dcc..5e5d8be56 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -660,26 +660,26 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) spaceoffset = 7 * fontW; //onid ypos+= sheight; - sprintf((char*) buf, "0x%04x (%i)", si.onid, si.onid); + sprintf((char*) buf, "0x%04X (%i)", si.onid, si.onid); g_Font[font_small]->RenderString(xpos, ypos, box_width, "ONid:" , COL_INFOBAR, 0, true); // UTF-8 g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR, 0, true); // UTF-8 //sid ypos+= sheight; - sprintf((char*) buf, "0x%04x (%i)", si.sid, si.sid); + sprintf((char*) buf, "0x%04X (%i)", si.sid, si.sid); g_Font[font_small]->RenderString(xpos, ypos, box_width, "Sid:" , COL_INFOBAR, 0, true); // UTF-8 g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR, 0, true); // UTF-8 //tsid ypos+= sheight; - sprintf((char*) buf, "0x%04x (%i)", si.tsid, si.tsid); + sprintf((char*) buf, "0x%04X (%i)", si.tsid, si.tsid); g_Font[font_small]->RenderString(xpos, ypos, box_width, "TSid:" , COL_INFOBAR, 0, true); // UTF-8 g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR, 0, true); // UTF-8 //pmtpid ypos+= sheight; pmt_version = si.pmt_version; - sprintf((char*) buf, "0x%04x (%i) [%i]", si.pmtpid, si.pmtpid,pmt_version); + sprintf((char*) buf, "0x%04X (%i) [%i]", si.pmtpid, si.pmtpid,pmt_version); g_Font[font_small]->RenderString(xpos, ypos, box_width, "PMTpid:", COL_INFOBAR, 0, true); // UTF-8 g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR, 0, true); // UTF-8 @@ -687,7 +687,7 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) //vpid ypos+= sheight; if ( g_RemoteControl->current_PIDs.PIDs.vpid > 0 ){ - sprintf((char*) buf, "0x%04x (%i)", g_RemoteControl->current_PIDs.PIDs.vpid, g_RemoteControl->current_PIDs.PIDs.vpid ); + sprintf((char*) buf, "0x%04X (%i)", g_RemoteControl->current_PIDs.PIDs.vpid, g_RemoteControl->current_PIDs.PIDs.vpid ); } else { sprintf((char*) buf, "%s", g_Locale->getText(LOCALE_STREAMINFO_NOT_AVAILABLE)); } @@ -703,7 +703,7 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) unsigned int sw=spaceoffset; for (unsigned int li= 0; (licurrent_PIDs.APIDs.size()) && (li<10); li++) { - sprintf((char*) buf, "0x%04x (%i)", g_RemoteControl->current_PIDs.APIDs[li].pid, g_RemoteControl->current_PIDs.APIDs[li].pid ); + sprintf((char*) buf, "0x%04X (%i)", g_RemoteControl->current_PIDs.APIDs[li].pid, g_RemoteControl->current_PIDs.APIDs[li].pid ); if (li == g_RemoteControl->current_PIDs.PIDs.selected_apid){ g_Font[font_small]->RenderString(xpos+sw, ypos, box_width, buf, COL_MENUHEAD, 0, true); // UTF-8 } @@ -723,7 +723,7 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) if ( g_RemoteControl->current_PIDs.PIDs.vtxtpid == 0 ) sprintf((char*) buf, "%s", g_Locale->getText(LOCALE_STREAMINFO_NOT_AVAILABLE)); else - sprintf((char*) buf, "0x%04x (%i)", g_RemoteControl->current_PIDs.PIDs.vtxtpid, g_RemoteControl->current_PIDs.PIDs.vtxtpid ); + sprintf((char*) buf, "0x%04X (%i)", g_RemoteControl->current_PIDs.PIDs.vtxtpid, g_RemoteControl->current_PIDs.PIDs.vtxtpid ); g_Font[font_small]->RenderString(xpos, ypos, box_width, "VTXTpid:" , COL_INFOBAR, 0, true); // UTF-8 g_Font[font_small]->RenderString(xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR, 0, true); // UTF-8 if(box_h == 0) From 4ff2c614b5768714cc54c3386c68ee69e803dd55 Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Sat, 10 Mar 2012 12:49:37 +0000 Subject: [PATCH 6/6] * Neutrino shutdown: Optimization reworked - Shutdown functions (shutdown, reboot, soft-reboot, sighandler) optimized - Fixed error messages (delete videoDecoder). git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2145 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/neutrino.cpp | 22 ++++++++++++++-------- src/zapit/src/zapit.cpp | 1 - 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index df89fe861..ac10ac853 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -144,11 +144,13 @@ void * sectionsd_main_thread(void *data); extern bool timeset; // sectionsd extern cVideo * videoDecoder; +extern cDemux *videoDemux; extern cAudio * audioDecoder; cPowerManager *powerManager; cCpuFreqManager * cpuFreq; void stop_daemons(bool stopall = true); +void stop_video(void); // uncomment if you want to have a "test" menue entry (rasc) //#define __EXPERIMENTAL_CODE__ @@ -2969,8 +2971,7 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) standby.timer_minutes_hi = fp_timer >> 8;; standby.timer_minutes_lo = fp_timer & 0xFF; - delete videoDecoder; - cs_api_exit(); + stop_video(); int fd = open("/dev/display", O_RDONLY); if (fd < 0) { @@ -3035,7 +3036,7 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) delete funNotifier; } //CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_MAINMENU_REBOOT)); - delete frameBuffer; + stop_video(); #if 0 /* FIXME this next hack to test, until we find real crash on exit reason */ system("/etc/init.d/rcK"); @@ -3615,11 +3616,9 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) delete g_fontRenderer; delete hintBox; - delete frameBuffer; stop_daemons(true); - delete videoDecoder; - cs_api_exit(); + stop_video(); /* g_Timerd, g_Zapit and CVFD are used in stop_daemons */ delete g_Timerd; delete g_Zapit; //do we really need this? @@ -3737,6 +3736,14 @@ void stop_daemons(bool stopall) } } +void stop_video() +{ + delete videoDecoder; + delete videoDemux; + delete CFrameBuffer::getInstance(); + cs_api_exit(); +} + void sighandler (int signum) { signal (signum, SIG_IGN); @@ -3745,8 +3752,7 @@ void sighandler (int signum) case SIGINT: delete CRecordManager::getInstance(); stop_daemons(); - delete videoDecoder; - cs_api_exit(); + stop_video(); _exit(0); default: break; diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index c7eee7c5a..78e9bae00 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -2121,7 +2121,6 @@ void CZapit::run() delete pcrDemux; delete pmtDemux; delete audioDecoder; - delete videoDemux; delete audioDemux; INFO("demuxes/decoders deleted");