Skip to content

Commit

Permalink
FIXUP: [down reso] setting to allow reso change
Browse files Browse the repository at this point in the history
  • Loading branch information
koying committed Dec 15, 2017
1 parent cb799dc commit 94cd041
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
7 changes: 7 additions & 0 deletions addons/resource.language.en_gb/resources/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -19911,3 +19911,10 @@ msgctxt "#39108"
msgid "1080"
msgstr ""

msgctxt "#39110"
msgid "Also allow resolution switch"
msgstr ""

msgctxt "#39111"
msgid "Allow also the resolution to be adjusted to closely match the source material"
msgstr ""
5 changes: 5 additions & 0 deletions system/settings/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
</constraints>
<control type="list" format="string" />
</setting>
<setting id="videoplayer.adjustresolution" type="boolean" label="39110" help="39111">
<level>2</level>
<default>true</default>
<control type="toggle" />
</setting>
<setting id="videoplayer.usedisplayasclock" type="boolean" label="13510" help="36166">
<level>1</level>
<default>false</default>
Expand Down
10 changes: 7 additions & 3 deletions xbmc/guilib/Resolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "utils/log.h"
#include "utils/MathUtils.h"
#include "settings/AdvancedSettings.h"
#include "settings/Settings.h"
#include "settings/DisplaySettings.h"
#include <cstdlib>

Expand Down Expand Up @@ -194,7 +195,7 @@ void CResolutionUtils::FindResolutionFromFpsMatch(float fps, int width, bool is3
RESOLUTION CResolutionUtils::FindClosestResolution(float fps, int width, bool is3D, float multiplier, RESOLUTION current, float& weight)
{
RESOLUTION_INFO curr = g_graphicsContext.GetResInfo(current);

bool adjustReso = CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_ADJUSTRESOLUTION);
float fRefreshRate = fps;

int curr_diff = curr.iScreenWidth - width;
Expand All @@ -217,6 +218,11 @@ RESOLUTION CResolutionUtils::FindClosestResolution(float fps, int width, bool is
(info.dwFlags & D3DPRESENTFLAG_MODEMASK) != (curr.dwFlags & D3DPRESENTFLAG_MODEMASK) ||
info.fRefreshRate < (fRefreshRate * multiplier / 1.001) - 0.001)
{
// If not allowed to switch reso, ignore the ones
// not equal to the current one
if (!adjustReso && (info.iScreenWidth != curr.iScreenWidth || info.iScreenHeight != curr.iScreenHeight))
continue;

// evaluate all higher modes and evalute them
// concerning dimension and refreshrate weight
// skip lower resolutions
Expand All @@ -225,9 +231,7 @@ RESOLUTION CResolutionUtils::FindClosestResolution(float fps, int width, bool is
(info.iScreenHeight < 720) || // ignore < 720p
(info.dwFlags & D3DPRESENTFLAG_MODEMASK) != (curr.dwFlags & D3DPRESENTFLAG_MODEMASK) || // don't switch to interlaced modes
(info.iScreen != curr.iScreen)) // skip not current displays
{
continue;
}
}

// Allow switching to a matching resolution:
Expand Down
1 change: 1 addition & 0 deletions xbmc/settings/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ const std::string CSettings::SETTING_VIDEOPLAYER_AUTOPLAYNEXTITEM = "videoplayer
const std::string CSettings::SETTING_VIDEOPLAYER_SEEKSTEPS = "videoplayer.seeksteps";
const std::string CSettings::SETTING_VIDEOPLAYER_SEEKDELAY = "videoplayer.seekdelay";
const std::string CSettings::SETTING_VIDEOPLAYER_ADJUSTREFRESHRATE = "videoplayer.adjustrefreshrate";
const std::string CSettings::SETTING_VIDEOPLAYER_ADJUSTRESOLUTION = "videoplayer.adjustresolution";
const std::string CSettings::SETTING_VIDEOPLAYER_USEDISPLAYASCLOCK = "videoplayer.usedisplayasclock";
const std::string CSettings::SETTING_VIDEOPLAYER_ERRORINASPECT = "videoplayer.errorinaspect";
const std::string CSettings::SETTING_VIDEOPLAYER_STRETCH43 = "videoplayer.stretch43";
Expand Down
1 change: 1 addition & 0 deletions xbmc/settings/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class CSettings : public CSettingCreator, public CSettingControlCreator
static const std::string SETTING_VIDEOPLAYER_SEEKSTEPS;
static const std::string SETTING_VIDEOPLAYER_SEEKDELAY;
static const std::string SETTING_VIDEOPLAYER_ADJUSTREFRESHRATE;
static const std::string SETTING_VIDEOPLAYER_ADJUSTRESOLUTION;
static const std::string SETTING_VIDEOPLAYER_USEDISPLAYASCLOCK;
static const std::string SETTING_VIDEOPLAYER_ERRORINASPECT;
static const std::string SETTING_VIDEOPLAYER_STRETCH43;
Expand Down

0 comments on commit 94cd041

Please sign in to comment.