From ff11dd44ab76d3d9a716ab20903449a27a2a5025 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Tue, 28 Feb 2017 15:02:09 +0100 Subject: [PATCH] osd resolution: Use COsdHelpers::changeOsdResolution() to adjust... ...OSD resolution after switching video format --- lib/libcoolstream2/cs_api.h | 1 + lib/libcoolstream2/video_cs.h | 2 ++ src/gui/osd_setup.cpp | 9 +++++++-- src/gui/videosettings.cpp | 7 +++++++ src/neutrino.cpp | 34 ++++++++++++++++++++++++++++++++- src/neutrino.h | 1 + src/zapit/include/zapit/zapit.h | 1 + src/zapit/src/zapit.cpp | 4 ++++ 8 files changed, 56 insertions(+), 3 deletions(-) diff --git a/lib/libcoolstream2/cs_api.h b/lib/libcoolstream2/cs_api.h index fe1b463da..bbb03eb46 100644 --- a/lib/libcoolstream2/cs_api.h +++ b/lib/libcoolstream2/cs_api.h @@ -49,6 +49,7 @@ enum CS_LOG_MODULE { // Initialization void cs_api_init(void); void cs_api_exit(void); +void cs_new_auto_videosystem(); // Memory helpers void *cs_malloc_uncached(size_t size); diff --git a/lib/libcoolstream2/video_cs.h b/lib/libcoolstream2/video_cs.h index 6c1da4931..3bfa62793 100644 --- a/lib/libcoolstream2/video_cs.h +++ b/lib/libcoolstream2/video_cs.h @@ -190,6 +190,7 @@ private: analog_mode_t analog_mode_scart; fp_icon mode_icon; cDemux *demux; + int current_video_system; // int SelectAutoFormat(); void ScalePic(); @@ -244,6 +245,7 @@ public: int Flush(void); /* set video_system */ + int GetVideoSystem(); int SetVideoSystem(int video_system, bool remember = true); int SetStreamType(VIDEO_FORMAT type); void SetSyncMode(AVSYNC_TYPE mode); diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index ad4b6b51e..281999311 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -660,7 +660,11 @@ int COsdSetup::showOsdSetup() kext[0].valname = "-"; resCount = 1; } - CMenuOptionChooser * osd_res = new CMenuOptionChooser(LOCALE_COLORMENU_OSD_RESOLUTION, &g_settings.osd_resolution, kext, resCount, (resCount>1), this); + int videoSystem = COsdHelpers::getInstance()->getVideoSystem(); + bool enable = ((resCount > 1) && + COsdHelpers::getInstance()->isVideoSystem1080(videoSystem) && + (g_settings.video_Mode != VIDEO_STD_AUTO)); + CMenuOptionChooser * osd_res = new CMenuOptionChooser(LOCALE_COLORMENU_OSD_RESOLUTION, &g_settings.osd_resolution, kext, resCount, enable, this); osd_res->setHint("", LOCALE_MENU_HINT_OSD_RESOLUTION); osd_menu->addItem(osd_res); #endif @@ -1394,7 +1398,8 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data) return true; osd_menu->hide(); uint32_t osd_mode = (uint32_t)*(int*)data; - COsdHelpers::getInstance()->changeOsdResolution(osd_mode, osd_mode); + COsdHelpers::getInstance()->g_settings_osd_resolution_save = osd_mode; + COsdHelpers::getInstance()->changeOsdResolution(osd_mode); #if 0 if (frameBuffer->fullHdAvailable()) { if (frameBuffer->osd_resolutions.empty()) diff --git a/src/gui/videosettings.cpp b/src/gui/videosettings.cpp index 9a013a6af..6cb14bcd4 100644 --- a/src/gui/videosettings.cpp +++ b/src/gui/videosettings.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -412,7 +413,9 @@ void CVideoSettings::setVideoSettings() void CVideoSettings::setupVideoSystem(bool do_ask) { printf("[neutrino VideoSettings] %s setup videosystem...\n", __FUNCTION__); + COsdHelpers::getInstance()->resetOsdResolution(g_settings.video_Mode); videoDecoder->SetVideoSystem(g_settings.video_Mode); //FIXME + COsdHelpers::getInstance()->changeOsdResolution(0, true, true); if (do_ask) { @@ -422,7 +425,9 @@ void CVideoSettings::setupVideoSystem(bool do_ask) if (ShowMsg(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_VIDEO_MODE_OK), CMsgBox::mbrNo, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_INFO) != CMsgBox::mbrYes) { g_settings.video_Mode = prev_video_mode; + COsdHelpers::getInstance()->resetOsdResolution(g_settings.video_Mode); videoDecoder->SetVideoSystem(g_settings.video_Mode); + COsdHelpers::getInstance()->changeOsdResolution(0, true, true); } else prev_video_mode = g_settings.video_Mode; @@ -606,7 +611,9 @@ void CVideoSettings::nextMode(void) else if(res == messages_return::cancel_info) { g_settings.video_Mode = VIDEOMENU_VIDEOMODE_OPTIONS[curmode].key; //CVFD::getInstance()->ShowText(text); + COsdHelpers::getInstance()->resetOsdResolution(g_settings.video_Mode); videoDecoder->SetVideoSystem(g_settings.video_Mode); + COsdHelpers::getInstance()->changeOsdResolution(0, true, true); //return; disp_cur = 1; } diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 87f4dcf2f..99eff149b 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -81,6 +81,7 @@ #include "gui/infoviewer.h" #include "gui/mediaplayer.h" #include "gui/movieplayer.h" +#include "gui/osd_helpers.h" #include "gui/osd_setup.h" #include "gui/osdlang_setup.h" #include "gui/pictureviewer.h" @@ -226,6 +227,7 @@ CNeutrinoApp::CNeutrinoApp() { standby_pressed_at.tv_sec = 0; osd_resolution_tmp = -1; + frameBufferInitialized = false; frameBuffer = CFrameBuffer::getInstance(); frameBuffer->setIconBasePath(ICONSDIR); @@ -719,6 +721,7 @@ int CNeutrinoApp::loadSetup(const char * fname) //screen configuration g_settings.osd_resolution = (osd_resolution_tmp == -1) ? configfile.getInt32("osd_resolution", 0) : osd_resolution_tmp; + COsdHelpers::getInstance()->g_settings_osd_resolution_save = g_settings.osd_resolution; g_settings.screen_StartX_crt_0 = configfile.getInt32("screen_StartX_crt_0", 80); g_settings.screen_StartY_crt_0 = configfile.getInt32("screen_StartY_crt_0", 45); g_settings.screen_EndX_crt_0 = configfile.getInt32("screen_EndX_crt_0" , 1280 - g_settings.screen_StartX_crt_0 - 1); @@ -1359,7 +1362,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32("channellist_show_numbers", g_settings.channellist_show_numbers); //screen configuration - configfile.setInt32("osd_resolution" , g_settings.osd_resolution); + configfile.setInt32("osd_resolution" , COsdHelpers::getInstance()->g_settings_osd_resolution_save); configfile.setInt32("screen_StartX_lcd_0", g_settings.screen_StartX_lcd_0); configfile.setInt32("screen_StartY_lcd_0", g_settings.screen_StartY_lcd_0); configfile.setInt32("screen_EndX_lcd_0" , g_settings.screen_EndX_lcd_0); @@ -1870,6 +1873,7 @@ void CNeutrinoApp::CmdParser(int argc, char **argv) /************************************************************************************** * CNeutrinoApp - setup the framebuffer * **************************************************************************************/ + void CNeutrinoApp::SetupFrameBuffer() { frameBuffer->init(); @@ -1898,6 +1902,10 @@ void CNeutrinoApp::SetupFrameBuffer() frameBuffer->osd_resolutions[ort].yRes, frameBuffer->osd_resolutions[ort].bpp); +/* + setFbMode = 0; + COsdHelpers::getInstance()->changeOsdResolution(0, true); +*/ #else /* all other hardware ignores setMode parameters */ setFbMode = frameBuffer->setMode(0, 0, 0); @@ -1908,6 +1916,7 @@ void CNeutrinoApp::SetupFrameBuffer() exit(-1); } frameBuffer->Clear(); + frameBufferInitialized = true; } /************************************************************************************** @@ -2121,6 +2130,9 @@ int CNeutrinoApp::run(int argc, char **argv) TIMER_START(); cs_api_init(); cs_register_messenger(CSSendMessage); +#ifdef BOXMODEL_CS_HD2 + cs_new_auto_videosystem(); +#endif g_Locale = new CLocaleManager; @@ -2179,6 +2191,8 @@ TIMER_START(); ZapStart_arg.volume = g_settings.current_volume; ZapStart_arg.webtv_xml = &g_settings.webtv_xml; + ZapStart_arg.osd_resolution = g_settings.osd_resolution; + CCamManager::getInstance()->SetCITuner(g_settings.ci_tuner); /* create decoders, read channels */ bool zapit_init = CZapit::getInstance()->Start(&ZapStart_arg); @@ -2970,6 +2984,24 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) CMoviePlayerGui::getInstance(true).showSubtitle(data); return messages_return::handled; } + if (msg == NeutrinoMessages::EVT_AUTO_SET_VIDEOSYSTEM) { + printf(">>>>>[CNeutrinoApp::%s:%d] Receive EVT_AUTO_SET_VIDEOSYSTEM message\n", __func__, __LINE__); + COsdHelpers *coh = COsdHelpers::getInstance(); + int videoSystem = (int)data; + if (coh->getVideoSystem() == videoSystem) + return messages_return::handled; + + if (!frameBufferInitialized) { + coh->resetOsdResolution(videoSystem); + videoDecoder->SetVideoSystem(videoSystem, false); + return messages_return::handled; + } + + coh->resetOsdResolution(videoSystem); + videoDecoder->SetVideoSystem(videoSystem, false); + coh->changeOsdResolution(0, true, true); + return messages_return::handled; + } if(msg == NeutrinoMessages::EVT_ZAP_COMPLETE) { CZapit::getInstance()->GetAudioMode(g_settings.audio_AnalogMode); if(g_settings.audio_AnalogMode < 0 || g_settings.audio_AnalogMode > 2) diff --git a/src/neutrino.h b/src/neutrino.h index 291a018ea..6d8749865 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -109,6 +109,7 @@ private: bool channelList_painted; int first_mode_found; int osd_resolution_tmp; + bool frameBufferInitialized; void SDT_ReloadChannels(); void setupNetwork( bool force= false ); diff --git a/src/zapit/include/zapit/zapit.h b/src/zapit/include/zapit/zapit.h index a60c79fb5..989f3cc7c 100644 --- a/src/zapit/include/zapit/zapit.h +++ b/src/zapit/include/zapit/zapit.h @@ -42,6 +42,7 @@ typedef struct ZAPIT_start_arg t_channel_id startchannelradio_id; int uselastchannel; int video_mode; + uint32_t osd_resolution; int volume; int ci_clock; std::list *webtv_xml; diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index e8682ba1b..7d1b517e7 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -76,6 +76,7 @@ #include #include +#include /* globals */ int sig_delay = 2; // seconds between signal check @@ -1664,6 +1665,7 @@ bool CZapit::ParseCommand(CBasicMessage::Header &rmsg, int connfd) CZapitMessages::commandInt msg; CBasicServer::receive_data(connfd, &msg, sizeof(msg)); videoDecoder->SetVideoSystem(msg.val); + COsdHelpers::getInstance()->changeOsdResolution(0, true); CNeutrinoApp::getInstance()->g_settings_video_Mode(msg.val); break; } @@ -2368,6 +2370,8 @@ bool CZapit::Start(Z_start_arg *ZapStart_arg) videoDecoder->SetDemux(videoDemux); videoDecoder->SetVideoSystem(video_mode); + uint32_t osd_resolution = ZapStart_arg->osd_resolution; + COsdHelpers::getInstance()->changeOsdResolution(osd_resolution); videoDecoder->Standby(false); audioDecoder->SetDemux(audioDemux);