Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

video calibration fix #1231

Merged
merged 1 commit into from

6 participants

@FernetMenta
Collaborator

Video calibrations loading broke after the GUI creation was moved.

This is a bit more flexible than it was because it allows to apply calibrations for resolutions being added while is running. Typical use case when a user connects a projector.

@mkortstiege
Collaborator

+1 for asap merge :)

@FernetMenta
Collaborator

Updated

@Memphiz
Owner

If the typo is fixed i can confirm that xbmc loads my handcrafted calibration. Good work on that one. If FernetMenta gets to fix the compilation (because of the iHight typo) we should consider merging this fix before the alpha5 tag aswell...

@Memphiz
Owner

Well to late - versions already bumped. Assign it to august merge window and merge if you ask me (it will hit nightlies and alpha5 then). Please also track this PR in the August merge thread in the forum.

@FernetMenta FernetMenta was assigned
@jmarshallnz
Owner

Fix - merge at will.

@jpsdr

Warning : I had a strange issue when tested it. Video played fine on my standard PC with a VGA PC screen, but was totaly broken on my PC to view video, linked by HDMI to my audio receveir, and TV screen afterward. Video was ultra zommed, i think roughly only the upper left quarter was displayed. I'll have to make more test (but compliling is long), to check if it this patch, or if actual git is broken.

@FernetMenta
Collaborator

@jpsdr
Make sure your receiver is powered up before you start XBMC.

@jpsdr

It is, that's for sure, as all HDMI enter in receiver, and after output to TV => Receiver off => No screen...
Receiver if powered on even before i power on the PC.

@FernetMenta
Collaborator

@jpsdr
What is the status? Are you sure this commit breaks your system?

@jpsdr

I have to compile two version, one updated to last git i'll do very shortly, and the same with the patch, but compile take around half an hour for me, so, expect me to be back with result no before at least an hour... More likely in two hours.
As i said, it'll take time for me to check.

@Memphiz
Owner

Honestly - imo its more then unlikly that this patch leads to the reported problem. Just look at the code. Its doesn't care where you plug in your tv. If the calibrations are not matching for receiver and vga, then its not XBMCs fault imho.

@Begall

Did you turn on your xbmc box while the display was shut off? This for me leads to a problem almost exactly as you've described here.

@jpsdr

It's not the patch, something broke video display in git update between the 28/07 and yesterday.

@FernetMenta
Collaborator

@Memphiz
Check ticket 13224, the problem is in master. Software rendering on Windows is broken,

@FernetMenta FernetMenta merged commit dea8c9b into xbmc:master
@Memphiz
Owner

@FernetMenta

Any idea if this PR could lead to growing guisettings.xml on profile changes? (resolutions get written over and over again and make the file huge like gozilla) Described here:

http://forum.xbmc.org/showthread.php?tid=138804&page=2

Couldn't reproduce it.

@FernetMenta
Collaborator

A resolution is defined by a string like this "720x480 @ 29.97 - Full Screen". I would assume that this string changes when they switch profiles. Unfortunately all links in the post are expired.

@FernetMenta
Collaborator

The vector m_calibrations is not cleared in LoadCalibrations(). This can lead to duplicate entries if settings are loaded more than once. I am not aware that this can happen.
Nevertheless, it is a good practice to do so. Will provide a fix tomorrow with a check for duplicate entries. This way users get rid of duplicates without having to manually edit guisettings.

@LongChair LongChair referenced this pull request from a commit in plexinc/plex-home-theater-public
@LongChair LongChair Fix Consider adjusting context menu item if PQ of that item type does…
…n't exist #1231
825d59a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 1, 2012
  1. @FernetMenta
