From 05c16cb1599899120527ecc3a9923c4ee4ef07bf Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Wed, 22 Feb 2023 16:12:53 +0000 Subject: [PATCH] Add disable-hdmi-modechange to runtime config --- src/config.cc | 2 ++ src/config.json.sample | 7 ++++++- src/videoomx.cc | 32 +++++++++++++++++++++----------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/config.cc b/src/config.cc index 8139fe7..9b2c5f8 100644 --- a/src/config.cc +++ b/src/config.cc @@ -55,6 +55,8 @@ void Config::applyDefaults() insertInt("server-discovery", "prefer-ipv", 6); + insertBool("videoomx", "disable-hdmi-modechange", false); + // Not in config.json.sample - VDR login always sets this insertInt("subtitles", "default", 0); } diff --git a/src/config.json.sample b/src/config.json.sample index 3448df4..e0f9c27 100644 --- a/src/config.json.sample +++ b/src/config.json.sample @@ -52,7 +52,7 @@ "input_udp": { "port": 2000 - } + }, "input_lirc": { @@ -88,5 +88,10 @@ "lirc-remote-name-2": { } + }, + + "videoomx": + { + "disable-hdmi-modechange": false } } diff --git a/src/videoomx.cc b/src/videoomx.cc index 437fc24..028c62d 100644 --- a/src/videoomx.cc +++ b/src/videoomx.cc @@ -33,6 +33,7 @@ #include "boxstack.h" #include "inputman.h" #include "util.h" +#include "config.h" #include "videoomx.h" @@ -509,18 +510,27 @@ void VideoOMX::selectVideoMode(int interlaced) } } // InputMan::getInstance()->shutdown(); FIXME FIXME FIXME - disabling this temp, why does this have to run? - vc_tv_power_off(); - if (mymode) { - LogNT::getInstance()->info(TAG, "Switch to optimum mode"); - vc_tv_hdmi_power_on_explicit(HDMI_MODE_HDMI,group,mymode->code); - } else if (mymode_second_best) { - LogNT::getInstance()->info(TAG, "Switch to close to optimum mode"); - vc_tv_hdmi_power_on_explicit(HDMI_MODE_HDMI,group,mymode_second_best->code); - } else { - LogNT::getInstance()->info(TAG, "Switch to prefered mode"); - vc_tv_hdmi_power_on_best(1920, 1080, target_fps, interlaced ? HDMI_INTERLACED : HDMI_NONINTERLACED, - static_cast(HDMI_MODE_MATCH_FRAMERATE|HDMI_MODE_MATCH_RESOLUTION|HDMI_MODE_MATCH_SCANMODE)); + + + bool disableHDMIModeChange{false}; + bool confSuccess = Config::getInstance()->getBool("videoomx", "disable-hdmi-modechange", disableHDMIModeChange); + + if (!(confSuccess && disableHDMIModeChange)) + { + vc_tv_power_off(); + if (mymode) { + LogNT::getInstance()->info(TAG, "Switch to optimum mode"); + vc_tv_hdmi_power_on_explicit(HDMI_MODE_HDMI,group,mymode->code); + } else if (mymode_second_best) { + LogNT::getInstance()->info(TAG, "Switch to close to optimum mode"); + vc_tv_hdmi_power_on_explicit(HDMI_MODE_HDMI,group,mymode_second_best->code); + } else { + LogNT::getInstance()->info(TAG, "Switch to prefered mode"); + vc_tv_hdmi_power_on_best(1920, 1080, target_fps, interlaced ? HDMI_INTERLACED : HDMI_NONINTERLACED, + static_cast(HDMI_MODE_MATCH_FRAMERATE|HDMI_MODE_MATCH_RESOLUTION|HDMI_MODE_MATCH_SCANMODE)); + } } + hdmi=true; outputinterlaced=interlaced; } else { -- 2.39.5