From c9d123addef2e638052169e91a210ac50b0a13f2 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 4 Dec 2014 19:21:14 +0300 Subject: [PATCH] gui/videosettings.cpp: split format key modes and auto-modes on apollo, disable broken 14:9 pan&scan on apollo Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/68e240b4e716b21d6271057a47f96b2ffac8f090 Author: [CST] Focus Date: 2014-12-04 (Thu, 04 Dec 2014) --- data/locale/english.locale | 2 ++ src/gui/videosettings.cpp | 28 +++++++++++++++++++++++----- src/neutrino.cpp | 9 +++++++++ src/system/locals.h | 2 ++ src/system/locals_intern.h | 2 ++ src/system/setting_helpers.cpp | 7 +++++-- src/system/settings.h | 1 + 7 files changed, 44 insertions(+), 7 deletions(-) diff --git a/data/locale/english.locale b/data/locale/english.locale index d9e26192e..f74088eb8 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1347,6 +1347,7 @@ menu.hint_video_dbdr MPEG2 enhancement filters menu.hint_video_format TV aspect ratio menu.hint_video_mode HDMI output video mode menu.hint_video_modes VF key will cycle between enabled modes +menu.hint_video_modes_auto Enable modes to auto-select based on content menu.hint_video_pip Picture in picture size and position menu.hint_video_saturation Change picture saturation menu.hint_video_scart_mode Select analog output mode for SCART connectors @@ -2251,6 +2252,7 @@ videomenu.dbdr_both de-block+de-ring videomenu.dbdr_deblock de-block videomenu.dbdr_none none videomenu.enabled_modes VF key enabled modes +videomenu.enabled_modes_auto Auto-select enabled modes videomenu.fullscreen Full screen videomenu.hdmi_cec CSTLink (HDMI-CEC) videomenu.hdmi_cec_mode Receiver to use diff --git a/src/gui/videosettings.cpp b/src/gui/videosettings.cpp index 491577a72..5ddcfeaec 100644 --- a/src/gui/videosettings.cpp +++ b/src/gui/videosettings.cpp @@ -101,15 +101,17 @@ int CVideoSettings::exec(CMenuTarget* parent, const std::string &/*actionKey*/) return res; } -#define VIDEOMENU_43MODE_OPTION_COUNT 4 -const CMenuOptionChooser::keyval VIDEOMENU_43MODE_OPTIONS[VIDEOMENU_43MODE_OPTION_COUNT] = +const CMenuOptionChooser::keyval VIDEOMENU_43MODE_OPTIONS[] = { { DISPLAY_AR_MODE_PANSCAN, LOCALE_VIDEOMENU_PANSCAN }, +#ifndef BOXMODEL_APOLLO { DISPLAY_AR_MODE_PANSCAN2, LOCALE_VIDEOMENU_PANSCAN2 }, +#endif { DISPLAY_AR_MODE_LETTERBOX, LOCALE_VIDEOMENU_LETTERBOX }, { DISPLAY_AR_MODE_NONE, LOCALE_VIDEOMENU_FULLSCREEN } //{ 2, LOCALE_VIDEOMENU_AUTO } // whatever is this auto mode, it seems its totally broken }; +#define VIDEOMENU_43MODE_OPTION_COUNT (sizeof(VIDEOMENU_43MODE_OPTIONS)/sizeof(CMenuOptionChooser::keyval)) #ifdef ANALOG_MODE #define VIDEOMENU_VIDEOSIGNAL_HD1_OPTION_COUNT 8 @@ -277,6 +279,10 @@ int CVideoSettings::showVideoSetup() CMenuOptionChooser * vs_dbdropt_ch = NULL; CMenuForwarder * vs_videomodes_fw = NULL; CMenuWidget videomodes(LOCALE_MAINSETTINGS_VIDEO, NEUTRINO_ICON_SETTINGS); +#ifdef BOXMODEL_APOLLO + CMenuForwarder * vs_automodes_fw = NULL; + CMenuWidget automodes(LOCALE_MAINSETTINGS_VIDEO, NEUTRINO_ICON_SETTINGS); +#endif CAutoModeNotifier anotify; if (!g_settings.easymenu) { //dbdr options @@ -288,10 +294,19 @@ int CVideoSettings::showVideoSetup() for (int i = 0; i < VIDEOMENU_VIDEOMODE_OPTION_COUNT; i++) videomodes.addItem(new CMenuOptionChooser(VIDEOMENU_VIDEOMODE_OPTIONS[i].valname, &g_settings.enabled_video_modes[i], OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, &anotify)); - //anotify.changeNotify(NONEXISTANT_LOCALE, 0); vs_videomodes_fw = new CMenuForwarder(LOCALE_VIDEOMENU_ENABLED_MODES, true, NULL, &videomodes, NULL, CRCInput::RC_red); vs_videomodes_fw->setHint("", LOCALE_MENU_HINT_VIDEO_MODES); + +#ifdef BOXMODEL_APOLLO + automodes.addIntroItems(LOCALE_VIDEOMENU_ENABLED_MODES_AUTO); + + for (int i = 0; i < VIDEOMENU_VIDEOMODE_OPTION_COUNT - 1; i++) + automodes.addItem(new CMenuOptionChooser(VIDEOMENU_VIDEOMODE_OPTIONS[i].valname, &g_settings.enabled_auto_modes[i], OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, &anotify)); + + vs_automodes_fw = new CMenuForwarder(LOCALE_VIDEOMENU_ENABLED_MODES_AUTO, true, NULL, &automodes, NULL, CRCInput::RC_green); + vs_automodes_fw->setHint("", LOCALE_MENU_HINT_VIDEO_MODES_AUTO); +#endif } //--------------------------------------- @@ -312,6 +327,9 @@ int CVideoSettings::showVideoSetup() if (!g_settings.easymenu) { videosetup->addItem(vs_dbdropt_ch); //dbdr options videosetup->addItem(vs_videomodes_fw); //video modes submenue +#ifdef BOXMODEL_APOLLO + videosetup->addItem(vs_automodes_fw); //video auto modes submenue +#endif } #ifdef BOXMODEL_APOLLO @@ -497,14 +515,14 @@ void CVideoSettings::next43Mode(void) neutrino_locale_t text; int curmode = 0; - for (int i = 0; i < VIDEOMENU_43MODE_OPTION_COUNT; i++) { + for (int i = 0; i < (int) VIDEOMENU_43MODE_OPTION_COUNT; i++) { if (VIDEOMENU_43MODE_OPTIONS[i].key == g_settings.video_43mode) { curmode = i; break; } } curmode++; - if (curmode >= VIDEOMENU_43MODE_OPTION_COUNT) + if (curmode >= (int) VIDEOMENU_43MODE_OPTION_COUNT) curmode = 0; text = VIDEOMENU_43MODE_OPTIONS[curmode].value; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index bb054b9c8..4ad445803 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -398,6 +398,11 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.enabled_video_modes[3] = 1; // 720p 50Hz g_settings.enabled_video_modes[4] = 1; // 1080i 50Hz + for(int i = 0; i < VIDEOMENU_VIDEOMODE_OPTION_COUNT; i++) { + sprintf(cfg_key, "enabled_auto_mode_%d", i); + g_settings.enabled_auto_modes[i] = configfile.getInt32(cfg_key, 1); + } + g_settings.cpufreq = configfile.getInt32("cpufreq", 0); g_settings.standby_cpufreq = configfile.getInt32("standby_cpufreq", 100); g_settings.rounded_corners = configfile.getInt32("rounded_corners", 1); @@ -936,6 +941,10 @@ void CNeutrinoApp::saveSetup(const char * fname) sprintf(cfg_key, "enabled_video_mode_%d", i); configfile.setInt32(cfg_key, g_settings.enabled_video_modes[i]); } + for(int i = 0; i < VIDEOMENU_VIDEOMODE_OPTION_COUNT; i++) { + sprintf(cfg_key, "enabled_auto_mode_%d", i); + configfile.setInt32(cfg_key, g_settings.enabled_auto_modes[i]); + } configfile.setInt32( "cpufreq", g_settings.cpufreq); configfile.setInt32( "standby_cpufreq", g_settings.standby_cpufreq); configfile.setInt32("rounded_corners", g_settings.rounded_corners); diff --git a/src/system/locals.h b/src/system/locals.h index bea11da8e..92d169d82 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1374,6 +1374,7 @@ typedef enum LOCALE_MENU_HINT_VIDEO_FORMAT, LOCALE_MENU_HINT_VIDEO_MODE, LOCALE_MENU_HINT_VIDEO_MODES, + LOCALE_MENU_HINT_VIDEO_MODES_AUTO, LOCALE_MENU_HINT_VIDEO_PIP, LOCALE_MENU_HINT_VIDEO_SATURATION, LOCALE_MENU_HINT_VIDEO_SCART_MODE, @@ -2279,6 +2280,7 @@ typedef enum LOCALE_VIDEOMENU_DBDR_DEBLOCK, LOCALE_VIDEOMENU_DBDR_NONE, LOCALE_VIDEOMENU_ENABLED_MODES, + LOCALE_VIDEOMENU_ENABLED_MODES_AUTO, LOCALE_VIDEOMENU_FULLSCREEN, LOCALE_VIDEOMENU_HDMI_CEC, LOCALE_VIDEOMENU_HDMI_CEC_MODE, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index c1fd6fb8d..799b72fb7 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1374,6 +1374,7 @@ const char * locale_real_names[] = "menu.hint_video_format", "menu.hint_video_mode", "menu.hint_video_modes", + "menu.hint_video_modes_auto", "menu.hint_video_pip", "menu.hint_video_saturation", "menu.hint_video_scart_mode", @@ -2279,6 +2280,7 @@ const char * locale_real_names[] = "videomenu.dbdr_deblock", "videomenu.dbdr_none", "videomenu.enabled_modes", + "videomenu.enabled_modes_auto", "videomenu.fullscreen", "videomenu.hdmi_cec", "videomenu.hdmi_cec_mode", diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index 216724066..b041ea950 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -581,9 +581,12 @@ bool CAutoModeNotifier::changeNotify(const neutrino_locale_t /*OptionName*/, voi memset(modes, 0, sizeof(int)*VIDEO_STD_MAX+1); - for(i = 0; i < VIDEOMENU_VIDEOMODE_OPTION_COUNT; i++) { + for(i = 0; i < VIDEOMENU_VIDEOMODE_OPTION_COUNT; i++) +#ifdef BOXMODEL_APOLLO + modes[VIDEOMENU_VIDEOMODE_OPTIONS[i].key] = g_settings.enabled_auto_modes[i]; +#else modes[VIDEOMENU_VIDEOMODE_OPTIONS[i].key] = g_settings.enabled_video_modes[i]; - } +#endif videoDecoder->SetAutoModes(modes); return false; } diff --git a/src/system/settings.h b/src/system/settings.h index 5dde15d88..7d6fe8194 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -188,6 +188,7 @@ struct SNeutrinoSettings int hdmi_cec_view_on; int hdmi_cec_standby; int enabled_video_modes[VIDEOMENU_VIDEOMODE_OPTION_COUNT]; + int enabled_auto_modes[VIDEOMENU_VIDEOMODE_OPTION_COUNT]; int cpufreq; int standby_cpufreq; int make_hd_list;