This page is out of date. Refresh to see the latest.
View
1  xbmc/settings/GUIWindowSettingsScreenCalibration.cpp
@@ -117,6 +117,7 @@ bool CGUIWindowSettingsScreenCalibration::OnMessage(CGUIMessage& message)
{
case GUI_MSG_WINDOW_DEINIT:
{
+ g_settings.UpdateCalibrations();
g_settings.Save();
g_graphicsContext.SetCalibrating(false);
g_windowManager.ShowOverlay(OVERLAY_STATE_SHOWN);
View
170 xbmc/settings/Settings.cpp
@@ -488,60 +488,114 @@ bool CSettings::LoadCalibration(const TiXmlElement* pRoot, const CStdString& str
const TiXmlElement *pResolution = pElement->FirstChildElement("resolution");
while (pResolution)
{
- // get the data for this resolution
- CStdString mode;
- XMLUtils::GetString(pResolution, "description", mode);
- // find this resolution in our resolution vector
- for (unsigned int res = 0; res < m_ResInfo.size(); res++)
- {
- if (res == RES_WINDOW)
- continue;
+ // get the data for this calibration
+ RESOLUTION_INFO cal;
- if (m_ResInfo[res].strMode == mode)
- { // found, read in the rest of the information for this item
- const TiXmlElement *pOverscan = pResolution->FirstChildElement("overscan");
- if (pOverscan)
- {
- GetInteger(pOverscan, "left", m_ResInfo[res].Overscan.left, 0, -m_ResInfo[res].iWidth / 4, m_ResInfo[res].iWidth / 4);
- GetInteger(pOverscan, "top", m_ResInfo[res].Overscan.top, 0, -m_ResInfo[res].iHeight / 4, m_ResInfo[res].iHeight / 4);
- GetInteger(pOverscan, "right", m_ResInfo[res].Overscan.right, m_ResInfo[res].iWidth, m_ResInfo[res].iWidth / 2, m_ResInfo[res].iWidth*3 / 2);
- GetInteger(pOverscan, "bottom", m_ResInfo[res].Overscan.bottom, m_ResInfo[res].iHeight, m_ResInfo[res].iHeight / 2, m_ResInfo[res].iHeight*3 / 2);
- }
+ XMLUtils::GetString(pResolution, "description", cal.strMode);
+ XMLUtils::GetInt(pResolution, "subtitles", cal.iSubtitles);
+ XMLUtils::GetFloat(pResolution, "pixelratio", cal.fPixelRatio);
+#ifdef HAS_XRANDR
+ XMLUtils::GetFloat(pResolution, "refreshrate", cal.fRefreshRate);
+ XMLUtils::GetString(pResolution, "output", cal.strOutput);
+ XMLUtils::GetString(pResolution, "xrandrid", cal.strId);
+#endif
- // get the appropriate "safe graphics area" = 10% for 4x3, 3.5% for 16x9
- float fSafe;
- if (res == RES_PAL_4x3 || res == RES_NTSC_4x3 || res == RES_PAL60_4x3 || res == RES_HDTV_480p_4x3)
- fSafe = 0.1f;
- else
- fSafe = 0.035f;
-
- GetInteger(pResolution, "subtitles", m_ResInfo[res].iSubtitles, (int)((1 - fSafe)*m_ResInfo[res].iHeight), m_ResInfo[res].iHeight / 2, m_ResInfo[res].iHeight*5 / 4);
- GetFloat(pResolution, "pixelratio", m_ResInfo[res].fPixelRatio, 128.0f / 117.0f, 0.5f, 2.0f);
- /* CLog::Log(LOGDEBUG, " calibration for %s %ix%i", m_ResInfo[res].strMode, m_ResInfo[res].iWidth, m_ResInfo[res].iHeight);
- CLog::Log(LOGDEBUG, " subtitle yposition:%i pixelratio:%03.3f offsets:(%i,%i)->(%i,%i)",
- m_ResInfo[res].iSubtitles, m_ResInfo[res].fPixelRatio,
- m_ResInfo[res].Overscan.left, m_ResInfo[res].Overscan.top,
- m_ResInfo[res].Overscan.right, m_ResInfo[res].Overscan.bottom);*/
- }
+ const TiXmlElement *pOverscan = pResolution->FirstChildElement("overscan");
+ if (pOverscan)
+ {
+ XMLUtils::GetInt(pOverscan, "left", cal.Overscan.left);
+ XMLUtils::GetInt(pOverscan, "top", cal.Overscan.top);
+ XMLUtils::GetInt(pOverscan, "right", cal.Overscan.right);
+ XMLUtils::GetInt(pOverscan, "bottom", cal.Overscan.bottom);
}
+
+ // mark calibration as not updated
+ // we must not delete those, resolution just might not be available
+ cal.iWidth = cal.iHeight = 0;
+
+ // store calibration
+ m_Calibrations.push_back(cal);
+
// iterate around
pResolution = pResolution->NextSiblingElement("resolution");
+ }
+ ApplyCalibrations();
+ return true;
+}
+void CSettings::ApplyCalibrations()
+{
+ // apply all calibrations to the resolutions
+ for (size_t i = 0; i < m_Calibrations.size(); ++i)
+ {
+ // find resolutions
+ for (size_t res = 0; res < m_ResInfo.size(); ++res)
+ {
+ if (res == RES_WINDOW)
+ continue;
+ if (m_Calibrations[i].strMode.Equals(m_ResInfo[res].strMode))
+ {
+ // overscan
+ m_ResInfo[res].Overscan.left = m_Calibrations[i].Overscan.left;
+ if (m_ResInfo[res].Overscan.left < -m_ResInfo[res].iWidth/4)
+ m_ResInfo[res].Overscan.left = -m_ResInfo[res].iWidth/4;
+ if (m_ResInfo[res].Overscan.left > m_ResInfo[res].iWidth/4)
+ m_ResInfo[res].Overscan.left = m_ResInfo[res].iWidth/4;
+
+ m_ResInfo[res].Overscan.top = m_Calibrations[i].Overscan.top;
+ if (m_ResInfo[res].Overscan.top < -m_ResInfo[res].iHeight/4)
+ m_ResInfo[res].Overscan.top = -m_ResInfo[res].iHeight/4;
+ if (m_ResInfo[res].Overscan.top > m_ResInfo[res].iHeight/4)
+ m_ResInfo[res].Overscan.top = m_ResInfo[res].iHeight/4;
+
+ m_ResInfo[res].Overscan.right = m_Calibrations[i].Overscan.right;
+ if (m_ResInfo[res].Overscan.right < m_ResInfo[res].iWidth / 2)
+ m_ResInfo[res].Overscan.right = m_ResInfo[res].iWidth / 2;
+ if (m_ResInfo[res].Overscan.right > m_ResInfo[res].iWidth * 3/2)
+ m_ResInfo[res].Overscan.right = m_ResInfo[res].iWidth *3/2;
+
+ m_ResInfo[res].Overscan.bottom = m_Calibrations[i].Overscan.bottom;
+ if (m_ResInfo[res].Overscan.bottom < m_ResInfo[res].iHeight / 2)
+ m_ResInfo[res].Overscan.bottom = m_ResInfo[res].iHeight / 2;
+ if (m_ResInfo[res].Overscan.bottom > m_ResInfo[res].iHeight * 3/2)
+ m_ResInfo[res].Overscan.bottom = m_ResInfo[res].iHeight * 3/2;
+
+ m_ResInfo[res].iSubtitles = m_Calibrations[i].iSubtitles;
+ if (m_ResInfo[res].iSubtitles < m_ResInfo[res].iHeight / 2)
+ m_ResInfo[res].iSubtitles = m_ResInfo[res].iHeight / 2;
+ if (m_ResInfo[res].iSubtitles > m_ResInfo[res].iHeight* 5/4)
+ m_ResInfo[res].iSubtitles = m_ResInfo[res].iHeight* 5/4;
+
+ m_ResInfo[res].fPixelRatio = m_Calibrations[i].fPixelRatio;
+ if (m_ResInfo[res].fPixelRatio < 0.5f)
+ m_ResInfo[res].fPixelRatio = 0.5f;
+ if (m_ResInfo[res].fPixelRatio > 2.0f)
+ m_ResInfo[res].fPixelRatio = 2.0f;
+ break;
+ }
+ }
+ }
+}
-/* Hmm, these stuff shouldn't be releaded, they should be used instead of our internal
- id counter to select what resolution is affected by this settings
-#ifdef HAS_XRANDR
- const CStdString def("");
- CStdString val;
- GetString(pResolution, "xrandrid", val, def);
- strncpy(m_ResInfo[iRes].strId, val.c_str(), sizeof(m_ResInfo[iRes].strId));
- GetString(pResolution, "output", val, def);
- strncpy(m_ResInfo[iRes].strOutput, val.c_str(), sizeof(m_ResInfo[iRes].strOutput));
- GetFloat(pResolution, "refreshrate", m_ResInfo[iRes].fRefreshRate, 0, 0, 200);
-#endif
-*/
+void CSettings::UpdateCalibrations()
+{
+ for (size_t res = RES_DESKTOP; res < m_ResInfo.size(); ++res)
+ {
+ // find calibration
+ bool found = false;
+ for (std::vector<RESOLUTION_INFO>::iterator it = m_Calibrations.begin(); it != m_Calibrations.end(); ++it)
+ {
+ if (it->strMode.Equals(m_ResInfo[res].strMode))
+ {
+ // TODO: erase calibrations with default values
+ (*it) = m_ResInfo[res];
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ m_Calibrations.push_back(m_ResInfo[res]);
}
- return true;
}
bool CSettings::SaveCalibration(TiXmlNode* pRootNode) const
@@ -549,28 +603,28 @@ bool CSettings::SaveCalibration(TiXmlNode* pRootNode) const
TiXmlElement xmlRootElement("resolutions");
TiXmlNode *pRoot = pRootNode->InsertEndChild(xmlRootElement);
- // save WINDOW, DESKTOP and CUSTOM resolution
- for (size_t i = RES_WINDOW ; i < m_ResInfo.size() ; i++)
+ // save calibrations
+ for (size_t i = 0 ; i < m_Calibrations.size() ; i++)
{
// Write the resolution tag
TiXmlElement resElement("resolution");
TiXmlNode *pNode = pRoot->InsertEndChild(resElement);
// Now write each of the pieces of information we need...
- XMLUtils::SetString(pNode, "description", m_ResInfo[i].strMode);
- XMLUtils::SetInt(pNode, "subtitles", m_ResInfo[i].iSubtitles);
- XMLUtils::SetFloat(pNode, "pixelratio", m_ResInfo[i].fPixelRatio);
+ XMLUtils::SetString(pNode, "description", m_Calibrations[i].strMode);
+ XMLUtils::SetInt(pNode, "subtitles", m_Calibrations[i].iSubtitles);
+ XMLUtils::SetFloat(pNode, "pixelratio", m_Calibrations[i].fPixelRatio);
#ifdef HAS_XRANDR
- XMLUtils::SetFloat(pNode, "refreshrate", m_ResInfo[i].fRefreshRate);
- XMLUtils::SetString(pNode, "output", m_ResInfo[i].strOutput);
- XMLUtils::SetString(pNode, "xrandrid", m_ResInfo[i].strId);
+ XMLUtils::SetFloat(pNode, "refreshrate", m_Calibrations[i].fRefreshRate);
+ XMLUtils::SetString(pNode, "output", m_Calibrations[i].strOutput);
+ XMLUtils::SetString(pNode, "xrandrid", m_Calibrations[i].strId);
#endif
// create the overscan child
TiXmlElement overscanElement("overscan");
TiXmlNode *pOverscanNode = pNode->InsertEndChild(overscanElement);
- XMLUtils::SetInt(pOverscanNode, "left", m_ResInfo[i].Overscan.left);
- XMLUtils::SetInt(pOverscanNode, "top", m_ResInfo[i].Overscan.top);
- XMLUtils::SetInt(pOverscanNode, "right", m_ResInfo[i].Overscan.right);
- XMLUtils::SetInt(pOverscanNode, "bottom", m_ResInfo[i].Overscan.bottom);
+ XMLUtils::SetInt(pOverscanNode, "left", m_Calibrations[i].Overscan.left);
+ XMLUtils::SetInt(pOverscanNode, "top", m_Calibrations[i].Overscan.top);
+ XMLUtils::SetInt(pOverscanNode, "right", m_Calibrations[i].Overscan.right);
+ XMLUtils::SetInt(pOverscanNode, "bottom", m_Calibrations[i].Overscan.bottom);
}
return true;
}
View
4 xbmc/settings/Settings.h
@@ -335,6 +335,7 @@ class CSettings
int GetCurrentProfileId() const;
std::vector<RESOLUTION_INFO> m_ResInfo;
+ std::vector<RESOLUTION_INFO> m_Calibrations;
// utility functions for user data folders
@@ -381,6 +382,9 @@ class CSettings
static bool GetString(const TiXmlElement* pRootElement, const char *strTagName, CStdString& strValue, const CStdString& strDefaultValue);
bool GetString(const TiXmlElement* pRootElement, const char *strTagName, char *szValue, const CStdString& strDefaultValue);
bool GetSource(const CStdString &category, const TiXmlNode *source, CMediaSource &share);
+
+ void ApplyCalibrations();
+ void UpdateCalibrations();
protected:
void GetSources(const TiXmlElement* pRootElement, const CStdString& strTagName, VECSOURCES& items, CStdString& strDefault);
bool SetSources(TiXmlNode *root, const char *section, const VECSOURCES &shares, const char *defaultPath);
View
2  xbmc/windowing/WinSystem.cpp
@@ -45,7 +45,7 @@ CWinSystemBase::~CWinSystemBase()
bool CWinSystemBase::InitWindowSystem()
{
UpdateResolutions();
-
+ g_settings.ApplyCalibrations();
return true;
}
Something went wrong with that request. Please try again.