aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Pfau <pfau@peak3d.de>2019-01-26 12:18:11 +0100
committerGitHub <noreply@github.com>2019-01-26 12:18:11 +0100
commitc50039872ec676df0055119bd679d532c65c0963 (patch)
treee6c2d12f4a8c202657d36635121eb55dee78a9aa
parent5ab276866ba892c1b1deb5e2f97142ecd9aa9629 (diff)
parent365b1feec82cf16157e81734f80ae6db4fa66584 (diff)
Merge pull request #15318 from peak3d/aspect
[VideoPlayer] Improve forced aspect_ratio
-rw-r--r--xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp7
-rw-r--r--xbmc/windowing/Resolution.cpp20
2 files changed, 17 insertions, 10 deletions
diff --git a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
index 4f057e6fac..5ad2bcbf33 100644
--- a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
+++ b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
@@ -670,7 +670,14 @@ bool CVideoPlayerVideo::ProcessDecoderOutput(double &frametime, double &pts)
// use forced aspect if any
if (m_fForcedAspectRatio != 0.0f)
+ {
m_picture.iDisplayWidth = (int) (m_picture.iDisplayHeight * m_fForcedAspectRatio);
+ if (m_picture.iDisplayWidth > m_picture.iWidth)
+ {
+ m_picture.iDisplayWidth = m_picture.iWidth;
+ m_picture.iDisplayHeight = (int) (m_picture.iDisplayWidth / m_fForcedAspectRatio);
+ }
+ }
// set stereo mode if not set by decoder
if (m_picture.stereoMode.empty())
diff --git a/xbmc/windowing/Resolution.cpp b/xbmc/windowing/Resolution.cpp
index 53427f965e..e28708ff06 100644
--- a/xbmc/windowing/Resolution.cpp
+++ b/xbmc/windowing/Resolution.cpp
@@ -109,8 +109,9 @@ void CResolutionUtils::FindResolutionFromWhitelist(float fps, int width, int hei
const RESOLUTION_INFO info = CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo(i);
// allow resolutions that are exact and have the correct refresh rate
- if (((height == info.iScreenHeight && width <= info.iScreenWidth) ||
- (width == info.iScreenWidth && height <= info.iScreenHeight)) &&
+ // allow macroblock alignement / padding errors (e.g. 1080 mod16 == 8)
+ if (((height == info.iScreenHeight && width <= info.iScreenWidth + 8) ||
+ (width == info.iScreenWidth && height <= info.iScreenHeight + 8)) &&
(info.dwFlags & D3DPRESENTFLAG_MODEMASK) == (curr.dwFlags & D3DPRESENTFLAG_MODEMASK) &&
MathUtils::FloatEquals(info.fRefreshRate, fps, 0.01f))
{
@@ -128,8 +129,9 @@ void CResolutionUtils::FindResolutionFromWhitelist(float fps, int width, int hei
const RESOLUTION_INFO info = CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo(i);
// allow resolutions that are exact and have double the refresh rate
- if (((height == info.iScreenHeight && width <= info.iScreenWidth) ||
- (width == info.iScreenWidth && height <= info.iScreenHeight)) &&
+ // allow macroblock alignement / padding errors (e.g. 1080 mod16 == 8)
+ if (((height == info.iScreenHeight && width <= info.iScreenWidth + 8) ||
+ (width == info.iScreenWidth && height <= info.iScreenHeight + 8)) &&
(info.dwFlags & D3DPRESENTFLAG_MODEMASK) == (curr.dwFlags & D3DPRESENTFLAG_MODEMASK) &&
MathUtils::FloatEquals(info.fRefreshRate, fps * 2, 0.01f))
{
@@ -141,15 +143,15 @@ void CResolutionUtils::FindResolutionFromWhitelist(float fps, int width, int hei
CLog::Log(LOGDEBUG, "No double refresh rate whitelisted resolution matched, trying current resolution");
+ const RESOLUTION_INFO desktop_info = CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo(CDisplaySettings::GetInstance().GetCurrentResolution());
+
for (const auto &mode : indexList)
{
auto i = CDisplaySettings::GetInstance().GetResFromString(mode.asString());
const RESOLUTION_INFO info = CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo(i);
- const RESOLUTION_INFO desktop_info = CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo(CDisplaySettings::GetInstance().GetCurrentResolution());
-
// allow resolutions that are desktop resolution but have the correct refresh rate
- if (info.iScreenWidth == desktop_info.iWidth &&
+ if (info.iScreenWidth == desktop_info.iScreenWidth &&
(info.dwFlags & D3DPRESENTFLAG_MODEMASK) == (desktop_info.dwFlags & D3DPRESENTFLAG_MODEMASK) &&
MathUtils::FloatEquals(info.fRefreshRate, fps, 0.01f))
{
@@ -166,10 +168,8 @@ void CResolutionUtils::FindResolutionFromWhitelist(float fps, int width, int hei
auto i = CDisplaySettings::GetInstance().GetResFromString(mode.asString());
const RESOLUTION_INFO info = CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo(i);
- const RESOLUTION_INFO desktop_info = CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo(CDisplaySettings::GetInstance().GetCurrentResolution());
-
// allow resolutions that are desktop resolution but have double the refresh rate
- if (info.iScreenWidth == desktop_info.iWidth &&
+ if (info.iScreenWidth == desktop_info.iScreenWidth &&
(info.dwFlags & D3DPRESENTFLAG_MODEMASK) == (desktop_info.dwFlags & D3DPRESENTFLAG_MODEMASK) &&
MathUtils::FloatEquals(info.fRefreshRate, fps * 2, 0.01f))
{