diff options
author | spiff_ <spiff_@svn> | 2010-01-08 23:47:11 +0000 |
---|---|---|
committer | spiff_ <spiff_@svn> | 2010-01-08 23:47:11 +0000 |
commit | d5c23e36410e2570b1089da505acb2b69d53262a (patch) | |
tree | e38ac6cc8d36b323a3e800bb399585a014b3ea4f | |
parent | ccea07a5a4229a0f7ebb7ff58e034820751a744a (diff) |
cosmetics
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@26558 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
298 files changed, 1761 insertions, 1760 deletions
diff --git a/guilib/AnimatedGif.cpp b/guilib/AnimatedGif.cpp index 30363b69fd..45d3cdb153 100644 --- a/guilib/AnimatedGif.cpp +++ b/guilib/AnimatedGif.cpp @@ -335,7 +335,7 @@ int CAnimatedGifSet::LoadGIF (const char * szFileName) } else nLoops = 0; - + if (nLoops) nLoops++; getbyte(fd); } @@ -415,7 +415,7 @@ int CAnimatedGifSet::LoadGIF (const char * szFileName) bool isPalRead = false; if (LocalColorMap && fread((char*)NextImage->Palette, 1, palSize, fd) == palSize) isPalRead = true; - + // Copy global, if no palette if (!isPalRead) memcpy(NextImage->Palette, GlobalColorMap, palSize); @@ -576,7 +576,7 @@ int LZWDecoder (char * bufIn, char * bufOut, // - Table Suffices contain the raw codes to be output while (OutCode >= FirstEntry) { - if (OutIndex > 4096 || OutCode >= 4096) + if (OutIndex > 4096 || OutCode >= 4096) return 0; OutStack[OutIndex++] = Suffix[OutCode]; // Add suffix to Output Stack OutCode = Prefix[OutCode]; // Loop with preffix diff --git a/guilib/AnimatedGif.h b/guilib/AnimatedGif.h index 4cfc322b87..1f77fb5fbd 100644 --- a/guilib/AnimatedGif.h +++ b/guilib/AnimatedGif.h @@ -77,7 +77,7 @@ GUIBITMAPINFOHEADER; \ingroup textures \brief */ -typedef struct tagGUIBITMAPINFO +typedef struct tagGUIBITMAPINFO { GUIBITMAPINFOHEADER bmiHeader; GUIRGBQUAD bmiColors[1]; diff --git a/guilib/GUIActionDescriptor.h b/guilib/GUIActionDescriptor.h index 80109a6106..a2a8ce1250 100644 --- a/guilib/GUIActionDescriptor.h +++ b/guilib/GUIActionDescriptor.h @@ -19,17 +19,17 @@ public: CGUIActionDescriptor(CStdString& action) { m_lang = LANG_XBMC; - m_action = action; + m_action = action; m_sourceWindowId = -1; } - + CGUIActionDescriptor(ActionLang lang, CStdString& action) { m_lang = lang; m_action = action; m_sourceWindowId = -1; } - + CStdString m_action; ActionLang m_lang; int m_sourceWindowId; // the id of the window that was a source of an action diff --git a/guilib/GUIAudioManager.cpp b/guilib/GUIAudioManager.cpp index 8be427e379..51f9d18a3f 100644 --- a/guilib/GUIAudioManager.cpp +++ b/guilib/GUIAudioManager.cpp @@ -57,7 +57,7 @@ void CGUIAudioManager::Initialize(int iDevice) if (g_guiSettings.GetString("lookandfeel.soundskin")=="OFF") return; - + if (iDevice==CAudioContext::DEFAULT_DEVICE) { CSingleLock lock(m_cs); diff --git a/guilib/GUIAudioManager.h b/guilib/GUIAudioManager.h index ef73abc11d..afe15097f5 100644 --- a/guilib/GUIAudioManager.h +++ b/guilib/GUIAudioManager.h @@ -80,7 +80,7 @@ private: CStdString m_strMediaDir; bool m_bEnabled; bool m_bInitialized; - + CCriticalSection m_cs; }; diff --git a/guilib/GUIBaseContainer.cpp b/guilib/GUIBaseContainer.cpp index 525d6c4415..bee83b5f20 100644 --- a/guilib/GUIBaseContainer.cpp +++ b/guilib/GUIBaseContainer.cpp @@ -735,7 +735,7 @@ void CGUIBaseContainer::UpdateVisibility(const CGUIListItem *item) if (item.get() == lastItem) m_lastItem = lastItem; } - if (updateItems && item->HasProperties()) + if (updateItems && item->HasProperties()) { // has info, so update it CStdString info = item->GetProperty("label"); if (!info.IsEmpty()) item->SetLabel(CGUIInfoLabel::GetLabel(info)); @@ -932,7 +932,7 @@ void CGUIBaseContainer::LoadContent(TiXmlElement *content) { newItem->m_strPath += " , "; } - newItem->m_strPath += (*it).m_action; + newItem->m_strPath += (*it).m_action; } newItem->SetLabel2(CGUIInfoLabel::GetLabel(label2)); newItem->SetThumbnailImage(CGUIInfoLabel::GetLabel(thumb, true)); diff --git a/guilib/GUIControl.cpp b/guilib/GUIControl.cpp index e9611a2764..6bc24acdc5 100644 --- a/guilib/GUIControl.cpp +++ b/guilib/GUIControl.cpp @@ -185,13 +185,13 @@ bool CGUIControl::OnAction(const CAction &action) OnRight(); return true; break; - + case ACTION_NEXT_CONTROL: if (!HasFocus()) return false; OnNextControl(); return true; break; - + case ACTION_PREV_CONTROL: if (!HasFocus()) return false; OnPrevControl(); diff --git a/guilib/GUIControl.h b/guilib/GUIControl.h index 6cc6783be4..267d9a3609 100644 --- a/guilib/GUIControl.h +++ b/guilib/GUIControl.h @@ -290,7 +290,7 @@ protected: int m_controlDown; int m_controlNext; int m_controlPrev; - + std::vector<CGUIActionDescriptor> m_leftActions; std::vector<CGUIActionDescriptor> m_rightActions; std::vector<CGUIActionDescriptor> m_upActions; diff --git a/guilib/GUIControlFactory.cpp b/guilib/GUIControlFactory.cpp index 26ded2d04b..124d84908e 100644 --- a/guilib/GUIControlFactory.cpp +++ b/guilib/GUIControlFactory.cpp @@ -157,7 +157,7 @@ bool CGUIControlFactory::GetAction(const TiXmlElement* pElement, CGUIActionDescr action.m_lang = CGUIActionDescriptor::LANG_PYTHON; else action.m_lang = CGUIActionDescriptor::LANG_XBMC; - + if (pElement->FirstChild()) { action.m_action = pElement->FirstChild()->Value(); @@ -1058,7 +1058,7 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl if (bPassword) ((CGUIEditControl *) control)->SetInputType(CGUIEditControl::INPUT_TYPE_PASSWORD, 0); - ((CGUIEditControl *) control)->SetTextChangeActions(textChangeActions); + ((CGUIEditControl *) control)->SetTextChangeActions(textChangeActions); } else if (strType == "videowindow") { diff --git a/guilib/GUIControlProfiler.cpp b/guilib/GUIControlProfiler.cpp index 121e5be566..16142f3b72 100644 --- a/guilib/GUIControlProfiler.cpp +++ b/guilib/GUIControlProfiler.cpp @@ -34,7 +34,7 @@ CGUIControlProfilerItem::CGUIControlProfilerItem(CGUIControlProfiler *pProfiler, m_ControlType = m_pControl->GetControlType(); m_strDescription = m_pControl->GetDescription(); } - else + else { m_controlID = 0; m_ControlType = CGUIControl::GUICONTROL_UNKNOWN; @@ -73,7 +73,7 @@ void CGUIControlProfilerItem::EndVisibility(void) } void CGUIControlProfilerItem::BeginRender(void) -{ +{ m_i64RenderStart = CurrentHostCounter(); } @@ -86,42 +86,42 @@ void CGUIControlProfilerItem::SaveToXML(TiXmlElement *parent) { TiXmlElement *xmlControl = new TiXmlElement("control"); parent->LinkEndChild(xmlControl); - + const char *lpszType = NULL; switch (m_ControlType) { - case CGUIControl::GUICONTROL_BUTTON: + case CGUIControl::GUICONTROL_BUTTON: lpszType = "button"; break; - case CGUIControl::GUICONTROL_CHECKMARK: + case CGUIControl::GUICONTROL_CHECKMARK: lpszType = "checkmark"; break; - case CGUIControl::GUICONTROL_FADELABEL: + case CGUIControl::GUICONTROL_FADELABEL: lpszType = "fadelabel"; break; - case CGUIControl::GUICONTROL_IMAGE: - case CGUIControl::GUICONTROL_BORDEREDIMAGE: + case CGUIControl::GUICONTROL_IMAGE: + case CGUIControl::GUICONTROL_BORDEREDIMAGE: lpszType = "image"; break; - case CGUIControl::GUICONTROL_LARGE_IMAGE: + case CGUIControl::GUICONTROL_LARGE_IMAGE: lpszType = "largeimage"; break; - case CGUIControl::GUICONTROL_LABEL: + case CGUIControl::GUICONTROL_LABEL: lpszType = "label"; break; - case CGUIControl::GUICONTROL_LISTGROUP: + case CGUIControl::GUICONTROL_LISTGROUP: lpszType = "group"; break; - case CGUIControl::GUICONTROL_PROGRESS: + case CGUIControl::GUICONTROL_PROGRESS: lpszType = "progress"; break; - case CGUIControl::GUICONTROL_RADIO: + case CGUIControl::GUICONTROL_RADIO: lpszType = "radiobutton"; break; - case CGUIControl::GUICONTROL_RSS: + case CGUIControl::GUICONTROL_RSS: lpszType = "rss"; break; - case CGUIControl::GUICONTROL_SELECTBUTTON: + case CGUIControl::GUICONTROL_SELECTBUTTON: lpszType = "selectbutton"; break; - case CGUIControl::GUICONTROL_SLIDER: + case CGUIControl::GUICONTROL_SLIDER: lpszType = "slider"; break; - case CGUIControl::GUICONTROL_SETTINGS_SLIDER: + case CGUIControl::GUICONTROL_SETTINGS_SLIDER: lpszType = "sliderex"; break; - case CGUIControl::GUICONTROL_SPIN: + case CGUIControl::GUICONTROL_SPIN: lpszType = "spincontrol"; break; - case CGUIControl::GUICONTROL_SPINEX: + case CGUIControl::GUICONTROL_SPINEX: lpszType = "spincontrolex"; break; - case CGUIControl::GUICONTROL_TEXTBOX: + case CGUIControl::GUICONTROL_TEXTBOX: lpszType = "textbox"; break; case CGUIControl::GUICONTROL_TOGGLEBUTTON: lpszType = "togglebutton"; break; @@ -157,11 +157,11 @@ void CGUIControlProfilerItem::SaveToXML(TiXmlElement *parent) lpszType = "fixedlist"; break; case CGUIControl::GUICONTAINER_PANEL: lpszType = "panel"; break; - //case CGUIControl::GUICONTROL_LIST: - //case CGUIControl::GUICONTROL_UNKNOWN: - //case CGUIControl::GUICONTROL_LISTEX: - //case CGUIControl::GUICONTROL_SPINBUTTON: - //case CGUIControl::GUICONTROL_THUMBNAIL: + //case CGUIControl::GUICONTROL_LIST: + //case CGUIControl::GUICONTROL_UNKNOWN: + //case CGUIControl::GUICONTROL_LISTEX: + //case CGUIControl::GUICONTROL_SPINBUTTON: + //case CGUIControl::GUICONTROL_THUMBNAIL: //case CGUIControl::GUICONTROL_CONSOLE: default: break; @@ -169,7 +169,7 @@ void CGUIControlProfilerItem::SaveToXML(TiXmlElement *parent) if (lpszType) xmlControl->SetAttribute("type", lpszType); - if (m_controlID != 0) + if (m_controlID != 0) { CStdString str; str.Format("%u", m_controlID); @@ -188,7 +188,7 @@ void CGUIControlProfilerItem::SaveToXML(TiXmlElement *parent) { TiXmlElement *elem = new TiXmlElement("description"); xmlControl->LinkEndChild(elem); - TiXmlText *text = new TiXmlText(m_strDescription.c_str()); + TiXmlText *text = new TiXmlText(m_strDescription.c_str()); elem->LinkEndChild(text); } @@ -203,7 +203,7 @@ void CGUIControlProfilerItem::SaveToXML(TiXmlElement *parent) val.Format("%u", rend); TiXmlText *text = new TiXmlText(val.c_str()); elem->LinkEndChild(text); - + elem = new TiXmlElement("visibletime"); xmlControl->LinkEndChild(elem); val.Format("%u", vis); @@ -240,7 +240,7 @@ CGUIControlProfilerItem *CGUIControlProfilerItem::FindOrAddControl(CGUIControl * } if (pControl->GetParentControl() == m_pControl) - return AddControl(pControl); + return AddControl(pControl); return NULL; } @@ -258,8 +258,8 @@ CGUIControlProfiler &CGUIControlProfiler::Instance(void) return _instance; } -bool CGUIControlProfiler::IsRunning(void) -{ +bool CGUIControlProfiler::IsRunning(void) +{ return m_bIsRunning; } @@ -303,7 +303,7 @@ CGUIControlProfilerItem *CGUIControlProfiler::FindOrAddControl(CGUIControl *pCon // the one we want again next time if (m_pLastItem->m_pControl == pControl) return m_pLastItem; - // If that control is not a match, usually the one we want is the next + // If that control is not a match, usually the one we want is the next // sibling of that control, or the parent of that control so check // the parent first as it is more convenient m_pLastItem = m_pLastItem->m_pParent; diff --git a/guilib/GUIControlProfiler.h b/guilib/GUIControlProfiler.h index 7443c795ec..a9f0613943 100644 --- a/guilib/GUIControlProfiler.h +++ b/guilib/GUIControlProfiler.h @@ -44,12 +44,12 @@ public: int64_t m_i64RenderStart; CGUIControlProfilerItem(CGUIControlProfiler *pProfiler, CGUIControlProfilerItem *pParent, CGUIControl *pControl); - ~CGUIControlProfilerItem(void); + ~CGUIControlProfilerItem(void); void Reset(CGUIControlProfiler *pProfiler); void BeginVisibility(void); void EndVisibility(void); - void BeginRender(void); + void BeginRender(void); void EndRender(void); void SaveToXML(TiXmlElement *parent); unsigned int GetTotalTime(void) const { return m_visTime + m_renderTime; }; diff --git a/guilib/GUIEditControl.cpp b/guilib/GUIEditControl.cpp index 8246dce882..bf3f3cf349 100644 --- a/guilib/GUIEditControl.cpp +++ b/guilib/GUIEditControl.cpp @@ -290,7 +290,7 @@ void CGUIEditControl::UpdateText(bool sendUpdate) if (sendUpdate) { SEND_CLICK_MESSAGE(GetID(), GetParentID(), 0); - + vector<CGUIActionDescriptor> textChangeActions = m_textChangeActions; for (unsigned int i = 0; i < textChangeActions.size(); i++) { @@ -355,7 +355,7 @@ void CGUIEditControl::RenderText() { if (m_smsTimer.GetElapsedMilliseconds() > smsDelay) UpdateText(); - + if (m_bInvalidated) { m_textLayout.Update(m_info.GetLabel(GetParentID())); @@ -488,7 +488,7 @@ void CGUIEditControl::OnSMSCharacter(unsigned int key) assert(key < 10); bool sendUpdate = false; if (m_smsTimer.IsRunning()) - { + { // we're already entering an SMS character if (key != m_smsLastKey || m_smsTimer.GetElapsedMilliseconds() > smsDelay) { // a different key was clicked than last time, or we have timed out @@ -508,9 +508,9 @@ void CGUIEditControl::OnSMSCharacter(unsigned int key) m_smsLastKey = key; m_smsKeyIndex = 0; } - + m_smsKeyIndex = m_smsKeyIndex % strlen(smsLetters[key]); - + m_text2.insert(m_text2.begin() + m_cursorPos++, smsLetters[key][m_smsKeyIndex]); UpdateText(sendUpdate); m_smsTimer.StartZero(); @@ -533,13 +533,13 @@ void CGUIEditControl::OnPasteClipboard() { hglb = GetClipboardData(CF_TEXT); if (hglb != NULL) - { + { lptstr = (LPTSTR)GlobalLock(hglb); if (lptstr != NULL) - { + { m_text2 = (char*)lptstr; GlobalUnlock(hglb); - } + } } CloseClipboard(); UpdateText(); diff --git a/guilib/GUIEditControl.h b/guilib/GUIEditControl.h index 69a27048c9..59e1368e02 100644 --- a/guilib/GUIEditControl.h +++ b/guilib/GUIEditControl.h @@ -71,11 +71,11 @@ public: void SetCursorPosition(unsigned int iPosition); void SetInputType(INPUT_TYPE type, int heading); - + void SetTextChangeActions(const std::vector<CGUIActionDescriptor>& textChangeActions) { m_textChangeActions = textChangeActions; }; - + bool HasTextChangeActions() { return m_textChangeActions.size() > 0; }; - + protected: virtual void RenderText(); CStdStringW GetDisplayedText() const; @@ -97,14 +97,14 @@ protected: int m_inputHeading; INPUT_TYPE m_inputType; - - std::vector<CGUIActionDescriptor> m_textChangeActions; - + std::vector<CGUIActionDescriptor> m_textChangeActions; + + unsigned int m_smsKeyIndex; unsigned int m_smsLastKey; CStopWatch m_smsTimer; - + static const char* smsLetters[10]; static const unsigned int smsDelay; }; diff --git a/guilib/GUIFontTTF.h b/guilib/GUIFontTTF.h index 1c05641ff9..e2a89afa82 100644 --- a/guilib/GUIFontTTF.h +++ b/guilib/GUIFontTTF.h @@ -54,7 +54,7 @@ typedef std::vector<color_t> vecColors; typedef struct _SVertex { float u, v; - unsigned char r, g, b, a; + unsigned char r, g, b, a; float x, y, z; } SVertex; @@ -62,7 +62,7 @@ typedef struct _SVertex class CGUIFontTTFBase { friend class CGUIFont; - + public: CGUIFontTTFBase(const CStdString& strFileName); diff --git a/guilib/GUIFontTTFGL.h b/guilib/GUIFontTTFGL.h index b23a9d3af3..c4dc88ec6a 100644 --- a/guilib/GUIFontTTFGL.h +++ b/guilib/GUIFontTTFGL.h @@ -50,7 +50,7 @@ protected: virtual bool CopyCharToTexture(FT_BitmapGlyph bitGlyph, Character *ch); virtual void DeleteHardwareTexture(); virtual void RenderInternal(SVertex* v) {} - + }; #endif diff --git a/guilib/GUIFontTTFGLES.cpp b/guilib/GUIFontTTFGLES.cpp index 8adcefebc2..a6bc5f28da 100644 --- a/guilib/GUIFontTTFGLES.cpp +++ b/guilib/GUIFontTTFGLES.cpp @@ -44,12 +44,12 @@ using namespace std; CGUIFontTTFGLES::CGUIFontTTFGLES(const CStdString& strFileName) : CGUIFontTTFBase(strFileName) { - + } CGUIFontTTFGLES::~CGUIFontTTFGLES(void) { - + } void CGUIFontTTFGLES::Begin() diff --git a/guilib/GUIFontTTFGLES.h b/guilib/GUIFontTTFGLES.h index 207da8c57f..17939729fb 100644 --- a/guilib/GUIFontTTFGLES.h +++ b/guilib/GUIFontTTFGLES.h @@ -50,7 +50,7 @@ protected: virtual bool CopyCharToTexture(FT_BitmapGlyph bitGlyph, Character *ch); virtual void DeleteHardwareTexture(); virtual void RenderInternal(SVertex* v) {} - + }; #endif diff --git a/guilib/GUIImage.cpp b/guilib/GUIImage.cpp index 4cb8711dc6..7cf90622da 100644 --- a/guilib/GUIImage.cpp +++ b/guilib/GUIImage.cpp @@ -100,7 +100,7 @@ void CGUIImage::Render() // check whether our image failed to allocate, and if so drop back to the fallback image if (m_texture.FailedToAlloc() && !m_texture.GetFileName().Equals(m_info.GetFallback())) m_texture.SetFileName(m_info.GetFallback()); - + if (m_crossFadeTime) { // make sure our texture has started allocating diff --git a/guilib/GUIListContainer.cpp b/guilib/GUIListContainer.cpp index 86026bc1fd..c127760ae7 100644 --- a/guilib/GUIListContainer.cpp +++ b/guilib/GUIListContainer.cpp @@ -248,7 +248,7 @@ bool CGUIListContainer::SelectItemFromPoint(const CPoint &point) { if (!m_focusedLayout || !m_layout) return false; - + int row = 0; float pos = (m_orientation == VERTICAL) ? point.y : point.x; while (row < m_itemsPerPage + 1) // 1 more to ensure we get the (possible) half item at the end. @@ -258,7 +258,7 @@ bool CGUIListContainer::SelectItemFromPoint(const CPoint &point) { // found correct "row" -> check horizontal if (!InsideLayout(layout, point)) return false; - + SetContainerMoving(row - m_cursor); m_cursor = row; CGUIListItemLayout *focusedLayout = GetFocusedLayout(); diff --git a/guilib/GUIListContainer.h b/guilib/GUIListContainer.h index 5d3418e2b6..2f667127b1 100644 --- a/guilib/GUIListContainer.h +++ b/guilib/GUIListContainer.h @@ -58,6 +58,6 @@ protected: virtual bool MoveUp(bool wrapAround); virtual void ValidateOffset(); virtual void SelectItem(int item); - virtual bool SelectItemFromPoint(const CPoint &point); + virtual bool SelectItemFromPoint(const CPoint &point); }; diff --git a/guilib/GUIListItem.cpp b/guilib/GUIListItem.cpp index 912fb35c91..4e201a685f 100644 --- a/guilib/GUIListItem.cpp +++ b/guilib/GUIListItem.cpp @@ -234,11 +234,11 @@ void CGUIListItem::Serialize(CArchive &ar) ar >> m_strThumbnailImage; ar >> m_strIcon; ar >> m_bSelected; - + int overlayIcon; ar >> overlayIcon; m_overlayIcon = GUIIconOverlay(overlayIcon); - + int mapSize; ar >> mapSize; for (int i = 0; i < mapSize; i++) diff --git a/guilib/GUIMessage.h b/guilib/GUIMessage.h index ba3fb5867c..79242a5fca 100644 --- a/guilib/GUIMessage.h +++ b/guilib/GUIMessage.h @@ -301,7 +301,7 @@ private: int m_param1; int m_param2; CGUIListItemPtr m_item; - + static CStdString empty_string; }; #endif diff --git a/guilib/GUIPanelContainer.cpp b/guilib/GUIPanelContainer.cpp index 3a2ce4b452..17b73b99d2 100644 --- a/guilib/GUIPanelContainer.cpp +++ b/guilib/GUIPanelContainer.cpp @@ -88,7 +88,7 @@ void CGUIPanelContainer::Render() if (m_orientation == VERTICAL) RenderItem(m_posX + col * m_layout->Size(HORIZONTAL), pos, item.get(), false); else - RenderItem(pos, m_posY + col * m_layout->Size(VERTICAL), item.get(), false); + RenderItem(pos, m_posY + col * m_layout->Size(VERTICAL), item.get(), false); } } // increment our position diff --git a/guilib/GUIRSSControl.cpp b/guilib/GUIRSSControl.cpp index f756ce214d..d222f94672 100644 --- a/guilib/GUIRSSControl.cpp +++ b/guilib/GUIRSSControl.cpp @@ -96,8 +96,8 @@ void CGUIRSSControl::Render() if (m_pReader == NULL) { if (g_rssManager.GetReader(GetID(), GetParentID(), this, m_pReader)) - m_scrollInfo.characterPos = m_pReader->m_SavedScrollPos; - else + m_scrollInfo.characterPos = m_pReader->m_SavedScrollPos; + else { if (m_strRSSTags != "") { diff --git a/guilib/GUITextLayout.cpp b/guilib/GUITextLayout.cpp index 191abdbfe1..0ae01e49d8 100644 --- a/guilib/GUITextLayout.cpp +++ b/guilib/GUITextLayout.cpp @@ -211,9 +211,9 @@ void CGUITextLayout::SetText(const CStdStringW &text, float maxWidth, bool force // remove any trailing blank lines while (!m_lines.empty() && m_lines.back().m_text.empty()) m_lines.pop_back(); - + BidiTransform(m_lines, forceLTRReadingOrder); - + // and cache the width and height for later reading CalcTextExtent(); } @@ -226,18 +226,18 @@ void CGUITextLayout::BidiTransform(vector<CGUIString> &lines, bool forceLTRReadi CGUIString &line = lines[i]; // reserve enough space in the flipped text - vecText flippedText; + vecText flippedText; flippedText.reserve(line.m_text.size()); character_t sectionStyle = 0xffff0000; // impossible to achieve CStdStringW sectionText; for (vecText::iterator it = line.m_text.begin(); it != line.m_text.end(); ++it) - { + { character_t style = *it & 0xffff0000; - if (style != sectionStyle) + if (style != sectionStyle) { if (!sectionText.IsEmpty()) - { // style has changed, bidi flip text + { // style has changed, bidi flip text CStdStringW sectionFlipped = BidiFlip(sectionText, forceLTRReadingOrder); for (unsigned int j = 0; j < sectionFlipped.size(); j++) flippedText.push_back(sectionStyle | sectionFlipped[j]); diff --git a/guilib/GUITextLayout.h b/guilib/GUITextLayout.h index 2633731637..9fa101d03d 100644 --- a/guilib/GUITextLayout.h +++ b/guilib/GUITextLayout.h @@ -96,7 +96,7 @@ protected: void BidiTransform(std::vector<CGUIString> &lines, bool forceLTRReadingOrder); CStdStringW BidiFlip(const CStdStringW &text, bool forceLTRReadingOrder); void CalcTextExtent(); - + // our text to render vecColors m_colors; std::vector<CGUIString> m_lines; diff --git a/guilib/GUITexture.cpp b/guilib/GUITexture.cpp index 500a872ee7..654ed820d2 100644 --- a/guilib/GUITexture.cpp +++ b/guilib/GUITexture.cpp @@ -196,14 +196,14 @@ void CGUITextureBase::Render() Render(m_vertex.x1, m_vertex.y1, m_vertex.x1 + m_info.border.x1, m_vertex.y1 + m_info.border.y1, 0, 0, u1, v1, u3, v3); Render(m_vertex.x1, m_vertex.y1 + m_info.border.y1, m_vertex.x1 + m_info.border.x1, m_vertex.y2 - m_info.border.y2, 0, v1, u1, v2, u3, v3); if (m_info.border.y2) - Render(m_vertex.x1, m_vertex.y2 - m_info.border.y2, m_vertex.x1 + m_info.border.x1, m_vertex.y2, 0, v2, u1, v3, u3, v3); + Render(m_vertex.x1, m_vertex.y2 - m_info.border.y2, m_vertex.x1 + m_info.border.x1, m_vertex.y2, 0, v2, u1, v3, u3, v3); } // middle segment (u1,0,u2,v3) if (m_info.border.y1) Render(m_vertex.x1 + m_info.border.x1, m_vertex.y1, m_vertex.x2 - m_info.border.x2, m_vertex.y1 + m_info.border.y1, u1, 0, u2, v1, u3, v3); Render(m_vertex.x1 + m_info.border.x1, m_vertex.y1 + m_info.border.y1, m_vertex.x2 - m_info.border.x2, m_vertex.y2 - m_info.border.y2, u1, v1, u2, v2, u3, v3); if (m_info.border.y2) - Render(m_vertex.x1 + m_info.border.x1, m_vertex.y2 - m_info.border.y2, m_vertex.x2 - m_info.border.x2, m_vertex.y2, u1, v2, u2, v3, u3, v3); + Render(m_vertex.x1 + m_info.border.x1, m_vertex.y2 - m_info.border.y2, m_vertex.x2 - m_info.border.x2, m_vertex.y2, u1, v2, u2, v3, u3, v3); // right segment if (m_info.border.x2) { // have a left border @@ -211,8 +211,8 @@ void CGUITextureBase::Render() Render(m_vertex.x2 - m_info.border.x2, m_vertex.y1, m_vertex.x2, m_vertex.y1 + m_info.border.y1, u2, 0, u3, v1, u3, v3); Render(m_vertex.x2 - m_info.border.x2, m_vertex.y1 + m_info.border.y1, m_vertex.x2, m_vertex.y2 - m_info.border.y2, u2, v1, u3, v2, u3, v3); if (m_info.border.y2) - Render(m_vertex.x2 - m_info.border.x2, m_vertex.y2 - m_info.border.y2, m_vertex.x2, m_vertex.y2, u2, v2, u3, v3, u3, v3); - } + Render(m_vertex.x2 - m_info.border.x2, m_vertex.y2 - m_info.border.y2, m_vertex.x2, m_vertex.y2, u2, v2, u3, v3, u3, v3); + } // close off our renderer End(); @@ -260,7 +260,7 @@ void CGUITextureBase::Render(float left, float top, float right, float bottom, f x[3] = ROUND_TO_PIXEL(g_graphicsContext.ScaleFinalXCoord(vertex.x1, vertex.y2)); y[3] = ROUND_TO_PIXEL(g_graphicsContext.ScaleFinalYCoord(vertex.x1, vertex.y2)); z[3] = ROUND_TO_PIXEL(g_graphicsContext.ScaleFinalZCoord(vertex.x1, vertex.y2)); - + if (y[2] == y[0]) y[2] += 1.0f; if (x[2] == x[0]) x[2] += 1.0f; if (y[3] == y[1]) y[3] += 1.0f; if (x[3] == x[1]) x[3] += 1.0f; @@ -303,7 +303,7 @@ void CGUITextureBase::AllocResources() if (g_largeTextureManager.GetImage(m_info.filename, texture, !IsAllocated())) { m_isAllocated = LARGE; - + if (!texture.size()) // not ready as yet return; diff --git a/guilib/GUITexture.h b/guilib/GUITexture.h index 1cd53362d3..bdb760ff04 100644 --- a/guilib/GUITexture.h +++ b/guilib/GUITexture.h @@ -1,6 +1,6 @@ /*! \file GUITexture.h -\brief +\brief */ #ifndef GUILIB_GUITEXTURE_H diff --git a/guilib/GUITextureD3D.h b/guilib/GUITextureD3D.h index b168f685eb..98eaee3d4d 100644 --- a/guilib/GUITextureD3D.h +++ b/guilib/GUITextureD3D.h @@ -1,6 +1,6 @@ /*! \file GUITextureD3D.h -\brief +\brief */ #ifndef GUILIB_GUITEXTURED3D_H diff --git a/guilib/GUITextureGL.cpp b/guilib/GUITextureGL.cpp index 8af30ff291..e26d54d468 100644 --- a/guilib/GUITextureGL.cpp +++ b/guilib/GUITextureGL.cpp @@ -41,11 +41,11 @@ void CGUITextureGL::Begin() glBindTexture(GL_TEXTURE_2D, texture->GetTextureObject()); glEnable(GL_TEXTURE_2D); - + glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); // Turn Blending On glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - + // diffuse coloring glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE); @@ -97,7 +97,7 @@ void CGUITextureGL::Draw(float *x, float *y, float *z, const CRect &texture, con if (m_diffuse.size()) glMultiTexCoord2fARB(GL_TEXTURE1_ARB, diffuse.x1, diffuse.y1); glVertex3f(x[0], y[0], z[0]); - + // Top-right vertex (corner) glColor4ub(r, g, b, a); if (orientation & 4) @@ -119,7 +119,7 @@ void CGUITextureGL::Draw(float *x, float *y, float *z, const CRect &texture, con if (m_diffuse.size()) glMultiTexCoord2fARB(GL_TEXTURE1_ARB, diffuse.x2, diffuse.y2); glVertex3f(x[2], y[2], z[2]); - + // Bottom-left vertex (corner) glColor4ub(r, g, b, a); if (orientation & 4) diff --git a/guilib/GUITextureGL.h b/guilib/GUITextureGL.h index bf349f05dd..c3d0baa336 100644 --- a/guilib/GUITextureGL.h +++ b/guilib/GUITextureGL.h @@ -1,6 +1,6 @@ /*! \file GUITextureGL.h -\brief +\brief */ #ifndef GUILIB_GUITEXTUREGL_H diff --git a/guilib/GUITextureGLES.cpp b/guilib/GUITextureGLES.cpp index 7f1458e22d..52fc0c86cd 100644 --- a/guilib/GUITextureGLES.cpp +++ b/guilib/GUITextureGLES.cpp @@ -48,7 +48,7 @@ void CGUITextureGLES::Draw(float *x, float *y, float *z, const CRect &texture, c void CGUITextureGLES::DrawQuad(const CRect &rect, DWORD color) { - // TODO: OpenGLES + // TODO: OpenGLES } #endif diff --git a/guilib/GUITextureGLES.h b/guilib/GUITextureGLES.h index cbfce6ee4c..2b2d046a97 100644 --- a/guilib/GUITextureGLES.h +++ b/guilib/GUITextureGLES.h @@ -1,6 +1,6 @@ /*! \file GUITextureGLES.h -\brief +\brief */ #ifndef GUILIB_GUITEXTUREGLES_H diff --git a/guilib/GUIWindow.cpp b/guilib/GUIWindow.cpp index fb6830178b..492aee999f 100644 --- a/guilib/GUIWindow.cpp +++ b/guilib/GUIWindow.cpp @@ -141,10 +141,10 @@ bool CGUIWindow::Load(TiXmlDocument &xmlDoc) // now load in the skin file SetDefaults(); - + CGUIControlFactory::GetMultipleString(pRootElement, "onload", m_loadActions); CGUIControlFactory::GetMultipleString(pRootElement, "onunload", m_unloadActions); - + TiXmlElement *pChild = pRootElement->FirstChildElement(); while (pChild) { @@ -490,7 +490,7 @@ void CGUIWindow::OnInitWindow() SetInitialVisibility(); QueueAnimation(ANIM_TYPE_WINDOW_OPEN); g_windowManager.ShowOverlay(m_overlayState); - + if (!m_manualRunActions) { RunLoadActions(); @@ -507,7 +507,7 @@ void CGUIWindow::OnDeinitWindow(int nextWindowID) { RunUnloadActions(); } - + if (nextWindowID != WINDOW_FULLSCREEN_VIDEO) { // Dialog animations are handled in Close() rather than here @@ -1000,10 +1000,10 @@ void CGUIWindow::SetRunActionsManually() void CGUIWindow::RunLoadActions() { - RunActions(m_loadActions); + RunActions(m_loadActions); } - + void CGUIWindow::RunUnloadActions() { - RunActions(m_unloadActions); + RunActions(m_unloadActions); } diff --git a/guilib/GUIWindow.h b/guilib/GUIWindow.h index 6f499eca87..512e844609 100644 --- a/guilib/GUIWindow.h +++ b/guilib/GUIWindow.h @@ -141,7 +141,7 @@ public: void SetRunActionsManually(); void RunLoadActions(); void RunUnloadActions(); - + bool HasProperty(const CStdString &strKey) const; void SetProperty(const CStdString &strKey, const char *strValue); void SetProperty(const CStdString &strKey, const CStdString &strValue); @@ -202,7 +202,7 @@ protected: //#endif void RunActions(std::vector<CGUIActionDescriptor>& actions); - + int m_idRange; bool m_bRelativeCoords; OVERLAY_STATE m_overlayState; @@ -242,7 +242,7 @@ protected: std::vector<CGUIActionDescriptor> m_loadActions; std::vector<CGUIActionDescriptor> m_unloadActions; - + bool m_manualRunActions; }; diff --git a/guilib/GraphicContext.cpp b/guilib/GraphicContext.cpp index bc63e0587f..be74eeb8b5 100644 --- a/guilib/GraphicContext.cpp +++ b/guilib/GraphicContext.cpp @@ -64,7 +64,7 @@ void CGraphicContext::SetOrigin(float x, float y) m_origins.push(CPoint(x,y) + m_origins.top()); else m_origins.push(CPoint(x,y)); - + AddTransform(TransformMatrix::CreateTranslation(x, y)); } @@ -81,19 +81,19 @@ bool CGraphicContext::SetClipRegion(float x, float y, float w, float h) CPoint origin; if (m_origins.size()) origin = m_origins.top(); - + // ok, now intersect with our old clip region CRect rect(x, y, x + w, y + h); rect += origin; if (m_clipRegions.size()) - { + { // intersect with original clip region rect.Intersect(m_clipRegions.top()); } - + if (rect.IsEmpty()) return false; - + m_clipRegions.push(rect); // here we could set the hardware clipping, if applicable @@ -268,7 +268,7 @@ void CGraphicContext::SetFullScreenVideo(bool bOnOff) else if(g_guiSettings.m_LookAndFeelResolution > RES_DESKTOP) g_graphicsContext.SetVideoResolution(g_guiSettings.m_LookAndFeelResolution); else - g_graphicsContext.SetVideoResolution(RES_DESKTOP); + g_graphicsContext.SetVideoResolution(RES_DESKTOP); } else g_graphicsContext.SetVideoResolution(RES_WINDOW); @@ -299,14 +299,14 @@ bool CGraphicContext::IsValidResolution(RESOLUTION res) { return true; } - + return false; } void CGraphicContext::SetVideoResolution(RESOLUTION res, bool forceUpdate) { RESOLUTION lastRes = m_Resolution; - + // If the user asked us to guess, go with desktop if (res == RES_AUTORES || !IsValidResolution(res)) { @@ -318,7 +318,7 @@ void CGraphicContext::SetVideoResolution(RESOLUTION res, bool forceUpdate) { return; } - + if (res >= RES_DESKTOP) { g_advancedSettings.m_fullScreen = true; @@ -331,12 +331,12 @@ void CGraphicContext::SetVideoResolution(RESOLUTION res, bool forceUpdate) } Lock(); - + m_iScreenWidth = g_settings.m_ResInfo[res].iWidth; m_iScreenHeight = g_settings.m_ResInfo[res].iHeight; m_iScreenId = g_settings.m_ResInfo[res].iScreen; m_Resolution = res; - + if (g_advancedSettings.m_fullScreen) { #if defined (__APPLE__) || defined (_WIN32) @@ -766,7 +766,7 @@ void CGraphicContext::ClipToViewWindow() void CGraphicContext::GetAllowedResolutions(vector<RESOLUTION> &res) { - res.clear(); + res.clear(); res.push_back(RES_WINDOW); res.push_back(RES_DESKTOP); diff --git a/guilib/Shader.cpp b/guilib/Shader.cpp index 5eb35a653c..89c5ddd706 100644 --- a/guilib/Shader.cpp +++ b/guilib/Shader.cpp @@ -64,13 +64,13 @@ bool CGLSLVertexShader::Compile() Free(); -#ifdef HAS_GL +#ifdef HAS_GL if(!GLEW_VERSION_2_0) { CLog::Log(LOGERROR, "GL: GLSL vertex shaders not supported"); return false; } -#endif +#endif m_vertexShader = glCreateShader(GL_VERTEX_SHADER); const char *ptr = m_source.c_str(); @@ -101,10 +101,10 @@ bool CGLSLVertexShader::Compile() void CGLSLVertexShader::Free() { -#ifdef HAS_GL +#ifdef HAS_GL if(!GLEW_VERSION_2_0) return; -#endif +#endif if (m_vertexShader) glDeleteShader(m_vertexShader); @@ -163,14 +163,14 @@ void CARBVertexShader::Free() ////////////////////////////////////////////////////////////////////// bool CGLSLPixelShader::Compile() { -#ifdef HAS_GL +#ifdef HAS_GL if(!GLEW_VERSION_2_0) { CLog::Log(LOGERROR, "GL: GLSL pixel shaders not supported"); return false; } #endif - + GLint params[4]; Free(); @@ -210,7 +210,7 @@ bool CGLSLPixelShader::Compile() void CGLSLPixelShader::Free() { -#ifdef HAS_GL +#ifdef HAS_GL if(!GLEW_VERSION_2_0) return; #endif @@ -272,7 +272,7 @@ void CARBPixelShader::Free() ////////////////////////////////////////////////////////////////////// void CGLSLShaderProgram::Free() { -#ifdef HAS_GL +#ifdef HAS_GL if(!GLEW_VERSION_2_0) return; #endif @@ -291,7 +291,7 @@ void CGLSLShaderProgram::Free() bool CGLSLShaderProgram::CompileAndLink() { -#ifdef HAS_GL +#ifdef HAS_GL // check that we support shaders if(!GLEW_VERSION_2_0) { @@ -299,7 +299,7 @@ bool CGLSLShaderProgram::CompileAndLink() return false; } #endif - + GLint params[4]; // free resources @@ -378,11 +378,11 @@ bool CGLSLShaderProgram::CompileAndLink() bool CGLSLShaderProgram::Enable() { -#ifdef HAS_GL +#ifdef HAS_GL if(!GLEW_VERSION_2_0) return false; #endif - + if (OK()) { glUseProgram(m_shaderProgram); @@ -403,11 +403,11 @@ bool CGLSLShaderProgram::Enable() void CGLSLShaderProgram::Disable() { -#ifdef HAS_GL +#ifdef HAS_GL if(!GLEW_VERSION_2_0) return; #endif - + if (OK()) { glUseProgram(0); diff --git a/guilib/Shader.h b/guilib/Shader.h index d12e971cdb..a415dde579 100644 --- a/guilib/Shader.h +++ b/guilib/Shader.h @@ -185,7 +185,7 @@ namespace Shaders { }; - class CGLSLShaderProgram + class CGLSLShaderProgram : virtual public CShaderProgram { public: @@ -221,7 +221,7 @@ namespace Shaders { #ifndef HAS_GLES - class CARBShaderProgram + class CARBShaderProgram : virtual public CShaderProgram { public: diff --git a/guilib/Texture.cpp b/guilib/Texture.cpp index f686d21f79..9b3f8ca131 100644 --- a/guilib/Texture.cpp +++ b/guilib/Texture.cpp @@ -79,7 +79,7 @@ void CBaseTexture::Allocate(unsigned int width, unsigned int height, unsigned in m_pixels = new unsigned char[GetPitch() * GetRows()]; } -void CBaseTexture::Update(unsigned int width, unsigned int height, unsigned int pitch, unsigned int format, const unsigned char *pixels, bool loadToGPU) +void CBaseTexture::Update(unsigned int width, unsigned int height, unsigned int pitch, unsigned int format, const unsigned char *pixels, bool loadToGPU) { if (pixels == NULL) return; @@ -233,7 +233,7 @@ bool CBaseTexture::LoadPaletted(unsigned int width, unsigned int height, unsigne return true; } -unsigned int CBaseTexture::PadPow2(unsigned int x) +unsigned int CBaseTexture::PadPow2(unsigned int x) { --x; x |= x >> 1; diff --git a/guilib/Texture.h b/guilib/Texture.h index 128a697d78..1e659c4931 100644 --- a/guilib/Texture.h +++ b/guilib/Texture.h @@ -21,7 +21,7 @@ /*! \file Texture.h -\brief +\brief */ #ifndef GUILIB_TEXTURE_H diff --git a/guilib/TextureBundle.cpp b/guilib/TextureBundle.cpp index e8f2694a66..006660fea4 100644 --- a/guilib/TextureBundle.cpp +++ b/guilib/TextureBundle.cpp @@ -42,12 +42,12 @@ bool CTextureBundle::HasFile(const CStdString& Filename) { return m_tbXPR.HasFile(Filename); } - else if (m_tbXBT.HasFile(Filename)) + else if (m_tbXBT.HasFile(Filename)) { m_useXBT = true; return true; - } - else if (m_tbXPR.HasFile(Filename)) + } + else if (m_tbXPR.HasFile(Filename)) { m_useXPR = true; return true; @@ -67,7 +67,7 @@ void CTextureBundle::GetTexturesFromPath(const CStdString &path, std::vector<CSt else if (m_useXPR) { m_tbXPR.GetTexturesFromPath(path, textures); - } + } } bool CTextureBundle::LoadTexture(const CStdString& Filename, CBaseTexture** ppTexture, @@ -84,7 +84,7 @@ bool CTextureBundle::LoadTexture(const CStdString& Filename, CBaseTexture** ppTe else { return false; - } + } } int CTextureBundle::LoadAnim(const CStdString& Filename, CBaseTexture*** ppTextures, @@ -101,7 +101,7 @@ int CTextureBundle::LoadAnim(const CStdString& Filename, CBaseTexture*** ppTextu else { return 0; - } + } } void CTextureBundle::Cleanup() @@ -117,7 +117,7 @@ void CTextureBundle::Cleanup() m_useXPR = m_useXBT = false; } - + void CTextureBundle::SetThemeBundle(bool themeBundle) { m_tbXPR.SetThemeBundle(themeBundle); diff --git a/guilib/TextureBundle.h b/guilib/TextureBundle.h index d9584dd5f8..9867a5688f 100644 --- a/guilib/TextureBundle.h +++ b/guilib/TextureBundle.h @@ -41,11 +41,11 @@ public: bool LoadTexture(const CStdString& Filename, CBaseTexture** ppTexture, int &width, int &height); int LoadAnim(const CStdString& Filename, CBaseTexture*** ppTextures, int &width, int &height, int& nLoops, int** ppDelays); - + private: CTextureBundleXPR m_tbXPR; CTextureBundleXBT m_tbXBT; - + bool m_useXPR; bool m_useXBT; }; diff --git a/guilib/TextureBundleXBT.cpp b/guilib/TextureBundleXBT.cpp index beac56a831..76009d12da 100644 --- a/guilib/TextureBundleXBT.cpp +++ b/guilib/TextureBundleXBT.cpp @@ -45,7 +45,7 @@ CTextureBundleXBT::CTextureBundleXBT(void) { - m_themeBundle = false; + m_themeBundle = false; } CTextureBundleXBT::~CTextureBundleXBT(void) @@ -81,25 +81,25 @@ bool CTextureBundleXBT::OpenBundle() } strPath = PTH_IC(strPath); - + // Load the texture file if (!m_XBTFReader.Open(strPath)) { return false; } - + m_TimeStamp = m_XBTFReader.GetLastModificationTimestamp(); - + if (lzo_init() != LZO_E_OK) { return false; } - + return true; } bool CTextureBundleXBT::HasFile(const CStdString& Filename) -{ +{ if (!m_XBTFReader.IsOpen() && !OpenBundle()) return false; @@ -125,7 +125,7 @@ void CTextureBundleXBT::GetTexturesFromPath(const CStdString &path, std::vector< CStdString testPath = Normalize(path); CUtil::AddSlashAtEnd(testPath); int testLength = testPath.GetLength(); - + std::vector<CXBTFFile>& files = m_XBTFReader.GetFiles(); for (size_t i = 0; i < files.size(); i++) { @@ -143,19 +143,19 @@ bool CTextureBundleXBT::LoadTexture(const CStdString& Filename, CBaseTexture** p CXBTFFile* file = m_XBTFReader.Find(name); if (!file) return false; - + if (file->GetFrames().size() == 0) return false; - + CXBTFFrame& frame = file->GetFrames().at(0); if (!ConvertFrameToTexture(Filename, frame, ppTexture)) { return false; } - + width = frame.GetWidth(); height = frame.GetHeight(); - + return true; } @@ -167,30 +167,30 @@ int CTextureBundleXBT::LoadAnim(const CStdString& Filename, CBaseTexture*** ppTe CXBTFFile* file = m_XBTFReader.Find(name); if (!file) return false; - + if (file->GetFrames().size() == 0) return false; - + size_t nTextures = file->GetFrames().size(); *ppTextures = new CBaseTexture*[nTextures]; *ppDelays = new int[nTextures]; - + for (size_t i = 0; i < nTextures; i++) { CXBTFFrame& frame = file->GetFrames().at(i); - + if (!ConvertFrameToTexture(Filename, frame, &((*ppTextures)[i]))) { return false; } - + (*ppDelays)[i] = frame.GetDuration(); } - + width = file->GetFrames().at(0).GetWidth(); - height = file->GetFrames().at(0).GetHeight(); + height = file->GetFrames().at(0).GetHeight(); nLoops = file->GetLoop(); - + return nTextures; } @@ -271,16 +271,16 @@ void CTextureBundleXBT::Cleanup() if (m_XBTFReader.IsOpen()) { m_XBTFReader.Close(); - } + } } - + void CTextureBundleXBT::SetThemeBundle(bool themeBundle) { m_themeBundle = themeBundle; } // normalize to how it's stored within the bundle -// lower case + using forward slash rather than back slash +// lower case + using forward slash rather than back slash CStdString CTextureBundleXBT::Normalize(const CStdString &name) { CStdString newName(name); diff --git a/guilib/TextureBundleXBT.h b/guilib/TextureBundleXBT.h index a9b033c2d4..a2e44f5489 100644 --- a/guilib/TextureBundleXBT.h +++ b/guilib/TextureBundleXBT.h @@ -44,10 +44,10 @@ public: int LoadAnim(const CStdString& Filename, CBaseTexture*** ppTextures, int &width, int &height, int& nLoops, int** ppDelays); - -private: + +private: bool OpenBundle(); - bool ConvertFrameToTexture(const CStdString& name, CXBTFFrame& frame, CBaseTexture** ppTexture); + bool ConvertFrameToTexture(const CStdString& name, CXBTFFrame& frame, CBaseTexture** ppTexture); time_t m_TimeStamp; diff --git a/guilib/TextureBundleXPR.cpp b/guilib/TextureBundleXPR.cpp index 69d7462b7c..25764151dd 100644 --- a/guilib/TextureBundleXPR.cpp +++ b/guilib/TextureBundleXPR.cpp @@ -257,7 +257,7 @@ bool CTextureBundleXPR::LoadFile(const CStdString& Filename, CAutoTexBuffer& Unp // found texture - allocate the necessary buffers DWORD ReadSize = (file->second.PackedSize + (ALIGN - 1)) & ~(ALIGN - 1); BYTE *buffer = (BYTE*)malloc(ReadSize); - + if (!buffer || !UnpackedBuf.Set((BYTE*)XPhysicalAlloc(file->second.UnpackedSize, MAXULONG_PTR, 128, PAGE_READWRITE))) { // failed due to lack of memory #ifndef _LINUX diff --git a/guilib/TextureDX.h b/guilib/TextureDX.h index ce15d5bcb7..6dabeaac35 100644 --- a/guilib/TextureDX.h +++ b/guilib/TextureDX.h @@ -21,7 +21,7 @@ /*! \file TextureDX.h -\brief +\brief */ #ifndef GUILIB_TEXTUREDX_H diff --git a/guilib/TextureGL.cpp b/guilib/TextureGL.cpp index 8075e36a7d..3ce4299868 100644 --- a/guilib/TextureGL.cpp +++ b/guilib/TextureGL.cpp @@ -95,17 +95,17 @@ void CGLTexture::LoadToGPU() switch (m_format) { - case XB_FMT_DXT1: + case XB_FMT_DXT1: format = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; - break; - case XB_FMT_DXT3: + break; + case XB_FMT_DXT3: format = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; - break; - case XB_FMT_DXT5: + break; + case XB_FMT_DXT5: case XB_FMT_DXT5_YCoCg: format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; - break; - case XB_FMT_A8R8G8B8: + break; + case XB_FMT_A8R8G8B8: default: #ifdef HAS_GL format = GL_BGRA; @@ -123,7 +123,7 @@ void CGLTexture::LoadToGPU() else { // changed from glCompressedTexImage2D to support GL < 1.3 - glCompressedTexImage2DARB(GL_TEXTURE_2D, 0, format, + glCompressedTexImage2DARB(GL_TEXTURE_2D, 0, format, m_textureWidth, m_textureHeight, 0, GetPitch() * GetRows(), m_pixels); } diff --git a/guilib/TextureGL.h b/guilib/TextureGL.h index 4197601563..e208c725f3 100644 --- a/guilib/TextureGL.h +++ b/guilib/TextureGL.h @@ -21,7 +21,7 @@ /*! \file TextureManager.h -\brief +\brief */ #ifndef GUILIB_TEXTUREGL_H diff --git a/guilib/TextureManager.cpp b/guilib/TextureManager.cpp index d41ec38d8c..3038980ef5 100644 --- a/guilib/TextureManager.cpp +++ b/guilib/TextureManager.cpp @@ -145,9 +145,9 @@ CTextureMap::~CTextureMap() bool CTextureMap::Release() { - if (!m_texture.m_textures.size()) + if (!m_texture.m_textures.size()) return true; - if (!m_referenceCount) + if (!m_referenceCount) return true; m_referenceCount--; @@ -206,7 +206,7 @@ void CTextureMap::Add(CBaseTexture* texture, int delay) m_texture.Add(texture, delay); if (texture) - m_memUsage += sizeof(CTexture) + (texture->GetTextureWidth() * texture->GetTextureHeight() * 4); + m_memUsage += sizeof(CTexture) + (texture->GetTextureWidth() * texture->GetTextureHeight() * 4); } /************************************************************************/ @@ -392,7 +392,7 @@ int CGUITextureManager::Load(const CStdString& strTextureName, bool checkBundleO int width = 0, height = 0; if (bundle >= 0) { - if (FAILED(m_TexBundle[bundle].LoadTexture(strTextureName, &pTexture, width, height))) + if (FAILED(m_TexBundle[bundle].LoadTexture(strTextureName, &pTexture, width, height))) { CLog::Log(LOGERROR, "Texture manager unable to load bundled file: %s", strTextureName.c_str()); return 0; @@ -413,7 +413,7 @@ int CGUITextureManager::Load(const CStdString& strTextureName, bool checkBundleO } if (!pTexture) return 0; - + CTextureMap* pMap = new CTextureMap(strTextureName, width, height, 0); pMap->Add(pTexture, 100); m_vecTextures.push_back(pMap); diff --git a/guilib/XBTF.cpp b/guilib/XBTF.cpp index 839cfe4e0e..82c17f19dc 100644 --- a/guilib/XBTF.cpp +++ b/guilib/XBTF.cpp @@ -161,7 +161,7 @@ std::vector<CXBTFFrame>& CXBTFFile::GetFrames() uint64_t CXBTFFile::GetHeaderSize() const { - uint64_t result = + uint64_t result = sizeof(m_path) + sizeof(m_loop) + sizeof(uint32_t); /* Number of frames */ diff --git a/guilib/XBTFReader.cpp b/guilib/XBTFReader.cpp index 7ec435de85..523f053039 100644 --- a/guilib/XBTFReader.cpp +++ b/guilib/XBTFReader.cpp @@ -45,35 +45,35 @@ bool CXBTFReader::IsOpen() const bool CXBTFReader::Open(const CStdString& fileName) { m_fileName = fileName; - + #ifdef _WIN32 CStdStringW strPathW; g_charsetConverter.utf8ToW(_P(m_fileName), strPathW, false); m_file = _wfopen(strPathW.c_str(), L"rb"); #else m_file = fopen(m_fileName.c_str(), "rb"); -#endif +#endif if (m_file == NULL) { return false; } - + char magic[4]; READ_STR(magic, 4, m_file); - + if (strncmp(magic, XBTF_MAGIC, sizeof(magic)) != 0) { return false; } - + char version[1]; READ_STR(version, 1, m_file); - + if (strncmp(version, XBTF_VERSION, sizeof(version)) != 0) { return false; } - + unsigned int nofFiles; READ_U32(nofFiles, m_file); for (unsigned int i = 0; i < nofFiles; i++) @@ -81,18 +81,18 @@ bool CXBTFReader::Open(const CStdString& fileName) CXBTFFile file; unsigned int u32; uint64_t u64; - + READ_STR(file.GetPath(), 256, m_file); READ_U32(u32, m_file); file.SetLoop(u32); - + unsigned int nofFrames; READ_U32(nofFrames, m_file); - + for (unsigned int j = 0; j < nofFrames; j++) { CXBTFFrame frame; - + READ_U32(u32, m_file); frame.SetWidth(u32); READ_U32(u32, m_file); @@ -107,23 +107,23 @@ bool CXBTFReader::Open(const CStdString& fileName) frame.SetDuration(u32); READ_U64(u64, m_file); frame.SetOffset(u64); - + file.GetFrames().push_back(frame); } - + m_xbtf.GetFiles().push_back(file); - + m_filesMap[file.GetPath()] = file; - } - + } + // Sanity check int64_t pos = ftell(m_file); if (pos != (int64_t)m_xbtf.GetHeaderSize()) { printf("Expected header size (%"PRId64") != actual size (%"PRId64")\n", m_xbtf.GetHeaderSize(), pos); return false; - } - + } + return true; } @@ -134,7 +134,7 @@ void CXBTFReader::Close() fclose(m_file); m_file = NULL; } - + m_xbtf.GetFiles().clear(); m_filesMap.clear(); } @@ -145,13 +145,13 @@ time_t CXBTFReader::GetLastModificationTimestamp() { return 0; } - + struct stat fileStat; if (fstat(fileno(m_file), &fileStat) == -1) { return 0; } - + return fileStat.st_mtime; } @@ -167,7 +167,7 @@ CXBTFFile* CXBTFReader::Find(const CStdString& name) { return NULL; } - + return &(iter->second); } @@ -185,12 +185,12 @@ bool CXBTFReader::Load(const CXBTFFrame& frame, unsigned char* buffer) { return false; } - + if (fread(buffer, 1, (size_t)frame.GetPackedSize(), m_file) != frame.GetPackedSize()) { return false; } - + return true; } diff --git a/guilib/XBTFReader.h b/guilib/XBTFReader.h index 27264d3333..3233efc2b7 100644 --- a/guilib/XBTFReader.h +++ b/guilib/XBTFReader.h @@ -39,7 +39,7 @@ public: CXBTFFile* Find(const CStdString& name); bool Load(const CXBTFFrame& frame, unsigned char* buffer); std::vector<CXBTFFile>& GetFiles(); - + private: CXBTF m_xbtf; CStdString m_fileName; diff --git a/xbmc/AdvancedSettings.cpp b/xbmc/AdvancedSettings.cpp index b68c55283e..be9318a128 100644 --- a/xbmc/AdvancedSettings.cpp +++ b/xbmc/AdvancedSettings.cpp @@ -83,7 +83,7 @@ void CAdvancedSettings::Initialize() m_videoDefaultPlayer = "dvdplayer"; m_videoDefaultDVDPlayer = "dvdplayer"; m_videoIgnoreAtStart = 15; - m_videoIgnoreAtEnd = 5; + m_videoIgnoreAtEnd = 5; m_videoPlayCountMinimumPercent = 90.0f; m_videoHighQualityScaling = SOFTWARE_UPSCALING_DISABLED; m_videoHighQualityScalingMethod = VS_SCALINGMETHOD_BICUBIC_SOFTWARE; @@ -303,7 +303,7 @@ bool CAdvancedSettings::Load() XMLUtils::GetInt(pElement, "headroom", m_audioHeadRoom, 0, 12); XMLUtils::GetString(pElement, "defaultplayer", m_audioDefaultPlayer); XMLUtils::GetFloat(pElement, "playcountminimumpercent", m_audioPlayCountMinimumPercent, 0.0f, 100.0f); - + XMLUtils::GetBoolean(pElement, "usetimeseeking", m_musicUseTimeSeeking); XMLUtils::GetInt(pElement, "timeseekforward", m_musicTimeSeekForward, 0, 6000); XMLUtils::GetInt(pElement, "timeseekbackward", m_musicTimeSeekBackward, -6000, 0); @@ -427,7 +427,7 @@ bool CAdvancedSettings::Load() XMLUtils::GetBoolean(pElement, "cleanonupdate", m_bVideoLibraryCleanOnUpdate); XMLUtils::GetString(pElement, "itemseparator", m_videoItemSeparator); XMLUtils::GetBoolean(pElement, "exportautothumbs", m_bVideoLibraryExportAutoThumbs); - + TiXmlElement* pMyMovies = pElement->FirstChildElement("mymovies"); if (pMyMovies) XMLUtils::GetBoolean(pMyMovies, "categoriestogenres", m_bVideoLibraryMyMoviesCategoriesToGenres); @@ -536,7 +536,7 @@ bool CAdvancedSettings::Load() XMLUtils::GetInt(pElement, "defaultrootmenu", m_iTuxBoxDefaultRootMenu, 0, 4); XMLUtils::GetInt(pElement, "zapwaittime", m_iTuxBoxZapWaitTime, 0, 120); } - + // Myth TV pElement = pRootElement->FirstChildElement("myth"); if (pElement) @@ -549,7 +549,7 @@ bool CAdvancedSettings::Load() if (pElement) { XMLUtils::GetBoolean(pElement, "mergeshortcommbreaks", m_bEdlMergeShortCommBreaks); - XMLUtils::GetInt(pElement, "maxcommbreaklength", m_iEdlMaxCommBreakLength, 0, 10 * 60); // Between 0 and 10 minutes + XMLUtils::GetInt(pElement, "maxcommbreaklength", m_iEdlMaxCommBreakLength, 0, 10 * 60); // Between 0 and 10 minutes XMLUtils::GetInt(pElement, "mincommbreaklength", m_iEdlMinCommBreakLength, 0, 5 * 60); // Between 0 and 5 minutes XMLUtils::GetInt(pElement, "maxcommbreakgap", m_iEdlMaxCommBreakGap, 0, 5 * 60); // Between 0 and 5 minutes. XMLUtils::GetInt(pElement, "maxstartgap", m_iEdlMaxStartGap, 0, 10 * 60); // Between 0 and 10 minutes diff --git a/xbmc/Album.cpp b/xbmc/Album.cpp index 63d26795f8..fe2b54cf13 100644 --- a/xbmc/Album.cpp +++ b/xbmc/Album.cpp @@ -76,10 +76,10 @@ bool CAlbum::Load(const TiXmlElement *album, bool chained) CStdString strDur; XMLUtils::GetString(node,"duration",strDur); song.iDuration = StringUtils::TimeStringToSeconds(strDur); - + if (bIncrement) song.iTrack = song.iTrack + 1; - + songs.push_back(song); } node = node->NextSiblingElement("track"); @@ -128,7 +128,7 @@ bool CAlbum::Save(TiXmlNode *node, const CStdString &tag, const CStdString& strP if (!thumbURL.m_xml.empty()) { TiXmlDocument doc; - doc.Parse(thumbURL.m_xml); + doc.Parse(thumbURL.m_xml); const TiXmlNode* thumb = doc.FirstChild("thumb"); while (thumb) { diff --git a/xbmc/Application.h b/xbmc/Application.h index 2d212a4f7a..cd0e6dbc2d 100644 --- a/xbmc/Application.h +++ b/xbmc/Application.h @@ -194,7 +194,7 @@ public: bool ExecuteAction(CGUIActionDescriptor action); static bool OnEvent(XBMC_Event& newEvent); - + CApplicationMessenger& getApplicationMessenger(); #if defined(HAS_LINUX_NETWORK) @@ -214,10 +214,10 @@ public: CGUIDialogMuteBug m_guiDialogMuteBug; CGUIWindowPointer m_guiPointer; -#ifdef HAS_DVD_DRIVE +#ifdef HAS_DVD_DRIVE MEDIA_DETECT::CAutorun m_Autorun; #endif - + #if !defined(_WIN32) && defined(HAS_DVD_DRIVE) MEDIA_DETECT::CDetectDVDMedia m_DetectDVDType; #endif diff --git a/xbmc/ApplicationMessenger.cpp b/xbmc/ApplicationMessenger.cpp index 91ccded107..269ec6eec3 100644 --- a/xbmc/ApplicationMessenger.cpp +++ b/xbmc/ApplicationMessenger.cpp @@ -405,7 +405,7 @@ case TMSG_POWERDOWN: g_graphicsContext.ToggleFullScreenRoot(); g_graphicsContext.Unlock(); break; - + case TMSG_MINIMIZE: g_application.Minimize(); break; @@ -518,7 +518,7 @@ case TMSG_POWERDOWN: pDialog->Show_Internal(); } break; - + case TMSG_GUI_DIALOG_CLOSE: { CGUIDialog *dialog = (CGUIDialog *)pMsg->lpVoid; @@ -568,7 +568,7 @@ case TMSG_POWERDOWN: share.m_iDriveType = CMediaSource::SOURCE_TYPE_DVD; g_mediaManager.AddAutoSource(share, pMsg->dwParam1 != 0); } - break; + break; case TMSG_OPTICAL_UNMOUNT: { @@ -577,7 +577,7 @@ case TMSG_POWERDOWN: share.strName = share.strPath; g_mediaManager.RemoveAutoSource(share); } - break; + break; #endif } } @@ -854,17 +854,17 @@ void CApplicationMessenger::Render() SendMessage(tMsg, true); } -void CApplicationMessenger::OpticalMount(CStdString device, bool bautorun) -{ +void CApplicationMessenger::OpticalMount(CStdString device, bool bautorun) +{ ThreadMessage tMsg = {TMSG_OPTICAL_MOUNT}; tMsg.strParam = device; tMsg.dwParam1 = (DWORD)bautorun; SendMessage(tMsg, false); -} - -void CApplicationMessenger::OpticalUnMount(CStdString device) -{ +} + +void CApplicationMessenger::OpticalUnMount(CStdString device) +{ ThreadMessage tMsg = {TMSG_OPTICAL_UNMOUNT}; tMsg.strParam = device; SendMessage(tMsg, false); -} +} diff --git a/xbmc/ApplicationMessenger.h b/xbmc/ApplicationMessenger.h index c0d388fbe2..8aa9bfc262 100644 --- a/xbmc/ApplicationMessenger.h +++ b/xbmc/ApplicationMessenger.h @@ -74,8 +74,8 @@ class CGUIDialog; #define TMSG_GUI_PYTHON_DIALOG 605 #define TMSG_GUI_DIALOG_CLOSE 606 -#define TMSG_OPTICAL_MOUNT 700 -#define TMSG_OPTICAL_UNMOUNT 701 +#define TMSG_OPTICAL_MOUNT 700 +#define TMSG_OPTICAL_UNMOUNT 701 typedef struct { @@ -126,7 +126,7 @@ public: void Reset(); void SwitchToFullscreen(); // void Minimize(bool wait = false); - void ExecOS(const CStdString command, bool waitExit = false); + void ExecOS(const CStdString command, bool waitExit = false); void UserEvent(int code); CStdString GetResponse(); @@ -143,7 +143,7 @@ public: void Render(); // will call g_windowManager.Render on the rendering thread void ActivateWindow(int windowID, const std::vector<CStdString> ¶ms, bool swappingWindows); - void OpticalMount(CStdString device, bool bautorun=false); + void OpticalMount(CStdString device, bool bautorun=false); void OpticalUnMount(CStdString device); private: diff --git a/xbmc/Artist.cpp b/xbmc/Artist.cpp index 8581eac76d..189e42d64f 100644 --- a/xbmc/Artist.cpp +++ b/xbmc/Artist.cpp @@ -66,7 +66,7 @@ bool CArtist::Load(const TiXmlElement *artist, bool chained) } node = node->NextSiblingElement("album"); } - + // fanart const TiXmlElement *fanart2 = artist->FirstChildElement("fanart"); if (fanart2) @@ -114,7 +114,7 @@ bool CArtist::Save(TiXmlNode *node, const CStdString &tag, const CStdString& str if (!thumbURL.m_xml.empty()) { TiXmlDocument doc; - doc.Parse(thumbURL.m_xml); + doc.Parse(thumbURL.m_xml); const TiXmlNode* thumb = doc.FirstChild("thumb"); while (thumb) { diff --git a/xbmc/Autorun.cpp b/xbmc/Autorun.cpp index 4eb6c800a7..cd2b529fb6 100644 --- a/xbmc/Autorun.cpp +++ b/xbmc/Autorun.cpp @@ -197,7 +197,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded bPlaying = true; return true; } - + // Video CDs can have multiple file formats. First we need to determine which one is used on the CD CStdString strExt; if (pItem->m_strPath.Find("MPEGAV") != -1) diff --git a/xbmc/CueDocument.cpp b/xbmc/CueDocument.cpp index f285d5edbd..da450cde8a 100644 --- a/xbmc/CueDocument.cpp +++ b/xbmc/CueDocument.cpp @@ -357,7 +357,7 @@ bool CCueDocument::ResolvePath(CStdString &strPath, const CStdString &strBase) { CStdString strDirectory; CUtil::GetDirectory(strBase, strDirectory); - + CStdString strFilename = strPath; CUtil::GetFileName(strFilename); diff --git a/xbmc/DPMSSupport.h b/xbmc/DPMSSupport.h index 6135cd51b4..767fef6a60 100644 --- a/xbmc/DPMSSupport.h +++ b/xbmc/DPMSSupport.h @@ -85,5 +85,5 @@ private: // false on failure and log a (platform-specific) ERROR message. bool PlatformSpecificDisablePowerSaving(); }; - + #endif // DPMSSUPPORT_H diff --git a/xbmc/Database.cpp b/xbmc/Database.cpp index ed9a9edd9c..0e5795dc67 100644 --- a/xbmc/Database.cpp +++ b/xbmc/Database.cpp @@ -112,7 +112,7 @@ bool CDatabase::Open() CLog::Log(LOGERROR, "Unable to open %s (old version?)", strDatabase.c_str()); return false; } - + // test if db already exists, if not we need to create the tables if (!m_pDB->exists()) { diff --git a/xbmc/DetectDVDType.cpp b/xbmc/DetectDVDType.cpp index 935f0bb3fc..087d0f5447 100644 --- a/xbmc/DetectDVDType.cpp +++ b/xbmc/DetectDVDType.cpp @@ -471,7 +471,7 @@ DWORD CDetectDVDMedia::GetTrayState() m_dwTrayState = TRAY_CLOSED_NO_MEDIA; break; case 1: // tray open - m_dwTrayState = TRAY_OPEN; + m_dwTrayState = TRAY_OPEN; break; case 2: // media accessible m_dwTrayState = TRAY_CLOSED_MEDIA_PRESENT; diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp index 7cb10fcb36..252e830c5b 100644 --- a/xbmc/FileItem.cpp +++ b/xbmc/FileItem.cpp @@ -546,7 +546,7 @@ bool CFileItem::IsKaraoke() const { if ( !IsAudio() || IsLastFM() || IsShoutCast()) return false; - + return CKaraokeLyricsFactory::HasLyrics( m_strPath ); } @@ -2072,7 +2072,7 @@ void CFileItemList::Stack() // set property item1->SetProperty("isstacked", "1"); - + // skip folders, nfo files, playlists if (item1->m_bIsFolder || item1->IsParentFolder() @@ -2104,7 +2104,7 @@ void CFileItemList::Stack() VECCREGEXP::iterator expr = stackRegExps.begin(); CUtil::Split(item1->m_strPath, filePath, file1); - int j; + int j; while (expr != stackRegExps.end()) { if (expr->RegFind(file1, offset) != -1) diff --git a/xbmc/FileSystem/CMythDirectory.cpp b/xbmc/FileSystem/CMythDirectory.cpp index f04dd1ca52..468c3bf8d3 100644 --- a/xbmc/FileSystem/CMythDirectory.cpp +++ b/xbmc/FileSystem/CMythDirectory.cpp @@ -339,7 +339,7 @@ bool CCMythDirectory::GetRecordings(const CStdString& base, CFileItemList &items /* * Set the label as preformated for MOVIES so any scraper lookup will use * the label rather than the filename. Don't set as preformated for other - * filter types as this prevents the display of the title changing + * filter types as this prevents the display of the title changing * depending on what the list is being sorted by. */ if (type == MOVIES) diff --git a/xbmc/FileSystem/DAVDirectory.cpp b/xbmc/FileSystem/DAVDirectory.cpp index 374ad6a398..1f15da8545 100644 --- a/xbmc/FileSystem/DAVDirectory.cpp +++ b/xbmc/FileSystem/DAVDirectory.cpp @@ -40,7 +40,7 @@ CDAVDirectory::~CDAVDirectory(void) {} * Return true if pElement value is equal value without namespace. * * if pElement is <DAV:foo> and value is foo then ValueWithoutNamespace is true - */ + */ bool CDAVDirectory::ValueWithoutNamespace(const TiXmlNode *pNode, CStdString value) { CStdStringArray result; @@ -57,7 +57,7 @@ bool CDAVDirectory::ValueWithoutNamespace(const TiXmlNode *pNode, CStdString val { return false; } - + StringUtils::SplitString(pElement->Value(), ":", result, 2); if (result.size() == 1 && result[0] == value) @@ -72,7 +72,7 @@ bool CDAVDirectory::ValueWithoutNamespace(const TiXmlNode *pNode, CStdString val { CLog::Log(LOGERROR, "%s - Splitting %s failed, size(): %lu, value: %s", __FUNCTION__, pElement->Value(), result.size(), value.c_str()); } - + return false; } @@ -83,7 +83,7 @@ CStdString CDAVDirectory::GetStatusTag(const TiXmlElement *pElement) { const TiXmlElement *pChild; - for (pChild = pElement->FirstChild()->ToElement(); pChild != 0; pChild = pChild->NextSibling()->ToElement()) + for (pChild = pElement->FirstChild()->ToElement(); pChild != 0; pChild = pChild->NextSibling()->ToElement()) { if (ValueWithoutNamespace(pChild, "status")) { @@ -108,7 +108,7 @@ bool CDAVDirectory::ParseResponse(const TiXmlElement *pElement, CFileItem &item) const TiXmlNode *pPropChild; /* Iterate response children elements */ - for (pResponseChild = pElement->FirstChild(); pResponseChild != 0; pResponseChild = pResponseChild->NextSibling()) + for (pResponseChild = pElement->FirstChild(); pResponseChild != 0; pResponseChild = pResponseChild->NextSibling()) { if (ValueWithoutNamespace(pResponseChild, "href")) { @@ -120,7 +120,7 @@ bool CDAVDirectory::ParseResponse(const TiXmlElement *pElement, CFileItem &item) if (GetStatusTag(pResponseChild->ToElement()) == "HTTP/1.1 200 OK") { /* Iterate propstat children elements */ - for (pPropstatChild = pResponseChild->FirstChild(); pPropstatChild != 0; pPropstatChild = pPropstatChild->NextSibling()) + for (pPropstatChild = pResponseChild->FirstChild(); pPropstatChild != 0; pPropstatChild = pPropstatChild->NextSibling()) { if (ValueWithoutNamespace(pPropstatChild, "prop")) { @@ -144,7 +144,7 @@ bool CDAVDirectory::ParseResponse(const TiXmlElement *pElement, CFileItem &item) } } } - + return true; } @@ -181,10 +181,10 @@ bool CDAVDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items if (!strResponse) { CLog::Log(LOGERROR, "%s - Failed to get any response", __FUNCTION__); - } + } // Iterarte over all responses - for ( pChild = davResponse.RootElement()->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) + for ( pChild = davResponse.RootElement()->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) { if (ValueWithoutNamespace(pChild, "response")) { diff --git a/xbmc/FileSystem/DAVDirectory.h b/xbmc/FileSystem/DAVDirectory.h index 1a80baf3bd..3f0542a0cd 100644 --- a/xbmc/FileSystem/DAVDirectory.h +++ b/xbmc/FileSystem/DAVDirectory.h @@ -33,7 +33,7 @@ namespace DIRECTORY virtual ~CDAVDirectory(void); virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items); virtual DIR_CACHE_TYPE GetCacheType(const CStdString& strPath) const { return DIR_CACHE_ONCE; }; - private: + private: bool ValueWithoutNamespace(const TiXmlNode *pNode, CStdString value); CStdString GetStatusTag(const TiXmlElement *pElement); bool ParseResponse(const TiXmlElement *pElement, CFileItem &item); diff --git a/xbmc/FileSystem/DirectoryTuxBox.cpp b/xbmc/FileSystem/DirectoryTuxBox.cpp index 89fdcc2833..2fa4fba460 100644 --- a/xbmc/FileSystem/DirectoryTuxBox.cpp +++ b/xbmc/FileSystem/DirectoryTuxBox.cpp @@ -182,7 +182,7 @@ bool CDirectoryTuxBox::GetDirectory(const CStdString& strPath, CFileItemList &it } else iWaitTimer = iWaitTimer+10; - + result = false; http.Close(); // Close old connections } diff --git a/xbmc/FileSystem/FactoryFileDirectory.cpp b/xbmc/FileSystem/FactoryFileDirectory.cpp index a62dccfc2e..6707884293 100644 --- a/xbmc/FileSystem/FactoryFileDirectory.cpp +++ b/xbmc/FileSystem/FactoryFileDirectory.cpp @@ -121,10 +121,10 @@ IFileDirectory* CFactoryFileDirectory::Create(const CStdString& strPath, CFileIt CDirectory::GetDirectory(strUrl, items, strMask); if (items.Size() == 0) // no files pItem->m_bIsFolder = true; - else if (items.Size() == 1 && items[0]->m_idepth == 0) + else if (items.Size() == 1 && items[0]->m_idepth == 0) { // one STORED file - collapse it down - *pItem = *items[0]; + *pItem = *items[0]; } else { // compressed or more than one file -> create a zip dir @@ -165,7 +165,7 @@ IFileDirectory* CFactoryFileDirectory::Create(const CStdString& strPath, CFileIt } } } - + CFileItemList items; CDirectory::GetDirectory(strUrl, items, strMask); if (items.Size() == 0) // no files - hide this diff --git a/xbmc/FileSystem/FileCache.cpp b/xbmc/FileSystem/FileCache.cpp index 5cbc7a35cc..a30593902c 100644 --- a/xbmc/FileSystem/FileCache.cpp +++ b/xbmc/FileSystem/FileCache.cpp @@ -170,6 +170,7 @@ void CFileCache::Process() m_seekEnded.Set(); } +printf("reading %i\n",chunksize); int iRead = m_source.Read(buffer.get(), chunksize); if(iRead == 0) { diff --git a/xbmc/FileSystem/FileCurl.cpp b/xbmc/FileSystem/FileCurl.cpp index 8db0d7bb66..4bf8347add 100644 --- a/xbmc/FileSystem/FileCurl.cpp +++ b/xbmc/FileSystem/FileCurl.cpp @@ -401,7 +401,7 @@ void CFileCurl::SetCommonOptions(CReadState* state) g_curlInterface.easy_setopt(h, CURLOPT_REFERER, m_referer.c_str()); else g_curlInterface.easy_setopt(h, CURLOPT_AUTOREFERER, TRUE); - + // setup any requested authentication if( m_ftpauth.length() > 0 ) { @@ -783,7 +783,7 @@ bool CFileCurl::Open(const CURL& url) { m_opened = true; - + CURL url2(url); ParseAndCorrectUrl(url2); @@ -863,7 +863,7 @@ bool CFileCurl::CReadState::ReadString(char *szLine, int iLineLength) { if (m_fileSize != 0) CLog::Log(LOGWARNING, "%s - Transfer ended before entire file was retrieved pos %"PRId64", size %"PRId64, __FUNCTION__, m_filePos, m_fileSize); - + return false; } @@ -1053,8 +1053,8 @@ int CFileCurl::Stat(const CURL& url, struct __stat64* buffer) { char content[255]; if (CURLE_OK != g_curlInterface.easy_getinfo(m_state->m_easyHandle, CURLINFO_CONTENT_TYPE, content)) - { - g_curlInterface.easy_release(&m_state->m_easyHandle, NULL); + { + g_curlInterface.easy_release(&m_state->m_easyHandle, NULL); errno = ENOENT; return -1; } @@ -1187,7 +1187,7 @@ bool CFileCurl::CReadState::FillBuffer(unsigned int want) } CLog::Log(LOGDEBUG, "%s: Reconnect, (re)try %i", __FUNCTION__, retry); - + // Connect + seek to current position (again) g_curlInterface.easy_setopt(m_easyHandle, CURLOPT_RESUME_FROM_LARGE, m_filePos); g_curlInterface.multi_add_handle(m_multiHandle, m_easyHandle); diff --git a/xbmc/FileSystem/FileMusicDatabase.cpp b/xbmc/FileSystem/FileMusicDatabase.cpp index 4e3769a865..b18d3b2db6 100644 --- a/xbmc/FileSystem/FileMusicDatabase.cpp +++ b/xbmc/FileSystem/FileMusicDatabase.cpp @@ -43,7 +43,7 @@ CStdString CFileMusicDatabase::TranslateUrl(const CURL& url) CMusicDatabase musicDatabase; if (!musicDatabase.Open()) return ""; - + CStdString strFileName=CUtil::GetFileName(url.Get()); CStdString strExtension; CUtil::GetExtension(strFileName, strExtension); @@ -57,14 +57,14 @@ CStdString CFileMusicDatabase::TranslateUrl(const CURL& url) CSong song; if (!musicDatabase.GetSongById(idSong, song)) return ""; - + CStdString strExtensionFromDb; CUtil::GetExtension(song.strFileName, strExtensionFromDb); if (!strExtensionFromDb.Equals(strExtension)) return ""; - - return song.strFileName; + + return song.strFileName; } bool CFileMusicDatabase::Open(const CURL& url) diff --git a/xbmc/FileSystem/FileShoutcast.cpp b/xbmc/FileSystem/FileShoutcast.cpp index 66de5192d6..39124237c4 100644 --- a/xbmc/FileSystem/FileShoutcast.cpp +++ b/xbmc/FileSystem/FileShoutcast.cpp @@ -218,7 +218,7 @@ bool CFileShoutcast::Open(const CURL& url) int ret; CGUIDialogProgress* dlgProgress = NULL; - + // dvdplayer can deadlock with progress dialog so check first if (g_application.GetCurrentPlayer() == EPC_PAPLAYER) { @@ -439,15 +439,15 @@ bool CFileShoutcast::GetMusicInfoTag(CMusicInfoTag& tag) CStdString CFileShoutcast::GetContent() { - switch (m_contenttype) - { - case CONTENT_TYPE_MP3: - return "audio/mpeg"; - case CONTENT_TYPE_OGG: - return "audio/ogg"; - case CONTENT_TYPE_AAC: - return "audio/aac"; - default: - return "application/octet-stream"; + switch (m_contenttype) + { + case CONTENT_TYPE_MP3: + return "audio/mpeg"; + case CONTENT_TYPE_OGG: + return "audio/ogg"; + case CONTENT_TYPE_AAC: + return "audio/aac"; + default: + return "application/octet-stream"; } } diff --git a/xbmc/FileSystem/FileSmb.cpp b/xbmc/FileSystem/FileSmb.cpp index 7bed8fe8a8..23f837f75d 100644 --- a/xbmc/FileSystem/FileSmb.cpp +++ b/xbmc/FileSystem/FileSmb.cpp @@ -164,12 +164,12 @@ void CSMB::Init() smbc_setOptionBrowseMaxLmbCount(m_context, 0); smbc_setTimeout(m_context, g_advancedSettings.m_sambaclienttimeout * 1000); #else - m_context->debug = g_advancedSettings.m_logLevel == LOG_LEVEL_DEBUG_SAMBA ? 10 : 0; - m_context->callbacks.auth_fn = xb_smbc_auth; - orig_cache = m_context->callbacks.get_cached_srv_fn; - m_context->callbacks.get_cached_srv_fn = xb_smbc_cache; - m_context->options.one_share_per_server = false; - m_context->options.browse_max_lmb_count = 0; + m_context->debug = g_advancedSettings.m_logLevel == LOG_LEVEL_DEBUG_SAMBA ? 10 : 0; + m_context->callbacks.auth_fn = xb_smbc_auth; + orig_cache = m_context->callbacks.get_cached_srv_fn; + m_context->callbacks.get_cached_srv_fn = xb_smbc_cache; + m_context->options.one_share_per_server = false; + m_context->options.browse_max_lmb_count = 0; m_context->timeout = g_advancedSettings.m_sambaclienttimeout * 1000; #endif @@ -496,7 +496,7 @@ int CFileSMB::OpenFile(const CURL &url, CStdString& strAuth) // set up new filehandle (as CFileSMB::Open does) strPath = GetAuthenticatedPath(url); - + fd = smbc_open(strPath.c_str(), O_RDONLY, 0); } } diff --git a/xbmc/FileSystem/HDHomeRun.cpp b/xbmc/FileSystem/HDHomeRun.cpp index a95a40a908..0768b5ba2c 100644 --- a/xbmc/FileSystem/HDHomeRun.cpp +++ b/xbmc/FileSystem/HDHomeRun.cpp @@ -180,7 +180,7 @@ bool CFileHomeRun::Exists(const CURL& url) } int64_t CFileHomeRun::Seek(int64_t iFilePosition, int iWhence) -{ +{ return -1; } diff --git a/xbmc/FileSystem/HTSPDirectory.cpp b/xbmc/FileSystem/HTSPDirectory.cpp index c5e784a297..7f6079f6a2 100644 --- a/xbmc/FileSystem/HTSPDirectory.cpp +++ b/xbmc/FileSystem/HTSPDirectory.cpp @@ -57,9 +57,9 @@ struct SSession struct STimedOut { - STimedOut(DWORD idle) : m_idle(idle) - { - m_time = CTimeUtils::GetTimeMS(); + STimedOut(DWORD idle) : m_idle(idle) + { + m_time = CTimeUtils::GetTimeMS(); } bool operator()(SSession& data) { diff --git a/xbmc/FileSystem/HTSPDirectory.h b/xbmc/FileSystem/HTSPDirectory.h index 171ddf4335..17fee74d9e 100644 --- a/xbmc/FileSystem/HTSPDirectory.h +++ b/xbmc/FileSystem/HTSPDirectory.h @@ -31,10 +31,10 @@ class CFileItem; typedef boost::shared_ptr<CFileItem> CFileItemPtr; namespace HTSP { - class CHTSPDirectorySession + class CHTSPDirectorySession : public CThread { - public: + public: bool GetEvent(SEvent& event, uint32_t id); SChannels GetChannels(); SChannels GetChannels(int tag); diff --git a/xbmc/FileSystem/HTSPSession.h b/xbmc/FileSystem/HTSPSession.h index 4fa39567f2..0a0dab2bd9 100644 --- a/xbmc/FileSystem/HTSPSession.h +++ b/xbmc/FileSystem/HTSPSession.h @@ -36,7 +36,7 @@ namespace HTSP { template<typename T> -class const_circular_iter +class const_circular_iter : public std::iterator< typename std::iterator_traits<T>::iterator_category , typename std::iterator_traits<T>::value_type , typename std::iterator_traits<T>::difference_type @@ -164,7 +164,7 @@ struct SQueueStatus uint32_t delay; // Estimated delay of queue (in µs) uint32_t bdrops; // Number of B-frames dropped uint32_t pdrops; // Number of P-frames dropped - uint32_t idrops; // Number of I-frames dropped + uint32_t idrops; // Number of I-frames dropped SQueueStatus() { Clear(); } void Clear() diff --git a/xbmc/FileSystem/RSSDirectory.cpp b/xbmc/FileSystem/RSSDirectory.cpp index 826b1034d3..6b4aff2a00 100644 --- a/xbmc/FileSystem/RSSDirectory.cpp +++ b/xbmc/FileSystem/RSSDirectory.cpp @@ -50,7 +50,7 @@ bool CRSSDirectory::ContainsFiles(const CStdString& strPath) CFileItemList items; if(!GetDirectory(strPath, items)) return false; - + return items.Size() > 0; } @@ -130,7 +130,7 @@ static void ParseItemMRSS(CFileItem* item, TiXmlElement* item_child, const CStdS } if(dur) - StringUtils::SecondsToTimeString(atoi(dur), vtag->m_strRuntime); + StringUtils::SecondsToTimeString(atoi(dur), vtag->m_strRuntime); ParseItem(item, item_child); } diff --git a/xbmc/FileSystem/SAPDirectory.cpp b/xbmc/FileSystem/SAPDirectory.cpp index c9a007cd04..6e8578f236 100644 --- a/xbmc/FileSystem/SAPDirectory.cpp +++ b/xbmc/FileSystem/SAPDirectory.cpp @@ -371,11 +371,11 @@ bool CSAPSessions::ParseAnnounce(char* data, int len) session.payload.assign(data, len); session.timeout = CTimeUtils::GetTimeMS() + 60*60*1000; m_sessions.push_back(session); - + CGUIMessage message(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_UPDATE_PATH); message.SetStringParam("sap://"); g_windowManager.SendThreadMessage(message); - + return true; } diff --git a/xbmc/FileSystem/SpecialProtocol.h b/xbmc/FileSystem/SpecialProtocol.h index 34328f2b5f..8aaab540a1 100644 --- a/xbmc/FileSystem/SpecialProtocol.h +++ b/xbmc/FileSystem/SpecialProtocol.h @@ -34,7 +34,7 @@ Win32: FIXME: Currently the same as special://home/ special://userhome/ - a writable version of the user home directory Linux, OS X: ~/.xbmc - Win32: home directory of user + Win32: home directory of user special://masterprofile/ - the master users userdata folder - usually special://home/userdata Linux: ~/.xbmc/userdata/ OS X: ~/Library/Application Support/XBMC/UserData/ diff --git a/xbmc/FileSystem/StackDirectory.cpp b/xbmc/FileSystem/StackDirectory.cpp index 3659149404..e79e16963e 100644 --- a/xbmc/FileSystem/StackDirectory.cpp +++ b/xbmc/FileSystem/StackDirectory.cpp @@ -107,7 +107,7 @@ namespace DIRECTORY strStackTitlePath, strStackTitle, strCommonDir = CUtil::GetParentPath(strPath); - + stack.GetDirectory(strPath, files); if (files.Size() > 1) diff --git a/xbmc/FileSystem/UPnPDirectory.cpp b/xbmc/FileSystem/UPnPDirectory.cpp index 7069c24ff4..211f341fe4 100644 --- a/xbmc/FileSystem/UPnPDirectory.cpp +++ b/xbmc/FileSystem/UPnPDirectory.cpp @@ -274,7 +274,7 @@ CUPnPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items) CProtocolFinder("xbmc-get"), resource); - CLog::Log(LOGDEBUG, "CUPnPDirectory::GetDirectory - resource protocol info '%s'", + CLog::Log(LOGDEBUG, "CUPnPDirectory::GetDirectory - resource protocol info '%s'", (const char*)(resource.m_ProtocolInfo.ToString())); // if it's an item, path is the first url to the item @@ -302,7 +302,7 @@ CUPnPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items) pItem->SetContentType((const char*)resource.m_ProtocolInfo.GetContentType()); } } else { - CLog::Log(LOGERROR, "CUPnPDirectory::GetDirectory - invalid protocol info '%s'", + CLog::Log(LOGERROR, "CUPnPDirectory::GetDirectory - invalid protocol info '%s'", (const char*)(resource.m_ProtocolInfo.ToString())); } diff --git a/xbmc/FileSystem/ZipManager.cpp b/xbmc/FileSystem/ZipManager.cpp index 1ef37987c6..03c2a65048 100644 --- a/xbmc/FileSystem/ZipManager.cpp +++ b/xbmc/FileSystem/ZipManager.cpp @@ -50,7 +50,7 @@ CZipManager::~CZipManager() bool CZipManager::GetZipList(const CStdString& strPath, vector<SZipEntry>& items) { CLog::Log(LOGDEBUG, "%s - Processing %s", __FUNCTION__, strPath.c_str()); - + CURL url(strPath); struct __stat64 m_StatData; @@ -95,7 +95,7 @@ bool CZipManager::GetZipList(const CStdString& strPath, vector<SZipEntry>& items CFile::Stat(strFile,&m_StatData); mZipDate.insert(make_pair(strFile,m_StatData.st_mtime)); - + // Look for end of central directory record // Zipfile comment may be up to 65535 bytes // End of central directory record is 22 bytes (ECDREC_SIZE) @@ -112,7 +112,7 @@ bool CZipManager::GetZipList(const CStdString& strPath, vector<SZipEntry>& items // It could be between 2 blocks, so we need to read 3 extra bytes char *buffer = new char[blockSize+3]; bool found = false; - + // Loop through blocks starting at the end of the file (minus ECDREC_SIZE-1) for (int nb=1; !found && (nb <= nbBlock); nb++) { @@ -128,7 +128,7 @@ bool CZipManager::GetZipList(const CStdString& strPath, vector<SZipEntry>& items } } } - + // If not found, look in the last block left... if ( !found && (extraBlockSize > 0) ) { @@ -144,7 +144,7 @@ bool CZipManager::GetZipList(const CStdString& strPath, vector<SZipEntry>& items } } } - + delete [] buffer; if ( !found ) @@ -153,12 +153,12 @@ bool CZipManager::GetZipList(const CStdString& strPath, vector<SZipEntry>& items mFile.Close(); return false; } - + unsigned int cdirOffset, cdirSize; // Get size of the central directory mFile.Seek(12,SEEK_CUR); mFile.Read(&cdirSize,4); - cdirSize = Endian_SwapLE32(cdirSize); + cdirSize = Endian_SwapLE32(cdirSize); // Get Offset of start of central directory with respect to the starting disk number mFile.Read(&cdirOffset,4); cdirOffset = Endian_SwapLE32(cdirOffset); @@ -185,22 +185,22 @@ bool CZipManager::GetZipList(const CStdString& strPath, vector<SZipEntry>& items g_charsetConverter.unknownToUTF8(strName); ZeroMemory(ze.name, 255); strncpy(ze.name, strName.c_str(), strName.size()>254 ? 254 : strName.size()); - + // Save the current position int64_t savePos = mFile.GetPosition(); - + // Go to the local file header to get the extra field length // !! local header extra field length != central file header extra field length !! mFile.Seek(ze.lhdrOffset+28,SEEK_SET); mFile.Read(&(ze.elength),2); ze.elength = Endian_SwapLE16(ze.elength); - + // Compressed data offset = local header offset + size of local header + filename length + local file header extra field length ze.offset = ze.lhdrOffset + LHDR_SIZE + ze.flength + ze.elength; - + // Jump after central file header extra field and file comment mFile.Seek(savePos + ze.eclength + ze.clength,SEEK_SET); - + items.push_back(ze); } @@ -309,7 +309,7 @@ void CZipManager::readCHeader(const char* buffer, SZipEntry& info) info.clength = Endian_SwapLE16(*(unsigned short*)(buffer+32)); // Skip disk number start, internal/external file attributes info.lhdrOffset = Endian_SwapLE32(*(unsigned int*)(buffer+42)); - + } void CZipManager::release(const CStdString& strPath) diff --git a/xbmc/FileSystem/iso9660.cpp b/xbmc/FileSystem/iso9660.cpp index ebc01aab18..2b2659164d 100644 --- a/xbmc/FileSystem/iso9660.cpp +++ b/xbmc/FileSystem/iso9660.cpp @@ -57,7 +57,7 @@ using namespace std; #ifndef HAS_DVD_DRIVE extern "C" { - void cdio_warn(const char* msg, ...) { CLog::Log(LOGWARNING, msg); } + void cdio_warn(const char* msg, ...) { CLog::Log(LOGWARNING, msg); } } #endif diff --git a/xbmc/GUIDialogAudioSubtitleSettings.h b/xbmc/GUIDialogAudioSubtitleSettings.h index 9694dd56ec..fef4040de5 100644 --- a/xbmc/GUIDialogAudioSubtitleSettings.h +++ b/xbmc/GUIDialogAudioSubtitleSettings.h @@ -33,7 +33,7 @@ public: static CStdString FormatDelay(float value, float minimum); static CStdString FormatDecibel(float value, float minimum); - + protected: virtual void CreateSettings(); virtual void OnSettingChanged(SettingInfo &setting); diff --git a/xbmc/GUIDialogContentSettings.cpp b/xbmc/GUIDialogContentSettings.cpp index 43b6022481..4ccdaabdb4 100644 --- a/xbmc/GUIDialogContentSettings.cpp +++ b/xbmc/GUIDialogContentSettings.cpp @@ -391,7 +391,7 @@ void CGUIDialogContentSettings::FillListControl() if (iter->strLanguage.Equals("multi")) strLanguage = g_localizeStrings.Get(21418); else - g_LangCodeExpander.Lookup(strLanguage, iter->strLanguage); + g_LangCodeExpander.Lookup(strLanguage, iter->strLanguage); item->SetLabel(iter->strTitle + " (" + strLanguage + ")"); diff --git a/xbmc/GUIDialogContextMenu.cpp b/xbmc/GUIDialogContextMenu.cpp index c7e67ed604..b144d70484 100644 --- a/xbmc/GUIDialogContextMenu.cpp +++ b/xbmc/GUIDialogContextMenu.cpp @@ -344,13 +344,13 @@ bool CGUIDialogContextMenu::OnContextButton(const CStdString &type, const CFileI // buttons that are available on both sources and autosourced items if (!item) return false; - + switch (button) { case CONTEXT_BUTTON_EJECT_DRIVE: return g_mediaManager.Eject(item->m_strPath); -#ifdef HAS_DVD_DRIVE +#ifdef HAS_DVD_DRIVE case CONTEXT_BUTTON_PLAY_DISC: return MEDIA_DETECT::CAutorun::PlayDisc(); @@ -360,7 +360,7 @@ bool CGUIDialogContextMenu::OnContextButton(const CStdString &type, const CFileI #else CIoSupport::ToggleTray(); #endif -#endif +#endif return true; default: break; diff --git a/xbmc/GUIDialogKaiToast.cpp b/xbmc/GUIDialogKaiToast.cpp index 8e9a763712..772d6877ee 100644 --- a/xbmc/GUIDialogKaiToast.cpp +++ b/xbmc/GUIDialogKaiToast.cpp @@ -91,7 +91,7 @@ bool CGUIDialogKaiToast::DoWork() { CSingleLock lock(m_critical); - if (m_notifications.size() > 0 && + if (m_notifications.size() > 0 && CTimeUtils::GetFrameTime() - m_timer > TOAST_MESSAGE_TIME) { Notification toast = m_notifications.front(); diff --git a/xbmc/GUIDialogKeyboard.cpp b/xbmc/GUIDialogKeyboard.cpp index 7761d8054a..47f024ddb9 100644 --- a/xbmc/GUIDialogKeyboard.cpp +++ b/xbmc/GUIDialogKeyboard.cpp @@ -152,7 +152,7 @@ bool CGUIDialogKeyboard::OnAction(const CAction &action) MoveCursor( -1); } else if (b == 0x27) // right - { + { MoveCursor(1); } else if (b == 0x0D) // enter diff --git a/xbmc/GUIDialogMediaSource.cpp b/xbmc/GUIDialogMediaSource.cpp index 7867c634ff..0b7b855ead 100644 --- a/xbmc/GUIDialogMediaSource.cpp +++ b/xbmc/GUIDialogMediaSource.cpp @@ -472,7 +472,7 @@ void CGUIDialogMediaSource::UpdateButtons() { if (!m_paths->Size()) // sanity return; - + CONTROL_ENABLE_ON_CONDITION(CONTROL_OK, !m_paths->Get(0)->m_strPath.IsEmpty() && !m_name.IsEmpty()); CONTROL_ENABLE_ON_CONDITION(CONTROL_PATH_REMOVE, m_paths->Size() > 1); // name diff --git a/xbmc/GUIDialogNetworkSetup.cpp b/xbmc/GUIDialogNetworkSetup.cpp index 26a83d1654..000440c80b 100644 --- a/xbmc/GUIDialogNetworkSetup.cpp +++ b/xbmc/GUIDialogNetworkSetup.cpp @@ -304,7 +304,7 @@ CStdString CGUIDialogNetworkSetup::ConstructPath() const if(!m_server.IsEmpty()) url.SetHostName(m_server); if (((m_protocol == NET_PROTOCOL_FTP) || - (m_protocol == NET_PROTOCOL_HTTP) || + (m_protocol == NET_PROTOCOL_HTTP) || (m_protocol == NET_PROTOCOL_HTTPS) || (m_protocol == NET_PROTOCOL_RSS) || (m_protocol == NET_PROTOCOL_XBMSP && !m_server.IsEmpty()) || diff --git a/xbmc/GUIDialogNumeric.cpp b/xbmc/GUIDialogNumeric.cpp index 597ed0ea2a..289dbe268b 100644 --- a/xbmc/GUIDialogNumeric.cpp +++ b/xbmc/GUIDialogNumeric.cpp @@ -653,7 +653,7 @@ bool CGUIDialogNumeric::ShowAndVerifyInput(CStdString& strToVerify, const CStdSt strToVerify =""; return false; } - + CStdString md5pword2; XBMC::MD5 md5state; md5state.append(strInput); diff --git a/xbmc/GUIDialogVideoSettings.cpp b/xbmc/GUIDialogVideoSettings.cpp index 8f0e0d030d..eb4bcac7cc 100644 --- a/xbmc/GUIDialogVideoSettings.cpp +++ b/xbmc/GUIDialogVideoSettings.cpp @@ -172,7 +172,7 @@ void CGUIDialogVideoSettings::OnSettingChanged(SettingInfo &setting) g_renderManager.SetViewMode(VIEW_MODE_CUSTOM); UpdateSetting(VIDEO_SETTINGS_VIEW_MODE); } - else + else #endif if (setting.id == VIDEO_SETTINGS_CALIBRATION) { diff --git a/xbmc/GUILargeTextureManager.h b/xbmc/GUILargeTextureManager.h index 69f6553d65..9fa8c05d15 100644 --- a/xbmc/GUILargeTextureManager.h +++ b/xbmc/GUILargeTextureManager.h @@ -43,7 +43,7 @@ public: \brief Work function that loads in a particular image. */ virtual bool DoWork(); - + CStdString m_path; ///< path of image to load CBaseTexture *m_texture; ///< Texture object to load the image into \sa CBaseTexture. }; @@ -51,10 +51,10 @@ public: /*! \ingroup textures \brief Background texture loading manager - + Used to load textures for the user interface asynchronously, allowing fluid framerates while background loading textures. - + \sa IJobCallback, CGUITexture */ class CGUILargeTextureManager : public IJobCallback @@ -65,20 +65,20 @@ public: /*! \brief Callback from CImageLoader on completion of a loaded image - + Transfers texture information from the loading job to our allocated texture list. - + \sa CImageLoader, IJobCallback */ virtual void OnJobComplete(unsigned int jobID, bool success, CJob *job); /*! \brief Request a texture to be loaded in the background. - + Loaded textures are reference counted, hence this call may immediately return with the texture object filled if the texture has been previously loaded, else will return with an empty texture object if it is being loaded. - + \param path path of the image to load. \param texture texture object to hold the resulting texture \param orientation orientation of resulting texture @@ -87,23 +87,23 @@ public: \sa CGUITextureArray and CGUITexture */ bool GetImage(const CStdString &path, CTextureArray &texture, bool firstRequest); - + /*! \brief Request a texture to be unloaded. - + When textures are finished with, this function should be called. This decrements the texture's reference count, and schedules it to be unloaded once the reference count reaches zero. If the texture is still queued for loading, or is in the process of loading, the image load is cancelled. - + \param path path of the image to release. \param immediately if set true the image is immediately unloaded once its reference count reaches zero rather than being unloaded after a delay. - */ + */ void ReleaseImage(const CStdString &path, bool immediately = false); /*! \brief Cleanup images that are no longer in use. - + Loaded textures are reference counted, and upon reaching reference count 0 through ReleaseImage() they are flagged as unused with the current time. After a delay they may be unloaded, hence CleanupUnusedImages() should be called periodically to ensure this occurs. @@ -123,7 +123,7 @@ private: bool DecrRef(bool deleteImmediately); bool DeleteIfRequired(bool deleteImmediately = false); void SetTexture(CBaseTexture* texture); - + const CStdString &GetPath() const { return m_path; }; const CTextureArray &GetTexture() const { return m_texture; }; diff --git a/xbmc/GUIViewState.cpp b/xbmc/GUIViewState.cpp index ab0aef484c..153b0bdad4 100644 --- a/xbmc/GUIViewState.cpp +++ b/xbmc/GUIViewState.cpp @@ -85,7 +85,7 @@ CGUIViewState* CGUIViewState::GetViewState(int windowId, const CFileItemList& it if (items.m_strPath == "special://musicplaylists/") return new CGUIViewStateWindowMusicSongs(items); - + if (windowId==WINDOW_MUSIC_NAV) return new CGUIViewStateWindowMusicNav(items); diff --git a/xbmc/GUIViewStateMusic.cpp b/xbmc/GUIViewStateMusic.cpp index 5f1dfebe28..091ee3ac13 100644 --- a/xbmc/GUIViewStateMusic.cpp +++ b/xbmc/GUIViewStateMusic.cpp @@ -275,11 +275,11 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item } AddSortMethod(SORT_METHOD_DURATION, 555, LABEL_MASKS("%T - %A", "%D")); // Titel, Artist, Duration| empty, empty AddSortMethod(SORT_METHOD_SONG_RATING, 563, LABEL_MASKS("%T - %A", "%R")); // Title - Artist, Rating - + SetSortMethod(g_settings.m_viewStateMusicNavSongs.m_sortMethod); - + SetViewAsControl(g_settings.m_viewStateMusicNavSongs.m_viewMode); - + SetSortOrder(g_settings.m_viewStateMusicNavSongs.m_sortOrder); } break; diff --git a/xbmc/GUIWindowFileManager.cpp b/xbmc/GUIWindowFileManager.cpp index d3bfdeb284..6ca4586752 100644 --- a/xbmc/GUIWindowFileManager.cpp +++ b/xbmc/GUIWindowFileManager.cpp @@ -175,7 +175,7 @@ bool CGUIWindowFileManager::OnAction(const CAction &action) #ifdef HAS_DVD_DRIVE if (m_vecItems[list]->Get(GetSelectedItem(list))->IsDVD()) return MEDIA_DETECT::CAutorun::PlayDisc(); -#endif +#endif } } if (action.id == ACTION_PREVIOUS_MENU) @@ -467,7 +467,7 @@ bool CGUIWindowFileManager::Update(int iList, const CStdString &strDirectory) pItem->SetLabelPreformated(true); m_vecItems[iList]->Add(pItem); } - + if (strDirectory.IsEmpty()) { CFileItemPtr pItem(new CFileItem("special://profile/", true)); diff --git a/xbmc/GUIWindowLoginScreen.cpp b/xbmc/GUIWindowLoginScreen.cpp index c0b069cf62..13b17618e5 100644 --- a/xbmc/GUIWindowLoginScreen.cpp +++ b/xbmc/GUIWindowLoginScreen.cpp @@ -101,7 +101,7 @@ bool CGUIWindowLoginScreen::OnMessage(CGUIMessage& message) if (bOkay) { - if (CFile::Exists("special://scripts/autoexec.py") && + if (CFile::Exists("special://scripts/autoexec.py") && watch.GetElapsedMilliseconds() < 5000.f) { while (watch.GetElapsedMilliseconds() < 5000) Sleep(10); diff --git a/xbmc/GUIWindowPictures.cpp b/xbmc/GUIWindowPictures.cpp index 4d67e2bae7..5d4969b2c5 100644 --- a/xbmc/GUIWindowPictures.cpp +++ b/xbmc/GUIWindowPictures.cpp @@ -281,7 +281,7 @@ void CGUIWindowPictures::OnPrepareFileItems(CFileItemList& items) if (!bProgressVisible && elapsed>1500 && m_dlgProgress) { // tag loading takes more then 1.5 secs, show a progress dialog CURL url(items.m_strPath); - + m_dlgProgress->SetHeading(189); m_dlgProgress->SetLine(0, 505); m_dlgProgress->SetLine(1, ""); @@ -365,11 +365,11 @@ bool CGUIWindowPictures::ShowPicture(int iItem, bool startSlideShow) return false; } -#ifdef HAS_DVD_DRIVE +#ifdef HAS_DVD_DRIVE if (pItem->IsDVD()) return MEDIA_DETECT::CAutorun::PlayDisc(); #endif - + if (pItem->m_bIsShareOrDrive) return false; diff --git a/xbmc/GUIWindowPrograms.cpp b/xbmc/GUIWindowPrograms.cpp index 6cc3895998..20b092c9b2 100644 --- a/xbmc/GUIWindowPrograms.cpp +++ b/xbmc/GUIWindowPrograms.cpp @@ -310,11 +310,11 @@ bool CGUIWindowPrograms::OnPlayMedia(int iItem) return false; } -#ifdef HAS_DVD_DRIVE +#ifdef HAS_DVD_DRIVE if (pItem->IsDVD()) return MEDIA_DETECT::CAutorun::PlayDisc(); #endif - + if (pItem->m_bIsFolder) return false; return false; diff --git a/xbmc/GUIWindowSettingsCategory.cpp b/xbmc/GUIWindowSettingsCategory.cpp index 66a3bedac1..67d398f96f 100644 --- a/xbmc/GUIWindowSettingsCategory.cpp +++ b/xbmc/GUIWindowSettingsCategory.cpp @@ -832,7 +832,7 @@ void CGUIWindowSettingsCategory::UpdateSettings() { for (unsigned int i = 0; i < m_vecSettings.size(); i++) { - CBaseSettingControl *pSettingControl = m_vecSettings[i]; + CBaseSettingControl *pSettingControl = m_vecSettings[i]; pSettingControl->Update(); CStdString strSetting = pSettingControl->GetSetting()->GetSetting(); if (strSetting.Equals("videoplayer.upscalingalgorithm")) @@ -1208,17 +1208,17 @@ void CGUIWindowSettingsCategory::UpdateSettings() CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID()); if (pControl) { - bool enabled = (g_guiSettings.GetBool("videoplayer.usedisplayasclock")) && + bool enabled = (g_guiSettings.GetBool("videoplayer.usedisplayasclock")) && (g_guiSettings.GetInt("videoplayer.synctype") == SYNC_RESAMPLE); pControl->SetEnabled(enabled); } - } + } else if (strSetting.Equals("videoplayer.resamplequality")) { CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID()); if (pControl) { - bool enabled = (g_guiSettings.GetBool("videoplayer.usedisplayasclock")) && + bool enabled = (g_guiSettings.GetBool("videoplayer.usedisplayasclock")) && (g_guiSettings.GetInt("videoplayer.synctype") == SYNC_RESAMPLE); pControl->SetEnabled(enabled); } @@ -1401,9 +1401,9 @@ void CGUIWindowSettingsCategory::OnSettingChanged(CBaseSettingControl *pSettingC } } else if (strSetting.Equals("videolibrary.export")) - CBuiltins::Execute("exportlibrary(video)"); + CBuiltins::Execute("exportlibrary(video)"); else if (strSetting.Equals("musiclibrary.export")) - CBuiltins::Execute("exportlibrary(music)"); + CBuiltins::Execute("exportlibrary(music)"); else if (strSetting.Equals("karaoke.export") ) { vector<CStdString> choices; @@ -1478,7 +1478,7 @@ void CGUIWindowSettingsCategory::OnSettingChanged(CBaseSettingControl *pSettingC { CStdString strPassword=g_guiSettings.GetString("scrobbler.lastfmpassword"); CStdString strUserName=g_guiSettings.GetString("scrobbler.lastfmusername"); - if ((g_guiSettings.GetBool("scrobbler.lastfmsubmit") || + if ((g_guiSettings.GetBool("scrobbler.lastfmsubmit") || g_guiSettings.GetBool("scrobbler.lastfmsubmitradio")) && !strUserName.IsEmpty() && !strPassword.IsEmpty()) { @@ -1493,7 +1493,7 @@ void CGUIWindowSettingsCategory::OnSettingChanged(CBaseSettingControl *pSettingC { CStdString strPassword=g_guiSettings.GetString("scrobbler.librefmpassword"); CStdString strUserName=g_guiSettings.GetString("scrobbler.librefmusername"); - if ((g_guiSettings.GetBool("scrobbler.librefmsubmit") || + if ((g_guiSettings.GetBool("scrobbler.librefmsubmit") || g_guiSettings.GetBool("scrobbler.librefmsubmitradio")) && !strUserName.IsEmpty() && !strPassword.IsEmpty()) { @@ -1541,7 +1541,7 @@ void CGUIWindowSettingsCategory::OnSettingChanged(CBaseSettingControl *pSettingC g_lcd->Initialize(); } #endif - else if ( strSetting.Equals("services.webserver") || strSetting.Equals("services.webserverport") || + else if ( strSetting.Equals("services.webserver") || strSetting.Equals("services.webserverport") || strSetting.Equals("services.webserverusername") || strSetting.Equals("services.webserverpassword")) { if (strSetting.Equals("services.webserverport")) @@ -1559,7 +1559,7 @@ void CGUIWindowSettingsCategory::OnSettingChanged(CBaseSettingControl *pSettingC } } #endif - } + } else if (strSetting.Equals("services.zeroconf")) { #ifdef HAS_ZEROCONF @@ -3189,23 +3189,23 @@ void CGUIWindowSettingsCategory::FillInAudioDevices(CSetting* pSetting, bool Pas return; CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID()); pControl->Clear(); - + CoreAudioDeviceList deviceList; CCoreAudioHardware::GetOutputDevices(&deviceList); - + if (CCoreAudioHardware::GetDefaultOutputDevice()) pControl->AddLabel("Default Output Device", 0); // This will cause FindAudioDevice to fall back to the system default as configured in 'System Preferences' int activeDevice = 0; - + CStdString deviceName; for (int i = pControl->GetMaximum(); !deviceList.empty(); i++) { CCoreAudioDevice device(deviceList.front()); pControl->AddLabel(device.GetName(deviceName), i); - + if (g_guiSettings.GetString("audiooutput.audiodevice").Equals(deviceName)) activeDevice = i; // Tag this one - + deviceList.pop_front(); } pControl->SetValue(activeDevice); @@ -3227,7 +3227,7 @@ void CGUIWindowSettingsCategory::FillInAudioDevices(CSetting* pSetting, bool Pas m_AnalogAudioSinkMap["Error - no devices found"] = "null:"; m_AnalogAudioSinkMap["custom"] = "custom"; } - + int numberSinks = 0; int selectedValue = -1; @@ -3292,7 +3292,7 @@ void CGUIWindowSettingsCategory::FillInWeatherPlugins(CGUISpinControlEx *pContro if (CDirectory::GetDirectory("special://home/plugins/weather/", items, "/", false)) { for (int i=0; i<items.Size(); ++i) - { + { // create the full path to the plugin CStdString plugin; CStdString pluginPath = items[i]->m_strPath; diff --git a/xbmc/GUIWindowTestPatternGL.cpp b/xbmc/GUIWindowTestPatternGL.cpp index 7b882b0277..03fe8f65db 100644 --- a/xbmc/GUIWindowTestPatternGL.cpp +++ b/xbmc/GUIWindowTestPatternGL.cpp @@ -192,7 +192,7 @@ void CGUIWindowTestPatternGL::DrawCircle(int originX, int originY, int radius) void CGUIWindowTestPatternGL::BeginRender() { glDisable(GL_TEXTURE_2D); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } void CGUIWindowTestPatternGL::EndRender() diff --git a/xbmc/GUIWindowVideoFiles.cpp b/xbmc/GUIWindowVideoFiles.cpp index 2fe562ea11..3f4dab7b1b 100644 --- a/xbmc/GUIWindowVideoFiles.cpp +++ b/xbmc/GUIWindowVideoFiles.cpp @@ -198,11 +198,11 @@ bool CGUIWindowVideoFiles::OnMessage(CGUIMessage& message) // use play button to add folders of items to temp playlist if (iAction == ACTION_PLAYER_PLAY && pItem->m_bIsFolder && !pItem->IsParentFolder()) { -#ifdef HAS_DVD_DRIVE +#ifdef HAS_DVD_DRIVE if (pItem->IsDVD()) return MEDIA_DETECT::CAutorun::PlayDisc(); #endif - + if (pItem->m_bIsShareOrDrive) return false; // if playback is paused or playback speed != 1, return @@ -322,11 +322,11 @@ bool CGUIWindowVideoFiles::OnPlayMedia(int iItem) if ( iItem < 0 || iItem >= (int)m_vecItems->Size() ) return false; CFileItemPtr pItem = m_vecItems->Get(iItem); -#ifdef HAS_DVD_DRIVE +#ifdef HAS_DVD_DRIVE if (pItem->IsDVD()) return MEDIA_DETECT::CAutorun::PlayDisc(); #endif - + if (pItem->m_bIsShareOrDrive) return false; @@ -411,9 +411,9 @@ void CGUIWindowVideoFiles::OnAssignContent(int iItem, int iFound, SScraperInfo& { OnUnAssignContent(iItem,20375,20340,20341); } - if (!info.strContent.IsEmpty() && + if (!info.strContent.IsEmpty() && !info2.strContent.IsEmpty() && - !info.strContent.Equals("None") && + !info.strContent.Equals("None") && (info2.strContent != info.strContent || !info.strPath.Equals(info2.strPath))) { diff --git a/xbmc/GUIWindowVideoInfo.cpp b/xbmc/GUIWindowVideoInfo.cpp index 1f11a7a88f..06bbdeb9b7 100644 --- a/xbmc/GUIWindowVideoInfo.cpp +++ b/xbmc/GUIWindowVideoInfo.cpp @@ -692,7 +692,7 @@ void CGUIWindowVideoInfo::Play(bool resume) strPath.Format("videodb://2/2/%i/",m_movieItem->GetVideoInfoTag()->m_iDbId); Close(); g_windowManager.ActivateWindow(WINDOW_VIDEO_NAV,strPath); - return; + return; } CFileItem movie(*m_movieItem->GetVideoInfoTag()); @@ -831,10 +831,10 @@ void CGUIWindowVideoInfo::OnGetThumb() void CGUIWindowVideoInfo::OnGetFanart() { CFileItemList items; - + CFileItem item(*m_movieItem->GetVideoInfoTag()); CStdString cachedThumb(item.GetCachedFanart()); - + if (CFile::Exists(cachedThumb)) { CFileItemPtr itemCurrent(new CFileItem("fanart://Current",false)); diff --git a/xbmc/LastFmManager.cpp b/xbmc/LastFmManager.cpp index 75e7702f4e..6404c22043 100644 --- a/xbmc/LastFmManager.cpp +++ b/xbmc/LastFmManager.cpp @@ -502,7 +502,7 @@ void CLastFmManager::OnSongChange(CFileItem& newSong) StopRadio(true); } else - { + { unsigned int start = CTimeUtils::GetTimeMS(); ReapSongs(); MovePlaying(); @@ -607,7 +607,7 @@ void CLastFmManager::Process() g_playlistPlayer.SetShuffle(PLAYLIST_MUSIC, false); g_playlistPlayer.SetRepeat(PLAYLIST_MUSIC, PLAYLIST::REPEAT_NONE); - + while (!m_bStop) { WaitForSingleObject(m_hWorkerEvent, INFINITE); @@ -622,10 +622,10 @@ void CLastFmManager::Process() iNrCachedTracks = m_RadioTrackQueue->size(); CacheTrackThumb(iNrCachedTracks); } - + g_playlistPlayer.SetShuffle(PLAYLIST_MUSIC, bLastShuffleState); g_playlistPlayer.SetRepeat(PLAYLIST_MUSIC, LastRepeatState); - + CLog::Log(LOGINFO,"LastFM thread terminated"); } @@ -655,7 +655,7 @@ void CLastFmManager::StopRadio(bool bKillSession /*= true*/) } } } - + if (!bKillSession) { SendUpdateMessage(); diff --git a/xbmc/MediaManager.cpp b/xbmc/MediaManager.cpp index 09c8c7aa77..8bd1404dbe 100644 --- a/xbmc/MediaManager.cpp +++ b/xbmc/MediaManager.cpp @@ -31,7 +31,7 @@ #include "GUIWindowManager.h" #ifdef HAS_DVD_DRIVE #include "FileSystem/cdioSupport.h" -#ifndef _WIN32 +#ifndef _WIN32 // TODO: switch all ports to use auto sources #include "DetectDVDType.h" #endif @@ -233,10 +233,10 @@ void CMediaManager::AddAutoSource(const CMediaSource &share, bool bAutorun) CGUIMessage msg(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_UPDATE_SOURCES); g_windowManager.SendThreadMessage( msg ); -#ifdef HAS_DVD_DRIVE +#ifdef HAS_DVD_DRIVE if(bAutorun) MEDIA_DETECT::CAutorun::ExecuteAutorun(); -#endif +#endif } void CMediaManager::RemoveAutoSource(const CMediaSource &share) @@ -249,10 +249,10 @@ void CMediaManager::RemoveAutoSource(const CMediaSource &share) CGUIMessage msg(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_UPDATE_SOURCES); g_windowManager.SendThreadMessage( msg ); -#ifdef HAS_DVD_DRIVE +#ifdef HAS_DVD_DRIVE // delete cached CdInfo if any RemoveCdInfo(TranslateDevicePath(share.strPath, true)); -#endif +#endif } ///////////////////////////////////////////////////////////// @@ -264,11 +264,11 @@ CStdString CMediaManager::TranslateDevicePath(const CStdString& devicePath, bool CSingleLock waitLock(m_muAutoSource); CStdString strDevice = devicePath; // fallback for cdda://local/ and empty devicePath -#ifdef HAS_DVD_DRIVE +#ifdef HAS_DVD_DRIVE if(devicePath.empty() || devicePath.Left(12).Compare("cdda://local")==0) strDevice = MEDIA_DETECT::CLibcdio::GetInstance()->GetDeviceFileName(); #endif - + #ifdef _WIN32 if(!m_bhasoptical) return ""; @@ -298,13 +298,13 @@ bool CMediaManager::IsDiscInDrive(const CStdString& devicePath) return true; else return false; -#else +#else // TODO: switch all ports to use auto sources return MEDIA_DETECT::CDetectDVDMedia::IsDiscInDrive(); #endif #else return false; -#endif +#endif } bool CMediaManager::IsAudio(const CStdString& devicePath) @@ -319,7 +319,7 @@ bool CMediaManager::IsAudio(const CStdString& devicePath) return true; return false; -#else +#else // TODO: switch all ports to use auto sources MEDIA_DETECT::CCdInfo* pInfo = MEDIA_DETECT::CDetectDVDMedia::GetCdInfo(); if (pInfo != NULL && pInfo->IsAudio(1)) @@ -350,7 +350,7 @@ DWORD CMediaManager::GetDriveStatus(const CStdString& devicePath) dwRet = DRIVE_CLOSED_NO_MEDIA; break; case 1: // tray open - dwRet = DRIVE_OPEN; + dwRet = DRIVE_OPEN; break; case 2: // media accessible dwRet = DRIVE_CLOSED_MEDIA_PRESENT; diff --git a/xbmc/MediaSource.cpp b/xbmc/MediaSource.cpp index 16f31b7030..ede701d4be 100644 --- a/xbmc/MediaSource.cpp +++ b/xbmc/MediaSource.cpp @@ -96,7 +96,7 @@ void AddOrReplace(VECSOURCES& sources, const CMediaSource& source) unsigned int i; for( i=0;i<sources.size();++i ) { - if (sources[i].strPath.Equals(source.strPath)) + if (sources[i].strPath.Equals(source.strPath)) { sources[i] = source; break; diff --git a/xbmc/MusicDatabase.cpp b/xbmc/MusicDatabase.cpp index cff4d19e4f..d27956320f 100644 --- a/xbmc/MusicDatabase.cpp +++ b/xbmc/MusicDatabase.cpp @@ -258,10 +258,10 @@ void CMusicDatabase::AddSong(const CSong& song, bool bCheck) { strSQL=FormatSQL("select * from song where idAlbum=%i and dwFileNameCRC='%ul' and strTitle='%s'", idAlbum, crc, song.strTitle.c_str()); - + if (!m_pDS->query(strSQL.c_str())) return; - + if (m_pDS->num_rows() != 0) { idSong = m_pDS->fv("idSong").get_asInt(); @@ -2251,7 +2251,7 @@ void CMusicDatabase::DeleteAlbumInfo() bool CMusicDatabase::LookupCDDBInfo(bool bRequery/*=false*/) { -#ifdef HAS_DVD_DRIVE +#ifdef HAS_DVD_DRIVE if (!g_guiSettings.GetBool("audiocds.usecddb")) return false; @@ -2371,12 +2371,12 @@ bool CMusicDatabase::LookupCDDBInfo(bool bRequery/*=false*/) return pCdInfo->HasCDDBInfo(); #else return false; -#endif +#endif } void CMusicDatabase::DeleteCDDBInfo() { -#ifdef HAS_DVD_DRIVE +#ifdef HAS_DVD_DRIVE WIN32_FIND_DATA wfd; memset(&wfd, 0, sizeof(wfd)); @@ -2451,7 +2451,7 @@ void CMusicDatabase::DeleteCDDBInfo() } mapCDDBIds.erase(mapCDDBIds.begin(), mapCDDBIds.end()); } -#endif +#endif } void CMusicDatabase::Clean() @@ -4265,7 +4265,7 @@ void CMusicDatabase::ExportToXML(const CStdString &xmlFile, bool singleFiles, bo xmlDoc.InsertEndChild(decl); } } - + if ((current % 50) == 0 && progress) { progress->SetLine(1, artist.strArtist); @@ -4776,7 +4776,7 @@ int CMusicDatabase::GetVariousArtistsAlbumsCount() m_pDS->query(strSQL.c_str()); if (!m_pDS->eof()) result = m_pDS->fv(0).get_asInt(); - m_pDS->close(); + m_pDS->close(); } catch(...) { diff --git a/xbmc/MusicInfoLoader.cpp b/xbmc/MusicInfoLoader.cpp index e3cb9f1ffe..d6d7a0bb2f 100644 --- a/xbmc/MusicInfoLoader.cpp +++ b/xbmc/MusicInfoLoader.cpp @@ -96,7 +96,7 @@ bool CMusicInfoLoader::LoadAdditionalTagInfo(CFileItem* pItem) database.Open(); if (database.GetArtistInfo(param.GetArtistId(),artist,false)) CMusicDatabase::SetPropertiesFromArtist(*pItem,artist); - + CAlbum album; if (database.GetAlbumInfo(param.GetAlbumId(),album,NULL)) CMusicDatabase::SetPropertiesFromAlbum(*pItem,album); diff --git a/xbmc/MusicInfoScanner.cpp b/xbmc/MusicInfoScanner.cpp index 052431609c..ae86d0dc32 100644 --- a/xbmc/MusicInfoScanner.cpp +++ b/xbmc/MusicInfoScanner.cpp @@ -113,7 +113,7 @@ void CMusicInfoScanner::Process() /* * A copy of the directory path is used because the path supplied is * immediately removed from the m_pathsToScan set in DoScan(). If the - * reference points to the entry in the set a null reference error + * reference points to the entry in the set a null reference error * occurs. */ CStdString directory = *m_pathsToScan.begin(); @@ -337,7 +337,7 @@ bool CMusicInfoScanner::DoScan(const CStdString& strDirectory) /* * remove this path from the list we're processing. This must be done prior to - * the check for file or folder exclusion to prevent an infinite while loop + * the check for file or folder exclusion to prevent an infinite while loop * in Process(). */ set<CStdString>::iterator it = m_pathsToScan.find(strDirectory); @@ -558,7 +558,7 @@ int CMusicInfoScanner::RetrieveMusicInfo(CFileItemList& items, const CStdString& { if (m_bStop) return songsToAdd.size(); - + long iAlbum = m_musicDatabase.GetAlbumByName(i->first, i->second); CStdString strPath; strPath.Format("musicdb://3/%u/",iAlbum); @@ -859,7 +859,7 @@ bool CMusicInfoScanner::DownloadAlbumInfo(const CStdString& strPath, const CStdS CLog::Log(LOGERROR, "%s - current and default scrapers are invalid. Pick another one", __FUNCTION__); return false; } - + if (!scraper.GetAlbumCount()) scraper.FindAlbuminfo(strAlbum, strArtist); @@ -1131,7 +1131,7 @@ bool CMusicInfoScanner::DownloadArtistInfo(const CStdString& strPath, const CStd { // none chosen if (!pDlg->IsButtonPressed()) { - bCanceled = true; + bCanceled = true; return false; } // manual button pressed diff --git a/xbmc/MusicInfoTagLoaderAAC.cpp b/xbmc/MusicInfoTagLoaderAAC.cpp index 5be57ce5e4..9256d2e5d9 100644 --- a/xbmc/MusicInfoTagLoaderAAC.cpp +++ b/xbmc/MusicInfoTagLoaderAAC.cpp @@ -27,7 +27,7 @@ (((uint32_t)b) << 16) | \ (((uint32_t)c) << 8) | \ (((uint32_t)d))) - + #define PACK_UINT64(a,b,c,d,e,f,g,h) \ ((((uint64_t)PACK_UINT32(a,b,c,d)) << 32) | \ (((uint64_t)PACK_UINT32(e,f,g,h)))) @@ -59,7 +59,7 @@ int CMusicInfoTagLoaderAAC::ReadDuration(const CStdString& strFileName) ; file.Close(); } - + return duration; } @@ -74,7 +74,7 @@ int CMusicInfoTagLoaderAAC::ReadID3Length(XFILE::CFile& file) tagLength += ((buf[6] << 21) | (buf[7] << 14) | (buf[8] << 7) | buf[9]) + 10; file.Seek(tagLength); } - + return 0; } @@ -86,7 +86,7 @@ int CMusicInfoTagLoaderAAC::ReadADTSDuration(XFILE::CFile& file, int offset) float framesPerSec = 0.f; file.Seek(offset); - + while (file.Read(buf, 10) == 10) { if ((buf[0] == 0xFF) && ((buf[1] & 0xF6) == 0xF0)) @@ -112,7 +112,7 @@ int CMusicInfoTagLoaderAAC::ReadADIFDuration(XFILE::CFile& file, int offset) int skip = 0; uint32_t bitrate = 0; int64_t fileLen = 0; - + file.Seek(offset); if (file.Read(buf, 17) == 17) diff --git a/xbmc/MusicInfoTagLoaderCDDA.cpp b/xbmc/MusicInfoTagLoaderCDDA.cpp index c47ad5c26d..40d6245995 100644 --- a/xbmc/MusicInfoTagLoaderCDDA.cpp +++ b/xbmc/MusicInfoTagLoaderCDDA.cpp @@ -149,6 +149,6 @@ bool CMusicInfoTagLoaderCDDA::Load(const CStdString& strFileName, CMusicInfoTag& #endif tag.SetLoaded(false); - + return false; } diff --git a/xbmc/MusicInfoTagLoaderFactory.cpp b/xbmc/MusicInfoTagLoaderFactory.cpp index 8be3430af2..d35e5cbe45 100644 --- a/xbmc/MusicInfoTagLoaderFactory.cpp +++ b/xbmc/MusicInfoTagLoaderFactory.cpp @@ -100,13 +100,13 @@ IMusicInfoTagLoader* CMusicInfoTagLoaderFactory::CreateLoader(const CStdString& CMusicInfoTagLoaderMP4 *pTagLoader = new CMusicInfoTagLoaderMP4(); return (IMusicInfoTagLoader*)pTagLoader; } -#ifdef HAS_DVD_DRIVE +#ifdef HAS_DVD_DRIVE else if (strExtension == "cdda") { CMusicInfoTagLoaderCDDA *pTagLoader = new CMusicInfoTagLoaderCDDA(); return (IMusicInfoTagLoader*)pTagLoader; } -#endif +#endif else if (strExtension == "ape" || strExtension == "mac") { CMusicInfoTagLoaderApe *pTagLoader = new CMusicInfoTagLoaderApe(); diff --git a/xbmc/OggTag.cpp b/xbmc/OggTag.cpp index 5e3c2168cc..a633836098 100644 --- a/xbmc/OggTag.cpp +++ b/xbmc/OggTag.cpp @@ -66,10 +66,10 @@ bool COggTag::Read(const CStdString& strFile1) CFile file; if (!file.Open(strFile)) return false; - + COggCallback callback(file); ov_callbacks oggIOCallbacks = callback.Get(strFile); - + OggVorbis_File vf; // open ogg file with decoder if (m_dll.ov_open_callbacks(&callback, &vf, NULL, 0, oggIOCallbacks)!=0) @@ -108,7 +108,7 @@ int COggTag::GetStreamCount(const CStdString& strFile) CFile file; if (!file.Open(strFile)) return false; - + COggCallback callback(file); ov_callbacks oggIOCallbacks = callback.Get(strFile); OggVorbis_File vf; diff --git a/xbmc/PowerManager.cpp b/xbmc/PowerManager.cpp index 7ffc3966c5..ff538e3493 100644 --- a/xbmc/PowerManager.cpp +++ b/xbmc/PowerManager.cpp @@ -126,7 +126,7 @@ void CPowerManager::Initialize() g_guiSettings.SetInt("powermanagement.shutdownstate", defaultShutdown); } - + bool CPowerManager::Powerdown() { return CanPowerdown() ? m_instance->Powerdown() : false; @@ -142,7 +142,7 @@ bool CPowerManager::Suspend() g_Keyboard.ResetState(); return m_instance->Suspend(); } - + return false; } bool CPowerManager::Hibernate() diff --git a/xbmc/ProgramDatabase.cpp b/xbmc/ProgramDatabase.cpp index 4fa47a15f8..efc592deb7 100644 --- a/xbmc/ProgramDatabase.cpp +++ b/xbmc/ProgramDatabase.cpp @@ -232,7 +232,7 @@ bool CProgramDatabase::AddProgramInfo(CFileItem *item, unsigned int titleID) item->m_dateTime.GetAsTimeStamp(time); ULARGE_INTEGER lastAccessed; - lastAccessed.u.LowPart = time.dwLowDateTime; + lastAccessed.u.LowPart = time.dwLowDateTime; lastAccessed.u.HighPart = time.dwHighDateTime; CStdString strPath, strParent; diff --git a/xbmc/RenderSystem.h b/xbmc/RenderSystem.h index 1a9defd61a..e073500782 100644 --- a/xbmc/RenderSystem.h +++ b/xbmc/RenderSystem.h @@ -57,7 +57,7 @@ public: CRenderSystemBase(); virtual ~CRenderSystemBase(); - // Retrieve + // Retrieve RenderingSystemType GetRenderingSystemType() { return m_enumRenderingSystem; } virtual bool InitRenderSystem() = 0; diff --git a/xbmc/RenderSystemDX.cpp b/xbmc/RenderSystemDX.cpp index bdcffb2e57..e30847d155 100644 --- a/xbmc/RenderSystemDX.cpp +++ b/xbmc/RenderSystemDX.cpp @@ -155,7 +155,7 @@ bool CRenderSystemDX::ResetRenderSystem(int width, int height, bool fullScreen, OnDeviceLost(); OnDeviceReset(); - + return true; } @@ -179,12 +179,12 @@ void CRenderSystemDX::BuildPresentParameters() // Try to create a 32-bit depth, 8-bit stencil if( FAILED( m_pD3D->CheckDeviceFormat( m_adapter, - D3DDEVTYPE_HAL, m_D3DPP.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL, + D3DDEVTYPE_HAL, m_D3DPP.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D24S8 ))) { - // Bugger, no 8-bit hardware stencil, just try 32-bit zbuffer + // Bugger, no 8-bit hardware stencil, just try 32-bit zbuffer if( FAILED( m_pD3D->CheckDeviceFormat(m_adapter, - D3DDEVTYPE_HAL, m_D3DPP.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL, + D3DDEVTYPE_HAL, m_D3DPP.BackBufferFormat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D32 ))) { // Jeez, what a naff card. Fall back on 16-bit depth buffering @@ -198,10 +198,10 @@ void CRenderSystemDX::BuildPresentParameters() if( SUCCEEDED( m_pD3D->CheckDepthStencilMatch( m_adapter, D3DDEVTYPE_HAL, m_D3DPP.BackBufferFormat, m_D3DPP.BackBufferFormat, D3DFMT_D24S8 ) ) ) { - m_D3DPP.AutoDepthStencilFormat = D3DFMT_D24S8; - } - else - m_D3DPP.AutoDepthStencilFormat = D3DFMT_D24X8; + m_D3DPP.AutoDepthStencilFormat = D3DFMT_D24S8; + } + else + m_D3DPP.AutoDepthStencilFormat = D3DFMT_D24X8; } } @@ -391,8 +391,8 @@ bool CRenderSystemDX::BeginRender() DWORD oldStatus = m_nDeviceStatus; if( FAILED( m_nDeviceStatus = m_pD3DDevice->TestCooperativeLevel() ) ) { - // The device has been lost but cannot be reset at this time. - // Therefore, rendering is not possible and we'll have to return + // The device has been lost but cannot be reset at this time. + // Therefore, rendering is not possible and we'll have to return // and try again at a later time. if( m_nDeviceStatus == D3DERR_DEVICELOST ) { @@ -402,7 +402,7 @@ bool CRenderSystemDX::BeginRender() return false; } - // The device has been lost but it can be reset at this time. + // The device has been lost but it can be reset at this time. if( m_nDeviceStatus == D3DERR_DEVICENOTRESET ) { OnDeviceReset(); @@ -453,12 +453,12 @@ bool CRenderSystemDX::ClearBuffers(color_t color) if (!m_bRenderCreated) return false; - if( FAILED( hr = m_pD3DDevice->Clear( - 0, - NULL, + if( FAILED( hr = m_pD3DDevice->Clear( + 0, + NULL, D3DCLEAR_TARGET, - color, - 1.0, + color, + 1.0, 0 ) ) ) return false; @@ -472,7 +472,7 @@ bool CRenderSystemDX::ClearBuffers(float r, float g, float b, float a) D3DXCOLOR color(r, g, b, a); - return ClearBuffers((DWORD)color); + return ClearBuffers((DWORD)color); } bool CRenderSystemDX::IsExtSupported(const char* extension) @@ -484,9 +484,9 @@ bool CRenderSystemDX::PresentRender() { if (!m_bRenderCreated) return false; - + bool result = PresentRenderImpl(); - + return result; } @@ -508,7 +508,7 @@ void CRenderSystemDX::CaptureStateBlock() { if (!m_bRenderCreated) return; - + SAFE_RELEASE(m_stateBlock); m_pD3DDevice->CreateStateBlock(D3DSBT_ALL, &m_stateBlock); } @@ -517,13 +517,13 @@ void CRenderSystemDX::ApplyStateBlock() { if (!m_bRenderCreated) return; - + if (m_stateBlock) m_stateBlock->Apply(); } void CRenderSystemDX::SetCameraPosition(const CPoint &camera, int screenWidth, int screenHeight) -{ +{ if (!m_bRenderCreated) return; @@ -622,7 +622,7 @@ bool CRenderSystemDX::TestRender() } void CRenderSystemDX::ApplyHardwareTransform(const TransformMatrix &finalMatrix) -{ +{ if (!m_bRenderCreated) return; } diff --git a/xbmc/RenderSystemGL.cpp b/xbmc/RenderSystemGL.cpp index 865fc5df64..36e4064f3f 100644 --- a/xbmc/RenderSystemGL.cpp +++ b/xbmc/RenderSystemGL.cpp @@ -52,7 +52,7 @@ bool CRenderSystemGL::InitRenderSystem() m_bVsyncInit = false; m_maxTextureSize = 2048; m_renderCaps = 0; - + // init glew library GLenum err = glewInit(); if (GLEW_OK != err) @@ -61,8 +61,8 @@ bool CRenderSystemGL::InitRenderSystem() CLog::Log(LOGERROR, "InitRenderSystem() glewInit returned %i: %s", err, glewGetErrorString(err)); return false; } - - // Get the GL version number + + // Get the GL version number m_RenderVersionMajor = 0; m_RenderVersionMinor = 0; @@ -72,11 +72,11 @@ bool CRenderSystemGL::InitRenderSystem() sscanf(ver, "%d.%d", &m_RenderVersionMajor, &m_RenderVersionMinor); m_RenderVersion = ver; } - + // Get our driver vendor and renderer m_RenderVendor = (const char*) glGetString(GL_VENDOR); m_RenderRenderer = (const char*) glGetString(GL_RENDERER); - + // grab our capabilities if (glewIsSupported("GL_EXT_texture_compression_s3tc")) m_renderCaps |= RENDER_CAPS_DXT; @@ -84,7 +84,7 @@ bool CRenderSystemGL::InitRenderSystem() if (glewIsSupported("GL_ARB_texture_non_power_of_two")) { m_renderCaps |= RENDER_CAPS_NPOT; - if (m_renderCaps & RENDER_CAPS_DXT && !g_sysinfo.IsAppleTV()) // This may not be correct on all hardware, Apple Tv(Nvidia 7300) having problems with this + if (m_renderCaps & RENDER_CAPS_DXT && !g_sysinfo.IsAppleTV()) // This may not be correct on all hardware, Apple Tv(Nvidia 7300) having problems with this m_renderCaps |= RENDER_CAPS_DXT_NPOT; } @@ -93,9 +93,9 @@ bool CRenderSystemGL::InitRenderSystem() m_RenderExtensions += " "; LogGraphicsInfo(); - + m_bRenderCreated = true; - + return true; } @@ -103,16 +103,16 @@ bool CRenderSystemGL::ResetRenderSystem(int width, int height, bool fullScreen, { m_width = width; m_height = height; - + glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); - + CalculateMaxTexturesize(); - + glViewport(0, 0, width, height); glScissor(0, 0, width, height); - glEnable(GL_TEXTURE_2D); - glEnable(GL_SCISSOR_TEST); + glEnable(GL_TEXTURE_2D); + glEnable(GL_SCISSOR_TEST); glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -120,12 +120,12 @@ bool CRenderSystemGL::ResetRenderSystem(int width, int height, bool fullScreen, glOrtho(0.0f, width-1, height-1, 0.0f, -1.0f, 1.0f); glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - + glLoadIdentity(); + glBlendFunc(GL_SRC_ALPHA, GL_ONE); glEnable(GL_BLEND); // Turn Blending On - glDisable(GL_DEPTH_TEST); - + glDisable(GL_DEPTH_TEST); + return true; } @@ -164,7 +164,7 @@ bool CRenderSystemGL::ClearBuffers(float r, float g, float b, float a) { if (!m_bRenderCreated) return false; - + glClearColor(r, g, b, a); GLbitfield flags = GL_COLOR_BUFFER_BIT; @@ -195,7 +195,7 @@ bool CRenderSystemGL::PresentRender() if (!m_bRenderCreated) return false; - if (m_iVSyncMode != 0 && m_iSwapRate != 0) + if (m_iVSyncMode != 0 && m_iSwapRate != 0) { int64_t curr, diff, freq; curr = CurrentHostCounter(); @@ -216,9 +216,9 @@ bool CRenderSystemGL::PresentRender() if (diff > 0) Sleep((DWORD)diff); } - + bool result = PresentRenderImpl(); - + if (m_iVSyncMode && m_iSwapRate != 0) { int64_t curr, diff; @@ -230,7 +230,7 @@ bool CRenderSystemGL::PresentRender() if (abs(diff - m_iSwapRate) < abs(diff)) CLog::Log(LOGDEBUG, "%s - missed requested swap",__FUNCTION__); } - + return result; } @@ -241,7 +241,7 @@ void CRenderSystemGL::SetVSync(bool enable) if (!m_bRenderCreated) return; - + if (enable) CLog::Log(LOGINFO, "GL: Enabling VSYNC"); else @@ -254,7 +254,7 @@ void CRenderSystemGL::SetVSync(bool enable) m_bVsyncInit = true; SetVSyncImpl(enable); - + if (!enable) return; @@ -279,18 +279,18 @@ void CRenderSystemGL::SetVSync(bool enable) m_iVSyncMode = 1; } } - + if (!m_iVSyncMode) CLog::Log(LOGERROR, "GL: Vertical Blank Syncing unsupported"); else - CLog::Log(LOGINFO, "GL: Selected vsync mode %d", m_iVSyncMode); + CLog::Log(LOGINFO, "GL: Selected vsync mode %d", m_iVSyncMode); } void CRenderSystemGL::CaptureStateBlock() { if (!m_bRenderCreated) return; - + glMatrixMode(GL_PROJECTION); glPushMatrix(); glMatrixMode(GL_TEXTURE); @@ -302,14 +302,14 @@ void CRenderSystemGL::CaptureStateBlock() glActiveTextureARB(GL_TEXTURE0_ARB); glDisable(GL_TEXTURE_2D); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glColor3f(1.0, 1.0, 1.0); + glColor3f(1.0, 1.0, 1.0); } void CRenderSystemGL::ApplyStateBlock() { if (!m_bRenderCreated) return; - + glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_TEXTURE); @@ -321,18 +321,18 @@ void CRenderSystemGL::ApplyStateBlock() glEnable(GL_TEXTURE_2D); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glEnable(GL_BLEND); - glEnable(GL_SCISSOR_TEST); + glEnable(GL_SCISSOR_TEST); } void CRenderSystemGL::SetCameraPosition(const CPoint &camera, int screenWidth, int screenHeight) -{ +{ if (!m_bRenderCreated) return; - + g_graphicsContext.BeginPaint(); - + CPoint offset = camera - CPoint(screenWidth*0.5f, screenHeight*0.5f); - + GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); @@ -347,7 +347,7 @@ void CRenderSystemGL::SetCameraPosition(const CPoint &camera, int screenWidth, i glLoadIdentity(); glFrustum( (-w - offset.x)*0.5f, (w - offset.x)*0.5f, (-h + offset.y)*0.5f, (h + offset.y)*0.5f, h, 100*h); glMatrixMode(GL_MODELVIEW); - + g_graphicsContext.EndPaint(); } @@ -373,10 +373,10 @@ bool CRenderSystemGL::TestRender() } void CRenderSystemGL::ApplyHardwareTransform(const TransformMatrix &finalMatrix) -{ +{ if (!m_bRenderCreated) return; - + glMatrixMode(GL_MODELVIEW); glPushMatrix(); GLfloat matrix[4][4]; @@ -397,9 +397,9 @@ void CRenderSystemGL::RestoreHardwareTransform() { if (!m_bRenderCreated) return; - + glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + glPopMatrix(); } void CRenderSystemGL::CalculateMaxTexturesize() @@ -408,7 +408,7 @@ void CRenderSystemGL::CalculateMaxTexturesize() glGetError(); // reset any previous GL errors // max out at 2^(8+8) - for (int i = 0 ; i<8 ; i++) + for (int i = 0 ; i<8 ; i++) { glTexImage2D(GL_PROXY_TEXTURE_2D, 0, 4, width, width, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); @@ -418,7 +418,7 @@ void CRenderSystemGL::CalculateMaxTexturesize() // GMA950 on OS X sets error instead if (width == 0 || (glGetError() != GL_NO_ERROR) ) break; - + m_maxTextureSize = width; width *= 2; if (width > 65536) // have an upper limit in case driver acts stupid @@ -428,7 +428,7 @@ void CRenderSystemGL::CalculateMaxTexturesize() break; } } - + #ifdef __APPLE__ // Max Texture size reported on some apple machines seems incorrect // Displaying a picture with that resolution results in a corrupted output @@ -441,7 +441,7 @@ void CRenderSystemGL::CalculateMaxTexturesize() // Mac mini G4 with ATI Radeon 9200 (GL_VERSION: 1.3 ATI-1.5.48) else if (strcmp(m_RenderRenderer, "ATI Radeon 9200 OpenGL Engine") == 0) m_maxTextureSize = 1024; -#endif +#endif CLog::Log(LOGINFO, "GL: Maximum texture width: %u", m_maxTextureSize); } @@ -450,10 +450,10 @@ void CRenderSystemGL::GetViewPort(CRect& viewPort) { if (!m_bRenderCreated) return; - + GLint glvp[4]; glGetIntegerv(GL_SCISSOR_BOX, glvp); - + viewPort.x1 = glvp[0]; viewPort.y1 = m_height - glvp[1] - glvp[3]; viewPort.x2 = glvp[0] + glvp[2]; @@ -464,7 +464,7 @@ void CRenderSystemGL::SetViewPort(CRect& viewPort) { if (!m_bRenderCreated) return; - + glScissor((GLint) viewPort.x1, (GLint) (m_height - viewPort.y1 - viewPort.Height()), (GLsizei) viewPort.Width(), (GLsizei) viewPort.Height()); glViewport((GLint) viewPort.x1, (GLint) (m_height - viewPort.y1 - viewPort.Height()), (GLsizei) viewPort.Width(), (GLsizei) viewPort.Height()); } diff --git a/xbmc/RenderSystemGL.h b/xbmc/RenderSystemGL.h index 67cb1a0fc4..3da334b1f0 100644 --- a/xbmc/RenderSystemGL.h +++ b/xbmc/RenderSystemGL.h @@ -57,12 +57,12 @@ public: virtual void RestoreHardwareTransform(); virtual bool TestRender(); - + protected: virtual void SetVSyncImpl(bool enable) = 0; virtual bool PresentRenderImpl() = 0; void CalculateMaxTexturesize(); - + int m_iVSyncMode; int m_iVSyncErrors; int64_t m_iSwapStamp; diff --git a/xbmc/Settings.cpp b/xbmc/Settings.cpp index c9946f2b86..d9683624b4 100644 --- a/xbmc/Settings.cpp +++ b/xbmc/Settings.cpp @@ -527,7 +527,7 @@ void CSettings::GetViewState(const TiXmlElement *pRootElement, const CStdString return; } GetInteger(pNode, "viewmode", viewState.m_viewMode, defaultView, DEFAULT_VIEW_LIST, DEFAULT_VIEW_MAX); - + int sortMethod; GetInteger(pNode, "sortmethod", sortMethod, defaultSort, SORT_METHOD_NONE, SORT_METHOD_MAX); viewState.m_sortMethod = (SORT_METHOD)sortMethod; @@ -568,7 +568,7 @@ bool CSettings::LoadCalibration(const TiXmlElement* pRoot, const CStdString& str { if (res == RES_WINDOW) continue; - + if (m_ResInfo[res].strMode == mode) { // found, read in the rest of the information for this item const TiXmlElement *pOverscan = pResolution->FirstChildElement("overscan"); @@ -988,7 +988,7 @@ bool CSettings::LoadProfile(int index) if (doc.LoadFile(CUtil::AddFileToFolder(GetUserDataFolder(),"guisettings.xml"))) g_guiSettings.LoadMasterLock(doc.RootElement()); } - + CPasswordManager::GetInstance().Clear(); // to set labels - shares are reloaded diff --git a/xbmc/SettingsControls.h b/xbmc/SettingsControls.h index 455547657b..466961133f 100644 --- a/xbmc/SettingsControls.h +++ b/xbmc/SettingsControls.h @@ -41,7 +41,7 @@ public: CSetting* GetSetting() { return m_pSetting; }; virtual bool NeedsUpdate() { return false; }; ///< Returns true if the control needs an update virtual void Reset() {}; ///< Resets the NeedsUpdate() state - + /*! \brief Specifies that this setting should update after a delay Useful for settings that have options to navigate through @@ -51,7 +51,7 @@ public: \sa IsDelayed() */ void SetDelayed() { m_delayed = true; }; - + /*! \brief Returns whether this setting should have delayed update \return true if the setting's update should be delayed diff --git a/xbmc/SmartPlaylist.cpp b/xbmc/SmartPlaylist.cpp index d2aaefadce..5a3110a785 100644 --- a/xbmc/SmartPlaylist.cpp +++ b/xbmc/SmartPlaylist.cpp @@ -350,13 +350,13 @@ CStdString CSmartPlaylistRule::GetVideoResolutionQuery(void) { CStdString retVal(" in (select distinct idFile from streamdetails where iVideoWidth "); int iRes = atoi(m_parameter.c_str()); - + int min, max; if (iRes >= 1080) { min = 1281; max = INT_MAX; } else if (iRes >= 720) { min = 961; max = 1280; } else if (iRes >= 540) { min = 721; max = 960; } else { min = 0; max = 720; } - + switch (m_operator) { case OPERATOR_EQUALS: @@ -405,7 +405,7 @@ CStdString CSmartPlaylistRule::GetWhereClause(const CStdString& strType) if (op == OPERATOR_DOES_NOT_EQUAL) negate = " NOT"; } - else + else { // the comparison piece switch (op) @@ -440,7 +440,7 @@ CStdString CSmartPlaylistRule::GetWhereClause(const CStdString& strType) parameter = CDatabase::FormatSQL(operatorString.c_str(), m_parameter.c_str()); } - + if (m_field == FIELD_LASTPLAYED) { if (m_operator == OPERATOR_IN_THE_LAST || m_operator == OPERATOR_NOT_IN_THE_LAST) diff --git a/xbmc/SmartPlaylist.h b/xbmc/SmartPlaylist.h index a63632a174..29b20bb861 100644 --- a/xbmc/SmartPlaylist.h +++ b/xbmc/SmartPlaylist.h @@ -130,7 +130,7 @@ public: CStdString m_parameter; private: SEARCH_OPERATOR TranslateOperator(const char *oper); - + CStdString GetVideoResolutionQuery(void); }; diff --git a/xbmc/UPnP.cpp b/xbmc/UPnP.cpp index cfa89f0f9d..08ceb11b3f 100644 --- a/xbmc/UPnP.cpp +++ b/xbmc/UPnP.cpp @@ -185,27 +185,27 @@ public: } // PLT_MediaServer methods - virtual NPT_Result OnBrowseMetadata(PLT_ActionReference& action, - const char* object_id, + virtual NPT_Result OnBrowseMetadata(PLT_ActionReference& action, + const char* object_id, const char* filter, NPT_UInt32 starting_index, NPT_UInt32 requested_count, const NPT_List<NPT_String>& sort_criteria, const PLT_HttpRequestContext& context); - virtual NPT_Result OnBrowseDirectChildren(PLT_ActionReference& action, - const char* object_id, + virtual NPT_Result OnBrowseDirectChildren(PLT_ActionReference& action, + const char* object_id, const char* filter, NPT_UInt32 starting_index, NPT_UInt32 requested_count, - const NPT_List<NPT_String>& sort_criteria, + const NPT_List<NPT_String>& sort_criteria, const PLT_HttpRequestContext& context); - virtual NPT_Result OnSearchContainer(PLT_ActionReference& action, - const char* container_id, + virtual NPT_Result OnSearchContainer(PLT_ActionReference& action, + const char* container_id, const char* search_criteria, const char* filter, NPT_UInt32 starting_index, NPT_UInt32 requested_count, - const NPT_List<NPT_String>& sort_criteria, + const NPT_List<NPT_String>& sort_criteria, const PLT_HttpRequestContext& context); // PLT_FileMediaServer methods @@ -254,8 +254,8 @@ private: return file_path.Left(index); } - static NPT_String GetProtocolInfo(const CFileItem& item, - const char* protocol, + static NPT_String GetProtocolInfo(const CFileItem& item, + const char* protocol, const PLT_HttpRequestContext* context = NULL); public: @@ -269,7 +269,7 @@ NPT_UInt32 CUPnPServer::m_MaxReturnedItems = 0; | CUPnPServer::GetContentType +---------------------------------------------------------------------*/ NPT_String -CUPnPServer::GetContentType(const char* filename, +CUPnPServer::GetContentType(const char* filename, const PLT_HttpRequestContext* context /* = NULL */) { NPT_String ext = CUtil::GetExtension(filename).c_str(); @@ -283,7 +283,7 @@ CUPnPServer::GetContentType(const char* filename, | CUPnPServer::GetContentType +---------------------------------------------------------------------*/ NPT_String -CUPnPServer::GetContentType(const CFileItem& item, +CUPnPServer::GetContentType(const CFileItem& item, const PLT_HttpRequestContext* context /* = NULL */) { NPT_String ext = CUtil::GetExtension(item.m_strPath).c_str(); @@ -333,7 +333,7 @@ CUPnPServer::GetContentType(const CFileItem& item, | CUPnPServer::GetProtocolInfo +---------------------------------------------------------------------*/ NPT_String -CUPnPServer::GetProtocolInfo(const CFileItem& item, +CUPnPServer::GetProtocolInfo(const CFileItem& item, const char* protocol, const PLT_HttpRequestContext* context /* = NULL */) { @@ -538,7 +538,7 @@ CUPnPServer::BuildObject(const CFileItem& item, resource.m_Size = item.m_dwSize; if (resource.m_Size == 0) { struct __stat64 info; - if(CFile::Stat((const char*)file_path, &info) >= 0 && info.st_size >= 0) + if(CFile::Stat((const char*)file_path, &info) >= 0 && info.st_size >= 0) resource.m_Size = info.st_size; } @@ -850,8 +850,8 @@ static NPT_String TranslateWMPObjectId(NPT_String id) | CUPnPServer::OnBrowseMetadata +---------------------------------------------------------------------*/ NPT_Result -CUPnPServer::OnBrowseMetadata(PLT_ActionReference& action, - const char* object_id, +CUPnPServer::OnBrowseMetadata(PLT_ActionReference& action, + const char* object_id, const char* filter, NPT_UInt32 starting_index, NPT_UInt32 requested_count, @@ -929,8 +929,8 @@ CUPnPServer::OnBrowseMetadata(PLT_ActionReference& action, | CUPnPServer::OnBrowseDirectChildren +---------------------------------------------------------------------*/ NPT_Result -CUPnPServer::OnBrowseDirectChildren(PLT_ActionReference& action, - const char* object_id, +CUPnPServer::OnBrowseDirectChildren(PLT_ActionReference& action, + const char* object_id, const char* filter, NPT_UInt32 starting_index, NPT_UInt32 requested_count, @@ -961,7 +961,7 @@ CUPnPServer::OnBrowseDirectChildren(PLT_ActionReference& action, item->SetLabel("Video Library"); item->SetLabelPreformated(true); items.Add(item); - + } else { CDirectory::GetDirectory((const char*)parent_id, items); } @@ -976,8 +976,8 @@ CUPnPServer::OnBrowseDirectChildren(PLT_ActionReference& action, // passed NPT_String action_name = action->GetActionDesc().GetName(); return BuildResponse( - action, - items, + action, + items, filter, starting_index, requested_count, @@ -1048,7 +1048,7 @@ CUPnPServer::BuildResponse(PLT_ActionReference& action, | FindSubCriteria +---------------------------------------------------------------------*/ static -NPT_String +NPT_String FindSubCriteria(NPT_String criteria, const char* name) { NPT_String result; @@ -1071,8 +1071,8 @@ FindSubCriteria(NPT_String criteria, const char* name) | CUPnPServer::OnSearchContainer +---------------------------------------------------------------------*/ NPT_Result -CUPnPServer::OnSearchContainer(PLT_ActionReference& action, - const char* object_id, +CUPnPServer::OnSearchContainer(PLT_ActionReference& action, + const char* object_id, const char* search_criteria, const char* filter, NPT_UInt32 starting_index, @@ -1080,7 +1080,7 @@ CUPnPServer::OnSearchContainer(PLT_ActionReference& action, const NPT_List<NPT_String>& sort_criteria, const PLT_HttpRequestContext& context) { - CLog::Log(LOGDEBUG, "Received Search request for object '%s' with search '%s'", + CLog::Log(LOGDEBUG, "Received Search request for object '%s' with search '%s'", (const char*)object_id, (const char*)search_criteria); @@ -1263,7 +1263,7 @@ CUPnPServer::ServeFile(NPT_HttpRequest& request, NPT_List<NPT_String>::Iterator url = files.GetFirstItem(); for (;url;url++) { output += PLT_FileMediaServer::BuildSafeResourceUri( - m_FileBaseUri, + m_FileBaseUri, context.GetLocalAddress().GetIpAddress().ToString(), *url); output += "\n\r"; @@ -1715,7 +1715,7 @@ CUPnPRenderer::PlayMedia(const char* uri, const char* meta, PLT_Action* action) PLT_MediaItemResource* res = object->m_Resources.GetFirstItem(); for(NPT_Cardinal i = 0; i < object->m_Resources.GetItemCount(); i++) { - if(object->m_Resources[i].m_Uri == uri) { + if(object->m_Resources[i].m_Uri == uri) { res = &object->m_Resources[i]; break; } @@ -1738,7 +1738,7 @@ CUPnPRenderer::PlayMedia(const char* uri, const char* meta, PLT_Action* action) item.SetLabel((const char*)object->m_Title); item.SetLabelPreformated(true); item.SetThumbnailImage((const char*)object->m_ExtraInfo.album_art_uri); - if (object->m_ObjectClass.type.StartsWith("object.item.audioItem")) { + if (object->m_ObjectClass.type.StartsWith("object.item.audioItem")) { if(NPT_SUCCEEDED(CUPnP::PopulateTagFromObject(*item.GetMusicInfoTag(), *object, res))) item.SetLabelPreformated(false); } else if (object->m_ObjectClass.type.StartsWith("object.item.videoItem")) { diff --git a/xbmc/URL.cpp b/xbmc/URL.cpp index ab6c3986f0..f0b81d6906 100644 --- a/xbmc/URL.cpp +++ b/xbmc/URL.cpp @@ -506,7 +506,7 @@ CStdString CURL::Get() const if (m_strProtocol == "") return m_strFileName; - + CStdString strURL; strURL.reserve(sizeneed); @@ -661,21 +661,21 @@ bool CURL::IsFullPath(const CStdString &url) CStdString CURL::ValidatePath(const CStdString &path) { CStdString result = path; - + // Don't do any stuff on URLs containing %-characters as we may screw up // URL-encoded (embedded) filenames (like with zip:// & rar://) if (path.Find("://") >= 0 && path.Find('%') >= 0) return result; - + // check the path for incorrect slashes #ifdef _WIN32 if (CUtil::IsDOSPath(path)) { result.Replace('/', '\\'); - // Fixup for double back slashes (but ignore the \\ of unc-paths) - for (int x=1; x<result.GetLength()-1; x++) + // Fixup for double back slashes (but ignore the \\ of unc-paths) + for (int x=1; x<result.GetLength()-1; x++) { - if (result[x] == '\\' && result[x+1] == '\\') + if (result[x] == '\\' && result[x+1] == '\\') result.Delete(x); } } @@ -683,20 +683,20 @@ CStdString CURL::ValidatePath(const CStdString &path) { result.Replace('\\', '/'); // Fixup for double forward slashes(/) but don't touch the :// of URLs - for (int x=1; x<result.GetLength()-1; x++) + for (int x=1; x<result.GetLength()-1; x++) { - if (result[x] == '/' && result[x+1] == '/' && result[x-1] != ':') - result.Delete(x); + if (result[x] == '/' && result[x+1] == '/' && result[x-1] != ':') + result.Delete(x); } } #else result.Replace('\\', '/'); - // Fixup for double forward slashes(/) but don't touch the :// of URLs - for (int x=1; x<result.GetLength()-1; x++) - { - if (result[x] == '/' && result[x+1] == '/' && result[x-1] != ':') - result.Delete(x); - } + // Fixup for double forward slashes(/) but don't touch the :// of URLs + for (int x=1; x<result.GetLength()-1; x++) + { + if (result[x] == '/' && result[x+1] == '/' && result[x-1] != ':') + result.Delete(x); + } #endif return result; } diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp index 2b4f449629..1252ade24b 100644 --- a/xbmc/Util.cpp +++ b/xbmc/Util.cpp @@ -856,11 +856,11 @@ bool CUtil::IsOnLAN(const CStdString& strPath) // check if we are on the local subnet if (!g_application.getNetwork().GetFirstConnectedInterface()) return false; - + if (g_application.getNetwork().HasInterfaceForIP(address)) return true; } - + return false; } @@ -923,10 +923,10 @@ bool CUtil::IsRAR(const CStdString& strFile) if (strExtension.Equals(".001") && strFile.Mid(strFile.length()-7,7).CompareNoCase(".ts.001")) return true; - + if (strExtension.CompareNoCase(".cbr") == 0) return true; - + if (strExtension.CompareNoCase(".rar") == 0) return true; @@ -1240,21 +1240,21 @@ void CUtil::GetDVDDriveIcon( const CStdString& strPath, CStdString& strIcon ) strIcon = "DefaultXboxDVD.png"; return ; } -#endif +#endif strIcon = "DefaultDVDRom.png"; return ; } if ( IsISO9660(strPath) ) { -#ifdef HAS_DVD_DRIVE +#ifdef HAS_DVD_DRIVE CCdInfo* pInfo = g_mediaManager.GetCdInfo(); if ( pInfo != NULL && pInfo->IsVideoCd( 1 ) ) { strIcon = "DefaultVCD.png"; return ; } -#endif +#endif strIcon = "DefaultDVDRom.png"; return ; } @@ -1391,7 +1391,7 @@ void CUtil::CacheSubtitles(const CStdString& strMovie, CStdString& strExtensionC CStdString strPath2; GetParentPath(strPath,strPath2); strLookInPaths.push_back(strPath2); - } + } int iSize = strLookInPaths.size(); for (int i=0;i<iSize;++i) { @@ -1918,7 +1918,7 @@ void CUtil::TakeScreenshot(const CStdString &filename, bool sync) for (int y = 0; y < height; y++) memcpy(outpixels + y * stride, pixels + (height - y - 1) * stride, stride); - delete [] pixels; + delete [] pixels; #else //nothing to take a screenshot from @@ -2125,22 +2125,22 @@ bool CUtil::CreateDirectoryEx(const CStdString& strPath) // return true if directory already exist if (CDirectory::Exists(strPath)) return true; - + // we currently only allow HD and smb paths if (!CUtil::IsHD(strPath) && !CUtil::IsSmb(strPath)) { CLog::Log(LOGERROR,"%s called with an unsupported path: %s", __FUNCTION__, strPath.c_str()); return false; } - + CURL url(strPath); // silly CStdString can't take a char in the constructor CStdString sep(1, url.GetDirectorySeparator()); - + // split the filename portion of the URL up into separate dirs CStdStringArray dirs; StringUtils::SplitString(url.GetFileName(), sep, dirs); - + // we start with the root path CStdString dir = url.GetWithoutFilename(); unsigned int i = 0; @@ -2156,7 +2156,7 @@ bool CUtil::CreateDirectoryEx(const CStdString& strPath) dir = CUtil::AddFileToFolder(dir, dirs[i]); CDirectory::Create(dir); } - + // was the final destination directory successfully created ? if (!CDirectory::Exists(strPath)) return false; return true; @@ -2204,7 +2204,7 @@ bool CUtil::IsUsingTTFSubtitles() void CUtil::SplitExecFunction(const CStdString &execString, CStdString &function, vector<CStdString> ¶meters) { CStdString paramString; - + int iPos = execString.Find("("); int iPos2 = execString.ReverseFind(")"); if (iPos > 0 && iPos2 > 0) @@ -2938,9 +2938,9 @@ void CUtil::ClearFileItemCache() void CUtil::InitRandomSeed() { - // Init random seed - int64_t now; - now = CurrentHostCounter(); + // Init random seed + int64_t now; + now = CurrentHostCounter(); unsigned int seed = (unsigned int)now; // CLog::Log(LOGDEBUG, "%s - Initializing random seed with %u", __FUNCTION__, seed); srand(seed); diff --git a/xbmc/Util.h b/xbmc/Util.h index 84c35b7cc1..fda154f878 100644 --- a/xbmc/Util.h +++ b/xbmc/Util.h @@ -97,8 +97,8 @@ public: static bool IsInZIP(const CStdString& strFile); static bool IsInArchive(const CStdString& strFile); static bool IsSpecial(const CStdString& strFile); - static bool IsPlugin(const CStdString& strFile); - static bool IsPluginRoot(const CStdString& strFile); + static bool IsPlugin(const CStdString& strFile); + static bool IsPluginRoot(const CStdString& strFile); static bool IsCDDA(const CStdString& strFile); static bool IsTuxBox(const CStdString& strFile); static bool IsMythTV(const CStdString& strFile); @@ -118,7 +118,7 @@ public: static bool GetDirectoryName(const CStdString& strFileName, CStdString& strDescription); static bool IsISO9660(const CStdString& strFile); static bool IsSmb(const CStdString& strFile); - static bool IsFTP(const CStdString& strFile); + static bool IsFTP(const CStdString& strFile); static bool IsDAAP(const CStdString& strFile); static bool IsUPnP(const CStdString& strFile); static bool IsWritable(const CStdString& strFile); @@ -164,7 +164,7 @@ public: static CStdString MakeLegalFileName(const CStdString &strFile, int LegalType=LEGAL_NONE); static CStdString MakeLegalPath(const CStdString &strPath, int LegalType=LEGAL_NONE); #endif - + static bool IsUsingTTFSubtitles(); static void SplitExecFunction(const CStdString &execString, CStdString &function, std::vector<CStdString> ¶meters); static int GetMatchingSource(const CStdString& strPath, VECSOURCES& VECSOURCES, bool& bIsSourceName); @@ -193,7 +193,7 @@ public: static CStdString GetCachedAlbumThumb(const CStdString &album, const CStdString &artist); static CStdString GetDefaultFolderThumb(const CStdString &folderThumb); static void ClearFileItemCache(); - + static void InitRandomSeed(); #ifdef _LINUX diff --git a/xbmc/VideoDatabase.cpp b/xbmc/VideoDatabase.cpp index 4b476f18de..aea37c1153 100644 --- a/xbmc/VideoDatabase.cpp +++ b/xbmc/VideoDatabase.cpp @@ -1799,7 +1799,7 @@ void CVideoDatabase::SetDetailsForMovie(const CStdString& strFilenameAndPath, co AddSetToMovie(idMovie, idSet); } } - + if (details.HasStreamDetails()) SetStreamDetailsForFileId(details.m_streamDetails, idFile); @@ -5357,7 +5357,7 @@ bool CVideoDatabase::GetMusicVideosNav(const CStdString& strBaseDir, CFileItemLi else where.Format(" %s %s%s",where.Mid(0).c_str(),"and",str2.c_str()); } - + return GetMusicVideosByWhere(strBaseDir, where, items); } diff --git a/xbmc/VideoDatabase.h b/xbmc/VideoDatabase.h index 715a7079b8..cddec33170 100644 --- a/xbmc/VideoDatabase.h +++ b/xbmc/VideoDatabase.h @@ -59,7 +59,7 @@ namespace VIDEO // these defines are based on how many columns we have and which column certain data is going to be in // when we do GetDetailsForMovie() -#define VIDEODB_MAX_COLUMNS 21 +#define VIDEODB_MAX_COLUMNS 21 #define VIDEODB_DETAILS_FILEID VIDEODB_MAX_COLUMNS + 1 #define VIDEODB_DETAILS_FILE VIDEODB_MAX_COLUMNS + 2 #define VIDEODB_DETAILS_PATH VIDEODB_MAX_COLUMNS + 3 diff --git a/xbmc/VideoInfoScanner.cpp b/xbmc/VideoInfoScanner.cpp index 463c26e1c4..00ad25d321 100644 --- a/xbmc/VideoInfoScanner.cpp +++ b/xbmc/VideoInfoScanner.cpp @@ -320,11 +320,11 @@ namespace VIDEO m_database.SetPathHash(strDirectory, hash); m_pathsToClean.push_back(m_database.GetPathId(strDirectory)); } - } + } else { m_pathsToClean.push_back(m_database.GetPathId(strDirectory)); - CLog::Log(LOGDEBUG, "Not adding item to library as no info was found :("); + CLog::Log(LOGDEBUG, "Not adding item to library as no info was found :("); } } @@ -576,7 +576,7 @@ namespace VIDEO if (result == CNfoFile::URL_NFO || result == CNfoFile::COMBINED_NFO) pURL = &scrUrl; - // Get the correct movie title + // Get the correct movie title CStdString strMovieName = pItem->GetMovieName(bDirNames); IMDB_MOVIELIST movielist; @@ -1149,7 +1149,7 @@ namespace VIDEO key.second = file->iEpisode; bool bFound = false; IMDB_EPISODELIST::iterator guide = episodes.begin();; - + for (; guide != episodes.end(); ++guide ) { if (file->cDate.IsValid() && guide->cDate.IsValid() && file->cDate==guide->cDate) diff --git a/xbmc/VideoInfoTag.cpp b/xbmc/VideoInfoTag.cpp index 07377ff498..f521d3e2ca 100644 --- a/xbmc/VideoInfoTag.cpp +++ b/xbmc/VideoInfoTag.cpp @@ -114,7 +114,7 @@ bool CVideoInfoTag::Save(TiXmlNode *node, const CStdString &tag, bool savePathIn if (!m_strPictureURL.m_xml.empty()) { TiXmlDocument doc; - doc.Parse(m_strPictureURL.m_xml); + doc.Parse(m_strPictureURL.m_xml); const TiXmlNode* thumb = doc.FirstChild("thumb"); while (thumb) { @@ -255,7 +255,7 @@ void CVideoInfoTag::Serialize(CArchive& ar) ar << m_cast[i].strRole; ar << m_cast[i].thumbUrl.m_xml; } - + ar << m_strSet; ar << m_strRuntime; ar << m_strFile; @@ -317,7 +317,7 @@ void CVideoInfoTag::Serialize(CArchive& ar) info.thumbUrl.ParseString(strXml); m_cast.push_back(info); } - + ar >> m_strSet; ar >> m_strRuntime; ar >> m_strFile; @@ -375,7 +375,7 @@ void CVideoInfoTag::ParseNative(const TiXmlElement* movie) int max_value = 10; const TiXmlElement* rElement = movie->FirstChildElement("rating"); if (rElement && (rElement->QueryIntAttribute("max", &max_value) == TIXML_SUCCESS) && max_value>=1) - { + { m_fRating = m_fRating / max_value * 10; // Normalise the Movie Rating to between 1 and 10 } XMLUtils::GetInt(movie, "year", m_iYear); @@ -474,7 +474,7 @@ void CVideoInfoTag::ParseNative(const TiXmlElement* movie) node = movie->FirstChildElement("fileinfo"); if (node) { - // Try to pull from fileinfo/streamdetails/[video|audio|subtitle] + // Try to pull from fileinfo/streamdetails/[video|audio|subtitle] const TiXmlNode *nodeStreamDetails = node->FirstChild("streamdetails"); if (nodeStreamDetails) { diff --git a/xbmc/VideoInfoTag.h b/xbmc/VideoInfoTag.h index e26a01c034..79358040de 100644 --- a/xbmc/VideoInfoTag.h +++ b/xbmc/VideoInfoTag.h @@ -85,8 +85,8 @@ public: int m_iYear; int m_iSeason; int m_iEpisode; - int m_iDbId; - int m_iFileId; + int m_iDbId; + int m_iFileId; int m_iSpecialSortSeason; int m_iSpecialSortEpisode; int m_iTrack; diff --git a/xbmc/VideoReferenceClock.cpp b/xbmc/VideoReferenceClock.cpp index 318b798942..28dc4bb654 100644 --- a/xbmc/VideoReferenceClock.cpp +++ b/xbmc/VideoReferenceClock.cpp @@ -307,7 +307,7 @@ bool CVideoReferenceClock::SetupGLX() //set up receiving of RandR events, we'll get one when the refreshrate changes XRRQueryExtension(m_Dpy, &m_RREventBase, &ReturnV); XRRSelectInput(m_Dpy, RootWindow(m_Dpy, m_vInfo->screen), RRScreenChangeNotifyMask); - + UpdateRefreshrate(true); //forced refreshrate update m_MissedVblanks = 0; @@ -379,11 +379,11 @@ int CVideoReferenceClock::GetRandRRate() { int RefreshRate; XRRScreenConfiguration *CurrInfo; - + CurrInfo = XRRGetScreenInfo(m_Dpy, RootWindow(m_Dpy, m_vInfo->screen)); RefreshRate = XRRConfigCurrentRate(CurrInfo); XRRFreeScreenConfigInfo(CurrInfo); - + return RefreshRate; } @@ -435,7 +435,7 @@ void CVideoReferenceClock::RunGLX() ReturnV = m_glXWaitVideoSyncSGI(2, (VblankCount + 1) % 2, &VblankCount); m_glXGetVideoSyncSGI(&VblankCount); //the vblank count returned by glXWaitVideoSyncSGI is not always correct Now = CurrentHostCounter(); //get the timestamp of this vblank - + if(ReturnV) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: glXWaitVideoSyncSGI returned %i", ReturnV); @@ -457,7 +457,7 @@ void CVideoReferenceClock::RunGLX() else { CLog::Log(LOGDEBUG, "CVideoReferenceClock: Vblank counter has reset"); - + //only try reattaching once if (IsReset) return; @@ -470,7 +470,7 @@ void CVideoReferenceClock::RunGLX() CLog::Log(LOGDEBUG, "CVideoReferenceClock: glXMakeCurrent returned %i", ReturnV); return; } - + CLog::Log(LOGDEBUG, "CVideoReferenceClock: Attaching glX context"); glXMakeCurrent(m_Dpy, m_Window, m_Context); if (ReturnV != True) @@ -480,7 +480,7 @@ void CVideoReferenceClock::RunGLX() } m_glXGetVideoSyncSGI(&VblankCount); - + IsReset = true; } PrevVblankCount = VblankCount; @@ -749,13 +749,13 @@ static CVReturn DisplayLinkCallBack(CVDisplayLinkRef displayLink, const CVTimeSt // Create an autorelease pool (necessary to call into non-Obj-C code from Obj-C code) void* pool = Cocoa_Create_AutoReleasePool(); - + CVideoReferenceClock *VideoReferenceClock = reinterpret_cast<CVideoReferenceClock*>(displayLinkContext); VideoReferenceClock->VblankHandler(inNow->hostTime, fps); - + // Destroy the autorelease pool Cocoa_Destroy_AutoReleasePool(pool); - + return kCVReturnSuccess; } @@ -767,7 +767,7 @@ bool CVideoReferenceClock::SetupCocoa() m_LastVBlankTime = CurrentHostCounter(); m_MissedVblanks = 0; m_RefreshRate = 60; //init the refreshrate so we don't get any division by 0 errors - + if (!Cocoa_CVDisplayLinkCreate((void*)DisplayLinkCallBack, reinterpret_cast<void*>(this))) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: Cocoa_CVDisplayLinkCreate failed"); @@ -793,14 +793,14 @@ void CVideoReferenceClock::CleanupCocoa() { CLog::Log(LOGDEBUG, "CVideoReferenceClock: cleaning up Cocoa"); Cocoa_CVDisplayLinkRelease(); -} +} void CVideoReferenceClock::VblankHandler(int64_t nowtime, double fps) { int NrVBlanks; double VBlankTime; int RefreshRate = MathUtils::round_int(fps); - + CSingleLock SingleLock(m_CritSection); if (RefreshRate != m_RefreshRate) @@ -809,20 +809,20 @@ void CVideoReferenceClock::VblankHandler(int64_t nowtime, double fps) m_RefreshRate = RefreshRate; } m_LastRefreshTime = m_CurrTime; - + //calculate how many vblanks happened VBlankTime = (double)(nowtime - m_LastVBlankTime) / (double)m_SystemFrequency; NrVBlanks = MathUtils::round_int(VBlankTime * (double)m_RefreshRate); //save the timestamp of this vblank so we can calculate how many happened next time m_LastVBlankTime = nowtime; - + //update the vblank timestamp, update the clock and send a signal that we got a vblank m_VblankTime = nowtime; UpdateClock(NrVBlanks, true); - + SingleLock.Leave(); - + SendVblankSignal(); } #endif @@ -834,7 +834,7 @@ void CVideoReferenceClock::UpdateClock(int NrVBlanks, bool CheckMissed) { if (NrVBlanks < m_MissedVblanks) //if this is true the vblank detection in the run function is wrong CLog::Log(LOGDEBUG, "CVideoReferenceClock: detected %i vblanks, missed %i", NrVBlanks, m_MissedVblanks); - + NrVBlanks -= m_MissedVblanks; //subtract the vblanks we missed m_MissedVblanks = 0; } @@ -853,29 +853,29 @@ void CVideoReferenceClock::UpdateClock(int NrVBlanks, bool CheckMissed) int64_t CVideoReferenceClock::GetTime() { CSingleLock SingleLock(m_CritSection); - + //when using vblank, get the time from that, otherwise use the systemclock if (m_UseVblank) { int64_t NextVblank; int64_t Now; - + Now = CurrentHostCounter(); //get current system time NextVblank = TimeOfNextVblank(); //get time when the next vblank should happen - + while(Now >= NextVblank) //keep looping until the next vblank is in the future { UpdateClock(1, false); //update clock when next vblank should have happened already NextVblank = TimeOfNextVblank(); //get time when the next vblank should happen } - + return m_CurrTime; } else { int64_t ClockOffset = m_ClockOffset; //get offset of clock SingleLock.Leave(); - + return CurrentHostCounter() + ClockOffset; } } @@ -924,7 +924,7 @@ bool CVideoReferenceClock::UpdateRefreshrate(bool Forced /*= false*/) m_LastRefreshTime = m_CurrTime; #if defined(HAS_GLX) && defined(HAS_XRANDR) - + bool GotEvent = Forced; XEvent Event; //check for RandR events @@ -937,10 +937,10 @@ bool CVideoReferenceClock::UpdateRefreshrate(bool Forced /*= false*/) } XRRUpdateConfiguration(&Event); } - + if (!GotEvent) //refreshrate did not change return false; - + //the refreshrate can be wrong on nvidia drivers, so read it from nvidia-settings when it's available if (m_UseNvSettings || Forced) { @@ -954,15 +954,15 @@ bool CVideoReferenceClock::UpdateRefreshrate(bool Forced /*= false*/) m_RefreshRate = NvRefreshRate; return true; } - + CLog::Log(LOGDEBUG, "CVideoReferenceClock: Using RandR for refreshrate detection"); } - + CSingleLock SingleLock(m_CritSection); m_RefreshRate = GetRandRRate(); - + CLog::Log(LOGDEBUG, "CVideoReferenceClock: Detected refreshrate: %i hertz", (int)m_RefreshRate); - + return true; #elif defined(_WIN32) && defined(HAS_DX) @@ -981,12 +981,12 @@ bool CVideoReferenceClock::UpdateRefreshrate(bool Forced /*= false*/) m_Height = DisplayMode.Height; return true; } - + return false; #elif defined(__APPLE__) int RefreshRate = MathUtils::round_int(Cocoa_GetCVDisplayLinkRefreshPeriod()); - + if (RefreshRate != m_RefreshRate || Forced) { CSingleLock SingleLock(m_CritSection); @@ -1022,7 +1022,7 @@ int64_t CVideoReferenceClock::Wait(int64_t Target) bool Late; CSingleLock SingleLock(m_CritSection); - + if (m_UseVblank) //when true the vblank is used as clock source { while (m_CurrTime < Target) @@ -1033,7 +1033,7 @@ int64_t CVideoReferenceClock::Wait(int64_t Target) SleepTime = (int)((NextVblank - Now) * 1000 / m_SystemFrequency); int64_t CurrTime = m_CurrTime; //save current value of the clock - + Late = false; if (SleepTime <= 0) //if sleeptime is 0 or lower, the vblank clock is already late in updating { @@ -1047,13 +1047,13 @@ int64_t CVideoReferenceClock::Wait(int64_t Target) Late = true; //the required time SingleLock.Enter(); } - + //if the vblank clock was late with its update, we update the clock ourselves if (Late && CurrTime == m_CurrTime) { #ifndef HAVE_LIBVDPAU // vdpau spams the log with missed vblanks so only log if vdpau is not compiled in. - // actually checking for vdpau enabled is too messy to be used in this routine. + // actually checking for vdpau enabled is too messy to be used in this routine. CLog::Log(LOGDEBUG, "CVideoReferenceClock: vblank clock was late: SleepTime %i", SleepTime); #endif UpdateClock(1, false); //update the clock by 1 vblank @@ -1070,7 +1070,7 @@ int64_t CVideoReferenceClock::Wait(int64_t Target) SleepTime = (int)((Target - (Now + ClockOffset)) * 1000 / m_SystemFrequency); if (SleepTime > 0) ::Sleep(SleepTime); - + Now = CurrentHostCounter(); return Now + ClockOffset; } diff --git a/xbmc/VideoReferenceClock.h b/xbmc/VideoReferenceClock.h index 59073b3691..a1f2d8f8db 100644 --- a/xbmc/VideoReferenceClock.h +++ b/xbmc/VideoReferenceClock.h @@ -72,7 +72,7 @@ class CVideoReferenceClock : public CThread #if defined(__APPLE__) void VblankHandler(int64_t nowtime, double fps); #endif - + private: void Process(); bool UpdateRefreshrate(bool Forced = false); @@ -132,7 +132,7 @@ class CVideoReferenceClock : public CThread bool SetupCocoa(); void RunCocoa(); void CleanupCocoa(); - + int64_t m_LastVBlankTime; //timestamp of the last vblank, used for calculating how many vblanks happened //not the same as m_VblankTime #endif diff --git a/xbmc/WinEvents.h b/xbmc/WinEvents.h index 2c7b62ec1c..d927118109 100644 --- a/xbmc/WinEvents.h +++ b/xbmc/WinEvents.h @@ -27,7 +27,7 @@ #include "StdString.h" #include "XBMC_events.h" -typedef bool (* PHANDLE_EVENT_FUNC)(XBMC_Event& newEvent); +typedef bool (* PHANDLE_EVENT_FUNC)(XBMC_Event& newEvent); class CWinEventsBase { diff --git a/xbmc/WinEventsSDL.cpp b/xbmc/WinEventsSDL.cpp index 4241a3f492..89a83b16f1 100644 --- a/xbmc/WinEventsSDL.cpp +++ b/xbmc/WinEventsSDL.cpp @@ -34,18 +34,18 @@ PHANDLE_EVENT_FUNC CWinEventsBase::m_pEventFunc = NULL; bool CWinEventsSDL::MessagePump() -{ +{ SDL_Event event; bool ret = false; - + while (SDL_PollEvent(&event)) { switch(event.type) - { + { case SDL_QUIT: if (!g_application.m_bStop) g_application.getApplicationMessenger().Quit(); break; - + #ifdef HAS_SDL_JOYSTICK case SDL_JOYBUTTONUP: case SDL_JOYBUTTONDOWN: @@ -56,7 +56,7 @@ bool CWinEventsSDL::MessagePump() ret = true; break; #endif - + case SDL_ACTIVEEVENT: //If the window was inconified or restored if( event.active.state & SDL_APPACTIVE ) @@ -70,18 +70,18 @@ bool CWinEventsSDL::MessagePump() g_Windowing.NotifyAppFocusChange(g_application.m_AppFocused); } break; - + case SDL_KEYDOWN: { // process any platform specific shortcuts before handing off to XBMC -#ifdef __APPLE__ +#ifdef __APPLE__ if (ProcessOSXShortcuts(event)) { ret = true; break; } -#endif - +#endif + XBMC_Event newEvent; newEvent.type = XBMC_KEYDOWN; newEvent.key.keysym.scancode = event.key.keysym.scancode; @@ -97,7 +97,7 @@ bool CWinEventsSDL::MessagePump() ret |= g_application.OnEvent(newEvent); break; } - + case SDL_KEYUP: { XBMC_Event newEvent; @@ -109,11 +109,11 @@ bool CWinEventsSDL::MessagePump() newEvent.key.state = event.key.state; newEvent.key.type = event.key.type; newEvent.key.which = event.key.which; - + ret |= g_application.OnEvent(newEvent); break; } - + case SDL_MOUSEBUTTONDOWN: { XBMC_Event newEvent; @@ -180,11 +180,11 @@ bool CWinEventsSDL::MessagePump() newEvent.user.code = event.user.code; ret |= g_application.OnEvent(newEvent); } - + } memset(&event, 0, sizeof(XBMC_Event)); } - + return ret; } @@ -226,8 +226,8 @@ bool CWinEventsSDL::ProcessOSXShortcuts(SDL_Event& event) return false; } } - - return false; + + return false; } #elif defined(_LINUX) diff --git a/xbmc/WinEventsSDL.h b/xbmc/WinEventsSDL.h index beecabc306..7d8795ae0e 100644 --- a/xbmc/WinEventsSDL.h +++ b/xbmc/WinEventsSDL.h @@ -32,13 +32,13 @@ class CWinEventsSDL : public CWinEventsBase { public: static bool MessagePump(); - + protected: -#ifdef __APPLE__ +#ifdef __APPLE__ static bool ProcessOSXShortcuts(SDL_Event& event); #elif defined(_LINUX) static bool ProcessLinuxShortcuts(SDL_Event& event); -#endif +#endif }; #endif // WINDOW_EVENTS_SDL_H diff --git a/xbmc/WinEventsWin32.cpp b/xbmc/WinEventsWin32.cpp index 7d03350377..aee43837de 100644 --- a/xbmc/WinEventsWin32.cpp +++ b/xbmc/WinEventsWin32.cpp @@ -239,12 +239,12 @@ static XBMC_keysym *TranslateKey(WPARAM vkey, UINT scancode, XBMC_keysym *keysym keysym->mod = XBMCKMOD_NONE; keysym->unicode = 0; - if ((vkey == VK_RETURN) && (scancode & 0x100)) + if ((vkey == VK_RETURN) && (scancode & 0x100)) { /* No VK_ code for the keypad enter key */ keysym->sym = XBMCK_KP_ENTER; } - else + else { keysym->sym = VK_keymap[XBMC_MapVirtualKey(scancode, vkey)]; } @@ -270,7 +270,7 @@ static XBMC_keysym *TranslateKey(WPARAM vkey, UINT scancode, XBMC_keysym *keysym } bool CWinEventsWin32::MessagePump() -{ +{ MSG msg; while( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) { @@ -300,7 +300,7 @@ LRESULT CALLBACK CWinEventsWin32::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, L if(g_uQueryCancelAutoPlay != 0 && uMsg == g_uQueryCancelAutoPlay) return S_FALSE; - switch (uMsg) + switch (uMsg) { case WM_CLOSE: case WM_QUIT: @@ -345,7 +345,7 @@ LRESULT CALLBACK CWinEventsWin32::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, L g_Windowing.NotifyAppFocusChange(g_application.m_AppFocused); break; case WM_SYSKEYDOWN: - switch (wParam) + switch (wParam) { case VK_F4: //alt-f4, default event quit. return(DefWindowProc(hWnd, uMsg, wParam, lParam)); @@ -355,9 +355,9 @@ LRESULT CALLBACK CWinEventsWin32::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, L return 0; } //deliberate fallthrough - case WM_KEYDOWN: + case WM_KEYDOWN: { - switch (wParam) + switch (wParam) { case VK_CONTROL: if ( lParam & EXTENDED_KEYMASK ) @@ -389,9 +389,9 @@ LRESULT CALLBACK CWinEventsWin32::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, L return(0); case WM_SYSKEYUP: - case WM_KEYUP: + case WM_KEYUP: { - switch (wParam) + switch (wParam) { case VK_CONTROL: if ( lParam&EXTENDED_KEYMASK ) @@ -404,7 +404,7 @@ LRESULT CALLBACK CWinEventsWin32::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, L uint32_t scanCodeL = MapVirtualKey(VK_LSHIFT, MAPVK_VK_TO_VSC); uint32_t scanCodeR = MapVirtualKey(VK_RSHIFT, MAPVK_VK_TO_VSC); uint32_t keyCode = (uint32_t)((lParam & 0xFF0000) >> 16); - if (keyCode == scanCodeL) + if (keyCode == scanCodeL) wParam = VK_LSHIFT; else if (keyCode == scanCodeR) wParam = VK_RSHIFT; @@ -576,7 +576,7 @@ LRESULT CALLBACK CWinEventsWin32::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, L if (lpdb -> dbch_devicetype == DBT_DEVTYP_VOLUME) { PDEV_BROADCAST_VOLUME lpdbv = (PDEV_BROADCAST_VOLUME)lpdb; - + // Check whether a CD or DVD was removed from a drive. if (lpdbv -> dbcv_flags & DBTF_MEDIA) { diff --git a/xbmc/WinSystem.cpp b/xbmc/WinSystem.cpp index e720b0d2e0..5d06e8b4bb 100644 --- a/xbmc/WinSystem.cpp +++ b/xbmc/WinSystem.cpp @@ -57,7 +57,7 @@ void CWinSystemBase::UpdateDesktopResolution(RESOLUTION_INFO& newRes, int screen newRes.bFullScreen = true; newRes.iSubtitles = (int)(0.965 * height); newRes.fRefreshRate = refreshRate; - newRes.fPixelRatio = 1.0f; + newRes.fPixelRatio = 1.0f; newRes.iWidth = width; newRes.iHeight = height; newRes.strMode.Format("%dx%d", width, height); diff --git a/xbmc/WinSystem.h b/xbmc/WinSystem.h index 460053643d..416af312bb 100644 --- a/xbmc/WinSystem.h +++ b/xbmc/WinSystem.h @@ -67,14 +67,14 @@ public: unsigned int GetWidth() { return m_nWidth; } unsigned int GetHeight() { return m_nHeight; } virtual int GetNumScreens() { return 0; } - bool IsFullScreen() { return m_bFullScreen; } + bool IsFullScreen() { return m_bFullScreen; } virtual void UpdateResolutions(); void SetWindowResolution(int width, int height); - + protected: void UpdateDesktopResolution(RESOLUTION_INFO& newRes, int screen, int width, int height, float refreshRate); - + WindowSystemType m_eWindowSystem; int m_nWidth; int m_nHeight; diff --git a/xbmc/WinSystemWin32.cpp b/xbmc/WinSystemWin32.cpp index e64bd313b4..e11cbf03db 100644 --- a/xbmc/WinSystemWin32.cpp +++ b/xbmc/WinSystemWin32.cpp @@ -87,11 +87,11 @@ bool CWinSystemWin32::IsSystemScreenSaverEnabled() result = true; } RegCloseKey(hKeyScreenSaver); - + return result; } -void CWinSystemWin32::EnableSystemScreenSaver(bool bEnable) +void CWinSystemWin32::EnableSystemScreenSaver(bool bEnable) { SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,bEnable,0,0); if(!bEnable) @@ -157,7 +157,7 @@ bool CWinSystemWin32::CreateBlankWindow() { WNDCLASSEX wcex; - wcex.cbSize = sizeof(WNDCLASSEX); + wcex.cbSize = sizeof(WNDCLASSEX); wcex.style= CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc= DefWindowProc; wcex.cbClsExtra= 0; @@ -173,7 +173,7 @@ bool CWinSystemWin32::CreateBlankWindow() // Now we can go ahead and register our new window class int reg = RegisterClassEx(&wcex); - m_hBlankWindow = CreateWindowEx(WS_EX_TOPMOST, "BlankWindowClass", "", WS_POPUP | WS_DISABLED, + m_hBlankWindow = CreateWindowEx(WS_EX_TOPMOST, "BlankWindowClass", "", WS_POPUP | WS_DISABLED, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL); if(m_hBlankWindow == NULL) @@ -267,7 +267,7 @@ bool CWinSystemWin32::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool ResizeInternal(forceResize); BlankNonActiveMonitor(m_bBlankOtherDisplay); - + return true; } @@ -324,7 +324,7 @@ bool CWinSystemWin32::ResizeInternal(bool forceRefresh) rc.left, rc.top, rc.right, rc.bottom, (dwStyle & WS_CAPTION) ? "" : " fullscreen"); SetWindowRgn(m_hWnd, 0, false); SetWindowLong(m_hWnd, GWL_STYLE, dwStyle); - + // The SWP_DRAWFRAME is here because, perversely, without it win7 draws a // white frame plus titlebar around the xbmc splash SetWindowPos(m_hWnd, windowAfter, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW|SWP_DRAWFRAME); @@ -372,9 +372,9 @@ void CWinSystemWin32::UpdateResolutions() refreshRate = (float)(m_MonitorsInfo[m_nPrimary].RefreshRate + 1) / 1.001f; else refreshRate = (float)m_MonitorsInfo[m_nPrimary].RefreshRate; - + UpdateDesktopResolution(g_settings.m_ResInfo[RES_DESKTOP], 0, w, h, refreshRate); - + // Secondary if(m_nMonitorsCount >= 2) diff --git a/xbmc/WinSystemWin32.h b/xbmc/WinSystemWin32.h index 1ea932529e..a6bef33c1f 100644 --- a/xbmc/WinSystemWin32.h +++ b/xbmc/WinSystemWin32.h @@ -92,7 +92,7 @@ protected: HWND m_hWnd; HWND m_hBlankWindow; HDC m_hDC; - HINSTANCE m_hInstance; + HINSTANCE m_hInstance; HICON m_hIcon; MONITOR_DETAILS m_MonitorsInfo[MAX_MONITORS_NUM]; int m_nMonitorsCount; diff --git a/xbmc/WinSystemWin32GL.cpp b/xbmc/WinSystemWin32GL.cpp index 0968ba251d..6329611583 100644 --- a/xbmc/WinSystemWin32GL.cpp +++ b/xbmc/WinSystemWin32GL.cpp @@ -33,7 +33,7 @@ #pragma comment (lib,"opengl32.lib") #pragma comment (lib,"glu32.lib") -#pragma comment (lib,"../../xbmc/lib/libglew/glew32.lib") +#pragma comment (lib,"../../xbmc/lib/libglew/glew32.lib") CWinSystemWin32GL g_Windowing; diff --git a/xbmc/WinSystemX11.cpp b/xbmc/WinSystemX11.cpp index 06b859b437..de8d285cc2 100644 --- a/xbmc/WinSystemX11.cpp +++ b/xbmc/WinSystemX11.cpp @@ -81,7 +81,7 @@ bool CWinSystemX11::InitWindowSystem() // set repeat to 10ms to ensure repeat time < frame time // so that hold times can be reliably detected SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 10); - + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); @@ -92,7 +92,7 @@ bool CWinSystemX11::InitWindowSystem() } else CLog::Log(LOGERROR, "GLX Error: No Display found"); - + return false; } @@ -117,7 +117,7 @@ bool CWinSystemX11::CreateNewWindow(const CStdString& name, bool fullScreen, RES CTexture iconTexture; iconTexture.LoadFromFile("special://xbmc/media/icon.png"); - + SDL_WM_SetIcon(SDL_CreateRGBSurfaceFrom(iconTexture.GetPixels(), iconTexture.GetWidth(), iconTexture.GetHeight(), 32, iconTexture.GetPitch(), 0xff0000, 0x00ff00, 0x0000ff, 0xff000000L), NULL); SDL_WM_SetCaption("XBMC Media Center", NULL); @@ -129,7 +129,7 @@ bool CWinSystemX11::DestroyWindow() { return true; } - + bool CWinSystemX11::ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) { if(m_nWidth == newWidth @@ -323,7 +323,7 @@ bool CWinSystemX11::RefreshGlxContext() else vInfo = glXChooseVisual(m_dpy, DefaultScreen(m_dpy), doubleVisAttributesOld); - if (vInfo) + if (vInfo) { if (m_glContext) glXDestroyContext(m_dpy, m_glContext); diff --git a/xbmc/WinSystemX11.h b/xbmc/WinSystemX11.h index a23060c61a..341becf278 100644 --- a/xbmc/WinSystemX11.h +++ b/xbmc/WinSystemX11.h @@ -41,26 +41,26 @@ public: virtual bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays); virtual void UpdateResolutions(); virtual void ShowOSMouse(bool show); - + virtual void NotifyAppActiveChange(bool bActivated); virtual bool Minimize(); virtual bool Restore() ; virtual bool Hide(); virtual bool Show(bool raise = true); - + // Local to WinSystemX11 only Display* GetDisplay() { return m_dpy; } GLXWindow GetWindow() { return m_glWindow; } -protected: +protected: bool RefreshGlxContext(); SDL_Surface* m_SDLSurface; GLXContext m_glContext; GLXWindow m_glWindow; Window m_wmWindow; - Display* m_dpy; + Display* m_dpy; bool m_bWasFullScreenBeforeMinimize; }; diff --git a/xbmc/WinSystemX11GL.cpp b/xbmc/WinSystemX11GL.cpp index 134b4b6de7..c929b1f78b 100644 --- a/xbmc/WinSystemX11GL.cpp +++ b/xbmc/WinSystemX11GL.cpp @@ -35,7 +35,7 @@ CWinSystemX11GL::CWinSystemX11GL() m_glXSwapIntervalMESA = NULL; m_glXGetSyncValuesOML = NULL; m_glXSwapBuffersMscOML = NULL; - + m_iVSyncErrors = 0; } @@ -134,7 +134,7 @@ void CWinSystemX11GL::SetVSyncImpl(bool enable) CStdString strVendor(m_RenderVendor); strVendor.ToLower(); - + if(!enable) return; @@ -227,7 +227,7 @@ bool CWinSystemX11GL::CreateNewWindow(const CStdString& name, bool fullScreen, R m_glXGetVideoSyncSGI = (int (*)(unsigned int*))glXGetProcAddress((const GLubyte*)"glXGetVideoSyncSGI"); else m_glXGetVideoSyncSGI = NULL; - + if (IsExtSupported("GLX_SGI_swap_control") ) m_glXSwapIntervalSGI = (int (*)(int))glXGetProcAddress((const GLubyte*)"glXSwapIntervalSGI"); else @@ -254,7 +254,7 @@ bool CWinSystemX11GL::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool { CWinSystemX11::SetFullScreen(fullScreen, res, blankOtherDisplays); CRenderSystemGL::ResetRenderSystem(res.iWidth, res.iHeight, fullScreen, res.fRefreshRate); - + return true; } diff --git a/xbmc/WinSystemX11GL.h b/xbmc/WinSystemX11GL.h index c458a1366b..9e4969189b 100644 --- a/xbmc/WinSystemX11GL.h +++ b/xbmc/WinSystemX11GL.h @@ -40,17 +40,17 @@ public: protected: virtual bool PresentRenderImpl(); virtual void SetVSyncImpl(bool enable); - + CStdString m_glxext; int (*m_glXGetVideoSyncSGI)(unsigned int*); int (*m_glXWaitVideoSyncSGI)(int, int, unsigned int*); int (*m_glXSwapIntervalSGI)(int); int (*m_glXSwapIntervalMESA)(int); - + Bool (*m_glXGetSyncValuesOML)(Display* dpy, GLXDrawable drawable, int64_t* ust, int64_t* msc, int64_t* sbc); int64_t (*m_glXSwapBuffersMscOML)(Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor,int64_t remainder); - + int m_iVSyncErrors; }; diff --git a/xbmc/Zeroconf.cpp b/xbmc/Zeroconf.cpp index 725b9114c7..7bc624e166 100644 --- a/xbmc/Zeroconf.cpp +++ b/xbmc/Zeroconf.cpp @@ -86,7 +86,7 @@ bool CZeroconf::RemoveService(const std::string& fcr_identifier) m_service_map.erase(it); if(m_started) return doRemoveService(fcr_identifier); - else + else return true; } diff --git a/xbmc/Zeroconf.h b/xbmc/Zeroconf.h index bb911a384d..9517269ef2 100644 --- a/xbmc/Zeroconf.h +++ b/xbmc/Zeroconf.h @@ -20,7 +20,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include <string> #include <map> @@ -37,7 +37,7 @@ class CCriticalSection; class CZeroconf { public: - + //tries to publish this service via zeroconf //fcr_identifier can be used to stop this service later //fcr_type is the zeroconf service type to publish (e.g. _http._tcp for webserver) @@ -49,33 +49,33 @@ public: const std::string& fcr_type, const std::string& fcr_name, unsigned int f_port); - + ///removes the specified service ///returns false if fcr_identifier does not exist bool RemoveService(const std::string& fcr_identifier); - + ///returns true if fcr_identifier exists bool HasService(const std::string& fcr_identifier) const; - + //starts publishing //services that were added with PublishService(...) while Zeroconf wasn't //started, get published now. void Start(); - + // unpublishs all services (but keeps them stored in this class) // a call to Start() will republish them void Stop(); - + // class methods // access to singleton; singleton gets created on call if not existent - // if zeroconf is disabled (!HAS_ZEROCONF), this will return a dummy implementation that + // if zeroconf is disabled (!HAS_ZEROCONF), this will return a dummy implementation that // just does nothings, otherwise the platform specific one static CZeroconf* GetInstance(); // release the singleton; (save to call multiple times) static void ReleaseInstance(); // returns false if ReleaseInstance() was called befores static bool IsInstantiated() { return smp_instance != 0; } - + protected: //methods to implement for concrete implementations //publishs this service @@ -88,22 +88,22 @@ protected: //removes all services (short hand for "for i in m_service_map doRemoveService(i)") virtual void doStop() = 0; - + protected: - //singleton: we don't want to get instantiated nor copied or deleted from outside + //singleton: we don't want to get instantiated nor copied or deleted from outside CZeroconf(); CZeroconf(const CZeroconf&); - virtual ~CZeroconf(); - + virtual ~CZeroconf(); + private: struct PublishInfo{ std::string type; std::string name; - unsigned int port; + unsigned int port; }; - + //protects data - CCriticalSection* mp_crit_sec; + CCriticalSection* mp_crit_sec; typedef std::map<std::string, PublishInfo> tServiceMap; tServiceMap m_service_map; bool m_started; diff --git a/xbmc/ZeroconfBrowser.h b/xbmc/ZeroconfBrowser.h index d1c50f2611..e5b7b6c278 100644 --- a/xbmc/ZeroconfBrowser.h +++ b/xbmc/ZeroconfBrowser.h @@ -81,13 +81,13 @@ public: // stops browsing void Stop(); - + ///returns the list of found services /// if this is updated, the following message with "zeroconf://" as path is sent: /// CGUIMessage message(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_UPDATE_PATH); std::vector<ZeroconfService> GetFoundServices(); ///@} - + // resolves a ZeroconfService to ip + port // @param fcr_service the service to resolve // @param f_timeout timeout in seconds for resolving diff --git a/xbmc/cores/AudioRenderers/ALSADirectSound.cpp b/xbmc/cores/AudioRenderers/ALSADirectSound.cpp index 903c4427ef..77e4087092 100644 --- a/xbmc/cores/AudioRenderers/ALSADirectSound.cpp +++ b/xbmc/cores/AudioRenderers/ALSADirectSound.cpp @@ -276,7 +276,7 @@ bool CALSADirectSound::Initialize(IAudioCallback* pCallback, const CStdString& d CHECK_ALSA_RETURN(LOGERROR,"snd_pcm_sw_params",nErr); snd_pcm_hw_params_free (hw_params); - snd_pcm_sw_params_free (sw_params); + snd_pcm_sw_params_free (sw_params); m_bCanPause = !!snd_pcm_hw_params_can_pause(hw_params); @@ -341,7 +341,7 @@ bool CALSADirectSound::Pause() if(m_bCanPause) { - int nErr = snd_pcm_pause(m_pPlayHandle,1); // this is not supported on all devices. + int nErr = snd_pcm_pause(m_pPlayHandle,1); // this is not supported on all devices. CHECK_ALSA(LOGERROR,"pcm_pause",nErr); if(nErr<0) m_bCanPause = false; @@ -392,7 +392,7 @@ long CALSADirectSound::GetCurrentVolume() const //*********************************************************************************************** void CALSADirectSound::Mute(bool bMute) { - if (!m_bIsAllocated) + if (!m_bIsAllocated) return; if (bMute) @@ -418,7 +418,7 @@ unsigned int CALSADirectSound::GetSpace() if (!m_bIsAllocated) return 0; int nSpace = snd_pcm_avail_update(m_pPlayHandle); - if (nSpace == 0) + if (nSpace == 0) { snd_pcm_state_t state = snd_pcm_state(m_pPlayHandle); if(state != SND_PCM_STATE_RUNNING && !m_bPause) @@ -440,7 +440,7 @@ unsigned int CALSADirectSound::AddPackets(const void* data, unsigned int len) { if (!m_bIsAllocated) { CLog::Log(LOGERROR,"CALSADirectSound::AddPackets - sanity failed. no valid play handle!"); - return len; + return len; } // if we are paused we don't accept any data as pause doesn't always // work, and then playback would start again @@ -448,7 +448,7 @@ unsigned int CALSADirectSound::AddPackets(const void* data, unsigned int len) return 0; const unsigned char *pcmPtr = (const unsigned char *)data; - int framesToWrite; + int framesToWrite; framesToWrite = std::min(GetSpace(), len); framesToWrite /= m_dwPacketSize; @@ -459,7 +459,7 @@ unsigned int CALSADirectSound::AddPackets(const void* data, unsigned int len) if(framesToWrite == 0) return 0; - // handle volume de-amp + // handle volume de-amp if (!m_bPassthrough) m_amp.DeAmplify((short *)pcmPtr, framesToWrite * m_uiChannels); @@ -494,13 +494,13 @@ unsigned int CALSADirectSound::AddPackets(const void* data, unsigned int len) //*********************************************************************************************** float CALSADirectSound::GetDelay() { - if (!m_bIsAllocated) + if (!m_bIsAllocated) return 0.0; snd_pcm_sframes_t frames = 0; int nErr = snd_pcm_delay(m_pPlayHandle, &frames); - CHECK_ALSA(LOGERROR,"snd_pcm_delay",nErr); + CHECK_ALSA(LOGERROR,"snd_pcm_delay",nErr); if (nErr < 0) { frames = 0; Flush(); @@ -576,7 +576,7 @@ void CALSADirectSound::EnumerateAudioSinks(AudioSinkList& vAudioSinks, bool pass int n_cards = -1; int numberCards = 0; - while ( snd_card_next( &n_cards ) == 0 && n_cards >= 0 ) + while ( snd_card_next( &n_cards ) == 0 && n_cards >= 0 ) numberCards++; if (numberCards <= 1) @@ -598,10 +598,10 @@ void CALSADirectSound::EnumerateAudioSinks(AudioSinkList& vAudioSinks, bool pass CStdString strReadableCardName = snd_ctl_card_info_get_name( info ); CStdString strCardName = snd_ctl_card_info_get_id( info ); - if (!passthrough) - GenSoundLabel(vAudioSinks, "default", strCardName, strReadableCardName); - GenSoundLabel(vAudioSinks, "iec958", strCardName, strReadableCardName); - GenSoundLabel(vAudioSinks, "hdmi", strCardName, strReadableCardName); + if (!passthrough) + GenSoundLabel(vAudioSinks, "default", strCardName, strReadableCardName); + GenSoundLabel(vAudioSinks, "iec958", strCardName, strReadableCardName); + GenSoundLabel(vAudioSinks, "hdmi", strCardName, strReadableCardName); } else CLog::Log(LOGERROR,"((ALSAENUM))control hardware info (%i): failed.\n", n_cards ); diff --git a/xbmc/cores/AudioRenderers/ALSADirectSound.h b/xbmc/cores/AudioRenderers/ALSADirectSound.h index f314a67bff..f72e1fddde 100644 --- a/xbmc/cores/AudioRenderers/ALSADirectSound.h +++ b/xbmc/cores/AudioRenderers/ALSADirectSound.h @@ -93,5 +93,5 @@ private: bool m_bPassthrough; }; -#endif +#endif diff --git a/xbmc/cores/AudioRenderers/AudioRendererFactory.cpp b/xbmc/cores/AudioRenderers/AudioRendererFactory.cpp index 7243329df9..df6b23e5f0 100644 --- a/xbmc/cores/AudioRenderers/AudioRendererFactory.cpp +++ b/xbmc/cores/AudioRenderers/AudioRendererFactory.cpp @@ -61,7 +61,7 @@ IAudioRenderer* CAudioRendererFactory::Create(IAudioCallback* pCallback, int iCh deviceString = g_guiSettings.GetString("audiooutput.passthroughdevice"); if (deviceString.Equals("custom")) deviceString = g_guiSettings.GetString("audiooutput.custompassthrough"); - + // some platforms (osx) do not have a separate passthroughdevice setting. if (deviceString.IsEmpty()) deviceString = g_guiSettings.GetString("audiooutput.audiodevice"); @@ -71,7 +71,7 @@ IAudioRenderer* CAudioRendererFactory::Create(IAudioCallback* pCallback, int iCh deviceString = g_guiSettings.GetString("audiooutput.audiodevice"); if (deviceString.Equals("custom")) deviceString = g_guiSettings.GetString("audiooutput.customdevice"); - } + } int iPos = deviceString.Find(":"); if (iPos > 0) { diff --git a/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp b/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp index 0d78b47f21..cc9d9f0b59 100644 --- a/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp +++ b/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp @@ -49,10 +49,10 @@ void* CAtomicAllocator::Alloc() void CAtomicAllocator::Free(void* p) { - lf_heap_free(&m_Heap, p); + lf_heap_free(&m_Heap, p); } -size_t CAtomicAllocator::GetBlockSize() +size_t CAtomicAllocator::GetBlockSize() { return m_BlockSize; } @@ -79,7 +79,7 @@ CSliceQueue::~CSliceQueue() // NOTE: The value of m_TotalBytes is only guaranteed to be accurate to within one slice, // but is sufficient. This means that it may at times be one slice too high or one slice // tool low, but will never be < 0. -void CSliceQueue::Push(audio_slice* pSlice) +void CSliceQueue::Push(audio_slice* pSlice) { if (pSlice) { @@ -134,11 +134,11 @@ size_t CSliceQueue::GetData(void* pBuf, size_t bufLen) { if (!pBuf || !bufLen) return 0; - + size_t remainder = 0; audio_slice* pNext = NULL; size_t bytesUsed = 0; - + // See if we can fill the request out of our partial slice (if there is one) if (m_RemainderSize >= bufLen) { @@ -155,7 +155,7 @@ size_t CSliceQueue::GetData(void* pBuf, size_t bufLen) bytesUsed += m_RemainderSize; m_RemainderSize = 0; } - + // Pull slices from the fifo until we have enough data do // TODO: The efficiency of this loop can be improved (a lot I imagine) { @@ -169,27 +169,27 @@ size_t CSliceQueue::GetData(void* pBuf, size_t bufLen) bytesUsed += (nextLen - remainder); // Increment output size (remainder will be captured separately) if (!remainder) m_pAllocator->Free(pNext); // Free the copied slice - } while (bytesUsed < bufLen); + } while (bytesUsed < bufLen); } - + // Clean up the previous partial slice if (!m_RemainderSize && m_pPartialSlice) { m_pAllocator->Free(m_pPartialSlice); m_pPartialSlice = NULL; } - + // Save off the new partial slice (if there is one) if (remainder) { m_pPartialSlice = pNext; m_RemainderSize = remainder; } - + return bytesUsed; } -size_t CSliceQueue::GetTotalBytes() +size_t CSliceQueue::GetTotalBytes() { return m_TotalBytes + m_RemainderSize; } @@ -220,12 +220,12 @@ CCoreAudioPerformance::CCoreAudioPerformance() : m_WatchdogBitrateSensitivity(0.99f), m_WatchdogPreroll(0) { - + } CCoreAudioPerformance::~CCoreAudioPerformance() { - + } void CCoreAudioPerformance::Init(UInt32 expectedBytesPerSec, UInt32 watchdogInterval /*= 1000*/, UInt32 flags /*=0*/) @@ -239,10 +239,10 @@ void CCoreAudioPerformance::ReportData(UInt32 bytesIn, UInt32 bytesOut) { m_TotalBytesIn += bytesIn; m_TotalBytesOut += bytesOut; - + if (!m_WatchdogEnable) return; - + // Perform watchdog funtions UInt32 time = CTimeUtils::GetTimeMS(); if (!m_LastWatchdogCheck) @@ -254,12 +254,12 @@ void CCoreAudioPerformance::ReportData(UInt32 bytesIn, UInt32 bytesOut) if (m_TotalBytesOut > m_WatchdogPreroll) // Allow m_WatchdogPreroll bytes to go by unmonitored { // Check outgoing bitrate - if (m_ActualBytesPerSec < m_WatchdogBitrateSensitivity * m_ExpectedBytesPerSec) + if (m_ActualBytesPerSec < m_WatchdogBitrateSensitivity * m_ExpectedBytesPerSec) CLog::Log(LOGWARNING, "CCoreAudioPerformance: Outgoing bitrate is lagging. Target: %lu, Actual: %lu. deltaTime was %lu", m_ExpectedBytesPerSec, m_ActualBytesPerSec, deltaTime); } m_LastWatchdogCheck = time; m_LastWatchdogBytesIn = m_TotalBytesIn; - m_LastWatchdogBytesOut = m_TotalBytesOut; + m_LastWatchdogBytesOut = m_TotalBytesOut; } } @@ -287,7 +287,7 @@ void CCoreAudioPerformance::Reset() m_ActualBytesPerSec = 0; m_LastWatchdogCheck = 0; m_LastWatchdogBytesIn = 0; - m_LastWatchdogBytesOut = 0; + m_LastWatchdogBytesOut = 0; } //*********************************************************************************************** @@ -310,7 +310,7 @@ CCoreAudioRenderer::CCoreAudioRenderer() : SInt32 major, minor; Gestalt(gestaltSystemVersionMajor, &major); Gestalt(gestaltSystemVersionMinor, &minor); - + // By default, kAudioHardwarePropertyRunLoop points at the process's main thread on SnowLeopard, // If your process lacks such a run loop, you can set kAudioHardwarePropertyRunLoop to NULL which // tells the HAL to run it's own thread for notifications (which was the default prior to SnowLeopard). @@ -342,17 +342,17 @@ if (!m_Initialized) \ return x bool CCoreAudioRenderer::Initialize(IAudioCallback* pCallback, const CStdString& device, int iChannels, unsigned int uiSamplesPerSec, unsigned int uiBitsPerSample, bool bResample, const char* strAudioCodec, bool bIsMusic, bool bPassthrough) -{ +{ if (m_Initialized) // Have to clean house before we start again. TODO: Should we return failure instead? Deinitialize(); - + if(bPassthrough) g_audioContext.SetActiveDevice(CAudioContext::DIRECTSOUND_DEVICE_DIGITAL); else g_audioContext.SetActiveDevice(CAudioContext::DIRECTSOUND_DEVICE); // TODO: If debugging, output information about all devices/streams - + // Attempt to find the configured output device AudioDeviceID outputDevice = CCoreAudioHardware::FindAudioDevice(g_guiSettings.GetString("audiooutput.audiodevice")); if (!outputDevice) // Fall back to the default device if no match is found @@ -362,9 +362,9 @@ bool CCoreAudioRenderer::Initialize(IAudioCallback* pCallback, const CStdString& if (!outputDevice) // Not a lot to be done with no device. TODO: Should we just grab the first existing device? return false; } - + // TODO: Determine if the device is in-use/locked by another process. - + // Attach our output object to the device m_AudioDevice.Open(outputDevice); @@ -376,7 +376,7 @@ bool CCoreAudioRenderer::Initialize(IAudioCallback* pCallback, const CStdString& Sleep(100); } - // If this is a PCM stream, or we failed to handle a passthrough stream natively, + // If this is a PCM stream, or we failed to handle a passthrough stream natively, // prepare the standard interleaved PCM interface if (!m_Passthrough) { @@ -387,7 +387,7 @@ bool CCoreAudioRenderer::Initialize(IAudioCallback* pCallback, const CStdString& // Hook the Ouput AudioUnit to the selected device if (!m_AudioUnit.SetCurrentDevice(outputDevice)) return false; - + // If we are here and this is a passthrough stream, native handling failed. // Try to handle it as IEC61937 data over straight PCM (DD-Wav) bool configured = false; @@ -399,28 +399,28 @@ bool CCoreAudioRenderer::Initialize(IAudioCallback* pCallback, const CStdString& Sleep(100); } else - { + { // Standard PCM data configured = InitializePCM(iChannels, uiSamplesPerSec, uiBitsPerSample); // TODO: wait for audio device startup Sleep(100); } - + if (!configured) // No suitable output format was able to be configured return false; - + // Configure the maximum number of frames that the AudioUnit will ask to process at one time. // If this is not called, there is no guarantee that the callback will ever be called. UInt32 bufferFrames = m_AudioUnit.GetBufferFrameSize(); // Size of the output buffer, in Frames if (!m_AudioUnit.SetMaxFramesPerSlice(bufferFrames)) - return false; - + return false; + m_ChunkLen = bufferFrames * m_BytesPerFrame; // This is the minimum amount of data that we will accept from a client // Setup the callback function that the AudioUnit will use to request data if (!m_AudioUnit.SetRenderProc(RenderCallback, this)) return false; - + // Initialize the Output AudioUnit if (!m_AudioUnit.Initialize()) return false; @@ -431,9 +431,9 @@ bool CCoreAudioRenderer::Initialize(IAudioCallback* pCallback, const CStdString& m_AudioUnit.GetInputFormat(&inputDesc_end); m_AudioUnit.GetOutputFormat(&outputDesc_end); CLog::Log(LOGDEBUG, "CoreAudioRenderer::Initialize: Input Stream Format %s", StreamDescriptionToString(inputDesc_end, formatString)); - CLog::Log(LOGDEBUG, "CoreAudioRenderer::Initialize: Output Stream Format % s", StreamDescriptionToString(outputDesc_end, formatString)); + CLog::Log(LOGDEBUG, "CoreAudioRenderer::Initialize: Output Stream Format % s", StreamDescriptionToString(outputDesc_end, formatString)); } - + m_NumLatencyFrames = m_AudioDevice.GetNumLatencyFrames(); m_MaxCacheLen = m_AvgBytesPerSec; // Set the max cache size to 1 second of data. TODO: Make this more intelligent m_Pause = true; // Suspend rendering. We will start once we have some data. @@ -447,11 +447,11 @@ bool CCoreAudioRenderer::Initialize(IAudioCallback* pCallback, const CStdString& m_DoRunout = 0; SetCurrentVolume(g_settings.m_nVolumeLevel); - + CLog::Log(LOGDEBUG, "CoreAudioRenderer::Initialize: Renderer Configuration - Chunk Len: %u, Max Cache: %lu (%0.0fms).", m_ChunkLen, m_MaxCacheLen, 1000.0 *(float)m_MaxCacheLen/(float)m_AvgBytesPerSec); - CLog::Log(LOGINFO, "CoreAudioRenderer::Initialize: Successfully configured audio output."); + CLog::Log(LOGINFO, "CoreAudioRenderer::Initialize: Successfully configured audio output."); + - return true; } @@ -478,11 +478,11 @@ bool CCoreAudioRenderer::Deinitialize() m_RunoutEvent = kInvalidID; m_DoRunout = 0; m_EnableVolumeControl = true; - + g_audioContext.SetActiveDevice(CAudioContext::DEFAULT_DEVICE); - + CLog::Log(LOGINFO, "CoreAudioRenderer::Deinitialize: Renderer has been shut down."); - + return true; } @@ -492,7 +492,7 @@ bool CCoreAudioRenderer::Deinitialize() bool CCoreAudioRenderer::Pause() { VERIFY_INIT(false); - + if (!m_Pause) { CLog::Log(LOGDEBUG, "CoreAudioRenderer::Pause: Pausing Playback."); @@ -562,14 +562,14 @@ void CCoreAudioRenderer::Mute(bool bMute) } bool CCoreAudioRenderer::SetCurrentVolume(LONG nVolume) -{ +{ VERIFY_INIT(false); if (m_EnableVolumeControl) // Don't change actual volume for encoded streams - { + { // Convert milliBels to percent Float32 volPct = pow(10.0f, (float)nVolume/2000.0f); - + // Try to set the volume. If it fails there is not a lot to be done. if (!m_AudioUnit.SetCurrentVolume(volPct)) return false; @@ -588,25 +588,25 @@ unsigned int CCoreAudioRenderer::GetSpace() } unsigned int CCoreAudioRenderer::AddPackets(const void* data, DWORD len) -{ +{ VERIFY_INIT(0); - + // Require at least one 'chunk'. This allows us at least some measure of control over efficiency if (len < m_ChunkLen || m_pCache->GetTotalBytes() >= m_MaxCacheLen) return 0; - unsigned int cacheSpace = GetSpace(); + unsigned int cacheSpace = GetSpace(); if (len > cacheSpace) return 0; // Wait until we can accept all of it - + size_t bytesUsed = m_pCache->AddData((void*)data, len); - + #ifdef _DEBUG // Update tracking variable m_PerfMon.ReportData(bytesUsed, 0); #endif Resume(); // We have some data. Attmept to resume playback - + return bytesUsed; // Number of bytes added to cache; } @@ -617,7 +617,7 @@ float CCoreAudioRenderer::GetDelay() float delay = (float)m_pCache->GetTotalBytes()/(float)m_AvgBytesPerSec; // TODO: Obtain hardware/os latency for better accuracy delay += (float)m_NumLatencyFrames/(float)m_AvgBytesPerSec; - + return delay; } @@ -642,7 +642,7 @@ void CCoreAudioRenderer::WaitCompletion() if (m_pCache->GetTotalBytes() == 0) // The cache is already empty. There is nothing to wait for. return; - + if (m_RunoutEvent != kInvalidID) { AtomicIncrement(&m_DoRunout); // Signal that we are waiting @@ -667,7 +667,7 @@ void CCoreAudioRenderer::WaitCompletion() } else CLog::Log(LOGERROR, "CCoreAudioRenderer::WaitCompletion: Invalid runout event. Remaining data will be truncated."); - + Stop(); } @@ -675,10 +675,10 @@ void CCoreAudioRenderer::WaitCompletion() // Rendering Methods //*********************************************************************************************** OSStatus CCoreAudioRenderer::OnRender(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) -{ +{ if (!m_Initialized) CLog::Log(LOGERROR, "CCoreAudioRenderer::OnRender: Callback to de/unitialized renderer."); - + // Process the request UInt32 bytesRequested = m_BytesPerFrame * inNumberFrames; // Data length requested, based on the input data format UInt32 bytesRead = (UInt32)m_pCache->GetData(ioData->mBuffers[m_OutputBufferIndex].mData, bytesRequested); @@ -695,11 +695,11 @@ OSStatus CCoreAudioRenderer::OnRender(AudioUnitRenderActionFlags *ioActionFlags, CLog::Log(LOGDEBUG, "CCoreAudioRenderer::OnRender: Buffer underrun."); } // Hard mute for formats that do not allow standard volume control. Throw away any actual data to keep the stream moving. - if (!m_EnableVolumeControl && m_CurrentVolume <= VOLUME_MINIMUM) + if (!m_EnableVolumeControl && m_CurrentVolume <= VOLUME_MINIMUM) ioData->mBuffers[m_OutputBufferIndex].mDataByteSize = 0; else ioData->mBuffers[m_OutputBufferIndex].mDataByteSize = bytesRead; - + #ifdef _DEBUG // Calculate stats and perform a sanity check m_PerfMon.ReportData(0, bytesRead); // TODO: Should we check the result? @@ -707,7 +707,7 @@ OSStatus CCoreAudioRenderer::OnRender(AudioUnitRenderActionFlags *ioActionFlags, return noErr; } -// Static Callback from AudioUnit +// Static Callback from AudioUnit OSStatus CCoreAudioRenderer::RenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) { return ((CCoreAudioRenderer*)inRefCon)->OnRender(ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, ioData); @@ -724,7 +724,7 @@ OSStatus CCoreAudioRenderer::DirectRenderCallback(AudioDeviceID inDevice, const // Audio Device Initialization Methods //*********************************************************************************************** bool CCoreAudioRenderer::InitializePCM(UInt32 channels, UInt32 samplesPerSecond, UInt32 bitsPerSample) -{ +{ // Set the input stream format for the AudioUnit (this is what is being sent to us) AudioStreamBasicDescription inputFormat; inputFormat.mFormatID = kAudioFormatLinearPCM; // Data encoding format @@ -736,17 +736,17 @@ bool CCoreAudioRenderer::InitializePCM(UInt32 channels, UInt32 samplesPerSecond, inputFormat.mBitsPerChannel = bitsPerSample; // Number of bits per sample, per channel inputFormat.mBytesPerFrame = (bitsPerSample>>3) * channels; // Size of a frame == 1 sample per channel inputFormat.mFramesPerPacket = 1; // The smallest amount of indivisible data. Always 1 for uncompressed audio - inputFormat.mBytesPerPacket = inputFormat.mBytesPerFrame * inputFormat.mFramesPerPacket; + inputFormat.mBytesPerPacket = inputFormat.mBytesPerFrame * inputFormat.mFramesPerPacket; inputFormat.mReserved = 0; if (!m_AudioUnit.SetInputFormat(&inputFormat)) return false; // TODO: Handle channel mapping - + m_BytesPerFrame = inputFormat.mBytesPerFrame; m_AvgBytesPerSec = inputFormat.mSampleRate * inputFormat.mBytesPerFrame; // 1 sample per channel per frame m_EnableVolumeControl = true; - + return true; } @@ -754,40 +754,40 @@ bool CCoreAudioRenderer::InitializePCMEncoded(UInt32 sampleRate) { m_AudioDevice.SetHogStatus(true); // Prevent any other application from using this device. m_AudioDevice.SetMixingSupport(false); // Try to disable mixing support. Effectiveness depends on the device. - + // Set the Sample Rate as defined by the spec. m_AudioDevice.SetNominalSampleRate((float)sampleRate); if (!InitializePCM(2, sampleRate, 16)) return false; - + m_EnableVolumeControl = false; // Prevent attempts to change the output volume. It is not possible with encoded audio - return true; + return true; } bool CCoreAudioRenderer::InitializeEncoded(AudioDeviceID outputDevice, UInt32 sampleRate) { //return false; // un-comment to force PCM Spoofing (DD-Wav). For testing use only. - + CStdString formatString; AudioStreamBasicDescription outputFormat = {0}; AudioStreamID outputStream = 0; - + // Fetch a list of the streams defined by the output device AudioStreamIdList streams; UInt32 streamIndex = 0; m_AudioDevice.GetStreams(&streams); - + while (!streams.empty()) { // Get the next stream CCoreAudioStream stream; stream.Open(streams.front()); streams.pop_front(); // We copied it, now we are done with it - - CLog::Log(LOGDEBUG, "CoreAudioRenderer::InitializeEncoded: Found %s stream - id: 0x%04X, Terminal Type: 0x%04lX", - stream.GetDirection() ? "Input" : "Output", - stream.GetId(), + + CLog::Log(LOGDEBUG, "CoreAudioRenderer::InitializeEncoded: Found %s stream - id: 0x%04X, Terminal Type: 0x%04lX", + stream.GetDirection() ? "Input" : "Output", + stream.GetId(), stream.GetTerminalType()); // Probe physical formats @@ -805,32 +805,32 @@ bool CCoreAudioRenderer::InitializeEncoded(AudioDeviceID outputDevice, UInt32 sa break; } physicalFormats.pop_front(); - } - + } + // TODO: How do we determine if this is the right stream (not just the right format) to use? if (outputFormat.mFormatID) break; // We found a suitable format. No need to continue. streamIndex++; } - + if (!outputFormat.mFormatID) // No match found { CLog::Log(LOGERROR, "CoreAudioRenderer::InitializeEncoded: Unable to identify suitable output format."); return false; - } + } m_ChunkLen = outputFormat.mBytesPerPacket; // 1 Chunk == 1 Packet m_AvgBytesPerSec = outputFormat.mChannelsPerFrame * (outputFormat.mBitsPerChannel>>3) * outputFormat.mSampleRate; // mBytesPerFrame is 0 for a cac3 stream m_BytesPerFrame = outputFormat.mChannelsPerFrame * (outputFormat.mBitsPerChannel>>3); - CLog::Log(LOGDEBUG, "CoreAudioRenderer::InitializeEncoded: Selected stream[%lu] - id: 0x%04lX, Physical Format: %s (%lu Bytes/sec.)", streamIndex, outputStream, StreamDescriptionToString(outputFormat, formatString), m_AvgBytesPerSec); - + CLog::Log(LOGDEBUG, "CoreAudioRenderer::InitializeEncoded: Selected stream[%lu] - id: 0x%04lX, Physical Format: %s (%lu Bytes/sec.)", streamIndex, outputStream, StreamDescriptionToString(outputFormat, formatString), m_AvgBytesPerSec); + // TODO: Auto hogging sets this for us. Figure out how/when to turn it off or use it // It appears that leaving this set will aslo restore the previous stream format when the // Application exits. If auto hogging is set and we try to set hog mode, we will deadlock // From the SDK docs: "If the AudioDevice is in a non-mixable mode, the HAL will automatically take hog mode on behalf of the first process to start an IOProc." - + // Lock down the device. This MUST be done PRIOR to switching to a non-mixable format, if it is done at all - // If it is attempted after the format change, there is a high likelihood of a deadlock + // If it is attempted after the format change, there is a high likelihood of a deadlock // We may need to do this sooner to enable mix-disable (i.e. before setting the stream format) CCoreAudioHardware::SetAutoHogMode(false); // Auto-Hog does not always un-hog the device when changing back to a mixable mode. Handle this on our own until it is fixed. @@ -842,7 +842,7 @@ bool CCoreAudioRenderer::InitializeEncoded(AudioDeviceID outputDevice, UInt32 sa m_AudioDevice.SetMixingSupport(false); // Try to disable mixing. If we cannot, it may not be a problem } m_NumLatencyFrames = m_AudioDevice.GetNumLatencyFrames(); - + // Configure the output stream object m_OutputStream.Open(outputStream); // This is the one we will keep AudioStreamBasicDescription previousFormat; @@ -850,10 +850,10 @@ bool CCoreAudioRenderer::InitializeEncoded(AudioDeviceID outputDevice, UInt32 sa CLog::Log(LOGDEBUG, "CoreAudioRenderer::InitializeEncoded: Previous Physical Format: %s (%lu Bytes/sec.)", StreamDescriptionToString(previousFormat, formatString), m_AvgBytesPerSec); m_OutputStream.SetPhysicalFormat(&outputFormat); // Set the active format (the old one will be reverted when we close) m_NumLatencyFrames += m_OutputStream.GetNumLatencyFrames(); - + // Register for data request callbacks from the driver m_AudioDevice.AddIOProc(DirectRenderCallback, this); - + m_EnableVolumeControl = false; // Prevent attempts to change the output volume. It is not possible with encoded audio return true; } diff --git a/xbmc/cores/AudioRenderers/CoreAudioRenderer.h b/xbmc/cores/AudioRenderers/CoreAudioRenderer.h index c88cdba8ca..7e01971345 100644 --- a/xbmc/cores/AudioRenderers/CoreAudioRenderer.h +++ b/xbmc/cores/AudioRenderers/CoreAudioRenderer.h @@ -90,7 +90,7 @@ protected: UInt32 m_ActualBytesPerSec; UInt32 m_Flags; bool m_WatchdogEnable; - UInt32 m_WatchdogInterval; + UInt32 m_WatchdogInterval; UInt32 m_LastWatchdogCheck; UInt32 m_LastWatchdogBytesIn; UInt32 m_LastWatchdogBytesOut; @@ -114,7 +114,7 @@ class CCoreAudioRenderer : public IAudioRenderer virtual bool Pause(); virtual bool Stop(); virtual bool Resume(); - + virtual long GetCurrentVolume() const; virtual void Mute(bool bMute); virtual bool SetCurrentVolume(long nVolume); @@ -137,25 +137,25 @@ class CCoreAudioRenderer : public IAudioRenderer bool m_Pause; bool m_Initialized; // Prevent multiple init/deinit - + long m_CurrentVolume; // Courtesy of the jerk that made GetCurrentVolume a const... unsigned int m_ChunkLen; // Minimum amount of data accepted by AddPackets CSliceQueue* m_pCache; size_t m_MaxCacheLen; // Maximum number of bytes to be cached by the renderer. - + CCoreAudioUnit m_AudioUnit; CCoreAudioDevice m_AudioDevice; CCoreAudioStream m_OutputStream; UInt32 m_OutputBufferIndex; - + bool m_Passthrough; bool m_EnableVolumeControl; - + // Stream format size_t m_AvgBytesPerSec; size_t m_BytesPerFrame; // Input frame size UInt32 m_NumLatencyFrames; - + #ifdef _DEBUG // Performace Monitoring CCoreAudioPerformance m_PerfMon; @@ -165,4 +165,4 @@ class CCoreAudioRenderer : public IAudioRenderer long m_DoRunout; }; -#endif +#endif diff --git a/xbmc/cores/AudioRenderers/NullDirectSound.h b/xbmc/cores/AudioRenderers/NullDirectSound.h index bfafc73786..6358e4a3b7 100644 --- a/xbmc/cores/AudioRenderers/NullDirectSound.h +++ b/xbmc/cores/AudioRenderers/NullDirectSound.h @@ -71,4 +71,4 @@ private: void Update(); }; -#endif +#endif diff --git a/xbmc/cores/AudioRenderers/PulseAudioDirectSound.cpp b/xbmc/cores/AudioRenderers/PulseAudioDirectSound.cpp index eb199b1be0..6a2cc47843 100644 --- a/xbmc/cores/AudioRenderers/PulseAudioDirectSound.cpp +++ b/xbmc/cores/AudioRenderers/PulseAudioDirectSound.cpp @@ -178,7 +178,7 @@ bool CPulseAudioDirectSound::Initialize(IAudioCallback* pCallback, const CStdStr CLog::Log(LOGWARNING, "PulseAudio: Does not support passthrough"); return false; } - + std::vector<CStdString> hostdevice; CUtil::Tokenize(device, hostdevice, "@"); @@ -196,9 +196,9 @@ bool CPulseAudioDirectSound::Initialize(IAudioCallback* pCallback, const CStdStr m_SampleSpec.channels = iChannels; m_SampleSpec.rate = uiSamplesPerSec; - m_SampleSpec.format = PA_SAMPLE_S16NE; + m_SampleSpec.format = PA_SAMPLE_S16NE; - if (!pa_sample_spec_valid(&m_SampleSpec)) + if (!pa_sample_spec_valid(&m_SampleSpec)) { CLog::Log(LOGERROR, "PulseAudio: Invalid sample spec"); Deinitialize(); @@ -275,7 +275,7 @@ bool CPulseAudioDirectSound::Initialize(IAudioCallback* pCallback, const CStdStr CLog::Log(LOGDEBUG, "PulseAudio: Choosen buffer attributes, maxlength=%u, tlength=%u, prebuf=%u, minreq=%u", a->maxlength, a->tlength, a->prebuf, a->minreq); } } - + pa_threaded_mainloop_unlock(m_MainLoop); m_bIsAllocated = true; @@ -374,7 +374,7 @@ bool CPulseAudioDirectSound::Pause() if (!m_bIsAllocated) return -1; - if (m_bPause) + if (m_bPause) return true; m_bPause = Cork(true); @@ -417,7 +417,7 @@ long CPulseAudioDirectSound::GetCurrentVolume() const void CPulseAudioDirectSound::Mute(bool bMute) { - if (!m_bIsAllocated) + if (!m_bIsAllocated) return; if (bMute) @@ -476,7 +476,7 @@ unsigned int CPulseAudioDirectSound::AddPackets(const void* data, unsigned int l pa_threaded_mainloop_unlock(m_MainLoop); - if (m_bAutoResume) + if (m_bAutoResume) m_bAutoResume = !Resume(); return length - rtn; @@ -620,7 +620,7 @@ bool CPulseAudioDirectSound::SetupContext(const char *host, pa_context **context /* Wait until the context is ready */ do - { + { pa_threaded_mainloop_wait(*mainloop); CLog::Log(LOGDEBUG, "PulseAudio: Context %s", ContextStateToString(pa_context_get_state(*context))); } diff --git a/xbmc/cores/AudioRenderers/PulseAudioDirectSound.h b/xbmc/cores/AudioRenderers/PulseAudioDirectSound.h index a91330f73b..03e3d02c98 100644 --- a/xbmc/cores/AudioRenderers/PulseAudioDirectSound.h +++ b/xbmc/cores/AudioRenderers/PulseAudioDirectSound.h @@ -77,7 +77,7 @@ private: long m_nCurrentVolume; unsigned int m_dwPacketSize; unsigned int m_dwNumPackets; - + bool m_bIsAllocated; unsigned int m_uiBytesPerSecond; @@ -96,5 +96,5 @@ private: pa_threaded_mainloop *m_MainLoop; }; -#endif +#endif diff --git a/xbmc/cores/AudioRenderers/Win32DirectSound.cpp b/xbmc/cores/AudioRenderers/Win32DirectSound.cpp index d101f3dec4..c5cccb43ee 100644 --- a/xbmc/cores/AudioRenderers/Win32DirectSound.cpp +++ b/xbmc/cores/AudioRenderers/Win32DirectSound.cpp @@ -35,7 +35,7 @@ DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, WAVE_FORMAT_IEEE_FLOAT, 0x0000, 0 DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_PCM, WAVE_FORMAT_PCM, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 ); DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF, WAVE_FORMAT_DOLBY_AC3_SPDIF, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 ); -const int dsound_channel_mask[] = +const int dsound_channel_mask[] = { SPEAKER_FRONT_CENTER, SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT, @@ -52,10 +52,10 @@ const int dsound_channel_mask[] = static BOOL CALLBACK DSEnumCallback(LPGUID lpGuid, LPCTSTR lpcstrDescription, LPCTSTR lpcstrModule, LPVOID lpContext) { AudioSinkList& enumerator = *static_cast<AudioSinkList*>(lpContext); - + CStdString device(lpcstrDescription); g_charsetConverter.unknownToUTF8(device); - + enumerator.push_back(AudioSink(CStdString("DirectSound: ").append(device), CStdString("directsound:").append(device))); return TRUE; @@ -102,7 +102,7 @@ bool CWin32DirectSound::Initialize(IAudioCallback* pCallback, const CStdString& m_Passthrough = bAudioPassthrough; m_nCurrentVolume = g_settings.m_nVolumeLevel; - + WAVEFORMATEXTENSIBLE wfxex = {0}; //fill waveformatex @@ -110,14 +110,14 @@ bool CWin32DirectSound::Initialize(IAudioCallback* pCallback, const CStdString& wfxex.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX); wfxex.Format.nChannels = iChannels; wfxex.Format.nSamplesPerSec = uiSamplesPerSec; - if (bAudioPassthrough == true) + if (bAudioPassthrough == true) { wfxex.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; wfxex.Format.wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF; wfxex.SubFormat = _KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF; wfxex.Format.wBitsPerSample = 16; wfxex.Format.nChannels = 2; - } + } else { wfxex.dwChannelMask = dsound_channel_mask[iChannels - 1]; @@ -158,7 +158,7 @@ bool CWin32DirectSound::Initialize(IAudioCallback* pCallback, const CStdString& // now create the stream buffer HRESULT res = IDirectSound_CreateSoundBuffer(m_pDSound, &dsbdesc, &m_pBuffer, NULL); - if (res != DS_OK) + if (res != DS_OK) { if (dsbdesc.dwFlags & DSBCAPS_LOCHARDWARE) // DSBCAPS_LOCHARDWARE Always fails on Vista, by design { @@ -168,7 +168,7 @@ bool CWin32DirectSound::Initialize(IAudioCallback* pCallback, const CStdString& dsbdesc.dwFlags &= ~DSBCAPS_LOCHARDWARE; res = IDirectSound_CreateSoundBuffer(m_pDSound, &dsbdesc, &m_pBuffer, NULL); } - if (res != DS_OK && dsbdesc.dwFlags & DSBCAPS_CTRLVOLUME) + if (res != DS_OK && dsbdesc.dwFlags & DSBCAPS_CTRLVOLUME) { SAFE_RELEASE(m_pBuffer); CLog::Log(LOGDEBUG, __FUNCTION__": Couldn't create secondary buffer (%s). Trying without CTRLVOLUME.", dserr2str(res)); @@ -176,7 +176,7 @@ bool CWin32DirectSound::Initialize(IAudioCallback* pCallback, const CStdString& dsbdesc.dwFlags &= ~DSBCAPS_CTRLVOLUME; res = IDirectSound_CreateSoundBuffer(m_pDSound, &dsbdesc, &m_pBuffer, NULL); } - if (res != DS_OK) + if (res != DS_OK) { SAFE_RELEASE(m_pBuffer); CLog::Log(LOGERROR, __FUNCTION__": cannot create secondary buffer (%s)", dserr2str(res)); @@ -189,7 +189,7 @@ bool CWin32DirectSound::Initialize(IAudioCallback* pCallback, const CStdString& SetChannelMap(iChannels, uiBitsPerSample, bAudioPassthrough, strAudioCodec); m_pBuffer->Stop(); - + if (DSERR_CONTROLUNAVAIL == m_pBuffer->SetVolume(g_settings.m_nVolumeLevel)) CLog::Log(LOGINFO, __FUNCTION__": Volume control is unavailable in the current configuration"); @@ -197,7 +197,7 @@ bool CWin32DirectSound::Initialize(IAudioCallback* pCallback, const CStdString& m_BufferOffset = 0; m_CacheLen = 0; m_LastCacheCheck = CTimeUtils::GetTimeMS(); - + return m_bIsAllocated; } @@ -221,7 +221,7 @@ bool CWin32DirectSound::Deinitialize() } m_pBuffer = NULL; - m_pDSound = NULL; + m_pDSound = NULL; m_BufferOffset = 0; m_CacheLen = 0; m_dwChunkSize = 0; @@ -322,7 +322,7 @@ unsigned int CWin32DirectSound::AddPackets(const void* data, unsigned int len) m_BufferOffset = 0; HRESULT res = m_pBuffer->Lock(m_BufferOffset, m_dwChunkSize, &start, &size, &startWrap, &sizeWrap, 0); if (DS_OK != res) - { + { CLog::Log(LOGERROR, __FUNCTION__ ": Unable to lock buffer at offset %u. HRESULT: 0x%08x", m_BufferOffset, res); break; } @@ -335,7 +335,7 @@ unsigned int CWin32DirectSound::AddPackets(const void* data, unsigned int len) MapDataIntoBuffer(pBuffer + size, sizeWrap, (unsigned char*)startWrap); m_BufferOffset = sizeWrap; } - + size_t bytes = size + sizeWrap; m_CacheLen += bytes; // This data is now in the cache pBuffer += bytes; // Update buffer pointer @@ -386,7 +386,7 @@ void CWin32DirectSound::UpdateCacheStatus() if ((playCursor > writeCursor && m_BufferOffset < writeCursor) || // (1) (playCursor < m_BufferOffset && m_BufferOffset < writeCursor) || // (2) (playCursor > writeCursor && playCursor < m_BufferOffset)) // (3) - { + { CLog::Log(LOGWARNING, "CWin32DirectSound::GetSpace - buffer underrun - W:%u, P:%u, O:%u.", writeCursor, playCursor, m_BufferOffset); m_BufferOffset = writeCursor; // Catch up m_pBuffer->Stop(); // Wait until someone gives us some data to restart playback (prevents glitches) @@ -539,7 +539,7 @@ void CWin32DirectSound::EnumerateAudioSinks(AudioSinkList &vAudioSinks, bool pas //*********************************************************************************************** char * CWin32DirectSound::dserr2str(int err) { - switch (err) + switch (err) { case DS_OK: return "DS_OK"; case DS_NO_VIRTUALIZATION: return "DS_NO_VIRTUALIZATION"; diff --git a/xbmc/cores/DllLoader/DllLoader.cpp b/xbmc/cores/DllLoader/DllLoader.cpp index a76b499aec..56024c869c 100644 --- a/xbmc/cores/DllLoader/DllLoader.cpp +++ b/xbmc/cores/DllLoader/DllLoader.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "DllLoader.h" #include "DllLoaderContainer.h" #include "FileSystem/SpecialProtocol.h" @@ -63,8 +63,8 @@ typedef struct _UNICODE_STRING { //#define ENABLE_SYMBOL_LOADING 1 // uncomment this to enable symbol unloading for dlls -// This is not working properly. If a dll is loaded -// multiple times, vs.net will not link your solution +// This is not working properly. If a dll is loaded +// multiple times, vs.net will not link your solution // again until you restart vs.net. //#define ENABLE_SYMBOL_UNLOADING 1 @@ -113,9 +113,9 @@ int dmiOffsets[][2] = { // To get the checksum of xbdm.dll from an other xdk version then the ones above, // use dumpbin /HEADERS on it and look at the OPTIONAL HEADER VALUES for the checksum -// To get the offset use dia2dump (installed with vs.net) and dump the xbdm.pdb -// of your xdk version to a textfile. Open the textfile and search for -// FFinishImageLoad until you get a result with an address in front of it, +// To get the offset use dia2dump (installed with vs.net) and dump the xbdm.pdb +// of your xdk version to a textfile. Open the textfile and search for +// FFinishImageLoad until you get a result with an address in front of it, // this is the offset you need. // Helper function to get the offset by using the checksum of the dll @@ -142,8 +142,8 @@ int GetDmiOffset(int dllchecksum) return 0; } -typedef void (WINAPI *fnFFinishImageLoad)(LPLDR_DATA_TABLE_ENTRY pldteT, - const char * szName, +typedef void (WINAPI *fnFFinishImageLoad)(LPLDR_DATA_TABLE_ENTRY pldteT, + const char * szName, LPLDR_DATA_TABLE_ENTRY* ppldteout); @@ -161,7 +161,7 @@ LPVOID GetXbdmBaseAddress() if (stricmp(modLoad.Name, "xbdm.dll")==0) { // ... and get its base address - // where the dll is loaded into + // where the dll is loaded into // memory. pBaseAddress=modLoad.BaseAddress; break; @@ -214,7 +214,7 @@ DllLoader::DllLoader(const char *sDll, bool bTrack, bool bSystemDll, bool bLoadS m_bTrack = bTrack; m_bSystemDll = bSystemDll; m_pDlls = NULL; - + if(!bSystemDll) { @@ -244,7 +244,7 @@ DllLoader::DllLoader(const char *sDll, bool bTrack, bool bSystemDll, bool bLoadS m_bLoadSymbols=bLoadSymbols; m_bUnloadSymbols=false; - + /* system dll's are never loaded in any way, so let's just use the pointer */ /* to this object as their base address */ if (m_bSystemDll) @@ -275,7 +275,7 @@ DllLoader::~DllLoader() if (entry->pDll) DllLoaderContainer::ReleaseModule(lib); delete entry; } - + // can't unload a system dll, as this might be happing during xbmc destruction if(!m_bSystemDll) { @@ -288,7 +288,7 @@ DllLoader::~DllLoader() if (m_bTrack) tracker_dll_free(this); ImportDirTable = 0; - + // hModule points to DllLoader in this case if (m_bSystemDll) hModule = NULL; @@ -375,13 +375,13 @@ void DllLoader::PrintImportTable(ImportDirTable_t *ImportDirTable) HavePrinted = 1; Name = (char*)RVA2Data(Imp->Name_RVA); - + CLog::Log(LOGDEBUG, " %s:\n", Name); CLog::Log(LOGDEBUG, " ImportAddressTable: %04lX\n", Imp->ImportAddressTable_RVA); CLog::Log(LOGDEBUG, " ImportLookupTable: %04lX\n", Imp->ImportLookupTable_RVA); CLog::Log(LOGDEBUG, " TimeStamp: %01lX\n", Imp->TimeStamp); CLog::Log(LOGDEBUG, " Forwarder Chain: %01lX\n", Imp->ForwarderChain); - + PrintImportLookupTable(Imp->ImportLookupTable_RVA); CLog::Log(LOGDEBUG, "\n"); Imp++; @@ -431,7 +431,7 @@ int DllLoader::ResolveImports(void) if ( NumOfDirectories >= 2 && Directory[IMPORT_TABLE].Size > 0 ) { ImportDirTable = (ImportDirTable_t*)RVA2Data(Directory[IMPORT_TABLE].RVA); - + #ifdef DUMPING_DATA PrintImportTable(ImportDirTable); #endif @@ -447,7 +447,7 @@ int DllLoader::ResolveImports(void) char *Name = (char*)RVA2Data(Imp->Name_RVA); char* FileName=ResolveReferencedDll(Name); - // If possible use the dll name WITH path to resolve exports. We could have loaded + // If possible use the dll name WITH path to resolve exports. We could have loaded // a dll with the same name as another dll but from a different directory if (FileName) Name=FileName; @@ -564,11 +564,11 @@ int DllLoader::ResolveExport(const char *sName, void **pAddr) return 1; } - + char* sDllName = strrchr(GetFileName(), '\\'); if (sDllName) sDllName += 1; else sDllName = GetFileName(); - + CLog::Log(LOGWARNING, "Unable to resolve: %s %s", sDllName, sName); return 0; } @@ -586,11 +586,11 @@ int DllLoader::ResolveOrdinal(unsigned long ordinal, void **pAddr) return 1; } - + char* sDllName = strrchr(GetFileName(), '\\'); if (sDllName) sDllName += 1; else sDllName = GetFileName(); - + CLog::Log(LOGWARNING, "Unable to resolve: %s %lu", sDllName, ordinal); return 0; } @@ -598,7 +598,7 @@ int DllLoader::ResolveOrdinal(unsigned long ordinal, void **pAddr) Export* DllLoader::GetExportByOrdinal(unsigned long ordinal) { ExportEntry* entry = m_pExportHead; - + while (entry) { if (ordinal == entry->exp.ordinal) @@ -625,7 +625,7 @@ Export* DllLoader::GetExportByOrdinal(unsigned long ordinal) Export* DllLoader::GetExportByFunctionName(const char* sFunctionName) { ExportEntry* entry = m_pExportHead; - + while (entry) { if (entry->exp.name && strcmp(sFunctionName, entry->exp.name) == 0) @@ -648,7 +648,7 @@ Export* DllLoader::GetExportByFunctionName(const char* sFunctionName) return NULL; } - + int DllLoader::ResolveOrdinal(char *sName, unsigned long ordinal, void **fixup) { DllLoader* pDll = (DllLoader*) DllLoaderContainer::GetModule(sName); @@ -697,7 +697,7 @@ void DllLoader::AddExport(unsigned long ordinal, void* function, void* track_fun entry->exp.ordinal = ordinal; entry->exp.track_function = track_function; entry->exp.name = NULL; - + entry->next = m_pExportHead; m_pExportHead = entry; } @@ -712,7 +712,7 @@ void DllLoader::AddExport(char* sFunctionName, unsigned long ordinal, void* func entry->exp.track_function = track_function; entry->exp.name = ((char*)(entry)) + len; strcpy((char*)entry->exp.name, sFunctionName); - + entry->next = m_pExportHead; m_pExportHead = entry; } @@ -727,7 +727,7 @@ void DllLoader::AddExport(char* sFunctionName, void* function, void* track_funct entry->exp.track_function = track_function; entry->exp.name = ((char*)(entry)) + len; strcpy((char*)entry->exp.name, sFunctionName); - + entry->next = m_pExportHead; m_pExportHead = entry; } @@ -739,9 +739,9 @@ bool DllLoader::Load() CLog::Log(LOGERROR, "Unable to open dll %s", GetFileName()); return false; } - + ResolveImports(); - LoadSymbols(); + LoadSymbols(); // only execute DllMain if no EntryPoint is found if (!EntryAddress) @@ -808,12 +808,12 @@ bool DllLoader::Load() #ifdef LOGALL CLog::Log(LOGDEBUG, "Executing EntryPoint with DLL_PROCESS_ATTACH at: 0x%x - Dll: %s", pLoader->EntryAddress, sName); #endif - + if(EntryAddress) { EntryFunc initdll = (EntryFunc)EntryAddress; /* since we are handing execution over to unknown code, safeguard here */ - try + try { #ifdef _LINUX extend_stack_for_dll_alloca(); @@ -846,7 +846,7 @@ bool DllLoader::Load() } // init function may have fixed up the export table - // this is what I expect should happens on PECompact2 + // this is what I expect should happens on PECompact2 // dll's if export table is compressed. if(!m_pExportHead) LoadExports(); @@ -876,9 +876,9 @@ void DllLoader::Unload() UnloadSymbols(); } -// This function is a hack to get symbols loaded for -// dlls. The function FFinishImageLoad internally allocates -// memory which is/can never be freed. And the dll can not be +// This function is a hack to get symbols loaded for +// dlls. The function FFinishImageLoad internally allocates +// memory which is/can never be freed. And the dll can not be // unloaded. void DllLoader::LoadSymbols() { @@ -920,7 +920,7 @@ void DllLoader::LoadSymbols() try { - // Call FFinishImageLoad to register this dll to the debugger and load its symbols. + // Call FFinishImageLoad to register this dll to the debugger and load its symbols. FFinishImageLoad(&ldte, szName, &pldteout); } catch(...) diff --git a/xbmc/cores/DllLoader/DllLoader.h b/xbmc/cores/DllLoader/DllLoader.h index b5fa9df3c4..1087f0fa89 100644 --- a/xbmc/cores/DllLoader/DllLoader.h +++ b/xbmc/cores/DllLoader/DllLoader.h @@ -55,7 +55,7 @@ typedef struct _LoadedList DllLoader* pDll; _LoadedList* pNext; } LoadedList; - + class DllLoader : public CoffLoader, public LibraryLoader { public: @@ -69,14 +69,14 @@ public: virtual int ResolveOrdinal(unsigned long ordinal, void** ptr); virtual bool HasSymbols() { return m_bLoadSymbols && !m_bUnloadSymbols; } virtual bool IsSystemDll() { return m_bSystemDll; } - virtual HMODULE GetHModule() { return (HMODULE)hModule; } - + virtual HMODULE GetHModule() { return (HMODULE)hModule; } + Export* GetExportByFunctionName(const char* sFunctionName); Export* GetExportByOrdinal(unsigned long ordinal); -protected: +protected: int Parse(); int ResolveImports(); - + void AddExport(unsigned long ordinal, void* function, void* track_function = NULL); void AddExport(char* sFunctionName, unsigned long ordinal, void* function, void* track_function = NULL); void AddExport(char* sFunctionName, void* function, void* track_function = NULL); @@ -101,7 +101,7 @@ protected: void PrintImportLookupTable(unsigned long ImportLookupTable_RVA); void PrintImportTable(ImportDirTable_t *ImportDirTable); void PrintExportTable(ExportDirTable_t *ExportDirTable); - + int ResolveOrdinal(char*, unsigned long, void**); int ResolveName(char*, char*, void **); char* ResolveReferencedDll(char* dll); diff --git a/xbmc/cores/DllLoader/DllLoaderContainer.cpp b/xbmc/cores/DllLoader/DllLoaderContainer.cpp index c0ca3c6a1c..89940e3cea 100644 --- a/xbmc/cores/DllLoader/DllLoaderContainer.cpp +++ b/xbmc/cores/DllLoader/DllLoaderContainer.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "DllLoaderContainer.h" #ifdef _LINUX #include "SoLoader.h" @@ -69,7 +69,7 @@ LibraryLoader* DllLoaderContainer::GetModule(HMODULE hModule) { for (int i = 0; m_dlls[i] != NULL && i < m_iNrOfDlls; i++) { - if (m_dlls[i]->GetHModule() == hModule) return m_dlls[i]; + if (m_dlls[i]->GetHModule() == hModule) return m_dlls[i]; } return NULL; } @@ -88,7 +88,7 @@ LibraryLoader* DllLoaderContainer::LoadModule(const char* sName, const char* sCu strPath+=sName; pDll = GetModule(strPath.c_str()); } - + if (!pDll) { pDll = GetModule(sName); @@ -165,7 +165,7 @@ LibraryLoader* DllLoaderContainer::FindModule(const char* sName, const char* sCu // can't find it in any of our paths - could be a system dll if ((pDll = LoadDll(sName, bLoadSymbols)) != NULL) return pDll; - + CLog::Log(LOGDEBUG, "Dll %s was not found in path", sName); return NULL; } @@ -224,7 +224,7 @@ LibraryLoader* DllLoaderContainer::LoadDll(const char* sName, bool bLoadSymbols) else #endif pLoader = new DllLoader(sName, m_bTrack, false, bLoadSymbols); - + if (!pLoader) { CLog::Log(LOGERROR, "Unable to create dll %s", sName); @@ -326,18 +326,18 @@ void DllLoaderContainer::UnloadPythonDlls() LibraryLoader* pDll = m_dlls[i]; pDll->IncrRef(); while (pDll->DecrRef() > 1) pDll->DecrRef(); - + // since we freed all python extension dlls first, we have to remove any associations with them first DllTrackInfo* info = tracker_get_dlltrackinfo_byobject((DllLoader*) pDll); if (info != NULL) { info->dllList.clear(); } - + ReleaseModule(pDll); break; } } - + } diff --git a/xbmc/cores/DllLoader/DllLoaderContainer.h b/xbmc/cores/DllLoader/DllLoaderContainer.h index eb5f9d63a9..c0ec87e342 100644 --- a/xbmc/cores/DllLoader/DllLoaderContainer.h +++ b/xbmc/cores/DllLoader/DllLoaderContainer.h @@ -25,13 +25,13 @@ class DllLoaderContainer { -public: +public: static void Clear(); static HMODULE GetModuleAddress(const char* sName); static int GetNrOfModules(); static LibraryLoader* GetModule(int iPos); static LibraryLoader* GetModule(const char* sName); - static LibraryLoader* GetModule(HMODULE hModule); + static LibraryLoader* GetModule(HMODULE hModule); static LibraryLoader* LoadModule(const char* sName, const char* sCurrentDir=NULL, bool bLoadSymbols=false); static void ReleaseModule(LibraryLoader*& pDll); diff --git a/xbmc/cores/DllLoader/LibraryLoader.cpp b/xbmc/cores/DllLoader/LibraryLoader.cpp index 16c7d0b7e6..9d0f34dd86 100644 --- a/xbmc/cores/DllLoader/LibraryLoader.cpp +++ b/xbmc/cores/DllLoader/LibraryLoader.cpp @@ -37,7 +37,7 @@ LibraryLoader::LibraryLoader(const char* libraryFile) strncpy(m_sPath, m_sFileName, sPath - m_sFileName); m_sPath[sPath - m_sFileName] = 0; } - else + else m_sPath=NULL; m_iRefCount = 1; @@ -71,7 +71,7 @@ char* LibraryLoader::GetPath() if (m_sPath) return m_sPath; return (char*)""; } - + int LibraryLoader::IncrRef() { m_iRefCount++; diff --git a/xbmc/cores/DllLoader/LibraryLoader.h b/xbmc/cores/DllLoader/LibraryLoader.h index 49e65b8b0f..1b8168e382 100644 --- a/xbmc/cores/DllLoader/LibraryLoader.h +++ b/xbmc/cores/DllLoader/LibraryLoader.h @@ -33,24 +33,24 @@ class LibraryLoader public: LibraryLoader(const char* libraryFile); virtual ~LibraryLoader(); - + virtual bool Load() = 0; virtual void Unload() = 0; - + virtual int ResolveExport(const char* symbol, void** ptr) = 0; virtual int ResolveOrdinal(unsigned long ordinal, void** ptr); virtual bool IsSystemDll() = 0; virtual HMODULE GetHModule() = 0; virtual bool HasSymbols() = 0; - + char* GetName(); // eg "mplayer.dll" char* GetFileName(); // "special://xbmc/system/mplayer/players/mplayer.dll" char* GetPath(); // "special://xbmc/system/mplayer/players/" - + int IncrRef(); int DecrRef(); int GetRef(); - + private: char* m_sFileName; char* m_sPath; diff --git a/xbmc/cores/DllLoader/Win32DllLoader.cpp b/xbmc/cores/DllLoader/Win32DllLoader.cpp index 3e94cf77ae..f2b6fa86fa 100644 --- a/xbmc/cores/DllLoader/Win32DllLoader.cpp +++ b/xbmc/cores/DllLoader/Win32DllLoader.cpp @@ -48,7 +48,7 @@ Export win32_exports[] = { "SetEvent", -1, (void*)SetEvent, NULL }, // { "GetModuleHandleA", -1, (void*)dllGetModuleHandleA, NULL }, { "CreateFileA", -1, (void*)dllCreateFileA, NULL }, - { "LoadLibraryExA", -1, (void*)dllLoadLibraryExA, (void*)track_LoadLibraryExA }, + { "LoadLibraryExA", -1, (void*)dllLoadLibraryExA, (void*)track_LoadLibraryExA }, { "GetModuleFileNameA", -1, (void*)dllGetModuleFileNameA, NULL }, // potential vfs stuff // { "CreateDirectoryA", -1, (void*)dllCreateDirectoryA, NULL }, @@ -279,7 +279,7 @@ void Win32DllLoader::OverrideImports(const CStdString &dll) return; } - // loop over all imported dlls + // loop over all imported dlls for (int i = 0; imp_desc[i].Characteristics != 0; i++) { char *dllName = (char*)(image_base + imp_desc[i].Name); @@ -290,7 +290,7 @@ void Win32DllLoader::OverrideImports(const CStdString &dll) // this will do a loadlibrary on it, which should effectively make sure that it's hooked // Note that the library has obviously already been loaded by the OS (as it's implicitly linked) // so all this will do is insert our hook and make sure our DllLoaderContainer knows about it - HMODULE hModule = dllLoadLibraryA(dllName); + HMODULE hModule = dllLoadLibraryA(dllName); if (hModule) m_referencedDlls.push_back(hModule); } diff --git a/xbmc/cores/DllLoader/coff.cpp b/xbmc/cores/DllLoader/coff.cpp index 621633401d..3d1c15a2d4 100644 --- a/xbmc/cores/DllLoader/coff.cpp +++ b/xbmc/cores/DllLoader/coff.cpp @@ -18,10 +18,10 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include <stdlib.h> #include <string.h> -#include "coff.h" +#include "coff.h" #include "coffldr.h" //#define DUMPING_DATA 1 @@ -102,7 +102,7 @@ CoffLoader::~CoffLoader() } // Has nothing to do with the coff loader itself -// it can be used to parse the headers of a dll +// it can be used to parse the headers of a dll // already loaded into memory int CoffLoader::ParseHeaders(void* hModule) { @@ -427,7 +427,7 @@ void* CoffLoader::RVA2Data(unsigned long RVA) { int Sctn = RVA2Section(RVA); - if( RVA < SectionHeader[Sctn].VirtualAddress + if( RVA < SectionHeader[Sctn].VirtualAddress || RVA >= SectionHeader[Sctn].VirtualAddress + SectionHeader[Sctn].VirtualSize) { // RVA2Section is lying, let's use base address of dll instead, only works if @@ -809,7 +809,7 @@ void CoffLoader::PrintSection(SectionHeader_t *ScnHdr, char* data) /* #if 0 if (ScnHdr->NumRelocations > 0) - { + { // Print Section Relocations ObjReloc_t ObjReloc; @@ -819,7 +819,7 @@ void CoffLoader::PrintSection(SectionHeader_t *ScnHdr, char* data) printf(" Offset Type Index Name\n"); printf(" -------- -------- -------- ------\n"); for (int i = 0; i < ScnHdr->NumRelocations; i++) - { + { fread(&ObjReloc, 1, sizeof(ObjReloc_t), fp); printf(" %08X ", ObjReloc.VirtualAddress); @@ -862,7 +862,7 @@ void CoffLoader::PrintSection(SectionHeader_t *ScnHdr, char* data) fread(&LineNumber, 1, sizeof(LineNumbers_t), fp); if (LineNumber.LineNum == 0) - { + { SymbolTable_t *Sym; int SymIndex; diff --git a/xbmc/cores/DllLoader/coff.h b/xbmc/cores/DllLoader/coff.h index e085b51ce8..8fbeeab304 100644 --- a/xbmc/cores/DllLoader/coff.h +++ b/xbmc/cores/DllLoader/coff.h @@ -1,6 +1,6 @@ #ifndef __COFF_H_ #define __COFF_H_ -#pragma once +#pragma once #include "system.h" @@ -64,7 +64,7 @@ typedef struct COFF_FileHeader_t; /* - * Machine Types + * Machine Types * Spec section 3.3.1 * (only i386 relevant for us) */ @@ -73,7 +73,7 @@ COFF_FileHeader_t; #ifndef IMAGE_FILE_MACHINE_I386 #define IMAGE_FILE_MACHINE_I386 0x14c -#endif +#endif @@ -186,7 +186,7 @@ typedef struct } WindowsHeaderPlus_t; -#if !defined (_XBOX) +#if !defined (_XBOX) /* #define IMAGE_SUBSYSTEM_UNKNOWN 0 #define IMAGE_SUBSYSTEM_NATIVE 1 @@ -197,7 +197,7 @@ WindowsHeaderPlus_t; #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12 - + #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0X8000 @@ -358,8 +358,8 @@ SymbolTable_t; #define IMAGE_SYM_UNDEFINED 0 #define IMAGE_SYM_ABSOLUTE 0xFFFF #define IMAGE_SYM_DEBUG 0xFFFE - - + + #define IMAGE_SYM_TYPE_NULL 0 #define IMAGE_SYM_TYPE_VOID 1 #define IMAGE_SYM_TYPE_CHAR 2 @@ -376,13 +376,13 @@ SymbolTable_t; #define IMAGE_SYM_TYPE_WORD 13 #define IMAGE_SYM_TYPE_UINT 14 #define IMAGE_SYM_TYPE_DWORD 15 - + #define IMAGE_SYM_DWORD_NULL 0 #define IMAGE_SYM_DWORD_POINTER 1 #define IMAGE_SYM_DWORD_FUNCTION 2 #define IMAGE_SYM_DWORD_ARRAY 3 - - + + #define IMAGE_SYM_CLASS_END_OF_FUNCTION 0xFF #define IMAGE_SYM_CLASS_NULL 0 #define IMAGE_SYM_CLASS_AUTOMATIC 1 diff --git a/xbmc/cores/DllLoader/coffldr.h b/xbmc/cores/DllLoader/coffldr.h index 0855842c25..a650e91f03 100644 --- a/xbmc/cores/DllLoader/coffldr.h +++ b/xbmc/cores/DllLoader/coffldr.h @@ -1,5 +1,5 @@ #ifndef __COFFLDR_H_ -#define __COFFLDR_H_ +#define __COFFLDR_H_ /* * Copyright (C) 2005-2008 Team XBMC diff --git a/xbmc/cores/DllLoader/dll.cpp b/xbmc/cores/DllLoader/dll.cpp index db036f5a3c..fcba2ab6d4 100644 --- a/xbmc/cores/DllLoader/dll.cpp +++ b/xbmc/cores/DllLoader/dll.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "dll.h" #include "DllLoader.h" #include "DllLoaderContainer.h" @@ -43,7 +43,7 @@ char* getpath(char *buf, const char *full) buf[pos - full + 1] = 0; return buf; } - else + else { buf[0] = 0; return buf; @@ -51,24 +51,24 @@ char* getpath(char *buf, const char *full) } extern "C" HMODULE __stdcall dllLoadLibraryExtended(LPCSTR lib_file, LPCSTR sourcedll) -{ +{ char libname[MAX_PATH + 1] = {}; char libpath[MAX_PATH + 1] = {}; - LibraryLoader* dll = NULL; + LibraryLoader* dll = NULL; - /* extract name */ + /* extract name */ const char* p = strrchr(lib_file, PATH_SEPARATOR_CHAR); - if (p) + if (p) strcpy(libname, p+1); - else - strcpy(libname, lib_file); + else + strcpy(libname, lib_file); if( libname[0] == '\0' ) return NULL; /* extract path */ getpath(libpath, lib_file); - + CLog::Log(LOGDEBUG, "LoadLibraryA('%s')", libname); if (sourcedll) { @@ -87,7 +87,7 @@ extern "C" HMODULE __stdcall dllLoadLibraryExtended(LPCSTR lib_file, LPCSTR sour /* if we still don't have a path, use default path */ if( libpath[0] == '\0' ) strcpy(libpath, DEFAULT_DLLPATH); - + /* msdn docs state */ /* "If no file name extension is specified in the lpFileName parameter, the default library extension .dll is appended. */ /* However, the file name string can include a trailing point character (.) to indicate that the module name has no extension." */ @@ -97,7 +97,7 @@ extern "C" HMODULE __stdcall dllLoadLibraryExtended(LPCSTR lib_file, LPCSTR sour libname[strlen(libname)-1] = '\0'; dll = DllLoaderContainer::LoadModule(libname, libpath); - + if (dll) { CLog::Log(LOGDEBUG, "LoadLibrary('%s') returning: %p", libname, (void*)dll); @@ -129,7 +129,7 @@ extern "C" HMODULE __stdcall dllLoadLibraryExExtended(LPCSTR lpLibFileName, HAND if (dwFlags & LOAD_WITH_ALTERED_SEARCH_PATH) strcat(strFlags, "\n - LOAD_WITH_ALTERED_SEARCH_PATH"); CLog::Log(LOGDEBUG, "LoadLibraryExA called with flags: %s", strFlags); - + return dllLoadLibraryExtended(lpLibFileName, sourcedll); } @@ -141,7 +141,7 @@ extern "C" HMODULE __stdcall dllLoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFil extern "C" BOOL __stdcall dllFreeLibrary(HINSTANCE hLibModule) { LibraryLoader* dllhandle = DllLoaderContainer::GetModule(hLibModule); - + if( !dllhandle ) { CLog::Log(LOGERROR, "%s - Invalid hModule specified",__FUNCTION__); @@ -150,7 +150,7 @@ extern "C" BOOL __stdcall dllFreeLibrary(HINSTANCE hLibModule) // to make sure systems dlls are never deleted if (dllhandle->IsSystemDll()) return 1; - + CLog::Log(LOGDEBUG, "FreeLibrary(%s) -> %p", dllhandle->GetName(), (void*)dllhandle); DllLoaderContainer::ReleaseModule(dllhandle); @@ -161,7 +161,7 @@ extern "C" BOOL __stdcall dllFreeLibrary(HINSTANCE hLibModule) extern "C" FARPROC __stdcall dllGetProcAddress(HMODULE hModule, LPCSTR function) { uintptr_t loc = (uintptr_t)_ReturnAddress(); - + void* address = NULL; LibraryLoader* dll = DllLoaderContainer::GetModule(hModule); @@ -209,7 +209,7 @@ extern "C" FARPROC __stdcall dllGetProcAddress(HMODULE hModule, LPCSTR function) DllTrackInfo* track = tracker_get_dlltrackinfo(loc); /* some dll's require us to always return a function or it will fail, other's */ /* decide functionallity depending on if the functions exist and may fail */ - if( dll->IsSystemDll() && track + if( dll->IsSystemDll() && track && stricmp(track->pDll->GetName(), "CoreAVCDecoder.ax") == 0 ) { address = (void*)create_dummy_function(dll->GetName(), function); @@ -217,13 +217,13 @@ extern "C" FARPROC __stdcall dllGetProcAddress(HMODULE hModule, LPCSTR function) CLog::Log(LOGDEBUG, "%s - created dummy function %s!%s", __FUNCTION__, dll->GetName(), function); } else - { + { address = NULL; CLog::Log(LOGDEBUG, "%s(%p(%s), '%s') => %p", __FUNCTION__, hModule, dll->GetName(), function, address); } } } - + return (FARPROC)address; } @@ -237,7 +237,7 @@ extern "C" HMODULE WINAPI dllGetModuleHandleA(LPCSTR lpModuleName) If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process (.exe file). */ - if( lpModuleName == NULL ) + if( lpModuleName == NULL ) return NULL; char* strModuleName = new char[strlen(lpModuleName) + 5]; @@ -255,7 +255,7 @@ extern "C" HMODULE WINAPI dllGetModuleHandleA(LPCSTR lpModuleName) //CLog::Log(LOGDEBUG, "GetModuleHandleA('%s') => 0x%x", lpModuleName, h); return (HMODULE)p->GetHModule(); } - + CLog::Log(LOGDEBUG, "GetModuleHandleA('%s') failed", lpModuleName); return NULL; } @@ -271,7 +271,7 @@ extern "C" DWORD WINAPI dllGetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, return 0; #endif } - + LibraryLoader* dll = DllLoaderContainer::GetModule(hModule); if( !dll ) { @@ -285,6 +285,6 @@ extern "C" DWORD WINAPI dllGetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, strncpy(lpFilename, sName, nSize); return strlen(lpFilename); } - + return 0; } diff --git a/xbmc/cores/DllLoader/dll.h b/xbmc/cores/DllLoader/dll.h index 00e36bc079..d3384a2625 100644 --- a/xbmc/cores/DllLoader/dll.h +++ b/xbmc/cores/DllLoader/dll.h @@ -1,5 +1,5 @@ #ifndef __DLL_H_ -#define __DLL_H_ +#define __DLL_H_ #include "system.h" diff --git a/xbmc/cores/DllLoader/dll_tracker.h b/xbmc/cores/DllLoader/dll_tracker.h index 12c42211ed..3d4d0baf56 100644 --- a/xbmc/cores/DllLoader/dll_tracker.h +++ b/xbmc/cores/DllLoader/dll_tracker.h @@ -82,21 +82,21 @@ typedef struct _DllTrackInfo DllLoader* pDll; uintptr_t lMinAddr; uintptr_t lMaxAddr; - + DataList dataList; // list with dll's that are loaded by this dll DllList dllList; - + // for dummy functions that are created if no exported function could be found DummyList dummyList; - + FileList fileList; SocketList socketList; CriticalSectionList criticalSectionList; HeapObjectList heapobjectList; - + VAllocList virtualList; } DllTrackInfo; diff --git a/xbmc/cores/DllLoader/dll_tracker_file.cpp b/xbmc/cores/DllLoader/dll_tracker_file.cpp index 6728ccca95..addba70127 100644 --- a/xbmc/cores/DllLoader/dll_tracker_file.cpp +++ b/xbmc/cores/DllLoader/dll_tracker_file.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "dll_tracker_file.h" #include "dll_tracker.h" #include "DllLoader.h" @@ -84,12 +84,12 @@ extern "C" void tracker_file_free_all(DllTrackInfo* pInfo) file = *it; CLog::Log(LOGDEBUG, "%s", file->name); free(file->name); - + if (file->type == FILE_XBMC_OPEN) dll_close(file->handle); else if (file->type == FILE_XBMC_FOPEN) dll_fclose((FILE*)file->handle); else if (file->type == FILE_OPEN) close(file->handle); else if (file->type == FILE_FOPEN) fclose((FILE*)file->handle); - + delete file; } } @@ -101,7 +101,7 @@ extern "C" int track_open(const char* sFileName, int iMode) { uintptr_t loc = (uintptr_t)_ReturnAddress(); - + int fd = dll_open(sFileName, iMode); if (fd >= 0) tracker_file_track(loc, fd, FILE_XBMC_OPEN, sFileName); return fd; @@ -110,7 +110,7 @@ extern "C" int track_close(int fd) { uintptr_t loc = (uintptr_t)_ReturnAddress(); - + tracker_file_free(loc, fd, FILE_XBMC_OPEN); return dll_close(fd); } @@ -118,24 +118,24 @@ extern "C" FILE* track_fopen(const char* sFileName, const char* mode) { uintptr_t loc = (uintptr_t)_ReturnAddress(); - + FILE* fd = dll_fopen(sFileName, mode); if (fd) tracker_file_track(loc, (uintptr_t)fd, FILE_XBMC_FOPEN, sFileName); return fd; } - + int track_fclose(FILE* stream) { uintptr_t loc = (uintptr_t)_ReturnAddress(); - + tracker_file_free(loc, (uintptr_t)stream, FILE_XBMC_FOPEN); return dll_fclose(stream); } - + FILE* track_freopen(const char *path, const char *mode, FILE *stream) { uintptr_t loc = (uintptr_t)_ReturnAddress(); - + tracker_file_free(loc, (uintptr_t)stream, FILE_XBMC_FOPEN); stream = dll_freopen(path, mode, stream); if (stream) diff --git a/xbmc/cores/DllLoader/dll_tracker_library.cpp b/xbmc/cores/DllLoader/dll_tracker_library.cpp index 844b59b80b..b8536986bd 100644 --- a/xbmc/cores/DllLoader/dll_tracker_library.cpp +++ b/xbmc/cores/DllLoader/dll_tracker_library.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "dll_tracker_library.h" #include "dll_tracker.h" #include "dll.h" @@ -75,7 +75,7 @@ extern "C" void tracker_library_free_all(DllTrackInfo* pInfo) if (strlen(pDll->GetFileName()) > 0) CLog::Log(LOGDEBUG," : %s", pDll->GetFileName()); } } - + // now unload the dlls for (DllListIter it = pInfo->dllList.begin(); it != pInfo->dllList.end(); ++it) { @@ -93,7 +93,7 @@ extern "C" void tracker_library_free_all(DllTrackInfo* pInfo) } } } - + extern "C" HMODULE __stdcall track_LoadLibraryA(LPCSTR file) { uintptr_t loc = (uintptr_t)_ReturnAddress(); @@ -101,10 +101,10 @@ extern "C" HMODULE __stdcall track_LoadLibraryA(LPCSTR file) DllTrackInfo* pInfo = tracker_get_dlltrackinfo(loc); char* path = NULL; if (pInfo) path = pInfo->pDll->GetFileName(); - + HMODULE hHandle = dllLoadLibraryExtended(file, path); tracker_library_track(loc, hHandle); - + return hHandle; } @@ -115,10 +115,10 @@ extern "C" HMODULE __stdcall track_LoadLibraryExA(LPCSTR lpLibFileName, HANDLE h DllTrackInfo* pInfo = tracker_get_dlltrackinfo(loc); char* path = NULL; if (pInfo) path = pInfo->pDll->GetFileName(); - + HMODULE hHandle = dllLoadLibraryExExtended(lpLibFileName, hFile, dwFlags, path); tracker_library_track(loc, hHandle); - + return hHandle; } diff --git a/xbmc/cores/DllLoader/dll_util.cpp b/xbmc/cores/DllLoader/dll_util.cpp index 0c24051769..ebe50a7747 100644 --- a/xbmc/cores/DllLoader/dll_util.cpp +++ b/xbmc/cores/DllLoader/dll_util.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "utils/log.h" #include "dll_util.h" @@ -56,7 +56,7 @@ unsigned char dummy_func[] = { /* Create a new callable function * This allocates a few bytes with the next content - * + * * 1 function in assembly code (dummy_func) * 2 datapointer (pointer to dll string) * 3 datapointer (pointer to function string) diff --git a/xbmc/cores/DllLoader/dll_util.h b/xbmc/cores/DllLoader/dll_util.h index b895acc78e..eec4313e28 100644 --- a/xbmc/cores/DllLoader/dll_util.h +++ b/xbmc/cores/DllLoader/dll_util.h @@ -1,5 +1,5 @@ #ifndef _DLL_UTIL_H_ -#define _DLL_UTIL_H_ +#define _DLL_UTIL_H_ #include <stdint.h> diff --git a/xbmc/cores/DllLoader/exports/emu_dummy.cpp b/xbmc/cores/DllLoader/exports/emu_dummy.cpp index 8ec4c1632b..0412e2fb72 100644 --- a/xbmc/cores/DllLoader/exports/emu_dummy.cpp +++ b/xbmc/cores/DllLoader/exports/emu_dummy.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "emu_dummy.h" #include "utils/log.h" diff --git a/xbmc/cores/DllLoader/exports/emu_kernel32.cpp b/xbmc/cores/DllLoader/exports/emu_kernel32.cpp index e196339f21..90edeed2e3 100644 --- a/xbmc/cores/DllLoader/exports/emu_kernel32.cpp +++ b/xbmc/cores/DllLoader/exports/emu_kernel32.cpp @@ -104,7 +104,7 @@ extern "C" HANDLE WINAPI dllFindFirstFileA(LPCTSTR lpFileName, LPWIN32_FIND_DATA { char* p = strdup(lpFileName); CORRECT_SEP_STR(p); - + // change default \\*.* into \\* which the xbox is using char* e = strrchr(p, '.'); if (e != NULL && strlen(e) > 1 && e[1] == '*') @@ -152,12 +152,12 @@ struct SThreadWrapper #ifdef _DEBUG #define MS_VC_EXCEPTION 0x406d1388 -typedef struct tagTHREADNAME_INFO -{ - DWORD dwType; // must be 0x1000 - LPCSTR szName; // pointer to name (in same addr space) - DWORD dwThreadID; // thread ID (-1 caller thread) - DWORD dwFlags; // reserved for future use, most be zero +typedef struct tagTHREADNAME_INFO +{ + DWORD dwType; // must be 0x1000 + LPCSTR szName; // pointer to name (in same addr space) + DWORD dwThreadID; // thread ID (-1 caller thread) + DWORD dwFlags; // reserved for future use, most be zero } THREADNAME_INFO; #endif @@ -170,19 +170,19 @@ unsigned int __stdcall dllThreadWrapper(LPVOID lpThreadParameter) SThreadWrapper *param = (SThreadWrapper*)lpThreadParameter; DWORD result; -#if defined(_DEBUG) && !defined(_LINUX) - THREADNAME_INFO info; - info.dwType = 0x1000; - info.szName = "DLL"; - info.dwThreadID = ::GetCurrentThreadId(); - info.dwFlags = 0; - __try - { - RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(DWORD), (DWORD *)&info); - } - __except (EXCEPTION_CONTINUE_EXECUTION) - { - } +#if defined(_DEBUG) && !defined(_LINUX) + THREADNAME_INFO info; + info.dwType = 0x1000; + info.szName = "DLL"; + info.dwThreadID = ::GetCurrentThreadId(); + info.dwFlags = 0; + __try + { + RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(DWORD), (DWORD *)&info); + } + __except (EXCEPTION_CONTINUE_EXECUTION) + { + } #endif __try @@ -190,7 +190,7 @@ unsigned int __stdcall dllThreadWrapper(LPVOID lpThreadParameter) result = param->lpStartAddress(param->lpParameter); } __except (EXCEPTION_EXECUTE_HANDLER) - { + { CLog::Log(LOGERROR, "DLL:%s - Unhandled exception in thread created by dll", param->lpDLL ); result = 0; } @@ -210,7 +210,7 @@ extern "C" HANDLE WINAPI dllCreateThread( ) { uintptr_t loc = (uintptr_t)_ReturnAddress(); - + SThreadWrapper *param = new SThreadWrapper; param->lpStartAddress = lpStartAddress; param->lpParameter = lpParameter; @@ -258,7 +258,7 @@ extern "C" BOOL WINAPI dllGetProcessTimes(HANDLE hProcess, LPFILETIME lpCreation // since the xbox has only one process, we just take the current thread HANDLE h = GetCurrentThread(); BOOL res = GetThreadTimes(h, lpCreationTime, lpExitTime, lpKernelTime, lpUserTime); - + return res; } @@ -372,8 +372,8 @@ extern "C" void WINAPI dllInitializeCriticalSection(LPCRITICAL_SECTION cs) LPCRITICAL_SECTION cs_new = new CRITICAL_SECTION; memset(cs_new, 0, sizeof(CRITICAL_SECTION)); InitializeCriticalSection(cs_new); - - // just take the first member of the CRITICAL_SECTION to save ourdata in, this will be used to + + // just take the first member of the CRITICAL_SECTION to save ourdata in, this will be used to // get fast access to the new critial section in dllLeaveCriticalSection and dllEnterCriticalSection ((LPCRITICAL_SECTION*)cs)[0] = cs_new; g_mapCriticalSection[cs] = cs_new; @@ -427,8 +427,8 @@ extern "C" BOOL WINAPI dllGetVersionExA(LPOSVERSIONINFO lpVersionInfo) lpVersionInfo->szCSDVersion[0] = 0; #ifdef API_DEBUG CLog::Log(LOGDEBUG, " Major version: %d\n Minor version: %d\n Build number: %x\n" - " Platform Id: %d\n Version string: '%s'\n", - lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, + " Platform Id: %d\n Version string: '%s'\n", + lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwBuildNumber, lpVersionInfo->dwPlatformId, lpVersionInfo->szCSDVersion); #endif return TRUE; @@ -441,7 +441,7 @@ extern "C" BOOL WINAPI dllGetVersionExW(LPOSVERSIONINFOW lpVersionInfo) #endif if(!dllGetVersionExA((LPOSVERSIONINFO)lpVersionInfo)) return FALSE; - + lpVersionInfo->szCSDVersion[0] = 0; lpVersionInfo->szCSDVersion[1] = 0; return TRUE; @@ -676,7 +676,7 @@ extern "C" DWORD WINAPI dllFormatMessageA(DWORD dwFlags, LPCVOID lpSource, DWORD #else not_implement("kernel32.dll fake function FormatMessage called\n"); //warning return 0; -#endif +#endif } extern "C" DWORD WINAPI dllGetFullPathNameA(LPCTSTR lpFileName, DWORD nBufferLength, LPTSTR lpBuffer, LPTSTR* lpFilePart) @@ -830,7 +830,7 @@ extern "C" BOOL WINAPI dllTlsFree(DWORD dwTlsIndex) extern "C" BOOL WINAPI dllTlsSetValue(int dwTlsIndex, LPVOID lpTlsValue) { - if (dwTlsIndex == -1) + if (dwTlsIndex == -1) return FALSE; BOOL retval = TlsSetValue(dwTlsIndex, lpTlsValue); @@ -842,7 +842,7 @@ extern "C" BOOL WINAPI dllTlsSetValue(int dwTlsIndex, LPVOID lpTlsValue) extern "C" LPVOID WINAPI dllTlsGetValue(DWORD dwTlsIndex) { - if(dwTlsIndex == (DWORD)(-1)) + if(dwTlsIndex == (DWORD)(-1)) return NULL; LPVOID retval = TlsGetValue(dwTlsIndex); @@ -955,7 +955,7 @@ extern "C" int WINAPI dllGetLocaleInfoA(LCID Locale, LCTYPE LCType, LPTSTR lpLCD } } } - + not_implement("kernel32.dll incomplete function GetLocaleInfoA called\n"); //warning SetLastError(ERROR_INVALID_FUNCTION); return 0; @@ -963,12 +963,12 @@ extern "C" int WINAPI dllGetLocaleInfoA(LCID Locale, LCTYPE LCType, LPTSTR lpLCD extern "C" UINT WINAPI dllGetConsoleCP() { - return 437; // OEM - United States + return 437; // OEM - United States } extern "C" UINT WINAPI dllGetConsoleOutputCP() { - return 437; // OEM - United States + return 437; // OEM - United States } // emulated because windows expects different behaviour @@ -986,7 +986,7 @@ extern "C" int WINAPI dllMultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCST destinationBufferSize++; destinationBuffer = (LPWSTR)malloc(destinationBufferSize * sizeof(WCHAR)); } - + int ret = MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, destinationBuffer, destinationBufferSize); if (ret > 0) @@ -996,18 +996,18 @@ extern "C" int WINAPI dllMultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCST if (cchWideChar == 0) { ret--; } - + // revert the first fix again if (cbMultiByte > 0 && cbMultiByte == cchWideChar) { // the 0 termination character could never have been written on a windows machine // because of cchWideChar == cbMultiByte, again xbox added one for it. ret--; - + memcpy(lpWideCharStr, destinationBuffer, ret * sizeof(WCHAR)); free(destinationBuffer); } } - + return ret; } @@ -1024,7 +1024,7 @@ extern "C" int WINAPI dllWideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWS destinationBufferSize++; destinationBuffer = (LPSTR)malloc(destinationBufferSize * sizeof(char)); } - + int ret = WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, destinationBuffer, destinationBufferSize, lpDefaultChar, lpUsedDefaultChar); if (ret > 0) @@ -1034,18 +1034,18 @@ extern "C" int WINAPI dllWideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWS if (cbMultiByte == 0) { ret--; } - + // revert the first fix again if (cchWideChar > 0 && cchWideChar == cbMultiByte) { // the 0 termination character could never have been written on a windows machine // because of cchWideChar == cbMultiByte, again xbox added one for it. ret--; - + memcpy(lpMultiByteStr, destinationBuffer, ret); free(destinationBuffer); } } - + return ret; } @@ -1063,7 +1063,7 @@ extern "C" UINT WINAPI dllSetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine, typedef struct _SFlsSlot { - LONG lInUse; + LONG lInUse; PVOID pData; PFLS_CALLBACK_FUNCTION pCallback; } @@ -1081,8 +1081,8 @@ extern "C" DWORD WINAPI dllFlsAlloc(PFLS_CALLBACK_FUNCTION lpCallback) #ifdef API_DEBUG CLog::Log(LOGDEBUG, "FlsAlloc(0x%x)\n", lpCallback); #endif - for (i = 0; i < FLS_NUM_SLOTS; i++) { - if( InterlockedCompareExchange(&flsSlots[i].lInUse, 1, 0) == 0 ) { + for (i = 0; i < FLS_NUM_SLOTS; i++) { + if( InterlockedCompareExchange(&flsSlots[i].lInUse, 1, 0) == 0 ) { flsSlots[i].pData = NULL; flsSlots[i].pCallback = lpCallback; return i; @@ -1138,8 +1138,8 @@ extern "C" BOOL WINAPI dllFlsFree(DWORD dwFlsIndex) if( slot->pCallback ) slot->pCallback(slot->pData); - - slot->pData = NULL; + + slot->pData = NULL; slot->lInUse = 0; return true; @@ -1195,7 +1195,7 @@ extern "C" DWORD WINAPI dllGetTempPathA(DWORD nBufferLength, LPTSTR lpBuffer) // the return value is the size of the buffer required to hold the path. const char* tempPath = "special://temp/temp/"; unsigned int len = strlen(tempPath); - + if (nBufferLength > len) { strcpy(lpBuffer, tempPath); @@ -1254,7 +1254,7 @@ extern "C" BOOL WINAPI dllDVDReadFileLayerChangeHack(HANDLE hFile, LPVOID lpBuff #else int32_t low = 0; int32_t high = 0; -#endif +#endif low = SetFilePointer(hFile, low, &high, FILE_CURRENT); CLog::Log(LOGWARNING, "DVDReadFile() warning - " diff --git a/xbmc/cores/DllLoader/exports/emu_kernel32.h b/xbmc/cores/DllLoader/exports/emu_kernel32.h index ef0fd3517a..4d92924b0d 100644 --- a/xbmc/cores/DllLoader/exports/emu_kernel32.h +++ b/xbmc/cores/DllLoader/exports/emu_kernel32.h @@ -93,7 +93,7 @@ SYSTEM_INFO, *LPSYSTEM_INFO; typedef DWORD LCTYPE; #if defined (_XBOX) || defined (_LINUX) typedef BOOL (*PHANDLER_ROUTINE)(DWORD); - + typedef struct _OSVERSIONINFO { DWORD dwOSVersionInfoSize; @@ -125,9 +125,9 @@ typedef struct _EXCEPTION_RECORD { PVOID ExceptionAddress; DWORD NumberParameters; ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; -} EXCEPTION_RECORD, +} EXCEPTION_RECORD, *PEXCEPTION_RECORD; - + #define LPOVERLAPPED void * #endif @@ -153,15 +153,15 @@ typedef struct _EXCEPTION_RECORD { #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF -#define PF_FLOATING_POINT_PRECISION_ERRATA 0 -#define PF_FLOATING_POINT_EMULATED 1 -#define PF_COMPARE_EXCHANGE_DOUBLE 2 -#define PF_MMX_INSTRUCTIONS_AVAILABLE 3 -#define PF_PPC_MOVEMEM_64BIT_OK 4 -#define PF_ALPHA_BYTE_INSTRUCTIONS 5 -#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 -#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 -#define PF_RDTSC_INSTRUCTION_AVAILABLE 8 +#define PF_FLOATING_POINT_PRECISION_ERRATA 0 +#define PF_FLOATING_POINT_EMULATED 1 +#define PF_COMPARE_EXCHANGE_DOUBLE 2 +#define PF_MMX_INSTRUCTIONS_AVAILABLE 3 +#define PF_PPC_MOVEMEM_64BIT_OK 4 +#define PF_ALPHA_BYTE_INSTRUCTIONS 5 +#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 +#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 +#define PF_RDTSC_INSTRUCTION_AVAILABLE 8 #define PF_PAE_ENABLED 9 #define ERROR_INVALID_FUNCTION 1 @@ -586,7 +586,7 @@ typedef struct _EXCEPTION_RECORD { #endif /* (WINVER >= 0x0500) */ #ifndef _BASETSD_H typedef long LONG_PTR; -#endif +#endif #endif //All kernel32 function should use WINAPI calling convention. diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp index dd175a38ca..f99f8e4870 100644 --- a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp +++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp @@ -98,7 +98,7 @@ struct _env }; #define EMU_MAX_ENVIRONMENT_ITEMS 50 -char *dll__environ[EMU_MAX_ENVIRONMENT_ITEMS + 1]; +char *dll__environ[EMU_MAX_ENVIRONMENT_ITEMS + 1]; CRITICAL_SECTION dll_cs_environ; #define dll_environ (*dll___p__environ()) /* pointer to environment table */ @@ -107,17 +107,17 @@ extern "C" void __stdcall init_emu_environ() { InitializeCriticalSection(&dll_cs_environ); memset(dll__environ, 0, EMU_MAX_ENVIRONMENT_ITEMS + 1); - + // libdvdnav dll_putenv("DVDREAD_NOKEYS=1"); //dll_putenv("DVDREAD_VERBOSE=1"); //dll_putenv("DVDREAD_USE_DIRECT=1"); - + // libdvdcss dll_putenv("DVDCSS_METHOD=key"); dll_putenv("DVDCSS_VERBOSE=3"); dll_putenv("DVDCSS_CACHE=special://masterprofile/cache"); - + // python #ifdef _XBOX dll_putenv("OS=xbox"); @@ -285,7 +285,7 @@ extern "C" CLog::Log(LOGDEBUG," msg: %s", szLine); else CLog::Log(LOGDEBUG," msg: %s\n", szLine); - + // return a non negative value return 0; } @@ -299,7 +299,7 @@ extern "C" va_end(va); tmp[2048 - 1] = 0; CLog::Log(LOGDEBUG, " msg: %s", tmp); - + return strlen(tmp); } @@ -366,7 +366,7 @@ extern "C" // let the operating system handle it return _fdopen(fd, mode); } - + not_implement("msvcrt.dll incomplete function _fdopen(...) called\n"); return NULL; } @@ -410,7 +410,7 @@ extern "C" bResult = pFile->OpenForWrite(CURL::ValidatePath(str), bOverwrite); else bResult = pFile->Open(CURL::ValidatePath(str)); - + if (bResult) { EmuFileObject* object = g_emuFileWrapper.RegisterFileObject(pFile); @@ -439,7 +439,7 @@ extern "C" // Translate the path return freopen(_P(path).c_str(), mode, stream); } - + // error // close stream and return NULL dll_fclose(stream); @@ -504,7 +504,7 @@ extern "C" if (pFile != NULL) { g_emuFileWrapper.UnRegisterFileObjectByDescriptor(fd); - + pFile->Close(); delete pFile; return 0; @@ -578,7 +578,7 @@ extern "C" { int fd = g_emuFileWrapper.GetDescriptorByStream(stream); if (fd >= 0) - { + { g_emuFileWrapper.LockFileObjectByDescriptor(fd); return; } @@ -845,7 +845,7 @@ extern "C" // it might be something else than a file, or the file is not emulated // let the operating system handle it return fgets(pszString, num, stream); - } + } CLog::Log(LOGERROR, "%s emulated function failed", __FUNCTION__); return NULL; } @@ -896,7 +896,7 @@ extern "C" { // it is a emulated file char szString[10]; - + if (dll_feof(stream)) { return EOF; @@ -906,7 +906,7 @@ extern "C" { return -1; } - + byte byKar = (byte)szString[0]; int iKar = byKar; return iKar; @@ -937,7 +937,7 @@ extern "C" CLog::Log(LOGERROR, "%s emulated function failed", __FUNCTION__); return EOF; } - + FILE* dll_fopen(const char* filename, const char* mode) { FILE* file = NULL; @@ -958,13 +958,13 @@ extern "C" iMode |= O_RDWR | _O_TRUNC; else if (strchr(mode, 'w')) iMode |= _O_WRONLY | O_CREAT; - + int fd = dll_open(filename, iMode); if (fd >= 0) { file = g_emuFileWrapper.GetStreamByDescriptor(fd);; } - + return file; } @@ -985,7 +985,7 @@ extern "C" { return dll_putc(c, stdout); } - + int dll_fputc(int character, FILE* stream) { if (IS_STDOUT_STREAM(stream) || IS_STDERR_STREAM(stream)) @@ -1037,7 +1037,7 @@ extern "C" return fputs(szLine, stream); } } - + OutputDebugString(szLine); OutputDebugString("\n"); CLog::Log(LOGERROR, "%s emulated function failed", __FUNCTION__); @@ -1189,9 +1189,9 @@ extern "C" { memcpy(buf, buffer, size * count); buf[size * count] = 0; // string termination - + CLog::Log(LOGDEBUG, "%s", buf); - + free(buf); return count; } @@ -1233,7 +1233,7 @@ extern "C" // let the operating system handle it return fflush(stream); } - + // std stream, no need to flush return 0; } @@ -1272,7 +1272,7 @@ extern "C" CLog::Log(LOGWARNING, "dll_vfprintf: Data lost due to undersized buffer"); } tmp[2048 - 1] = 0; - + if (IS_STDOUT_STREAM(stream) || IS_STDERR_STREAM(stream)) { CLog::Log(LOGINFO, " msg: %s", tmp); @@ -1318,7 +1318,7 @@ extern "C" return vfprintf(stream, format, va); } } - + OutputDebugString(tmp); OutputDebugString("\n"); CLog::Log(LOGERROR, "%s emulated function failed", __FUNCTION__); @@ -1334,7 +1334,7 @@ extern "C" va_end(va); return res; } - + int dll_fgetpos(FILE* stream, fpos_t* pos) { fpos64_t tmpPos; @@ -1457,10 +1457,10 @@ extern "C" return 0; } - uintptr_t dll_beginthread( + uintptr_t dll_beginthread( void( *start_address )( void * ), unsigned stack_size, - void *arglist + void *arglist ) { return _beginthread(start_address, stack_size, arglist); @@ -1483,7 +1483,7 @@ extern "C" return -1; if (!strnicmp(path, "mms://", 6)) // don't stat mms return -1; - + #ifdef _LINUX if (!_stricmp(path, "D:") || !_stricmp(path, "D:\\")) { @@ -1561,7 +1561,7 @@ extern "C" { return fstat(fd, buffer); } - + // fstat on stdin, stdout or stderr should fail // this is what python expects return -1; @@ -1573,7 +1573,7 @@ extern "C" if (pFile != NULL) { CLog::Log(LOGINFO, "Stating open file"); - + buffer->st_size = pFile->GetLength(); buffer->st_mode = _S_IFREG; return 0; @@ -1590,7 +1590,7 @@ extern "C" } return res; } - + // fstat on stdin, stdout or stderr should fail // this is what python expects return -1; @@ -1641,31 +1641,31 @@ extern "C" int dll_putenv(const char* envstring) { bool added = false; - + if (envstring != NULL) { const char *value_start = strchr(envstring, '='); - + if (value_start != NULL) { char var[64]; int size = strlen(envstring) + 1; char *value = (char*)malloc(size); - + if (!value) return -1; value[0] = 0; - + memcpy(var, envstring, value_start - envstring); var[value_start - envstring] = 0; strupr(var); - + strncpy(value, value_start + 1, size); if (size) value[size - 1] = '\0'; EnterCriticalSection(&dll_cs_environ); - + char** free_position = NULL; for (int i = 0; i < EMU_MAX_ENVIRONMENT_ITEMS && free_position == NULL; i++) { @@ -1685,7 +1685,7 @@ extern "C" free_position = &dll__environ[i]; } } - + if (free_position != NULL) { // free position, copy value @@ -1700,13 +1700,13 @@ extern "C" added = true; } } - + LeaveCriticalSection(&dll_cs_environ); free(value); } } - + return added ? 0 : -1; } @@ -1715,7 +1715,7 @@ extern "C" char *getenv(const char *s) { // some libs in the solution linked to getenv which was exported in python.lib - // now python is in a dll this needs the be fixed, or not + // now python is in a dll this needs the be fixed, or not CLog::Log(LOGWARNING, "old getenv from python.lib called, library check needed"); return NULL; } @@ -1749,17 +1749,17 @@ extern "C" value = ctemp; } #endif - + LeaveCriticalSection(&dll_cs_environ); - + if (value != NULL) { return value; } - + return NULL; } - + int dll_ctype(int i) { not_implement("msvcrt.dll fake function dll_ctype() called\n"); @@ -1775,7 +1775,7 @@ extern "C" void (__cdecl * dll_signal(int sig, void (__cdecl *func)(int)))(int) { #ifdef _XBOX - // the xbox has a NSIG of 23 (+1), problem is when calling signal with + // the xbox has a NSIG of 23 (+1), problem is when calling signal with // one of the signals below the xbox wil crash. Just return SIG_ERR if (sig == SIGILL || sig == SIGFPE || sig == SIGSEGV) return SIG_ERR; #elif defined(_WIN32) @@ -1790,7 +1790,7 @@ extern "C" { return 1; } - + int dll__commit(int fd) { CFile* pFile = g_emuFileWrapper.GetFileXbmcByDescriptor(fd); @@ -1809,11 +1809,11 @@ extern "C" return fsync(fd); #endif } - + // std stream, no need to flush return 0; } - + char*** dll___p__environ() { static char*** t = (char***)&dll__environ; diff --git a/xbmc/cores/VideoRenderers/BaseRenderer.cpp b/xbmc/cores/VideoRenderers/BaseRenderer.cpp index 5e0c667403..9a4e7175c0 100644 --- a/xbmc/cores/VideoRenderers/BaseRenderer.cpp +++ b/xbmc/cores/VideoRenderers/BaseRenderer.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "system.h" #include "BaseRenderer.h" diff --git a/xbmc/cores/VideoRenderers/ComboRenderer.cpp b/xbmc/cores/VideoRenderers/ComboRenderer.cpp index d903eb1faa..f2cb769686 100644 --- a/xbmc/cores/VideoRenderers/ComboRenderer.cpp +++ b/xbmc/cores/VideoRenderers/ComboRenderer.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "stdafx.h" #include "ComboRenderer.h" #include "Application.h" @@ -198,7 +198,7 @@ void CComboRenderer::FlipPage(int source) } void CComboRenderer::YV12toYUY2() -{ +{ int index = m_iYV12RenderBuffer; if (!m_RGBSurface[m_iYUY2RenderBuffer]) return; diff --git a/xbmc/cores/VideoRenderers/ComboRenderer.h b/xbmc/cores/VideoRenderers/ComboRenderer.h index ba694d2dd4..48668b35d9 100644 --- a/xbmc/cores/VideoRenderers/ComboRenderer.h +++ b/xbmc/cores/VideoRenderers/ComboRenderer.h @@ -36,7 +36,7 @@ public: virtual void SetupScreenshot(); virtual void FlipPage(int source); - // Functions called from mplayer + // Functions called from mplayer virtual bool Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags); virtual unsigned int PreInit(); virtual void UnInit(); diff --git a/xbmc/cores/VideoRenderers/LinuxRenderer.cpp b/xbmc/cores/VideoRenderers/LinuxRenderer.cpp index 0bcdb15868..88ca924b1e 100644 --- a/xbmc/cores/VideoRenderers/LinuxRenderer.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRenderer.cpp @@ -49,13 +49,13 @@ YUVCOEF yuv_coef_bt709 = { YUVCOEF yuv_coef_ebu = { 0.0f, 1.140f, -0.396f, -0.581f, - 2.029f, 0.0f, + 2.029f, 0.0f, }; YUVCOEF yuv_coef_smtp240m = { 0.0f, 1.5756f, -0.2253f, -0.5000f, /* page above have the 0.5000f as positive */ - 1.8270f, 0.0f, + 1.8270f, 0.0f, }; @@ -83,7 +83,7 @@ CLinuxRenderer::CLinuxRenderer() #endif m_image.flags = 0; - + } CLinuxRenderer::~CLinuxRenderer() @@ -174,7 +174,7 @@ void CLinuxRenderer::DrawAlpha(int x0, int y0, int w, int h, unsigned char *src, if(true /*isvobsub*/) // xbox_video.cpp is fixed to 720x576 osd, so this should be fine { // vobsubs are given to us unscaled - // scale them up to the full output, assuming vobsubs have same + // scale them up to the full output, assuming vobsubs have same // pixel aspect ratio as the movie, and are 720 pixels wide float pixelaspect = m_fSourceFrameRatio * m_sourceHeight / m_sourceWidth; @@ -189,7 +189,7 @@ void CLinuxRenderer::DrawAlpha(int x0, int y0, int w, int h, unsigned char *src, xscale = 1.0f; yscale = 1.0f; } - + // horizontal centering, and align to bottom of subtitles line osdRect.left = rv.x1 + (rv.Width() - (float)w * xscale) / 2.0f; osdRect.right = osdRect.left + (float)w * xscale; @@ -207,13 +207,13 @@ void CLinuxRenderer::DrawAlpha(int x0, int y0, int w, int h, unsigned char *src, DeleteOSDTextures(iOSDBuffer); m_iOSDTextureHeight[iOSDBuffer] = h; // Create osd textures for this buffer with new size - m_pOSDYTexture[iOSDBuffer] = SDL_CreateRGBSurface(SDL_HWSURFACE, m_iOSDTextureWidth, m_iOSDTextureHeight[iOSDBuffer], + m_pOSDYTexture[iOSDBuffer] = SDL_CreateRGBSurface(SDL_HWSURFACE, m_iOSDTextureWidth, m_iOSDTextureHeight[iOSDBuffer], 32, RMASK, GMASK, BMASK, AMASK); - m_pOSDATexture[iOSDBuffer] = SDL_CreateRGBSurface(SDL_HWSURFACE, m_iOSDTextureWidth, m_iOSDTextureHeight[iOSDBuffer], + m_pOSDATexture[iOSDBuffer] = SDL_CreateRGBSurface(SDL_HWSURFACE, m_iOSDTextureWidth, m_iOSDTextureHeight[iOSDBuffer], 32, RMASK, GMASK, BMASK, AMASK); - if (m_pOSDYTexture[iOSDBuffer] == NULL || m_pOSDATexture[iOSDBuffer] == NULL) + if (m_pOSDYTexture[iOSDBuffer] == NULL || m_pOSDATexture[iOSDBuffer] == NULL) { CLog::Log(LOGERROR, "Could not create OSD/Sub textures"); DeleteOSDTextures(iOSDBuffer); @@ -228,7 +228,7 @@ void CLinuxRenderer::DrawAlpha(int x0, int y0, int w, int h, unsigned char *src, //We know the resources have been used at this point (or they are the second buffer, wich means they aren't in use anyways) //reset these so the gpu doesn't try to block on these if (SDL_LockSurface(m_pOSDYTexture[iOSDBuffer]) == 0 && - SDL_LockSurface(m_pOSDATexture[iOSDBuffer]) == 0) + SDL_LockSurface(m_pOSDATexture[iOSDBuffer]) == 0) { //clear the textures memset(m_pOSDYTexture[iOSDBuffer]->pixels, 0, m_pOSDYTexture[iOSDBuffer]->pitch*m_iOSDTextureHeight[iOSDBuffer]); @@ -275,7 +275,7 @@ void CLinuxRenderer::RenderOSD() rect.x = osdRect.left; rect.y = osdRect.top; rect.w = osdRect.right - osdRect.left; - rect.h = osdRect.bottom - osdRect.top; + rect.h = osdRect.bottom - osdRect.top; g_graphicsContext.BlitToScreen(m_pOSDYTexture[iRenderBuffer],NULL,&rect); } @@ -326,7 +326,7 @@ bool CLinuxRenderer::Configure(unsigned int width, unsigned int height, unsigned #ifdef USE_SDL_OVERLAY - m_screen = g_graphicsContext.getScreenSurface()->SDL(); + m_screen = g_graphicsContext.getScreenSurface()->SDL(); if (m_overlay && (m_overlay->w != width || m_overlay->h != height)) { SDL_FreeYUVOverlay(m_overlay); @@ -368,17 +368,17 @@ bool CLinuxRenderer::Configure(unsigned int width, unsigned int height, unsigned m_screenbuffer=NULL; } - if (m_backbuffer == NULL) + if (m_backbuffer == NULL) m_backbuffer = SDL_CreateRGBSurface(SDL_HWSURFACE, width, height, 32, RMASK, GMASK, BMASK, AMASK);; - if (m_screenbuffer == NULL) + if (m_screenbuffer == NULL) m_screenbuffer = SDL_CreateRGBSurface(SDL_HWSURFACE, width, height, 32, RMASK, GMASK, BMASK, AMASK);; if (m_image.plane[0] == NULL) { m_image.stride[0] = m_sourceWidth; m_image.stride[1] = m_sourceWidth>>1; m_image.stride[2] = m_sourceWidth>>1; - + m_image.plane[0] = new BYTE[m_image.stride[0] * height]; if (m_image.plane[1]) delete [] m_image.plane[1]; @@ -389,7 +389,7 @@ bool CLinuxRenderer::Configure(unsigned int width, unsigned int height, unsigned } #endif - + m_image.width = width; m_image.height = height; m_image.cshift_x = 1; @@ -453,7 +453,7 @@ void CLinuxRenderer::ReleaseImage(int source, bool preserve) if (!m_backbuffer) { return; - } + } // copy image to backbuffer @@ -465,7 +465,7 @@ void CLinuxRenderer::ReleaseImage(int source, bool preserve) int srcStride[] = { m_image.stride[0], m_image.stride[1], m_image.stride[2], 0 }; uint8_t *dst[] = { (uint8_t*)m_backbuffer->pixels, 0, 0, 0 }; int dstStride[] = { m_backbuffer->pitch, 0, 0, 0 }; - + m_dllSwScale.sws_scale(context, src, srcStride, 0, m_image.height, dst, dstStride); for (int n=0; n<720*90;n++) { @@ -509,8 +509,8 @@ void CLinuxRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) } void CLinuxRenderer::FlipPage(int source) -{ -// TODO: if image buffer changed (due to DrawSlice) than re-copy its content (convert from YUV). +{ +// TODO: if image buffer changed (due to DrawSlice) than re-copy its content (convert from YUV). // copy back buffer to screen buffer #ifndef USE_SDL_OVERLAY @@ -528,7 +528,7 @@ unsigned int CLinuxRenderer::DrawSlice(unsigned char *src[], int stride[], int w BYTE *s; BYTE *d; int i, p; - + YV12Image &im = m_image; // copy Y p = 0; @@ -607,7 +607,7 @@ void CLinuxRenderer::UnInit() for (int i=0; i< NUM_BUFFERS; i++) { DeleteOSDTextures(i); } - + #ifdef USE_SDL_OVERLAY if (m_overlay) SDL_FreeYUVOverlay(m_overlay); @@ -670,7 +670,7 @@ void CLinuxRenderer::RenderLowMem(DWORD flags) rect.x = (int)m_sourceRect.x1; rect.y = (int)m_sourceRect.y1; rect.w = (int)m_sourceRect.Width(); - rect.h = (int)m_sourceRect.Height(); + rect.h = (int)m_sourceRect.Height(); g_graphicsContext.BlitToScreen(m_screenbuffer,NULL,&rect); #endif diff --git a/xbmc/cores/VideoRenderers/LinuxRenderer.h b/xbmc/cores/VideoRenderers/LinuxRenderer.h index a73b814733..32ab14cdfc 100644 --- a/xbmc/cores/VideoRenderers/LinuxRenderer.h +++ b/xbmc/cores/VideoRenderers/LinuxRenderer.h @@ -70,7 +70,7 @@ struct DRAWRECT float bottom; }; -enum EFIELDSYNC +enum EFIELDSYNC { FS_NONE, FS_ODD, @@ -111,8 +111,8 @@ public: void CreateThumbnail(CBaseTexture *texture, unsigned int width, unsigned int height); // Player functions - virtual bool Configure(unsigned int width, - unsigned int height, unsigned int d_width, unsigned int d_height, + virtual bool Configure(unsigned int width, + unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags); virtual bool IsConfigured() { return m_bConfigured; } virtual int GetImage(YV12Image *image, int source = AUTOSOURCE, bool readonly = false); @@ -140,7 +140,7 @@ protected: void DeleteOSDTextures(int index); void RenderOSD(); - // not really low memory. name is misleading... simply a renderer + // not really low memory. name is misleading... simply a renderer void RenderLowMem(DWORD flags); bool m_bConfigured; @@ -166,10 +166,10 @@ protected: // USE_SDL_OVERLAY - is temporary - just to get the framework going. temporary hack. #ifdef USE_SDL_OVERLAY SDL_Overlay *m_overlay; - SDL_Surface *m_screen; + SDL_Surface *m_screen; #else - SDL_Surface *m_backbuffer; - SDL_Surface *m_screenbuffer; + SDL_Surface *m_backbuffer; + SDL_Surface *m_screenbuffer; #endif // clear colour for "black" bars diff --git a/xbmc/cores/VideoRenderers/LinuxRendererATI.h b/xbmc/cores/VideoRenderers/LinuxRendererATI.h index 4120a845f6..088c0d2c0b 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererATI.h +++ b/xbmc/cores/VideoRenderers/LinuxRendererATI.h @@ -13,7 +13,7 @@ using namespace Surface; class CLinuxRendererATI:public CLinuxRendererGL { public: - CLinuxRendererATI(bool enableshaders=false); + CLinuxRendererATI(bool enableshaders=false); virtual ~CLinuxRendererATI(); // Player functions diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp index c679bbc677..5194394ae3 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp @@ -121,7 +121,7 @@ CLinuxRendererGL::CLinuxRendererGL() #ifdef HAVE_LIBVDPAU m_StrictBinding = g_guiSettings.GetBool("videoplayer.strictbinding"); #endif - + m_pboused = false; } @@ -171,7 +171,7 @@ bool CLinuxRendererGL::ValidateRenderTarget() else CLog::Log(LOGNOTICE,"Using GL_TEXTURE_2D"); - // create the yuv textures + // create the yuv textures LoadShaders(); for (int i = 0 ; i < m_NumYV12Buffers ; i++) { @@ -180,7 +180,7 @@ bool CLinuxRendererGL::ValidateRenderTarget() m_bValidated = true; return true; } - return false; + return false; } bool CLinuxRendererGL::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags) @@ -203,7 +203,7 @@ bool CLinuxRendererGL::Configure(unsigned int width, unsigned int height, unsign m_bImageReady = false; m_scalingMethodGui = (ESCALINGMETHOD)-1; - // Ensure that textures are recreated and rendering starts only after the 1st + // Ensure that textures are recreated and rendering starts only after the 1st // frame is loaded after every call to Configure(). m_bValidated = false; @@ -220,7 +220,7 @@ void CLinuxRendererGL::ChooseUpscalingMethod() m_upscalingHeight = m_destRect.Height(); int upscale = g_advancedSettings.m_videoHighQualityScaling; - + // See if we're a candiate for upscaling. bool candidateForUpscaling = false; if (upscale != SOFTWARE_UPSCALING_DISABLED && (int)m_sourceWidth < m_upscalingWidth && (int)m_sourceHeight < m_upscalingHeight) @@ -282,8 +282,8 @@ bool CLinuxRendererGL::IsSoftwareUpscaling() { // See if we should be performing software upscaling on this frame. if (m_scalingMethod < VS_SCALINGMETHOD_BICUBIC_SOFTWARE || - (m_currentField != FIELD_FULL && - g_settings.m_currentVideoSettings.m_InterlaceMethod!=VS_INTERLACEMETHOD_NONE && + (m_currentField != FIELD_FULL && + g_settings.m_currentVideoSettings.m_InterlaceMethod!=VS_INTERLACEMETHOD_NONE && g_settings.m_currentVideoSettings.m_InterlaceMethod!=VS_INTERLACEMETHOD_DEINTERLACE)) { return false; @@ -307,7 +307,7 @@ int CLinuxRendererGL::GetImage(YV12Image *image, int source, bool readonly) source = NextYV12Texture(); YV12Image &im = m_buffers[source].image; - + if (!im.plane[0]) { CLog::Log(LOGDEBUG, "CLinuxRendererGL::GetImage - image planes not allocated"); @@ -380,7 +380,7 @@ void CLinuxRendererGL::CalculateTextureSourceRects(int source, int num_planes) /* software upscaling is precropped */ if(IsSoftwareUpscaling()) p.rect.SetRect(0, 0, im->width, im->height); - else + else p.rect = m_sourceRect; p.width = im->width; @@ -400,7 +400,7 @@ void CLinuxRendererGL::CalculateTextureSourceRects(int source, int num_planes) /* half the height if this is a field */ p.height *= 0.5f; - p.rect.y1 *= 0.5f; + p.rect.y1 *= 0.5f; p.rect.y2 *= 0.5f; } @@ -488,7 +488,7 @@ void CLinuxRendererGL::LoadYV12Textures(int source) { for (int i = 0 ; i < m_NumYV12Buffers ; i++) (this->*CreateTextureFuncPtr)(i, true); - + im->flags = IMAGE_FLAG_READY; } @@ -601,7 +601,7 @@ void CLinuxRendererGL::LoadYV12Textures(int source) LoadPlane( fields[FIELD_EVEN][0], GL_BGRA, buf.flipindex , im->width, im->height >> 1 - , m_sourceWidth*2, m_rgbBuffer + m_sourceWidth*4); + , m_sourceWidth*2, m_rgbBuffer + m_sourceWidth*4); } else { @@ -635,7 +635,7 @@ void CLinuxRendererGL::LoadYV12Textures(int source) LoadPlane( fields[FIELD_EVEN][0], GL_LUMINANCE, buf.flipindex , im->width, im->height >> 1 - , im->stride[0]*2, im->plane[0] + im->stride[0]) ; + , im->stride[0]*2, im->plane[0] + im->stride[0]) ; } else { @@ -662,7 +662,7 @@ void CLinuxRendererGL::LoadYV12Textures(int source) LoadPlane( fields[FIELD_ODD][2], GL_LUMINANCE, buf.flipindex , im->width >> im->cshift_x, im->height >> (im->cshift_y + 1) , im->stride[2]*2, im->plane[2] ); - + // Load Odd U & V Fields LoadPlane( fields[FIELD_EVEN][1], GL_LUMINANCE, buf.flipindex , im->width >> im->cshift_x, im->height >> (im->cshift_y + 1) @@ -671,7 +671,7 @@ void CLinuxRendererGL::LoadYV12Textures(int source) LoadPlane( fields[FIELD_EVEN][2], GL_LUMINANCE, buf.flipindex , im->width >> im->cshift_x, im->height >> (im->cshift_y + 1) , im->stride[2]*2, im->plane[2] + im->stride[2] ); - + } else { @@ -1002,7 +1002,7 @@ void CLinuxRendererGL::LoadShaders(int field) CLog::Log(LOGNOTICE, "GL: Using VDPAU render method"); m_renderMethod = RENDER_VDPAU; } - else + else #endif //HAVE_LIBVDPAU if (m_iFlags & CONF_FLAGS_FORMAT_NV12) { @@ -1033,7 +1033,7 @@ void CLinuxRendererGL::LoadShaders(int field) CLog::Log(LOGERROR, "GL: Error enabling NV12toRGB ARB shader"); } } - else + else /* Try GLSL shaders if they're supported and if the user has requested for it. (settings -> video -> player -> rendermethod) @@ -1073,7 +1073,7 @@ void CLinuxRendererGL::LoadShaders(int field) 1) user requested it 2) or GLSL shaders failed and user selected AUTO */ - else if (glewIsSupported("GL_ARB_fragment_program") + else if (glewIsSupported("GL_ARB_fragment_program") && ((requestedMethod==RENDER_METHOD_AUTO || requestedMethod==RENDER_METHOD_ARB) || (requestedMethod==RENDER_METHOD_CRYSTALHD) || err)) @@ -1139,7 +1139,7 @@ void CLinuxRendererGL::LoadShaders(int field) else CLog::Log(LOGNOTICE, "GL: NPOT texture support detected"); - if (glewIsSupported("GL_ARB_pixel_buffer_object") + if (glewIsSupported("GL_ARB_pixel_buffer_object") && g_guiSettings.GetBool("videoplayer.usepbo") && !(m_renderMethod & RENDER_SW)) { CLog::Log(LOGNOTICE, "GL: Using GL_ARB_pixel_buffer_object"); @@ -1552,13 +1552,13 @@ void CLinuxRendererGL::RenderVDPAU(int index, int field) g_graphicsContext.ClipToViewWindow(); glEnable(m_textureTarget); - + if (!g_VDPAU->m_glPixmapTexture) { glGenTextures (1, &(g_VDPAU->m_glPixmapTexture)); CLog::Log(LOGNOTICE,"Created m_glPixmapTexture (%i)",(int)g_VDPAU->m_glPixmapTexture); } - + glBindTexture(m_textureTarget, g_VDPAU->m_glPixmapTexture); g_VDPAU->BindPixmap(); @@ -1953,7 +1953,7 @@ void CLinuxRendererGL::LoadNV12Textures(int source) SetEvent(m_eventTexturesDone[source]); return; } - + bool deinterlacing; if (m_currentField == FIELD_FULL) deinterlacing = false; @@ -1974,7 +1974,7 @@ void CLinuxRendererGL::LoadNV12Textures(int source) LoadPlane( fields[FIELD_EVEN][0], GL_LUMINANCE, buf.flipindex , im->width, im->height >> 1 - , im->stride[0]*2, im->plane[0] + im->stride[0]) ; + , im->stride[0]*2, im->plane[0] + im->stride[0]) ; } else { @@ -2032,7 +2032,7 @@ bool CLinuxRendererGL::CreateNV12Texture(int index, bool clear) im.stride[0] = im.width; im.stride[1] = im.width; im.stride[2] = 0; - + im.plane[0] = NULL; im.plane[1] = NULL; im.plane[2] = NULL; @@ -2145,7 +2145,7 @@ void CLinuxRendererGL::DeleteNV12Texture(int index) if( fields[FIELD_FULL][0].id == 0 ) return; CLog::Log(LOGDEBUG, "Deleted NV12 texture %i", index); - + // finish up all textures, and delete them g_graphicsContext.BeginPaint(); //FIXME for(int f = 0;f<MAX_FIELDS;f++) @@ -2286,7 +2286,7 @@ bool CLinuxRendererGL::Supports(ESCALINGMETHOD method) return true; - if(method == VS_SCALINGMETHOD_CUBIC + if(method == VS_SCALINGMETHOD_CUBIC && glewIsSupported("GL_ARB_texture_float") && glewIsSupported("GL_EXT_framebuffer_object") && (m_renderMethod & RENDER_GLSL)) diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.h b/xbmc/cores/VideoRenderers/LinuxRendererGL.h index 670f750d52..de86a6a6ac 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.h +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.h @@ -97,7 +97,7 @@ extern YUVCOEF yuv_coef_smtp240m; class CLinuxRendererGL : public CBaseRenderer { public: - CLinuxRendererGL(); + CLinuxRendererGL(); virtual ~CLinuxRendererGL(); virtual void Update(bool bPauseDrawing); @@ -159,7 +159,7 @@ protected: bool CreateNV12Texture(int index, bool clear = true); void CalculateTextureSourceRects(int source, int num_planes); - + // renderers void RenderMultiPass(int renderBuffer, int field); // multi pass glsl renderer void RenderSinglePass(int renderBuffer, int field); // single pass glsl renderer diff --git a/xbmc/cores/VideoRenderers/OverlayRendererDX.h b/xbmc/cores/VideoRenderers/OverlayRendererDX.h index acc6c9ff4c..4e5bd22092 100644 --- a/xbmc/cores/VideoRenderers/OverlayRendererDX.h +++ b/xbmc/cores/VideoRenderers/OverlayRendererDX.h @@ -53,7 +53,7 @@ namespace OVERLAY { DWORD m_fvf; CD3DTexture m_texture; CD3DVertexBuffer m_vertex; - }; + }; class COverlayImageDX : public COverlayMainThread @@ -74,7 +74,7 @@ namespace OVERLAY { DWORD m_fvf; CD3DTexture m_texture; CD3DVertexBuffer m_vertex; - }; + }; } diff --git a/xbmc/cores/VideoRenderers/OverlayRendererGL.h b/xbmc/cores/VideoRenderers/OverlayRendererGL.h index 548bdb5b79..08af75692a 100644 --- a/xbmc/cores/VideoRenderers/OverlayRendererGL.h +++ b/xbmc/cores/VideoRenderers/OverlayRendererGL.h @@ -62,7 +62,7 @@ namespace OVERLAY { struct VERTEX { GLfloat u, v; - GLubyte r, g, b, a; + GLubyte r, g, b, a; GLfloat x, y, z; }; @@ -72,7 +72,7 @@ namespace OVERLAY { GLuint m_texture; float m_u; float m_v; - }; + }; } diff --git a/xbmc/cores/VideoRenderers/OverlayRendererUtil.cpp b/xbmc/cores/VideoRenderers/OverlayRendererUtil.cpp index 060427b1d6..b3f826628f 100644 --- a/xbmc/cores/VideoRenderers/OverlayRendererUtil.cpp +++ b/xbmc/cores/VideoRenderers/OverlayRendererUtil.cpp @@ -180,7 +180,7 @@ bool convert_quad(CDVDOverlaySSA* o, double pts, int width, int height, SQuads& if (!images) return false; - + // first calculate how many glyph we have and the total x length for(img = images; img; img = img->next) diff --git a/xbmc/cores/VideoRenderers/OverlayRendererUtil.h b/xbmc/cores/VideoRenderers/OverlayRendererUtil.h index 4afbb76d8d..63e4fce740 100644 --- a/xbmc/cores/VideoRenderers/OverlayRendererUtil.h +++ b/xbmc/cores/VideoRenderers/OverlayRendererUtil.h @@ -28,7 +28,7 @@ namespace OVERLAY { struct SQuad { int u, v; - unsigned char r, g, b, a; + unsigned char r, g, b, a; int x, y; int w, h; }; diff --git a/xbmc/cores/VideoRenderers/PixelShaderRenderer.cpp b/xbmc/cores/VideoRenderers/PixelShaderRenderer.cpp index 637a2038b4..996418cb76 100644 --- a/xbmc/cores/VideoRenderers/PixelShaderRenderer.cpp +++ b/xbmc/cores/VideoRenderers/PixelShaderRenderer.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "stdafx.h" #include "PixelShaderRenderer.h" diff --git a/xbmc/cores/VideoRenderers/RGBRenderer.cpp b/xbmc/cores/VideoRenderers/RGBRenderer.cpp index 9617635eeb..3a07995ede 100644 --- a/xbmc/cores/VideoRenderers/RGBRenderer.cpp +++ b/xbmc/cores/VideoRenderers/RGBRenderer.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "stdafx.h" #include "RGBRenderer.h" @@ -113,7 +113,7 @@ bool CRGBRenderer::Configure(unsigned int width, unsigned int height, unsigned i { if(!CXBoxRenderer::Configure(width, height, d_width, d_height, fps, flags)) return false; - + // create our lookup textures for yv12->rgb translation, if(!CreateLookupTextures(m_yuvcoef, m_yuvrange) ) return false; @@ -130,7 +130,7 @@ void CRGBRenderer::Render(DWORD flags) RenderLowMem(flags); } else - { + { int index = m_iYV12RenderBuffer; if( !(flags & RENDER_FLAG_NOLOCK) ) @@ -175,8 +175,8 @@ void CRGBRenderer::Render(DWORD flags) m_pD3DDevice->SetRenderState( D3DRS_FOGENABLE, FALSE ); m_pD3DDevice->SetRenderState( D3DRS_FOGTABLEMODE, D3DFOG_NONE ); m_pD3DDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID ); - m_pD3DDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW ); - m_pD3DDevice->SetRenderState( D3DRS_YUVENABLE, FALSE ); + m_pD3DDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW ); + m_pD3DDevice->SetRenderState( D3DRS_YUVENABLE, FALSE ); DWORD alphaenabled; m_pD3DDevice->GetRenderState( D3DRS_ALPHABLENDENABLE, &alphaenabled ); @@ -199,7 +199,7 @@ void CRGBRenderer::Render(DWORD flags) rs_new.top >>=1; rs_new.bottom >>=1; } - + /* we will need extra texture, make sure it exists */ if (!m_444PTexture[FIELD_FULL]) Create444PTexture(); @@ -212,7 +212,7 @@ void CRGBRenderer::Render(DWORD flags) // we can render directly to backbuffer m_pD3DDevice->GetBackBuffer(0, 0, &p444PSource[FIELD_FULL]); -#if 0 +#if 0 // currently doesn't work properly, not sure why yet // no error is thrown, but rendering to these genrerated surfaces // doesn't result in any data on screen, not supported @@ -222,7 +222,7 @@ void CRGBRenderer::Render(DWORD flags) rs_new.top >>=1; rs_new.bottom >>=1; - + const DWORD pitch = (((p444PSource[FIELD_FULL]->Size&D3DSIZE_PITCH_MASK)>>D3DSIZE_PITCH_SHIFT)+1)*64; const DWORD height = ((p444PSource[FIELD_FULL]->Size&D3DSIZE_HEIGHT_MASK)>>D3DSIZE_HEIGHT_SHIFT)+1; const DWORD width = ((p444PSource[FIELD_FULL]->Size&D3DSIZE_WIDTH_MASK))+1; @@ -249,7 +249,7 @@ void CRGBRenderer::Render(DWORD flags) } if( (flags & RENDER_FLAG_FIELDMASK) == 0 ) - { + { InterleaveYUVto444P( m_YUVTexture[index][FIELD_FULL], p444PSource[FIELD_FULL], @@ -269,10 +269,10 @@ void CRGBRenderer::Render(DWORD flags) float offsety; if( (flags & RENDER_FLAG_FIELDMASK) == RENDER_FLAG_BOTH ) // keep field offsets, only compensate for scaling - offsety = 0.25f * ((float(rs_half.bottom - rs_half.top) / float(rs_new.bottom - rs_new.top)) - 1.0f); + offsety = 0.25f * ((float(rs_half.bottom - rs_half.top) / float(rs_new.bottom - rs_new.top)) - 1.0f); else // spatially align source, needs be done here if we are using same target surface here as in next step - offsety = 0.25; + offsety = 0.25; if( flags & RENDER_FLAG_ODD ) { @@ -284,7 +284,7 @@ void CRGBRenderer::Render(DWORD flags) 0.0f, +offsety, CHROMAOFFSET_HORIZ, +CHROMAOFFSET_VERT); } - + if( flags & RENDER_FLAG_EVEN ) { InterleaveYUVto444P( @@ -704,7 +704,7 @@ bool CRGBRenderer::CreateLookupTextures(const YUVCOEF &coef, const YUVRANGE &ran // convert to -0.5 .. 0.5 ( -127.5 .. 127.5 ) float fV = (v - range.v_min) * 255.f / (range.v_max - range.v_min) - 127.5f; float fU = (u - range.u_min) * 255.f / (range.u_max - range.u_min) - 127.5f; - + fU = CLAMP(fU, -127.5f, 127.5f); fV = CLAMP(fV, -127.5f, 127.5f); @@ -745,7 +745,7 @@ bool CRGBRenderer::CreateLookupTextures(const YUVCOEF &coef, const YUVRANGE &ran m_UVLookup->UnlockRect(0); m_UVErrorLookup->LockRect(0, &lr, NULL, 0); XGSwizzleRect(pErrorBuff, 0, NULL, lr.pBits, 256, 256, NULL, 4); - m_UVErrorLookup->UnlockRect(0); + m_UVErrorLookup->UnlockRect(0); m_yuvcoef_last = coef; m_yuvrange_last = range; diff --git a/xbmc/cores/VideoRenderers/RGBRendererV2.cpp b/xbmc/cores/VideoRenderers/RGBRendererV2.cpp index 007faf6551..450363835b 100644 --- a/xbmc/cores/VideoRenderers/RGBRendererV2.cpp +++ b/xbmc/cores/VideoRenderers/RGBRendererV2.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "stdafx.h" #include "RGBRendererV2.h" @@ -127,7 +127,7 @@ bool CRGBRendererV2::Configure(unsigned int width, unsigned int height, unsigned { if(!CXBoxRenderer::Configure(width, height, d_width, d_height, fps, flags)) return false; - + // create our lookup textures for yv12->rgb translation, if(!CreateLookupTextures(m_yuvcoef, m_yuvrange) ) return false; @@ -144,7 +144,7 @@ void CRGBRendererV2::Render(DWORD flags) RenderLowMem(flags); } else - { + { int index = m_iYV12RenderBuffer; if( !(flags & RENDER_FLAG_NOLOCK) ) @@ -216,8 +216,8 @@ void CRGBRendererV2::Render(DWORD flags) m_pD3DDevice->SetRenderState( D3DRS_ZENABLE, FALSE ); m_pD3DDevice->SetRenderState( D3DRS_FOGENABLE, FALSE ); m_pD3DDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID ); - m_pD3DDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW ); - m_pD3DDevice->SetRenderState( D3DRS_YUVENABLE, FALSE ); + m_pD3DDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW ); + m_pD3DDevice->SetRenderState( D3DRS_YUVENABLE, FALSE ); DWORD alphaenabled; m_pD3DDevice->GetRenderState( D3DRS_ALPHABLENDENABLE, &alphaenabled ); @@ -246,7 +246,7 @@ void CRGBRendererV2::Render(DWORD flags) { InterleaveYUVto444P( m_YUVTexture[index][FIELD_ODD], - m_444PTextureFull, // use a downscaled motion value from the full frame, + m_444PTextureFull, // use a downscaled motion value from the full frame, p444PSourceField, rsf, rs, rsf, 1, 1, @@ -257,7 +257,7 @@ void CRGBRendererV2::Render(DWORD flags) { InterleaveYUVto444P( m_YUVTexture[index][FIELD_EVEN], - m_444PTextureFull, // use a downscaled motion value from the full frame, + m_444PTextureFull, // use a downscaled motion value from the full frame, p444PSourceField, rsf, rs, rsf, 1, 1, @@ -271,7 +271,7 @@ void CRGBRendererV2::Render(DWORD flags) //Okey, when the gpu is done with the textures here, they are free to be modified again if( !(flags & RENDER_FLAG_NOUNLOCK) ) - m_pD3DDevice->InsertCallback(D3DCALLBACK_WRITE,&TextureCallback, (DWORD)m_eventTexturesDone[index]); + m_pD3DDevice->InsertCallback(D3DCALLBACK_WRITE,&TextureCallback, (DWORD)m_eventTexturesDone[index]); // Now perform the YUV->RGB conversion in a single pass, and render directly to the screen m_pD3DDevice->SetScreenSpaceOffset( -0.5f, -0.5f ); @@ -280,7 +280,7 @@ void CRGBRendererV2::Render(DWORD flags) { // NOTICE, field motion can have been replaced by downscaled frame motion // this method uses the difference between fields to estimate motion - // it work sorta, but it can't for example handle horizontal + // it work sorta, but it can't for example handle horizontal // hairlines wich only exist in one field, they will flicker // as they get considered motion @@ -295,7 +295,7 @@ void CRGBRendererV2::Render(DWORD flags) m_pD3DDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); m_pD3DDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL); m_pD3DDevice->SetRenderState(D3DRS_ALPHAREF, m_motionpass); - + if(flags & RENDER_FLAG_ODD) RenderYUVtoRGB(m_444PTextureField, rsf, rd, 0.0f, 0.25); else @@ -326,7 +326,7 @@ void CRGBRendererV2::Render(DWORD flags) m_pD3DDevice->SetRenderState(D3DRS_ALPHAREF, m_motionpass); RenderYUVtoRGB(m_444PTextureFull, rs, rd, 0.0f, 0.0f); } - + m_pD3DDevice->SetScreenSpaceOffset(0.0f, 0.0f); m_pD3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, alphaenabled ); m_pD3DDevice->SetRenderState( D3DRS_ALPHATESTENABLE, FALSE ); @@ -366,7 +366,7 @@ unsigned int CRGBRendererV2::PreInit() // interleave our data "xmma discard,discard,r0, t0,c0, t1,c1\n" "mad r0, t2,c2,r0\n" - + "sub_x4 r1, r0,t3\n" // calculate the differens in this pixel values "dp3 r1.rgba, r1,r1\n" // take the absolute of the "yuv" difference vector // "add_d2 r1.a, r1, t3\n" // average with previouse value to avoid minor changes @@ -512,7 +512,7 @@ bool CRGBRendererV2::CreateLookupTextures(const YUVCOEF &coef, const YUVRANGE &r // convert to -0.5 .. 0.5 ( -127.5 .. 127.5 ) float fV = (v - range.v_min) * 255.f / (range.v_max - range.v_min) - 127.5f; float fU = (u - range.u_min) * 255.f / (range.u_max - range.u_min) - 127.5f; - + fU = CLAMP(fU, -127.5f, 127.5f); fV = CLAMP(fV, -127.5f, 127.5f); @@ -574,7 +574,7 @@ void CRGBRendererV2::InterleaveYUVto444P( YUVPLANES pSources, LPDIRECT3DTEXTURE8 pAlpha, LPDIRECT3DSURFACE8 pTarget, - RECT &source, RECT &sourcealpha, RECT &target, + RECT &source, RECT &sourcealpha, RECT &target, unsigned cshift_x, unsigned cshift_y, float offset_x, float offset_y, float coffset_x, float coffset_y) @@ -662,7 +662,7 @@ void CRGBRendererV2::InterleaveYUVto444P( void CRGBRendererV2::RenderYUVtoRGB( D3DBaseTexture* pSource, - RECT &source, RECT &target, + RECT &source, RECT &target, float offset_x, float offset_y) { m_pD3DDevice->SetTexture( 0, pSource); diff --git a/xbmc/cores/VideoRenderers/RGBRendererV2.h b/xbmc/cores/VideoRenderers/RGBRendererV2.h index 650cb9f3ce..1ac67dee10 100644 --- a/xbmc/cores/VideoRenderers/RGBRendererV2.h +++ b/xbmc/cores/VideoRenderers/RGBRendererV2.h @@ -52,7 +52,7 @@ protected: YUVPLANES pSources, LPDIRECT3DTEXTURE8 pAlpha, LPDIRECT3DSURFACE8 pTarget, - RECT &source, RECT &sourcealpha, RECT &target, + RECT &source, RECT &sourcealpha, RECT &target, unsigned cshift_x, unsigned cshift_y, float offset_x, float offset_y, float coffset_x, float coffset_y); @@ -68,7 +68,7 @@ protected: bool m_444GeneratedFull; int m_444RenderBuffer; - + // textures for YUV->RGB lookup LPDIRECT3DTEXTURE8 m_UVLookup; diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp index 80ae7523f3..08ff258cdf 100644 --- a/xbmc/cores/VideoRenderers/RenderManager.cpp +++ b/xbmc/cores/VideoRenderers/RenderManager.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "system.h" #include "RenderManager.h" #include "utils/CriticalSection.h" @@ -151,7 +151,7 @@ void CXBMCRenderManager::WaitPresentTime(double presenttime) // correct error so it targets the closest vblank error = wrap(error, 0.0 - target, 1.0 - target); - // scale the error used for correction, + // scale the error used for correction, // based on how much buffer we have on // that side of the target if(error > 0) @@ -186,7 +186,7 @@ bool CXBMCRenderManager::Configure(unsigned int width, unsigned int height, unsi }; CRetakeLock<CExclusiveLock> lock(m_sharedSection, false); - if(!m_pRenderer) + if(!m_pRenderer) { CLog::Log(LOGERROR, "%s called without a valid Renderer object", __FUNCTION__); return false; @@ -207,7 +207,7 @@ bool CXBMCRenderManager::Configure(unsigned int width, unsigned int height, unsi m_presentstep = PRESENT_IDLE; m_presentevent.Set(); } - + return result; } @@ -270,7 +270,7 @@ unsigned int CXBMCRenderManager::PreInit() m_bIsStarted = false; m_bPauseDrawing = false; if (!m_pRenderer) - { + { #if defined(HAS_GL) m_pRenderer = new CLinuxRendererGL(); #elif defined(HAS_DX) @@ -305,7 +305,7 @@ void CXBMCRenderManager::SetupScreenshot() } void CXBMCRenderManager::CreateThumbnail(CBaseTexture *texture, unsigned int width, unsigned int height) -{ +{ CSharedLock lock(m_sharedSection); if (m_pRenderer) m_pRenderer->CreateThumbnail(texture, width, height); @@ -359,7 +359,7 @@ void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0L m_presentfield = FS_ODD; /* invert present field if we have one of those methods */ - if( m_presentmethod == VS_INTERLACEMETHOD_RENDER_BOB_INVERTED + if( m_presentmethod == VS_INTERLACEMETHOD_RENDER_BOB_INVERTED || m_presentmethod == VS_INTERLACEMETHOD_RENDER_WEAVE_INVERTED ) { if( m_presentfield == FS_EVEN ) @@ -393,7 +393,7 @@ float CXBMCRenderManager::GetMaximumFPS() } else fps = 1000.0f; - + return fps; } diff --git a/xbmc/cores/VideoRenderers/RenderManager.h b/xbmc/cores/VideoRenderers/RenderManager.h index 81590c051d..dbd866e6b3 100644 --- a/xbmc/cores/VideoRenderers/RenderManager.h +++ b/xbmc/cores/VideoRenderers/RenderManager.h @@ -138,7 +138,7 @@ public: void WaitPresentTime(double presenttime); CStdString GetVSyncState(); - + void UpdateResolution(); #ifdef HAS_GL @@ -149,7 +149,7 @@ public: CLinuxRenderer *m_pRenderer; #elif defined(HAS_XBOX_D3D) CXBoxRenderer *m_pRenderer; - + #endif void Present(); @@ -170,7 +170,7 @@ protected: CSharedSection m_sharedSection; bool m_bReconfigured; - + int m_rendermethod; enum EPRESENTSTEP diff --git a/xbmc/cores/VideoRenderers/WinRenderManager.cpp b/xbmc/cores/VideoRenderers/WinRenderManager.cpp index e41540ded0..e5bc87ee3a 100644 --- a/xbmc/cores/VideoRenderers/WinRenderManager.cpp +++ b/xbmc/cores/VideoRenderers/WinRenderManager.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "stdafx.h" #include "WinRenderManager.h" @@ -51,14 +51,14 @@ CWinRenderManager::~CWinRenderManager() bool CWinRenderManager::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags) { DWORD locks = ExitCriticalSection(g_graphicsContext); - CExclusiveLock lock(m_sharedSection); + CExclusiveLock lock(m_sharedSection); - if(!m_pRenderer) + if(!m_pRenderer) { RestoreCriticalSection(g_graphicsContext, locks); return false; } - + bool result = m_pRenderer->Configure(width, height, d_width, d_height, fps, flags); if(result) { @@ -71,7 +71,7 @@ bool CWinRenderManager::Configure(unsigned int width, unsigned int height, unsig m_pRenderer->Update(false); m_bIsStarted = true; } - + RestoreCriticalSection(g_graphicsContext, locks); return result; } @@ -90,7 +90,7 @@ void CWinRenderManager::Update(bool bPauseDrawing) void CWinRenderManager::RenderUpdate(bool clear, DWORD flags, DWORD alpha) { DWORD locks = ExitCriticalSection(g_graphicsContext); - CSharedLock lock(m_sharedSection); + CSharedLock lock(m_sharedSection); RestoreCriticalSection(g_graphicsContext, locks); if (m_pRenderer) diff --git a/xbmc/cores/VideoRenderers/WinRenderer.cpp b/xbmc/cores/VideoRenderers/WinRenderer.cpp index 6b33d9b144..6f36d50be8 100644 --- a/xbmc/cores/VideoRenderers/WinRenderer.cpp +++ b/xbmc/cores/VideoRenderers/WinRenderer.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #ifdef HAS_DX #include "WinRenderer.h" @@ -37,12 +37,12 @@ YUVRANGE yuv_range_lim = { 16, 235, 16, 240, 16, 240 }; YUVRANGE yuv_range_full = { 0, 255, 0, 255, 0, 255 }; -static float yuv_coef_bt601[4][4] = +static float yuv_coef_bt601[4][4] = { { 1.0f, 1.0f, 1.0f, 0.0f }, { 0.0f, -0.344f, 1.773f, 0.0f }, { 1.403f, -0.714f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f, 0.0f } + { 0.0f, 0.0f, 0.0f, 0.0f } }; static float yuv_coef_bt709[4][4] = @@ -53,7 +53,7 @@ static float yuv_coef_bt709[4][4] = { 0.0f, 0.0f, 0.0f, 0.0f } }; -static float yuv_coef_ebu[4][4] = +static float yuv_coef_ebu[4][4] = { { 1.0f, 1.0f, 1.0f, 0.0f }, { 0.0f, -0.3960f, 2.029f, 0.0f }, @@ -96,7 +96,7 @@ void CWinRenderer::ManageTextures() else if( m_NumYV12Buffers > neededbuffers ) { m_NumYV12Buffers = neededbuffers; - m_iYV12RenderBuffer = m_iYV12RenderBuffer % m_NumYV12Buffers; + m_iYV12RenderBuffer = m_iYV12RenderBuffer % m_NumYV12Buffers; for(int i = m_NumYV12Buffers-1; i>=neededbuffers;i--) DeleteYV12Texture(i); @@ -187,9 +187,9 @@ void CWinRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) if (!m_bConfigured) return; ManageTextures(); - if (!m_YUVMemoryTexture[m_iYV12RenderBuffer][0]) + if (!m_YUVMemoryTexture[m_iYV12RenderBuffer][0]) return ; - + CSingleLock lock(g_graphicsContext); ManageDisplay(); @@ -229,11 +229,11 @@ unsigned int CWinRenderer::DrawSlice(unsigned char *src[], int stride[], int w, BYTE *s; BYTE *d; int i, p; - + int index = NextYV12Texture(); if( index < 0 ) return -1; - + D3DLOCKED_RECT rect; RECT target; @@ -262,7 +262,7 @@ unsigned int CWinRenderer::DrawSlice(unsigned char *src[], int stride[], int w, target.top>>=1; target.bottom>>=1; target.left>>=1; - target.right>>=1; + target.right>>=1; // copy U p = 1; @@ -400,7 +400,7 @@ void CWinRenderer::RenderLowMem(DWORD flags) FLOAT tu3, tv3; }; - CUSTOMVERTEX verts[4] = + CUSTOMVERTEX verts[4] = { { m_destRect.x1 , m_destRect.y1, 0.0f, 1.0f, @@ -462,7 +462,7 @@ void CWinRenderer::RenderLowMem(DWORD flags) memcpy(temp.m, yuv_coef_smtp240m, 4*4*sizeof(float)); break; case CONF_FLAGS_YUVCOEF_BT709: memcpy(temp.m, yuv_coef_bt709 , 4*4*sizeof(float)); break; - case CONF_FLAGS_YUVCOEF_BT601: + case CONF_FLAGS_YUVCOEF_BT601: memcpy(temp.m, yuv_coef_bt601 , 4*4*sizeof(float)); break; case CONF_FLAGS_YUVCOEF_EBU: memcpy(temp.m, yuv_coef_ebu , 4*4*sizeof(float)); break; @@ -503,7 +503,7 @@ void CWinRenderer::RenderLowMem(DWORD flags) pD3DDevice->SetTexture(0, NULL); pD3DDevice->SetTexture(1, NULL); pD3DDevice->SetTexture(2, NULL); - + m_YUV2RGBEffect.EndPass() ; } @@ -564,10 +564,10 @@ void CWinRenderer::DeleteYV12Texture(int index) } void CWinRenderer::ClearYV12Texture(int index) -{ +{ YUVMEMORYPLANES &planes = m_YUVMemoryTexture[index]; D3DLOCKED_RECT rect; - + rect.pBits = planes[0]; rect.Pitch = m_sourceWidth; memset(rect.pBits, 0, rect.Pitch * m_sourceHeight); diff --git a/xbmc/cores/VideoRenderers/XBoxRenderer.cpp b/xbmc/cores/VideoRenderers/XBoxRenderer.cpp index 116bbae03a..6daf45a498 100644 --- a/xbmc/cores/VideoRenderers/XBoxRenderer.cpp +++ b/xbmc/cores/VideoRenderers/XBoxRenderer.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "stdafx.h" #include "XBoxRenderer.h" #include "Application.h" @@ -45,13 +45,13 @@ YUVCOEF yuv_coef_bt709 = { YUVCOEF yuv_coef_ebu = { 0.0f, 1.140f, -0.396f, -0.581f, - 2.029f, 0.0f, + 2.029f, 0.0f, }; YUVCOEF yuv_coef_smtp240m = { 0.0f, 1.5756f, -0.2253f, -0.5000f, /* page above have the 0.5000f as positive */ - 1.8270f, 0.0f, + 1.8270f, 0.0f, }; @@ -284,7 +284,7 @@ void CXBoxRenderer::DrawAlpha(int x0, int y0, int w, int h, unsigned char *src, if(true /*isvobsub*/) // xbox_video.cpp is fixed to 720x576 osd, so this should be fine { // vobsubs are given to us unscaled - // scale them up to the full output, assuming vobsubs have same + // scale them up to the full output, assuming vobsubs have same // pixel aspect ratio as the movie, and are 720 pixels wide float pixelaspect = m_fSourceFrameRatio * m_iSourceHeight / m_iSourceWidth; @@ -299,7 +299,7 @@ void CXBoxRenderer::DrawAlpha(int x0, int y0, int w, int h, unsigned char *src, xscale = 1.0f; yscale = 1.0f; } - + // horizontal centering, and align to bottom of subtitles line osdRect.left = (float)rv.left + (float)(rv.right - rv.left - (float)w * xscale) / 2.0f; osdRect.right = osdRect.left + (float)w * xscale; @@ -371,7 +371,7 @@ void CXBoxRenderer::DrawAlpha(int x0, int y0, int w, int h, unsigned char *src, m_pOSDATexture[iOSDBuffer]->UnlockRect(0); #else if (SDL_LockSurface(m_pOSDYTexture[iOSDBuffer]) == 0 && - SDL_LockSurface(m_pOSDATexture[iOSDBuffer]) == 0) + SDL_LockSurface(m_pOSDATexture[iOSDBuffer]) == 0) { //clear the textures memset(m_pOSDYTexture[iOSDBuffer]->pixels, 0, m_pOSDYTexture[iOSDBuffer]->pitch*m_iOSDTextureHeight[iOSDBuffer]); @@ -766,7 +766,7 @@ bool CXBoxRenderer::Configure(unsigned int width, unsigned int height, unsigned m_iSourceWidth = width; m_iSourceHeight = height; m_iFlags = flags; - + // setup what colorspace we live in if(flags & CONF_FLAGS_YUV_FULLRANGE) m_yuvrange = yuv_range_full; @@ -779,7 +779,7 @@ bool CXBoxRenderer::Configure(unsigned int width, unsigned int height, unsigned m_yuvcoef = yuv_coef_smtp240m; break; case CONF_FLAGS_YUVCOEF_BT709: m_yuvcoef = yuv_coef_bt709; break; - case CONF_FLAGS_YUVCOEF_BT601: + case CONF_FLAGS_YUVCOEF_BT601: m_yuvcoef = yuv_coef_bt601; break; case CONF_FLAGS_YUVCOEF_EBU: m_yuvcoef = yuv_coef_ebu; break; @@ -802,7 +802,7 @@ int CXBoxRenderer::NextYV12Texture() #ifdef MP_DIRECTRENDERING int source = m_iYV12RenderBuffer; do { - source = (source + 1) % m_NumYV12Buffers; + source = (source + 1) % m_NumYV12Buffers; } while( source != m_iYV12RenderBuffer && m_image[source].flags & IMAGE_FLAG_INUSE); @@ -825,7 +825,7 @@ int CXBoxRenderer::GetImage(YV12Image *image, int source, bool readonly) if( source == AUTOSOURCE ) source = NextYV12Texture(); -#ifdef MP_DIRECTRENDERING +#ifdef MP_DIRECTRENDERING if( source < 0 ) { /* no free source existed, so create one */ CSingleLock lock(g_graphicsContext); @@ -861,12 +861,12 @@ void CXBoxRenderer::ReleaseImage(int source, bool preserve) { if( m_image[source].flags & IMAGE_FLAG_WRITING ) SetEvent(m_eventTexturesDone[source]); - + m_image[source].flags &= ~IMAGE_FLAG_INUSE; /* if image should be preserved reserve it so it's not auto seleceted */ if( preserve ) - m_image[source].flags |= IMAGE_FLAG_RESERVED; + m_image[source].flags |= IMAGE_FLAG_RESERVED; } void CXBoxRenderer::Reset() @@ -876,7 +876,7 @@ void CXBoxRenderer::Reset() /* reset all image flags, this will cleanup textures later */ m_image[i].flags = 0; /* reset texure locks, abit uggly, could result in tearing */ - SetEvent(m_eventTexturesDone[i]); + SetEvent(m_eventTexturesDone[i]); } } @@ -919,7 +919,7 @@ void CXBoxRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) } void CXBoxRenderer::FlipPage(int source) -{ +{ if( source >= 0 && source < m_NumYV12Buffers ) m_iYV12RenderBuffer = source; else @@ -948,7 +948,7 @@ unsigned int CXBoxRenderer::DrawSlice(unsigned char *src[], int stride[], int w, BYTE *s; BYTE *d; int i, p; - + int index = NextYV12Texture(); if( index < 0 ) return -1; @@ -1065,7 +1065,7 @@ void CXBoxRenderer::UnInit() DeleteYV12Texture(i); DeleteOSDTextures(i); } - + if (m_hLowMemShader) { #ifndef _LINUX diff --git a/xbmc/cores/VideoRenderers/XBoxRenderer.h b/xbmc/cores/VideoRenderers/XBoxRenderer.h index 8e571a3c57..ec78134cb5 100644 --- a/xbmc/cores/VideoRenderers/XBoxRenderer.h +++ b/xbmc/cores/VideoRenderers/XBoxRenderer.h @@ -167,7 +167,7 @@ public: virtual void Reset(); /* resets renderer after seek for example */ void RenderUpdate(bool clear, DWORD flags = 0, DWORD alpha = 255); - RESOLUTION GetResolution(); + RESOLUTION GetResolution(); protected: virtual void Render(DWORD flags); diff --git a/xbmc/cores/dvdplayer/DVDClock.cpp b/xbmc/cores/dvdplayer/DVDClock.cpp index fb3c266e80..a6779f488b 100644 --- a/xbmc/cores/dvdplayer/DVDClock.cpp +++ b/xbmc/cores/dvdplayer/DVDClock.cpp @@ -217,17 +217,17 @@ int CDVDClock::UpdateFramerate(double fps) if (rate <= 0) return -1; - + CSingleLock lock(m_speedsection); - + m_speedadjust = true; - + double weight = (double)rate / (double)MathUtils::round_int(fps); //set the speed of the videoreferenceclock based on fps, refreshrate and maximum speed adjust set by user if (m_maxspeedadjust > 0.05) { - if (weight / MathUtils::round_int(weight) < 1.0 + m_maxspeedadjust / 100.0 + if (weight / MathUtils::round_int(weight) < 1.0 + m_maxspeedadjust / 100.0 && weight / MathUtils::round_int(weight) > 1.0 - m_maxspeedadjust / 100.0) weight = MathUtils::round_int(weight); } @@ -235,6 +235,6 @@ int CDVDClock::UpdateFramerate(double fps) lock.Leave(); g_VideoReferenceClock.SetSpeed(speed); - + return rate; } diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp index 157341a158..691ea55aea 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.cpp @@ -37,7 +37,7 @@ #include "CrystalHD.h" #include "DVDClock.h" #include "DynamicDll.h" -#include "utils/Atomics.h" +#include "utils/Atomics.h" #include "utils/Thread.h" #include "utils/log.h" #include "utils/fastmemcpy.h" @@ -178,11 +178,11 @@ class CMPCInputThread : public CThread public: CMPCInputThread(void *device, DllLibCrystalHD *dll); virtual ~CMPCInputThread(); - + bool AddInput(unsigned char* pData, size_t size, uint64_t pts); void Flush(void); unsigned int GetInputCount(void); - + protected: CMPCDecodeBuffer* AllocBuffer(size_t size); void FreeBuffer(CMPCDecodeBuffer* pBuffer); @@ -190,7 +190,7 @@ protected: void Process(void); CSyncPtrQueue<CMPCDecodeBuffer> m_InputList; - + DllLibCrystalHD *m_dll; void *m_Device; int m_SleepTime; @@ -202,7 +202,7 @@ class CMPCOutputThread : public CThread public: CMPCOutputThread(void *device, DllLibCrystalHD *dll); virtual ~CMPCOutputThread(); - + unsigned int GetReadyCount(void); CPictureBuffer* ReadyListPop(void); void FreeListPush(CPictureBuffer* pBuffer); @@ -213,7 +213,7 @@ protected: void SetAspectRatio(BCM::BC_PIC_INFO_BLOCK *pic_info); bool GetDecoderOutput(void); virtual void Process(void); - + CSyncPtrQueue<CPictureBuffer> m_FreeList; CSyncPtrQueue<CPictureBuffer> m_ReadyList; @@ -276,7 +276,7 @@ CMPCInputThread::CMPCInputThread(void *device, DllLibCrystalHD *dll) : m_SleepTime(10) { } - + CMPCInputThread::~CMPCInputThread() { while (m_InputList.Count()) @@ -422,8 +422,8 @@ void CMPCOutputThread::Flush(void) void CMPCOutputThread::SetFrameRate(uint32_t resolution) { m_interlace = FALSE; - - switch (resolution) + + switch (resolution) { case BCM::vdecRESOLUTION_480p0: m_framerate = 60.0; @@ -491,7 +491,7 @@ void CMPCOutputThread::SetFrameRate(uint32_t resolution) m_framerate = 30.0 * 1000.0 / 1001.0; break; case BCM::vdecRESOLUTION_480i: - m_framerate = 60.0 * 1000.0 / 1001.0; + m_framerate = 60.0 * 1000.0 / 1001.0; m_interlace = TRUE; break; case BCM::vdecRESOLUTION_NTSC: @@ -513,12 +513,12 @@ void CMPCOutputThread::SetFrameRate(uint32_t resolution) break; case BCM::vdecRESOLUTION_576p25: m_framerate = 25.0; - break; + break; default: m_framerate = 24.0 * 1000.0 / 1001.0; break; } - + if(m_interlace) { m_framerate /= 2; @@ -599,7 +599,7 @@ void CMPCOutputThread::SetAspectRatio(BCM::BC_PIC_INFO_BLOCK *pic_info) m_aspectratio_x = 0; m_aspectratio_y = 0; break; - + case BCM::vdecAspectRatioOther: m_aspectratio_x = pic_info->custom_aspect_ratio_width_height & 0x0000ffff; m_aspectratio_y = pic_info->custom_aspect_ratio_width_height >> 16; @@ -620,7 +620,7 @@ bool CMPCOutputThread::GetDecoderOutput(void) BCM::BC_DTS_PROC_OUT procOut; CPictureBuffer *pBuffer = NULL; bool got_picture = false; - + // Setup output struct memset(&procOut, 0, sizeof(BCM::BC_DTS_PROC_OUT)); @@ -635,16 +635,16 @@ bool CMPCOutputThread::GetDecoderOutput(void) if (procOut.PicInfo.timeStamp && (procOut.PicInfo.timeStamp != m_timestamp)) { m_timestamp = procOut.PicInfo.timeStamp; - + // Get next output buffer from the free list pBuffer = m_FreeList.Pop(); if (!pBuffer) { // No free pre-allocated buffers so make one - pBuffer = new CPictureBuffer(m_width, m_height); - CLog::Log(LOGDEBUG, "%s: Added a new Buffer, ReadyListCount: %d", __MODULE_NAME__, m_ReadyList.Count()); + pBuffer = new CPictureBuffer(m_width, m_height); + CLog::Log(LOGDEBUG, "%s: Added a new Buffer, ReadyListCount: %d", __MODULE_NAME__, m_ReadyList.Count()); } - + pBuffer->m_width = m_width; pBuffer->m_height = m_height; pBuffer->m_field = CRYSTALHD_FIELD_FULL; @@ -673,7 +673,7 @@ bool CMPCOutputThread::GetDecoderOutput(void) pBuffer->m_field = CRYSTALHD_FIELD_ODD; else pBuffer->m_field = CRYSTALHD_FIELD_EVEN; - + // copy y s = procOut.Ybuff; d = pBuffer->m_y_buffer_ptr; @@ -702,13 +702,13 @@ bool CMPCOutputThread::GetDecoderOutput(void) } } break; - + // frame that are not equal in width to 720, 1280 or 1920 // need to be copied by a quantized stride (possible lib/driver bug). default: { unsigned char *s, *d; - + if (w < 720) { // copy y @@ -757,22 +757,22 @@ bool CMPCOutputThread::GetDecoderOutput(void) } else { - //CLog::Log(LOGDEBUG, "%s: Duplicate or no timestamp detected: %llu", __MODULE_NAME__, procOut.PicInfo.timeStamp); + //CLog::Log(LOGDEBUG, "%s: Duplicate or no timestamp detected: %llu", __MODULE_NAME__, procOut.PicInfo.timeStamp); } } m_dll->DtsReleaseOutputBuffs(m_Device, NULL, FALSE); break; - + case BCM::BC_STS_NO_DATA: break; case BCM::BC_STS_FMT_CHANGE: - CLog::Log(LOGDEBUG, "%s: Format Change Detected. Flags: 0x%08x", __MODULE_NAME__, procOut.PoutFlags); + CLog::Log(LOGDEBUG, "%s: Format Change Detected. Flags: 0x%08x", __MODULE_NAME__, procOut.PoutFlags); if ((procOut.PoutFlags & BCM::BC_POUT_FLAGS_PIB_VALID) && (procOut.PoutFlags & BCM::BC_POUT_FLAGS_FMT_CHANGE)) { PrintFormat(procOut.PicInfo); - + if (procOut.PicInfo.height == 1088) { procOut.PicInfo.height = 1080; } @@ -783,7 +783,7 @@ bool CMPCOutputThread::GetDecoderOutput(void) m_OutputTimeout = 2000; } break; - + default: if (ret > 26) CLog::Log(LOGDEBUG, "%s: DtsProcOutput returned %d.", __MODULE_NAME__, ret); @@ -791,7 +791,7 @@ bool CMPCOutputThread::GetDecoderOutput(void) CLog::Log(LOGDEBUG, "%s: DtsProcOutput returned %s.", __MODULE_NAME__, g_DtsStatusText[ret]); break; } - + return got_picture; } @@ -844,11 +844,11 @@ CCrystalHD::CCrystalHD() : CheckCrystalHDLibraryPath(); if (m_dll->Load() && m_dll->IsLoaded() ) { - uint32_t mode = BCM::DTS_PLAYBACK_MODE | - BCM::DTS_LOAD_FILE_PLAY_FW | - BCM::DTS_PLAYBACK_DROP_RPT_MODE | + uint32_t mode = BCM::DTS_PLAYBACK_MODE | + BCM::DTS_LOAD_FILE_PLAY_FW | + BCM::DTS_PLAYBACK_DROP_RPT_MODE | DTS_DFLT_RESOLUTION(BCM::vdecRESOLUTION_720p23_976); - + BCM::BC_STATUS res= m_dll->DtsDeviceOpen(&m_Device, mode); if (res != BCM::BC_STS_SUCCESS) { @@ -917,13 +917,13 @@ CCrystalHD* CCrystalHD::GetInstance(void) void CCrystalHD::CheckCrystalHDLibraryPath(void) { // support finding library by windows registry -#if defined _WIN32 +#if defined _WIN32 HKEY hKey; CStdString strRegKey; - + CLog::Log(LOGDEBUG, "%s: detecting CrystalHD installation path", __MODULE_NAME__); strRegKey.Format("%s\\%s", BC_REG_PATH, BC_REG_PRODUCT ); - + if( CWIN32Util::UtilRegOpenKeyEx( HKEY_LOCAL_MACHINE, strRegKey.c_str(), KEY_READ, &hKey )) { DWORD dwType; @@ -973,7 +973,7 @@ bool CCrystalHD::OpenDecoder(CRYSTALHD_STREAM_TYPE stream_type, CRYSTALHD_CODEC_ break; } - do + do { res = m_dll->DtsOpenDecoder(m_Device, stream_type); if (res != BCM::BC_STS_SUCCESS) @@ -999,7 +999,7 @@ bool CCrystalHD::OpenDecoder(CRYSTALHD_STREAM_TYPE stream_type, CRYSTALHD_CODEC_ CLog::Log(LOGDEBUG, "%s: start capture failed", __MODULE_NAME__); break; } - + m_pInputThread = new CMPCInputThread(m_Device, m_dll); m_pInputThread->Create(); m_pOutputThread = new CMPCOutputThread(m_Device, m_dll); @@ -1008,7 +1008,7 @@ bool CCrystalHD::OpenDecoder(CRYSTALHD_STREAM_TYPE stream_type, CRYSTALHD_CODEC_ m_drop_state = false; m_ignore_drop_count = 10; m_IsConfigured = true; - + CLog::Log(LOGDEBUG, "%s: codec opened", __MODULE_NAME__); } while(false); @@ -1027,7 +1027,7 @@ void CCrystalHD::CloseDecoder(void) { while(m_BusyList.Count()) m_pOutputThread->FreeListPush( m_BusyList.Pop() ); - + m_pOutputThread->StopThread(); delete m_pOutputThread; m_pOutputThread = NULL; @@ -1065,7 +1065,7 @@ unsigned int CCrystalHD::GetInputCount(void) if (m_pInputThread) return m_pInputThread->GetInputCount(); else - return 0; + return 0; } bool CCrystalHD::AddInput(unsigned char *pData, size_t size, double pts) @@ -1103,7 +1103,7 @@ bool CCrystalHD::GetPicture(DVDVideoPicture *pDvdVideoPicture) pDvdVideoPicture->iHeight = pBuffer->m_height; pDvdVideoPicture->iDisplayWidth = pBuffer->m_width; pDvdVideoPicture->iDisplayHeight = pBuffer->m_height; - + // Y plane pDvdVideoPicture->data[0] = (BYTE*)pBuffer->m_y_buffer_ptr; pDvdVideoPicture->iLineSize[0] = pBuffer->m_width; @@ -1118,7 +1118,7 @@ bool CCrystalHD::GetPicture(DVDVideoPicture *pDvdVideoPicture) //pDvdVideoPicture->iDuration = 0; pDvdVideoPicture->iDuration = (DVD_TIME_BASE / pBuffer->m_framerate); pDvdVideoPicture->color_range = 1; - // todo + // todo //pDvdVideoPicture->color_matrix = 1; pDvdVideoPicture->iFlags = DVP_FLAG_ALLOCATED; pDvdVideoPicture->iFlags |= pBuffer->m_interlace ? DVP_FLAG_INTERLACED : 0; @@ -1150,7 +1150,7 @@ void CCrystalHD::SetDropState(bool bDrop) { m_dll->DtsSetFFRate(m_Device, 1); } - + if (m_drop_state) { // pop all picture off the ready list and push back into the free list @@ -1173,10 +1173,10 @@ void PrintFormat(BCM::BC_PIC_INFO_BLOCK &pib) CLog::Log(LOGDEBUG, "\tWidth: %d\n", pib.width); CLog::Log(LOGDEBUG, "\tHeight: %d\n", pib.height); CLog::Log(LOGDEBUG, "\tChroma: 0x%03x\n", pib.chroma_format); - CLog::Log(LOGDEBUG, "\tPulldown: %d\n", pib.pulldown); - CLog::Log(LOGDEBUG, "\tFlags: 0x%08x\n", pib.flags); - CLog::Log(LOGDEBUG, "\tFrame Rate/Res: %d\n", pib.frame_rate); - CLog::Log(LOGDEBUG, "\tAspect Ratio: %d\n", pib.aspect_ratio); + CLog::Log(LOGDEBUG, "\tPulldown: %d\n", pib.pulldown); + CLog::Log(LOGDEBUG, "\tFlags: 0x%08x\n", pib.flags); + CLog::Log(LOGDEBUG, "\tFrame Rate/Res: %d\n", pib.frame_rate); + CLog::Log(LOGDEBUG, "\tAspect Ratio: %d\n", pib.aspect_ratio); CLog::Log(LOGDEBUG, "\tColor Primaries: %d\n", pib.colour_primaries); CLog::Log(LOGDEBUG, "\tMetaData: %d\n", pib.picture_meta_payload); CLog::Log(LOGDEBUG, "\tSession Number: %d\n", pib.sess_num); diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.h index 386ca668bb..beacde4c70 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/CrystalHD.h @@ -129,10 +129,10 @@ public: void Flush(void); unsigned int GetInputCount(void); bool AddInput(unsigned char *pData, size_t size, double pts); - + int GetReadyCount(void); void BusyListPop(void); - + bool GetPicture(DVDVideoPicture* pDvdVideoPicture); void SetDropState(bool bDrop); @@ -140,7 +140,7 @@ protected: void CheckCrystalHDLibraryPath(void); void SetFrameRate(uint32_t resolution); void SetAspectRatio(uint32_t aspect_ratio, uint32_t custom_aspect_ratio_width_height); - + DllLibCrystalHD *m_dll; void *m_Device; @@ -155,7 +155,7 @@ protected: CMPCInputThread *m_pInputThread; CMPCOutputThread *m_pOutputThread; CSyncPtrQueue<CPictureBuffer> m_BusyList; - + private: CCrystalHD(); static CCrystalHD *m_pInstance; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h index 84c3b6bc42..ed1be90fa5 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h @@ -35,7 +35,7 @@ // should be entirely filled by all codecs struct DVDVideoPicture -{ +{ double pts; // timestamp in seconds, used in the CDVDPlayer class to keep track of pts BYTE* data[4]; // [4] = alpha channel, currently not used int iLineSize[4]; // [4] = alpha channel, currently not used diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCrystalHD.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCrystalHD.cpp index 85c80f0bb2..f281922f50 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCrystalHD.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCrystalHD.cpp @@ -52,12 +52,12 @@ bool CDVDVideoCodecCrystalHD::Open(CDVDStreamInfo &hints, CDVDCodecOptions &opti { int requestedMethod = g_guiSettings.GetInt("videoplayer.rendermethod"); - if ((requestedMethod == RENDER_METHOD_AUTO || + if ((requestedMethod == RENDER_METHOD_AUTO || requestedMethod == RENDER_METHOD_CRYSTALHD) && !hints.software) { CRYSTALHD_CODEC_TYPE codec_type; CRYSTALHD_STREAM_TYPE stream_type; - + switch (hints.codec) { case CODEC_ID_MPEG2VIDEO: @@ -89,7 +89,7 @@ bool CDVDVideoCodecCrystalHD::Open(CDVDStreamInfo &hints, CDVDCodecOptions &opti CLog::Log(LOGERROR, "%s: Failed to open Broadcom Crystal HD Codec", __MODULE_NAME__); return false; } - + if (m_Device && !m_Device->OpenDecoder(stream_type, codec_type)) { CLog::Log(LOGERROR, "%s: Failed to open Broadcom Crystal HD Codec", __MODULE_NAME__); @@ -97,11 +97,11 @@ bool CDVDVideoCodecCrystalHD::Open(CDVDStreamInfo &hints, CDVDCodecOptions &opti } m_DropPictures = false; - + CLog::Log(LOGINFO, "%s: Opened Broadcom Crystal HD Codec", __MODULE_NAME__); return true; } - + return false; } @@ -120,7 +120,7 @@ int CDVDVideoCodecCrystalHD::Decode(BYTE *pData, int iSize, double pts) bool annexbfiltered = false; m_Device->BusyListPop(); - + // in NULL is passed, DVDPlayer wants us to flush any internal picture frame. // we don't have internal picture frames so just return. if (!pData) @@ -130,7 +130,7 @@ int CDVDVideoCodecCrystalHD::Decode(BYTE *pData, int iSize, double pts) { int outbuf_size = 0; uint8_t *outbuf = NULL; - + h264_mp4toannexb_filter(pData, iSize, &outbuf, &outbuf_size); if (outbuf) { @@ -139,7 +139,7 @@ int CDVDVideoCodecCrystalHD::Decode(BYTE *pData, int iSize, double pts) iSize = outbuf_size; } } - + if (pData) { if ( m_Device->AddInput(pData, iSize, pts) ) @@ -154,17 +154,17 @@ int CDVDVideoCodecCrystalHD::Decode(BYTE *pData, int iSize, double pts) Sleep(10); } } - + if (m_Device->GetInputCount() < 10) ret |= VC_BUFFER; if (!m_DropPictures) Sleep(20); - + // Handle Output if (m_Device->GetReadyCount()) ret |= VC_PICTURE; - + if (!ret) ret = VC_ERROR; @@ -173,7 +173,7 @@ int CDVDVideoCodecCrystalHD::Decode(BYTE *pData, int iSize, double pts) void CDVDVideoCodecCrystalHD::Reset(void) { - CLog::Log(LOGDEBUG, "%s: Reset, flushing decoder.", __MODULE_NAME__); + CLog::Log(LOGDEBUG, "%s: Reset, flushing decoder.", __MODULE_NAME__); m_Device->Flush(); } @@ -194,7 +194,7 @@ bool CDVDVideoCodecCrystalHD::init_h264_mp4toannexb_filter(CDVDStreamInfo &hints // based on h264_mp4toannexb_bsf.c (ffmpeg) // which is Copyright (c) 2007 Benoit Fouet <benoit.fouet@free.fr> // and Licensed GPL 2.1 or greater - + m_sps_pps_data = NULL; m_sps_pps_size = 0; @@ -255,7 +255,7 @@ void CDVDVideoCodecCrystalHD::alloc_and_copy(uint8_t **poutbuf, int *poutbuf // based on h264_mp4toannexb_bsf.c (ffmpeg) // which is Copyright (c) 2007 Benoit Fouet <benoit.fouet@free.fr> // and Licensed GPL 2.1 or greater - + #define CHD_WB32(p, d) { \ ((uint8_t*)(p))[3] = (d); \ ((uint8_t*)(p))[2] = (d) >> 8; \ @@ -289,7 +289,7 @@ bool CDVDVideoCodecCrystalHD::h264_mp4toannexb_filter(BYTE* pData, int iSize, ui // based on h264_mp4toannexb_bsf.c (ffmpeg) // which is Copyright (c) 2007 Benoit Fouet <benoit.fouet@free.fr> // and Licensed GPL 2.1 or greater - + uint8_t *buf = pData; int buf_size = iSize; uint8_t unit_type; @@ -310,7 +310,7 @@ bool CDVDVideoCodecCrystalHD::h264_mp4toannexb_filter(BYTE* pData, int iSize, ui // prepend only to the first type 5 NAL unit of an IDR picture if (m_sps_pps_context.first_idr && unit_type == 5) { - alloc_and_copy(poutbuf, poutbuf_size, + alloc_and_copy(poutbuf, poutbuf_size, m_sps_pps_context.sps_pps_data, m_sps_pps_context.size, buf, nal_size); m_sps_pps_context.first_idr = 0; } diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCrystalHD.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCrystalHD.h index f2efbd54ed..3591baf161 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCrystalHD.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecCrystalHD.h @@ -54,7 +54,7 @@ protected: const uint8_t *sps_pps, uint32_t sps_pps_size, const uint8_t *in, uint32_t in_size); bool h264_mp4toannexb_filter(BYTE* pData, int iSize, uint8_t **poutbuf, int *poutbuf_size); - + bool m_annexbfiltering; uint8_t *m_sps_pps_data; uint32_t m_sps_pps_size; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp index ef0a139b26..c84b4a29e2 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp @@ -46,7 +46,7 @@ CVDPAU::Desc decoder_profiles[] = { }; const size_t decoder_profile_count = sizeof(decoder_profiles)/sizeof(CVDPAU::Desc); -static float studioCSC[3][4] = +static float studioCSC[3][4] = { { 1.0f, 0.0f, 1.57480000f,-0.78740000f}, { 1.0f,-0.18737736f,-0.46813736f, 0.32775736f}, @@ -96,7 +96,7 @@ CVDPAU::CVDPAU(int width, int height, CodecID codec) videoMixer = VDP_INVALID_HANDLE; dl_handle = dlopen("libvdpau.so.1", RTLD_LAZY); - if (!dl_handle) + if (!dl_handle) { CLog::Log(LOGNOTICE,"(VDPAU) unable to get handle to libvdpau"); return; @@ -329,7 +329,7 @@ bool CVDPAU::IsVDPAUFormat(PixelFormat format) void CVDPAU::CheckFeatures() { if (videoMixer == VDP_INVALID_HANDLE) - { + { CLog::Log(LOGNOTICE, " (VDPAU) Creating the video mixer"); // Creation of VideoMixer. VdpVideoMixerParameter parameters[] = { @@ -444,7 +444,7 @@ void CVDPAU::SetNoiseReduction() VdpVideoMixerAttribute attributes[] = { VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL }; VdpStatus vdp_st; - if (!g_settings.m_currentVideoSettings.m_NoiseReduction) + if (!g_settings.m_currentVideoSettings.m_NoiseReduction) { VdpBool enabled[]= {0}; vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); @@ -466,7 +466,7 @@ void CVDPAU::SetSharpness() VdpVideoMixerAttribute attributes[] = { VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL }; VdpStatus vdp_st; - if (!g_settings.m_currentVideoSettings.m_Sharpness) + if (!g_settings.m_currentVideoSettings.m_Sharpness) { VdpBool enabled[]={0}; vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); @@ -501,25 +501,25 @@ void CVDPAU::SetDeinterlacing() VdpStatus vdp_st; - if (!g_settings.m_currentVideoSettings.m_InterlaceMethod) + if (!g_settings.m_currentVideoSettings.m_InterlaceMethod) { VdpBool enabled[]={0,0,0}; vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); CheckStatus(vdp_st, __LINE__); } - else if (g_settings.m_currentVideoSettings.m_InterlaceMethod == VS_INTERLACEMETHOD_AUTO) + else if (g_settings.m_currentVideoSettings.m_InterlaceMethod == VS_INTERLACEMETHOD_AUTO) { VdpBool enabled[]={1,0,0}; vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); CheckStatus(vdp_st, __LINE__); } - else if (g_settings.m_currentVideoSettings.m_InterlaceMethod == VS_INTERLACEMETHOD_RENDER_BLEND) + else if (g_settings.m_currentVideoSettings.m_InterlaceMethod == VS_INTERLACEMETHOD_RENDER_BLEND) { VdpBool enabled[]={1,1,0}; vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); CheckStatus(vdp_st, __LINE__); } - else if (g_settings.m_currentVideoSettings.m_InterlaceMethod == VS_INTERLACEMETHOD_INVERSE_TELECINE) + else if (g_settings.m_currentVideoSettings.m_InterlaceMethod == VS_INTERLACEMETHOD_INVERSE_TELECINE) { VdpBool enabled[]={0,0,1}; vdp_st = vdp_video_mixer_set_feature_enables(videoMixer, ARSIZE(feature), feature, enabled); @@ -562,8 +562,8 @@ void CVDPAU::InitVDPAUProcs() vdp_device = VDP_INVALID_HANDLE; return; } - - if (vdp_st != VDP_STATUS_OK) + + if (vdp_st != VDP_STATUS_OK) { CLog::Log(LOGERROR,"(VDPAU) - Unable to create X11 device in %s",__FUNCTION__); vdp_device = VDP_INVALID_HANDLE; @@ -695,7 +695,7 @@ void CVDPAU::InitVDPAUProcs() VDP_FUNC_ID_VIDEO_MIXER_QUERY_FEATURE_SUPPORT, (void **)&vdp_video_mixer_query_feature_support ); - CheckStatus(vdp_st, __LINE__); + CheckStatus(vdp_st, __LINE__); vdp_st = vdp_get_proc_address( vdp_device, @@ -853,7 +853,7 @@ void CVDPAU::FiniVDPAUOutput() CheckStatus(vdp_st, __LINE__); vdp_flip_target = VDP_INVALID_HANDLE; - for (int i = 0; i < totalAvailableOutputSurfaces; i++) + for (int i = 0; i < totalAvailableOutputSurfaces; i++) { vdp_st = vdp_output_surface_destroy(outputSurfaces[i]); CheckStatus(vdp_st, __LINE__); @@ -879,7 +879,7 @@ void CVDPAU::ReadFormatOf( PixelFormat fmt , VdpDecoderProfile &vdp_decoder_profile , VdpChromaType &vdp_chroma_type) { - switch (fmt) + switch (fmt) { case PIX_FMT_VDPAU_MPEG1: vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG1; @@ -958,10 +958,10 @@ bool CVDPAU::ConfigVDPAU(AVCodecContext* avctx, int ref_frames) int tmpMaxOutputSurfaces = NUM_OUTPUT_SURFACES; if (vid_width == FULLHD_WIDTH) - tmpMaxOutputSurfaces = NUM_OUTPUT_SURFACES_FOR_FULLHD; + tmpMaxOutputSurfaces = NUM_OUTPUT_SURFACES_FOR_FULLHD; // Creation of outputSurfaces - for (int i = 0; i < NUM_OUTPUT_SURFACES && i < tmpMaxOutputSurfaces; i++) + for (int i = 0; i < NUM_OUTPUT_SURFACES && i < tmpMaxOutputSurfaces; i++) { vdp_st = vdp_output_surface_create(vdp_device, VDP_RGBA_FORMAT_B8G8R8A8, @@ -971,7 +971,7 @@ bool CVDPAU::ConfigVDPAU(AVCodecContext* avctx, int ref_frames) CHECK_VDPAU_RETURN(vdp_st, false); totalAvailableOutputSurfaces++; } - CLog::Log(LOGNOTICE, " (VDPAU) Total Output Surfaces Available: %i of a max (tmp: %i const: %i)", + CLog::Log(LOGNOTICE, " (VDPAU) Total Output Surfaces Available: %i of a max (tmp: %i const: %i)", totalAvailableOutputSurfaces, tmpMaxOutputSurfaces, NUM_OUTPUT_SURFACES); @@ -1033,7 +1033,7 @@ int CVDPAU::FFGetBuffer(AVCodecContext *avctx, AVFrame *pic) CLog::Log(LOGWARNING, "CVDPAU::FFGetBuffer - returning due to awaiting recovery"); return -1; } - + vdpau_render_state * render = NULL; // find unused surface @@ -1117,7 +1117,7 @@ void CVDPAU::FFReleaseBuffer(AVCodecContext *avctx, AVFrame *pic) render->state &= ~FF_VDPAU_STATE_USED_FOR_REFERENCE; for(i=0; i<4; i++) - pic->data[i]= NULL; + pic->data[i]= NULL; } @@ -1153,7 +1153,7 @@ void CVDPAU::FFDrawSlice(struct AVCodecContext *s, if(s->pix_fmt == PIX_FMT_VDPAU_H264) max_refs = render->info.h264.num_ref_frames; - if(vdp->decoder == VDP_INVALID_HANDLE + if(vdp->decoder == VDP_INVALID_HANDLE || vdp->vdpauConfigured == false || vdp->max_references < max_refs) { @@ -1187,7 +1187,7 @@ void CVDPAU::PrePresent(AVCodecContext *avctx, AVFrame *pFrame) if (interlaced && tmpDeint) structure = pFrame->top_field_first ? VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD : VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD; - else structure = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; + else structure = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; past[0] = past[1]; past[1] = current; @@ -1201,10 +1201,10 @@ void CVDPAU::PrePresent(AVCodecContext *avctx, AVFrame *pFrame) outRectVid.x1 = OutWidth; outRectVid.y1 = OutHeight; } - + if (current == VDP_INVALID_HANDLE) current = render->surface; - + vdp_st = vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue,outputSurface,&time); vdp_st = vdp_video_mixer_render(videoMixer, @@ -1223,7 +1223,7 @@ void CVDPAU::PrePresent(AVCodecContext *avctx, AVFrame *pFrame) 0, NULL); CheckStatus(vdp_st, __LINE__); - + surfaceNum++; if (surfaceNum >= totalAvailableOutputSurfaces) surfaceNum = 0; } diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h index 1e1cb99227..30d21cda5c 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h @@ -37,7 +37,7 @@ namespace Surface { class CSurface; } #define NUM_OUTPUT_SURFACES 4 #define NUM_VIDEO_SURFACES_MPEG2 10 // (1 frame being decoded, 2 reference) -#define NUM_VIDEO_SURFACES_H264 32 // (1 frame being decoded, up to 16 references) +#define NUM_VIDEO_SURFACES_H264 32 // (1 frame being decoded, up to 16 references) #define NUM_VIDEO_SURFACES_VC1 10 // (same as MPEG-2) #define NUM_VIDEO_SURFACES_MAX_TRIES 100 #define NUM_OUTPUT_SURFACES_FOR_FULLHD 2 @@ -177,7 +177,7 @@ public: VdpVideoMixer videoMixer; VdpRect outRect; VdpRect outRectVid; - + VdpBool upscalingAvailable; void* dl_handle; diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp index 96f15fe997..d71d3c8707 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp @@ -376,14 +376,14 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput) if (!iformat) { // av_probe_input_format failed, re-probe the ffmpeg/ffplay method. - // av_open_input_file uses av_probe_input_format2 for probing format, - // starting at 2048, up to max buffer size of 1048576. We just probe to - // the buffer size allocated above so as to avoid seeks on content that + // av_open_input_file uses av_probe_input_format2 for probing format, + // starting at 2048, up to max buffer size of 1048576. We just probe to + // the buffer size allocated above so as to avoid seeks on content that // might not be seekable. int max_buf_size = pd.buf_size; - for (int probe_size=std::min(2048, pd.buf_size); probe_size <= max_buf_size && !iformat; probe_size<<=1) + for (int probe_size=std::min(2048, pd.buf_size); probe_size <= max_buf_size && !iformat; probe_size<<=1) { - CLog::Log(LOGDEBUG, "%s - probing failed, re-probing with probe size [%d]", __FUNCTION__, probe_size); + CLog::Log(LOGDEBUG, "%s - probing failed, re-probing with probe size [%d]", __FUNCTION__, probe_size); int score= probe_size < max_buf_size ? AVPROBE_SCORE_MAX/4 : 0; pd.buf_size = probe_size; iformat = m_dllAvFormat.av_probe_input_format2(&pd, 1, &score); @@ -827,7 +827,7 @@ bool CDVDDemuxFFmpeg::SeekTime(int time, bool backwords, double *startpts) return true; } -#ifdef HAS_FILESYSTEM_MMS +#ifdef HAS_FILESYSTEM_MMS if (m_pInput->IsStreamType(DVDSTREAM_TYPE_MMS)) { if (!((CDVDInputStreamMMS*)m_pInput)->SeekTime(time)) @@ -1196,7 +1196,7 @@ void CDVDDemuxFFmpeg::GetStreamCodecName(int iStreamId, CStdString &strName) if (stream) { unsigned int in = stream->codec_fourcc; - // FourCC codes are only valid on video streams, audio codecs in AVI/WAV + // FourCC codes are only valid on video streams, audio codecs in AVI/WAV // are 2 bytes and audio codecs in transport streams have subtle variation // e.g AC-3 instead of ac3 if (stream->type == STREAM_VIDEO && in != 0) diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.cpp index 0fda444c7b..5027b23cf7 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.cpp @@ -70,7 +70,7 @@ public: CDemuxStreamAudioHTSP(CDVDDemuxHTSP *parent, const string& codec) : m_parent(parent) , m_codec(codec) - + {} void GetStreamInfo(string& strInfo) { diff --git a/xbmc/cores/dvdplayer/DVDFileInfo.cpp b/xbmc/cores/dvdplayer/DVDFileInfo.cpp index 633f1d2d90..dc59eeac8e 100644 --- a/xbmc/cores/dvdplayer/DVDFileInfo.cpp +++ b/xbmc/cores/dvdplayer/DVDFileInfo.cpp @@ -146,10 +146,10 @@ bool CDVDFileInfo::ExtractThumb(const CStdString &strPath, const CStdString &str CDVDStreamInfo hint(*pDemuxer->GetStream(nVideoStream), true); hint.software = true; - + if (hint.codec == CODEC_ID_MPEG2VIDEO || hint.codec == CODEC_ID_MPEG1VIDEO) { - // libmpeg2 is not thread safe so use ffmepg for mpeg2/mpeg1 thumb extraction + // libmpeg2 is not thread safe so use ffmepg for mpeg2/mpeg1 thumb extraction CDVDCodecOptions dvdOptions; pVideoCodec = CDVDFactoryCodec::OpenCodec(new CDVDVideoCodecFFmpeg(), hint, dvdOptions); } diff --git a/xbmc/cores/dvdplayer/DVDFileInfo.h b/xbmc/cores/dvdplayer/DVDFileInfo.h index 817bcf1c50..10958f6df7 100644 --- a/xbmc/cores/dvdplayer/DVDFileInfo.h +++ b/xbmc/cores/dvdplayer/DVDFileInfo.h @@ -34,7 +34,7 @@ public: // GetFileMetaData will fill pItem's properties according to what can be extracted from the file. static void GetFileMetaData(const CStdString &strPath, CFileItem *pItem); - + // Probe the files streams and store the info in the VideoInfoTag static bool GetFileStreamDetails(CFileItem *pItem); static bool DemuxerToStreamDetails(CDVDDemux *pDemux, CStreamDetails &details); diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.cpp index 9e07c6c102..5a5d8f42e3 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.cpp +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.cpp @@ -263,7 +263,7 @@ int CDVDInputStreamHTSP::GetTotalTime() int CDVDInputStreamHTSP::GetTime() { CDateTimeSpan time; - time = CDateTime::GetUTCDateTime() + time = CDateTime::GetUTCDateTime() - CDateTime((time_t)m_event.start); return time.GetDays() * 1000 * 60 * 60 * 24 diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamMMS.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamMMS.cpp index 7b7c0df441..9e686c3fed 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamMMS.cpp +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamMMS.cpp @@ -80,7 +80,7 @@ bool CDVDInputStreamMMS::SeekTime(int iTimeInMsec) { if (mmsx_get_seekable(m_mms)) return (mmsx_time_seek(NULL,m_mms,double(iTimeInMsec)/1000) != -1); - + return false; } diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp index efaccf3e90..dd93927c5d 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp @@ -62,9 +62,9 @@ bool CDVDInputStreamNavigator::Open(const char* strFile, const std::string& cont { char* strDVDFile; m_icurrentGroupId = 0; - if (!CDVDInputStream::Open(strFile, "video/x-dvd-mpeg")) + if (!CDVDInputStream::Open(strFile, "video/x-dvd-mpeg")) return false; - + // load libdvdnav.dll if (!m_dll.Load()) return false; diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.h b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.h index 1dc2f49cd9..b55c6fe0d0 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.h +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.h @@ -54,7 +54,7 @@ public: int type; }; -class CDVDInputStreamNavigator +class CDVDInputStreamNavigator : public CDVDInputStream , public CDVDInputStream::IDisplayTime { diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DllDvdNav.h b/xbmc/cores/dvdplayer/DVDInputStreams/DllDvdNav.h index 323b156c97..1902c84db6 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DllDvdNav.h +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DllDvdNav.h @@ -24,13 +24,13 @@ extern "C" { #define DVDNAV_COMPILE #include <stdint.h> - + #include "dvdnav/dvdnav.h" #ifndef WIN32 #define WIN32 #endif // WIN32 - + #ifndef HAVE_CONFIG_H #define HAVE_CONFIG_H #endif diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp index 67e04ef3a6..941dd9285c 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -995,8 +995,8 @@ void CDVDPlayer::Process() } } } - - // if playing a main title DVD/ISO rip, there is no menu structure so + + // if playing a main title DVD/ISO rip, there is no menu structure so // dvdnav will tell us it's done by setting EOF on the stream. if (pStream->IsEOF()) break; @@ -2066,7 +2066,7 @@ void CDVDPlayer::Seek(bool bPlus, bool bLargeStep) } #endif - if( bPlus && GetChapter() < GetChapterCount() + if( bPlus && GetChapter() < GetChapterCount() || !bPlus && GetChapter() > 1) { if(bPlus && GetChapter() < GetChapterCount()) @@ -2164,7 +2164,7 @@ bool CDVDPlayer::SeekScene(bool bPlus) /* * Seeking is flushed and inaccurate, just like Seek() */ - m_messenger.Put(new CDVDMsgPlayerSeek((int)iScenemarker, !bPlus, true, false, false)); + m_messenger.Put(new CDVDMsgPlayerSeek((int)iScenemarker, !bPlus, true, false, false)); SyncronizeDemuxer(100); return true; } @@ -2204,7 +2204,7 @@ void CDVDPlayer::GetGeneralInfo(CStdString& strGeneralInfo) strGeneralInfo.Format("C( ad:% 6.3f, a/v:% 6.3f%s, dcpu:%2i%% acpu:%2i%% vcpu:%2i%% )" , dDelay , dDiff - , strEDL.c_str() + , strEDL.c_str() , (int)(CThread::GetRelativeUsage()*100) , (int)(m_dvdPlayerAudio.GetRelativeUsage()*100) , (int)(m_dvdPlayerVideo.GetRelativeUsage()*100)); diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h index ff75b9e909..399a37fd59 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.h +++ b/xbmc/cores/dvdplayer/DVDPlayer.h @@ -207,7 +207,7 @@ public: virtual CStdString GetPlayerState(); virtual bool SetPlayerState(CStdString state); - + virtual CStdString GetPlayingTitle(); enum ECacheState diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp index 1716022ba5..d997b20e90 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.cpp @@ -550,7 +550,7 @@ void CDVDPlayerAudio::Process() m_droptime = 0.0; SetSyncType(audioframe.passthrough); - + // add any packets play packetadded = OutputPacket(audioframe); @@ -784,7 +784,7 @@ int CDVDPlayerAudio::GetAudioBitrate() { return (int)m_audioStats.GetBitrate(); } - + bool CDVDPlayerAudio::IsPassthrough() const { return m_pAudioCodec && m_pAudioCodec->NeedPassthrough(); diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudioResampler.cpp b/xbmc/cores/dvdplayer/DVDPlayerAudioResampler.cpp index 07571b6f39..b38b658364 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerAudioResampler.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerAudioResampler.cpp @@ -32,13 +32,13 @@ CDVDPlayerResampler::CDVDPlayerResampler() m_converterdata.src_ratio = 1.0; m_quality = SRC_LINEAR; m_ratio = 1.0; - + m_buffer = NULL; m_ptsbuffer = NULL; m_buffersize = 0; m_bufferfill = 0; } - + CDVDPlayerResampler::~CDVDPlayerResampler() { Clean(); @@ -48,17 +48,17 @@ void CDVDPlayerResampler::Add(DVDAudioFrame &audioframe, double pts) { //check if nr of channels changed so we can allocate new buffers if necessary CheckResampleBuffers(audioframe.channels); - + //value to divide samples by to get them into -1.0:1.0 range - float scale = (float)(1 << (audioframe.bits_per_sample - 1)); + float scale = (float)(1 << (audioframe.bits_per_sample - 1)); int nrframes = audioframe.size / audioframe.channels / (audioframe.bits_per_sample / 8); - + //resize sample buffer if necessary //we want the buffer to be large enough to hold the current frames in it, //the number of frames needed for libsamplerate's input //and the maximum number of frames libsamplerate might generate, times 2 for safety ResizeSampleBuffer(m_bufferfill + nrframes + nrframes * MathUtils::round_int(m_ratio + 0.5) * 2); - + //assign samplebuffers m_converterdata.input_frames = nrframes; m_converterdata.output_frames = m_buffersize - m_bufferfill - m_converterdata.input_frames; @@ -66,19 +66,19 @@ void CDVDPlayerResampler::Add(DVDAudioFrame &audioframe, double pts) m_converterdata.data_out = m_buffer + m_bufferfill * m_nrchannels; //intput buffer is a block of data at the end of the buffer m_converterdata.data_in = m_converterdata.data_out + m_converterdata.output_frames * m_nrchannels; - + //add samples to the resample input buffer int16_t* inputptr = (int16_t*)audioframe.data; float* outputptr = m_converterdata.data_in; - + for (int i = 0; i < nrframes * m_nrchannels; i++) *outputptr++ = (float)*inputptr++ / scale; - + //resample m_converterdata.src_ratio = m_ratio; src_set_ratio(m_converter, m_ratio); src_process(m_converter, &m_converterdata); - + //calculate a pts for each sample for (int i = 0; i < m_converterdata.output_frames_gen; i++) { @@ -91,33 +91,33 @@ bool CDVDPlayerResampler::Retrieve(DVDAudioFrame &audioframe, double &pts) { //check if nr of channels changed so we can allocate new buffers if necessary CheckResampleBuffers(audioframe.channels); - + //value to divide samples by to get them into -1.0:1.0 range - float scale = (float)(1 << (audioframe.bits_per_sample - 1)); + float scale = (float)(1 << (audioframe.bits_per_sample - 1)); int nrframes = audioframe.size / audioframe.channels / (audioframe.bits_per_sample / 8); - + //if we don't have enough in the samplebuffer, return false if (nrframes > m_bufferfill) { return false; } - + //use the pts of the first fresh value in the samplebuffer pts = m_ptsbuffer[0]; - + //add from samplebuffer to audioframe float* inputptr = m_buffer; int16_t* outputptr = (int16_t*)audioframe.data; for (int i = 0; i < nrframes * m_nrchannels; i++) *outputptr++ = MathUtils::round_int(Clamp(*inputptr++ * scale, scale * -1.0f, scale - 1.0f)); - + m_bufferfill -= nrframes; - + //shift old data to the beginning of the buffer memmove(m_buffer, m_buffer + (nrframes * m_nrchannels), m_bufferfill * m_nrchannels * sizeof(float)); memmove(m_ptsbuffer, m_ptsbuffer + nrframes, m_bufferfill * sizeof(double)); - + return true; } @@ -127,7 +127,7 @@ void CDVDPlayerResampler::CheckResampleBuffers(int channels) if (channels != m_nrchannels) { Clean(); - + m_nrchannels = channels; m_converter = src_new(m_quality, m_nrchannels, &error); } @@ -165,15 +165,15 @@ void CDVDPlayerResampler::Clean() { if (m_converter) src_delete(m_converter); m_converter = NULL; - + free(m_buffer); m_buffer = NULL; free(m_ptsbuffer); m_ptsbuffer = NULL; - + m_bufferfill = 0; m_buffersize = 0; - + m_nrchannels = -1; m_converterdata.end_of_input = 0; m_converterdata.src_ratio = 1.0; diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudioResampler.h b/xbmc/cores/dvdplayer/DVDPlayerAudioResampler.h index dd527975c0..4a4f5f8833 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerAudioResampler.h +++ b/xbmc/cores/dvdplayer/DVDPlayerAudioResampler.h @@ -19,7 +19,7 @@ * */ #pragma once - + #include <samplerate.h> #define MAXRATIO 30 @@ -38,30 +38,30 @@ class CDVDPlayerResampler public: CDVDPlayerResampler(); ~CDVDPlayerResampler(); - + void Add(DVDAudioFrame &audioframe, double pts); //add audioframes and resample bool Retrieve(DVDAudioFrame &audioframe, double &pts); //get audioframes fromt the samplebuffer void SetRatio(double ratio); //ratio higher than 1.0 means more output samples than input void Flush(); //clear samplebuffer void SetQuality(int quality); void Clean(); //free buffers - + private: - + int m_nrchannels; int m_quality; SRC_STATE* m_converter; SRC_DATA m_converterdata; double m_ratio; - + float* m_buffer; //buffer for the audioframes int m_bufferfill; //how many unread frames there are in the buffer int m_buffersize; //size of allocated buffer in frames double* m_ptsbuffer; //ringbuffer for the pts value, each frame gets its own pts - + void CheckResampleBuffers(int channels); void ResizeSampleBuffer(int nrframes); - + //this makes sure value is bewteen min and max template <typename A, typename B, typename C> inline A Clamp(A value, B min, C max){ return value < max ? (value > min ? value : min) : max; } diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp index d045873f08..bb400ee978 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -175,7 +175,7 @@ bool CDVDPlayerVideo::OpenStream( CDVDStreamInfo &hint ) //is not always correct m_bCalcFrameRate = g_guiSettings.GetBool("videoplayer.usedisplayasclock") || g_guiSettings.GetBool("videoplayer.adjustrefreshrate"); - + m_fStableFrameRate = 0.0; m_iFrameRateCount = 0; m_bAllowDrop = !m_bCalcFrameRate; //we start with not allowing drops to calculate the framerate @@ -271,7 +271,7 @@ void CDVDPlayerVideo::OnStartup() { CThread::SetName("CDVDPlayerVideo"); m_iDroppedFrames = 0; - + m_crop.x1 = m_crop.x2 = 0.0f; m_crop.y1 = m_crop.y2 = 0.0f; @@ -440,7 +440,7 @@ void CDVDPlayerVideo::Process() if(m_pVideoCodec) m_pVideoCodec->Reset(); LeaveCriticalSection(&m_critCodecSection); - + m_pullupCorrection.Flush(); //we need to recalculate the framerate //TODO: this needs to be set on a streamchange instead @@ -575,7 +575,7 @@ void CDVDPlayerVideo::Process() if(mDeinterlace.Process(&picture)) mDeinterlace.GetPicture(&picture); } - else if( mInt == VS_INTERLACEMETHOD_RENDER_WEAVE + else if( mInt == VS_INTERLACEMETHOD_RENDER_WEAVE || mInt == VS_INTERLACEMETHOD_RENDER_WEAVE_INVERTED ) { /* if we are syncing frames, dvdplayer will be forced to play at a given framerate */ @@ -772,7 +772,7 @@ void CDVDPlayerVideo::ProcessOverlays(DVDVideoPicture* pSource, YV12Image* pDest render = OVERLAY_GPU; #ifdef _LINUX - // for now use cpu for ssa overlays as it currently allocates and + // for now use cpu for ssa overlays as it currently allocates and // frees textures for each frame this causes a hugh memory leak // on some mesa intel drivers if(m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_SSA) && pSource->format == DVDVideoPicture::FMT_YUV420P) @@ -809,7 +809,7 @@ void CDVDPlayerVideo::ProcessOverlays(DVDVideoPicture* pSource, YV12Image* pDest if(!m_pTempOverlayPicture) return; - CDVDCodecUtils::CopyPicture(m_pTempOverlayPicture, pSource); + CDVDCodecUtils::CopyPicture(m_pTempOverlayPicture, pSource); } else { @@ -969,19 +969,19 @@ int CDVDPlayerVideo::OutputPicture(DVDVideoPicture* pPicture, double pts) //correct any pattern in the timestamps m_pullupCorrection.Add(pts); pts += m_pullupCorrection.Correction(); - + //try to calculate the framerate if (m_bCalcFrameRate) CalcFrameRate(); - + // signal to clock what our framerate is, it may want to adjust it's // speed to better match with our video renderer's output speed int refreshrate = m_pClock->UpdateFramerate(m_fFrameRate); if (refreshrate > 0) //refreshrate of -1 means the videoreferenceclock is not running {//when using the videoreferenceclock, a frame is always presented one vblank interval too late - pts -= (1.0 / refreshrate) * DVD_TIME_BASE; + pts -= (1.0 / refreshrate) * DVD_TIME_BASE; } - + //User set delay pts += m_iVideoDelay; @@ -1089,7 +1089,7 @@ int CDVDPlayerVideo::OutputPicture(DVDVideoPicture* pPicture, double pts) while(!m_bStop && m_dropbase < m_droptime) m_dropbase += frametime; while(!m_bStop && m_dropbase - frametime > m_droptime) m_dropbase -= frametime; - + m_pullupCorrection.Flush(); } else @@ -1348,11 +1348,11 @@ void CDVDPlayerVideo::CalcFrameRate() m_iFrameRateCount = 0; return; } - + //see if m_pullupCorrection was able to detect a pattern in the timestamps //and is able to calculate the correct frame duration from it double frameduration = m_pullupCorrection.CalcFrameDuration(); - + if (frameduration == DVD_NOPTS_VALUE) { //reset the stored framerates if no good framerate was detected @@ -1370,7 +1370,7 @@ void CDVDPlayerVideo::CalcFrameRate() } double framerate = DVD_TIME_BASE / frameduration; - + //store the current calculated framerate if we don't have any yet if (m_iFrameRateCount == 0) { @@ -1382,7 +1382,7 @@ void CDVDPlayerVideo::CalcFrameRate() { m_fStableFrameRate += framerate; //store the calculated framerate m_iFrameRateCount++; - + //if we've measured m_iFrameRateLength seconds of framerates, if (m_iFrameRateCount >= MathUtils::round_int(framerate) * m_iFrameRateLength) { @@ -1397,7 +1397,7 @@ void CDVDPlayerVideo::CalcFrameRate() m_fStableFrameRate = 0.0; m_iFrameRateCount = 0; m_iFrameRateLength *= 2; //double the length we should measure framerates - + //we're allowed to drop frames because we calculated a good framerate m_bAllowDrop = true; } diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.h b/xbmc/cores/dvdplayer/DVDPlayerVideo.h index bb8697dc79..4eafcce06f 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.h +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.h @@ -132,16 +132,16 @@ protected: int m_iDroppedRequest; void CalcFrameRate(); - + float m_fFrameRate; //framerate of the video currently playing bool m_bCalcFrameRate; //if we should calculate the framerate from the timestamps double m_fStableFrameRate; //place to store calculated framerates int m_iFrameRateCount; //how many calculated framerates we stored in m_fStableFrameRate bool m_bAllowDrop; //we can't drop frames until we've calculated the framerate int m_iFrameRateErr; //how many frames we couldn't calculate the framerate, we give up after a while - int m_iFrameRateLength; //how many seconds we should measure the framerate + int m_iFrameRateLength; //how many seconds we should measure the framerate //this is increased exponentially from CDVDPlayerVideo::CalcFrameRate() - + struct SOutputConfiguration { unsigned int width; @@ -184,7 +184,7 @@ protected: DVDVideoPicture* m_pTempOverlayPicture; CRITICAL_SECTION m_critCodecSection; - + CPullupCorrection m_pullupCorrection; }; diff --git a/xbmc/cores/dvdplayer/DVDStreamInfo.h b/xbmc/cores/dvdplayer/DVDStreamInfo.h index 18a3a2c891..59cb5da477 100644 --- a/xbmc/cores/dvdplayer/DVDStreamInfo.h +++ b/xbmc/cores/dvdplayer/DVDStreamInfo.h @@ -29,7 +29,7 @@ enum StreamType; enum CodecID; #else #include "DVDDemuxers/DVDDemux.h" -extern "C" { +extern "C" { #if (defined USE_EXTERNAL_FFMPEG) #if (defined HAVE_LIBAVCODEC_AVCODEC_H) #include <libavcodec/avcodec.h> diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMPL2.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMPL2.cpp index 0040ad0edf..041f713150 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMPL2.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParserMPL2.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "DVDSubtitleParserMPL2.h" #include "DVDCodecs/Overlay/DVDOverlayText.h" #include "DVDClock.h" diff --git a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleStream.cpp b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleStream.cpp index c30a9f8990..7726f7b6ea 100644 --- a/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleStream.cpp +++ b/xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleStream.cpp @@ -83,7 +83,7 @@ bool CDVDSubtitleStream::Open(const string& strFile) if (!isUTF8) isUTF8 = g_charsetConverter.isValidUtf8(m_stringstream.str()); - + if (!isUTF8) { CStdStringW strUTF16; diff --git a/xbmc/cores/dvdplayer/DVDTSCorrection.cpp b/xbmc/cores/dvdplayer/DVDTSCorrection.cpp index a81491f4d8..d0825944af 100644 --- a/xbmc/cores/dvdplayer/DVDTSCorrection.cpp +++ b/xbmc/cores/dvdplayer/DVDTSCorrection.cpp @@ -53,25 +53,25 @@ void CPullupCorrection::Add(double pts) m_prevpts = pts; return; } - + //increase the ringbuffer position m_ringpos = (m_ringpos + 1) % DIFFRINGSIZE; //add the current diff to the ringbuffer m_diffring[m_ringpos] = pts - m_prevpts; //save the pts m_prevpts = pts; - + //only search for patterns in a full ringbuffer m_ringfill++; if (m_ringfill < DIFFRINGSIZE) return; - + m_ringfill = DIFFRINGSIZE; - + //get the current pattern in the ringbuffer vector<double> pattern; GetPattern(pattern); - + //check if the pattern is the same as the saved pattern //and if it is actually a pattern if (!CheckPattern(pattern)) @@ -92,16 +92,16 @@ void CPullupCorrection::Add(double pts) CLog::Log(LOGDEBUG, "CPullupCorrection: detected pattern of length %i: %s", (int)pattern.size(), GetPatternStr().c_str()); } - + //calculate where we are in the pattern double ptsinpattern = 0.0; for (int i = 0; i < m_patternpos; i++) { ptsinpattern += m_pattern[m_pattern.size() - i - 1]; } - + double frameduration = CalcFrameDuration(); - + //correct the last pts based on where we should be according to the frame duration m_ptscorrection = (frameduration * m_patternpos) - ptsinpattern; } @@ -112,7 +112,7 @@ inline double CPullupCorrection::GetDiff(int diffnr) //m_ringpos is the last added diff, so if we want to go in the past we have to move back in the ringbuffer int pos = m_ringpos - diffnr; if (pos < 0) pos += DIFFRINGSIZE; - + return m_diffring[pos]; } @@ -121,11 +121,11 @@ void CPullupCorrection::GetPattern(std::vector<double>& pattern) { int difftypesbuff[DIFFRINGSIZE]; //difftypes of the diffs, difftypesbuff[0] is the last added diff, //difftypesbuff[1] the one added before that etc - + //get the difftypes vector<double> difftypes; GetDifftypes(difftypes); - + //mark each diff with what difftype it is for (int i = 0; i < DIFFRINGSIZE; i++) { @@ -138,7 +138,7 @@ void CPullupCorrection::GetPattern(std::vector<double>& pattern) } } } - + //we check for patterns to the length of DIFFRINGSIZE / 3 for (int i = 1; i <= DIFFRINGSIZE / 3; i++) { @@ -150,17 +150,17 @@ void CPullupCorrection::GetPattern(std::vector<double>& pattern) //but we can't go beyond the buffer if (j * i + i > DIFFRINGSIZE) nrdiffs = DIFFRINGSIZE - j * i; - + if (nrdiffs < 1) //if the buffersize can be cleanly divided by i we're done here break; - + if (!MatchDifftype(difftypesbuff, difftypesbuff + j * i, nrdiffs)) { hasmatch = false; break; } } - + if (hasmatch) { BuildPattern(pattern, i); @@ -183,7 +183,7 @@ void CPullupCorrection::GetDifftypes(vector<double>& difftypes) break; } } - + //if we don't have a match with a saved difftype, we add it as a new one if (!hasmatch) difftypes.push_back(GetDiff(i)); @@ -209,10 +209,10 @@ inline bool CPullupCorrection::MatchDiff(double diff1, double diff2) { if (fabs(diff1) < MAXERR && fabs(diff2) < MAXERR) return true; //very close to 0.0 - + if (diff2 == 0.0) return false; //don't want to divide by 0 - + return fabs(1.0 - (diff1 / diff2)) <= MAXERR; } @@ -237,15 +237,15 @@ bool CPullupCorrection::CheckPattern(std::vector<double>& pattern) m_patternpos = 0; //reset the position return false; } - + //the saved pattern should have moved 1 diff into the past m_patternpos = (m_patternpos + 1) % m_pattern.size(); - + //check if the current pattern matches the saved pattern, with an offset of 1 for (unsigned int i = 0; i < m_pattern.size(); i++) { double diff = pattern[(m_patternpos + i) % pattern.size()]; - + if (!MatchDiff(diff, m_pattern[i])) { m_pattern = pattern; //save the current pattern @@ -255,7 +255,7 @@ bool CPullupCorrection::CheckPattern(std::vector<double>& pattern) //we save the pattern, in case it changes very slowly m_pattern[i] = diff; } - + return true; } @@ -263,7 +263,7 @@ bool CPullupCorrection::CheckPattern(std::vector<double>& pattern) double CPullupCorrection::CalcFrameDuration() { double frameduration = 0.0; - + if (m_haspattern) { for (unsigned int i = 0; i < m_pattern.size(); i++) @@ -272,7 +272,7 @@ double CPullupCorrection::CalcFrameDuration() } return frameduration / m_pattern.size(); } - + return DVD_NOPTS_VALUE; } @@ -280,12 +280,12 @@ double CPullupCorrection::CalcFrameDuration() CStdString CPullupCorrection::GetPatternStr() { CStdString patternstr; - + for (unsigned int i = 0; i < m_pattern.size(); i++) { patternstr.AppendFormat("%.2f ", m_pattern[i]); } - + return patternstr; } diff --git a/xbmc/cores/dvdplayer/DVDTSCorrection.h b/xbmc/cores/dvdplayer/DVDTSCorrection.h index ea7934fefc..8a8508455a 100644 --- a/xbmc/cores/dvdplayer/DVDTSCorrection.h +++ b/xbmc/cores/dvdplayer/DVDTSCorrection.h @@ -20,9 +20,9 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include <vector> - + #define DIFFRINGSIZE 100 class CPullupCorrection @@ -32,29 +32,29 @@ class CPullupCorrection void Add(double pts); double Correction() {return m_ptscorrection;} void Flush(); //flush the saved pattern and the ringbuffer - + int GetPatternLength() {return m_patternlength;} double CalcFrameDuration(); //calculates the frame duration from m_pattern - + private: double m_prevpts; //last pts added double m_diffring[DIFFRINGSIZE]; //ringbuffer of differences between pts' int m_ringpos; //position of last diff added to ringbuffer int m_ringfill; //how many diffs we have in the ringbuffer double GetDiff(int diffnr); //gets diffs from now to the past - + void GetPattern(std::vector<double>& pattern); //gets the current pattern void GetDifftypes(std::vector<double>& difftypes); //gets the difftypes from the ringbuffer - + bool MatchDiff(double diff1, double diff2); //checks if two diffs match by MAXERR bool MatchDifftype(int* diffs1, int* diffs2, int nrdiffs); //checks if the difftypes match - + //builds a pattern of timestamps in the ringbuffer void BuildPattern(std::vector<double>& pattern, int patternlength); - + //checks if the current pattern matches with the saved m_pattern with offset m_patternpos - bool CheckPattern(std::vector<double>& pattern); - + bool CheckPattern(std::vector<double>& pattern); + std::vector<double> m_pattern; //the last saved pattern int m_patternpos; //the position of the pattern in the ringbuffer, moves one to the past each time a pts is added double m_ptscorrection; //the correction needed for the last added pts diff --git a/xbmc/cores/dvdplayer/Edl.cpp b/xbmc/cores/dvdplayer/Edl.cpp index 26b5b896f2..44f7729ce5 100644 --- a/xbmc/cores/dvdplayer/Edl.cpp +++ b/xbmc/cores/dvdplayer/Edl.cpp @@ -557,7 +557,7 @@ bool CEdl::WriteMPlayerEdl() CStdString strBuffer; for (int i = 0; i < (int)m_vecCuts.size(); i++) { - /* + /* * MPlayer doesn't understand the scene marker (2) or commercial break (3) identifiers that XBMC * supports in EDL files. * diff --git a/xbmc/cores/paplayer/FLACcodec.cpp b/xbmc/cores/paplayer/FLACcodec.cpp index cddc0759f4..5d4d6c64ed 100644 --- a/xbmc/cores/paplayer/FLACcodec.cpp +++ b/xbmc/cores/paplayer/FLACcodec.cpp @@ -278,7 +278,7 @@ FLAC__StreamDecoderWriteStatus FLACCodec::DecoderWriteCallback(const FLAC__Strea break; default: outptr32[current_sample*frame->header.channels + channel] = buffer[channel][current_sample]; - break; + break; } } } diff --git a/xbmc/cores/paplayer/OggCallback.cpp b/xbmc/cores/paplayer/OggCallback.cpp index 45458a70d5..3ac386007e 100644 --- a/xbmc/cores/paplayer/OggCallback.cpp +++ b/xbmc/cores/paplayer/OggCallback.cpp @@ -20,7 +20,7 @@ */ #include "OggCallback.h" - + COggCallback::COggCallback(XFILE::CFile& file) : m_file(file) { } diff --git a/xbmc/cores/paplayer/OggCallback.h b/xbmc/cores/paplayer/OggCallback.h index 90ec5ad621..bc5406a199 100644 --- a/xbmc/cores/paplayer/OggCallback.h +++ b/xbmc/cores/paplayer/OggCallback.h @@ -28,7 +28,7 @@ class COggCallback { public: COggCallback(XFILE::CFile& file); - + ov_callbacks Get(const CStdString& strFile); static size_t ReadCallback(void *ptr, size_t size, size_t nmemb, void *datasource); diff --git a/xbmc/cores/paplayer/PAPlayer.h b/xbmc/cores/paplayer/PAPlayer.h index 720cb44e09..92239a2eee 100644 --- a/xbmc/cores/paplayer/PAPlayer.h +++ b/xbmc/cores/paplayer/PAPlayer.h @@ -167,10 +167,10 @@ private: unsigned int m_SampleRate; unsigned int m_Channels; unsigned int m_BitsPerSample; - + unsigned int m_SampleRateOutput; unsigned int m_BitsPerSampleOutput; - + AudioPacket m_packet[2][PACKET_COUNT]; IAudioCallback* m_pCallback; diff --git a/xbmc/cores/paplayer/SPCCodec.cpp b/xbmc/cores/paplayer/SPCCodec.cpp index b12893e413..186930c65c 100644 --- a/xbmc/cores/paplayer/SPCCodec.cpp +++ b/xbmc/cores/paplayer/SPCCodec.cpp @@ -80,7 +80,7 @@ bool SPCCodec::Init(const CStdString &strFile, unsigned int filecache) XFILE::CFile::Delete(m_loader_name); return false; } - + if (!m_loader->Load()) { delete m_loader; diff --git a/xbmc/cores/playercorefactory/PlayerCoreConfig.h b/xbmc/cores/playercorefactory/PlayerCoreConfig.h index 4aa3424469..c77c25c3bb 100644 --- a/xbmc/cores/playercorefactory/PlayerCoreConfig.h +++ b/xbmc/cores/playercorefactory/PlayerCoreConfig.h @@ -74,7 +74,7 @@ public: case EPC_DVDPLAYER: pPlayer = new CDVDPlayer(callback); break; case EPC_PAPLAYER: pPlayer = new PAPlayer(callback); break; case EPC_EXTPLAYER: pPlayer = new CExternalPlayer(callback); break; - default: return NULL; + default: return NULL; } if (pPlayer->Initialize(m_config)) diff --git a/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp b/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp index f699dc8daa..fee5ca8b3c 100644 --- a/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp +++ b/xbmc/cores/playercorefactory/PlayerCoreFactory.cpp @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + #include "utils/BitstreamStats.h" #include "PlayerCoreFactory.h" #include "utils/SingleLock.h" @@ -65,8 +65,8 @@ template<typename T> void unique (T &con) } IPlayer* CPlayerCoreFactory::CreatePlayer(const CStdString& strCore, IPlayerCallback& callback) const -{ - return CreatePlayer( GetPlayerCore(strCore), callback ); +{ + return CreatePlayer( GetPlayerCore(strCore), callback ); } IPlayer* CPlayerCoreFactory::CreatePlayer(const PLAYERCOREID eCore, IPlayerCallback& callback) @@ -168,7 +168,7 @@ void CPlayerCoreFactory::GetPlayers( const CFileItem& item, VECPLAYERCORES &vecC vecCores.push_back(EPC_PAPLAYER); } else if ((url.GetFileType().Equals("ac3") && g_audioConfig.GetAC3Enabled()) - || (url.GetFileType().Equals("dts") && g_audioConfig.GetDTSEnabled())) + || (url.GetFileType().Equals("dts") && g_audioConfig.GetDTSEnabled())) { CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: adding DVDPlayer (%d)", EPC_DVDPLAYER); vecCores.push_back(EPC_DVDPLAYER); @@ -224,7 +224,7 @@ PLAYERCOREID CPlayerCoreFactory::GetDefaultPlayer( const CFileItem& item ) //If we have any players return the first one if( vecCores.size() > 0 ) return vecCores.at(0); - + return EPC_NONE; } @@ -239,7 +239,7 @@ PLAYERCOREID CPlayerCoreFactory::SelectPlayerDialog(VECPLAYERCORES &vecCores, fl // Add all possible players auto_aptr<int> btn_Cores(NULL); if( vecCores.size() > 0 ) - { + { btn_Cores = new int[ vecCores.size() ]; btn_Cores[0] = 0; @@ -313,7 +313,7 @@ bool CPlayerCoreFactory::LoadConfiguration(TiXmlElement* pConfig, bool clear) CLog::Log(LOGERROR, "Error loading configuration, no <playercorefactory> node"); return false; } - + TiXmlElement *pPlayers = pConfig->FirstChildElement("players"); if (pPlayers) { diff --git a/xbmc/cores/playercorefactory/PlayerSelectionRule.cpp b/xbmc/cores/playercorefactory/PlayerSelectionRule.cpp index fbf2b9706a..43482b53ba 100644 --- a/xbmc/cores/playercorefactory/PlayerSelectionRule.cpp +++ b/xbmc/cores/playercorefactory/PlayerSelectionRule.cpp @@ -52,7 +52,7 @@ void CPlayerSelectionRule::Initialize(TiXmlElement* pRule) m_playerCoreId = 0; TiXmlElement* pSubRule = pRule->FirstChildElement("rule"); - while (pSubRule) + while (pSubRule) { vecSubRules.push_back(new CPlayerSelectionRule(pSubRule)); pSubRule = pSubRule->NextSiblingElement("rule"); @@ -118,9 +118,9 @@ void CPlayerSelectionRule::GetPlayers(const CFileItem& item, VECPLAYERCORES &vec CURL url(item.m_strPath); if (CompileRegExp(m_fileTypes, regExp) && !MatchesRegExp(url.GetFileType(), regExp)) return; - + if (CompileRegExp(m_protocols, regExp) && !MatchesRegExp(url.GetProtocol(), regExp)) return; - + if (CompileRegExp(m_mimeTypes, regExp) && !MatchesRegExp(item.GetContentType(), regExp)) return; if (CompileRegExp(m_fileName, regExp) && !MatchesRegExp(item.m_strPath, regExp)) return; @@ -129,7 +129,7 @@ void CPlayerSelectionRule::GetPlayers(const CFileItem& item, VECPLAYERCORES &vec for (unsigned int i = 0; i < vecSubRules.size(); i++) vecSubRules[i]->GetPlayers(item, vecCores); - + PLAYERCOREID playerCoreId = GetPlayerCore(); if (playerCoreId != EPC_NONE) { diff --git a/xbmc/linux/ConsoleDeviceKitPowerSyscall.cpp b/xbmc/linux/ConsoleDeviceKitPowerSyscall.cpp index 42011fd6be..148ecea688 100644 --- a/xbmc/linux/ConsoleDeviceKitPowerSyscall.cpp +++ b/xbmc/linux/ConsoleDeviceKitPowerSyscall.cpp @@ -118,7 +118,7 @@ bool CConsoleDeviceKitPowerSyscall::ConsoleKitMethodCall(const char *method) if (reply) { bool boolean = false; - + if (dbus_message_get_args (reply, NULL, DBUS_TYPE_BOOLEAN, &boolean, DBUS_TYPE_INVALID)) return boolean; } diff --git a/xbmc/linux/DBusUtil.cpp b/xbmc/linux/DBusUtil.cpp index c092123f7e..2ad0a86eec 100644 --- a/xbmc/linux/DBusUtil.cpp +++ b/xbmc/linux/DBusUtil.cpp @@ -68,7 +68,7 @@ void CDBusUtil::GetAll(PropertyMap& properties, const char *destination, const c CStdString result; if (reply) { - DBusMessageIter iter; + DBusMessageIter iter; if (dbus_message_iter_init(reply, &iter)) { if (!dbus_message_has_signature(reply, "a{sv}")) diff --git a/xbmc/linux/DeviceKitDisksProvider.cpp b/xbmc/linux/DeviceKitDisksProvider.cpp index 396f610040..2e1b3e61f2 100644 --- a/xbmc/linux/DeviceKitDisksProvider.cpp +++ b/xbmc/linux/DeviceKitDisksProvider.cpp @@ -53,7 +53,7 @@ void CDeviceKitDiskDeviceOldAPI::Update() void CDeviceKitDiskDeviceNewAPI::Update() { PropertyMap properties; - + m_isFileSystem = CDBusUtil::GetVariant("org.freedesktop.DeviceKit.Disks", m_DeviceKitUDI.c_str(), "org.freedesktop.DeviceKit.Disks.Device", "IdUsage").Equals("filesystem"); if (m_isFileSystem) { @@ -377,7 +377,7 @@ std::vector<CStdString> CDeviceKitDisksProvider::EnumerateDisks() { char** disks = NULL; int length = 0; - + if (dbus_message_get_args (reply, NULL, DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH, &disks, &length, DBUS_TYPE_INVALID)) { for (int i = 0; i < length; i++) diff --git a/xbmc/linux/HALManager.cpp b/xbmc/linux/HALManager.cpp index 482b1c0493..16a037dc03 100644 --- a/xbmc/linux/HALManager.cpp +++ b/xbmc/linux/HALManager.cpp @@ -495,7 +495,7 @@ void CHALManager::AddDevice(const char *udi) { DBusError dbusError; dbus_error_init(&dbusError); - + char **capability; capability =libhal_device_get_property_strlist (m_Context, udi, "info.capabilities", &dbusError); for(char **ptr = capability; *ptr != NULL;ptr++) @@ -507,7 +507,7 @@ void CHALManager::AddDevice(const char *udi) CHALDevice dev = CHALDevice(udi); dev.FriendlyName = libhal_device_get_property_string(m_Context, udi, "info.product", &m_Error); m_Joysticks.push_back(dev); - + if(m_Joysticks.size() < 2 || m_bMultipleJoysticksSupport) { // Restart SDL joystick subsystem @@ -522,7 +522,7 @@ void CHALManager::AddDevice(const char *udi) CLog::Log(LOGERROR, "HAL: Restart joystick subsystem failed : %s",SDL_GetError()); break; } - + g_Joystick.Initialize(NULL); if (m_Notifications) g_application.m_guiDialogKaiToast.QueueNotification(g_localizeStrings.Get(13024), dev.FriendlyName.c_str()); @@ -587,7 +587,7 @@ bool CHALManager::RemoveDevice(const char *udi) CLog::Log(LOGERROR, "HAL: Restart joystick subsystem failed : %s",SDL_GetError()); return false; } - + g_Joystick.Initialize(NULL); g_application.m_guiDialogKaiToast.QueueNotification(g_localizeStrings.Get(13025), m_Joysticks[i].FriendlyName.c_str()); } diff --git a/xbmc/linux/HALManager.h b/xbmc/linux/HALManager.h index 82f34a2939..a927b864be 100644 --- a/xbmc/linux/HALManager.h +++ b/xbmc/linux/HALManager.h @@ -143,7 +143,7 @@ private: static CCriticalSection m_lock; bool m_bMultipleJoysticksSupport; - + //Callbacks HAL static void DeviceRemoved(LibHalContext *ctx, const char *udi); static void DeviceNewCapability(LibHalContext *ctx, const char *udi, const char *capability); diff --git a/xbmc/linux/HALPowerSyscall.cpp b/xbmc/linux/HALPowerSyscall.cpp index 688006ca5f..70a8f55d33 100644 --- a/xbmc/linux/HALPowerSyscall.cpp +++ b/xbmc/linux/HALPowerSyscall.cpp @@ -140,14 +140,14 @@ bool CHALPowerSyscall::QueryCapability(const char *capability) { if (dbus_error_is_set(&error)) dbus_error_free(&error); - + dbus_message_unref(msg); return false; } dbus_bool_t b = false; dbus_message_get_args(reply, &error, DBUS_TYPE_BOOLEAN, &b); - + if (dbus_error_is_set(&error)) dbus_error_free(&error); diff --git a/xbmc/linux/LinuxTimezone.cpp b/xbmc/linux/LinuxTimezone.cpp index 1dbea9bf0a..d35a9c0bc2 100644 --- a/xbmc/linux/LinuxTimezone.cpp +++ b/xbmc/linux/LinuxTimezone.cpp @@ -37,7 +37,7 @@ CLinuxTimezone::CLinuxTimezone() : m_IsDST(0) size_t linelen = 0; CStdString s; vector<CStdString> tokens; - + // Load timezones FILE* fp = fopen("/usr/share/zoneinfo/zone.tab", "r"); if (fp) diff --git a/xbmc/linux/PosixMountProvider.cpp b/xbmc/linux/PosixMountProvider.cpp index 9e8e5dda0a..9c3a204291 100644 --- a/xbmc/linux/PosixMountProvider.cpp +++ b/xbmc/linux/PosixMountProvider.cpp @@ -58,7 +58,7 @@ void CPosixMountProvider::GetDrives(VECSOURCES &drives) bool accepted = false; char* mount = reMount.GetReplaceString("\\1"); char* fs = reMount.GetReplaceString("\\2"); - + // Here we choose which filesystems are approved if (strcmp(fs, "fuseblk") == 0 || strcmp(fs, "vfat") == 0 || strcmp(fs, "ext2") == 0 || strcmp(fs, "ext3") == 0 @@ -69,8 +69,8 @@ void CPosixMountProvider::GetDrives(VECSOURCES &drives) // Ignore root if (strcmp(mount, "/") == 0) - accepted = false; - + accepted = false; + if(accepted) result.push_back(mount); diff --git a/xbmc/linux/XCriticalSection.cpp b/xbmc/linux/XCriticalSection.cpp index ee9e73178d..92abb34acc 100644 --- a/xbmc/linux/XCriticalSection.cpp +++ b/xbmc/linux/XCriticalSection.cpp @@ -57,7 +57,7 @@ void XCriticalSection::Initialize() pthread_mutexattr_t attr; SAFELY(pthread_mutexattr_init(&attr)); SAFELY(pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)); - + // Create the mutexes SAFELY(pthread_mutex_init(&m_mutex, &attr)); SAFELY(pthread_mutex_init(&m_countMutex, &attr)); @@ -92,7 +92,7 @@ XCriticalSection::~XCriticalSection() } ////////////////////////////////////////////////////////////////////// -void XCriticalSection::Enter() +void XCriticalSection::Enter() { if (m_isDestroyed) { @@ -196,7 +196,7 @@ DWORD XCriticalSection::Exit() DWORD count = m_count; for (DWORD i=0; i<count; i++) Leave(); - + pthread_mutex_unlock(&m_countMutex); return count; @@ -229,10 +229,10 @@ void XCriticalSection::Restore(DWORD count) } // The C API. -void InitializeCriticalSection(XCriticalSection* section) { section->Initialize(); } +void InitializeCriticalSection(XCriticalSection* section) { section->Initialize(); } void DeleteCriticalSection(XCriticalSection* section) { section->Destroy(); } BOOL OwningCriticalSection(XCriticalSection* section) { return section->Owning(); } -DWORD ExitCriticalSection(XCriticalSection* section) { return section->Exit(); } +DWORD ExitCriticalSection(XCriticalSection* section) { return section->Exit(); } void RestoreCriticalSection(XCriticalSection* section, DWORD count) { return section->Restore(count); } void EnterCriticalSection(XCriticalSection* section) { section->Enter(); } void LeaveCriticalSection(XCriticalSection* section) { section->Leave(); } diff --git a/xbmc/linux/XEventUtils.cpp b/xbmc/linux/XEventUtils.cpp index cd895e3f38..61cf9527c8 100644 --- a/xbmc/linux/XEventUtils.cpp +++ b/xbmc/linux/XEventUtils.cpp @@ -80,7 +80,7 @@ bool WINAPI SetEvent(HANDLE hEvent) SDL_CondSignal(hEvent->m_hCond); CloseHandle(hEvent); - + return true; } diff --git a/xbmc/linux/XFileUtils.cpp b/xbmc/linux/XFileUtils.cpp index 1ffb35386c..0a6515d69f 100644 --- a/xbmc/linux/XFileUtils.cpp +++ b/xbmc/linux/XFileUtils.cpp @@ -91,7 +91,7 @@ HANDLE FindFirstFile(LPCSTR szPath,LPWIN32_FIND_DATA lpFindData) strFiles.Replace("?","."); strFiles.MakeLower(); // Do we really want this case insensitive? - CRegExp re(true); + CRegExp re(true); if (re.RegComp(strFiles.c_str()) == NULL) return(INVALID_HANDLE_VALUE); @@ -595,7 +595,7 @@ DWORD GetTimeZoneInformation( LPTIME_ZONE_INFORMATION lpTimeZoneInformation ) { if (lpTimeZoneInformation == NULL) return TIME_ZONE_ID_INVALID; - + memset(lpTimeZoneInformation, 0, sizeof(LPTIME_ZONE_INFORMATION)); #ifdef __APPLE__ diff --git a/xbmc/linux/XHandle.cpp b/xbmc/linux/XHandle.cpp index 5ce53f4cc1..5a314f6281 100644 --- a/xbmc/linux/XHandle.cpp +++ b/xbmc/linux/XHandle.cpp @@ -190,7 +190,7 @@ BOOL WINAPI DuplicateHandle( if(lpTargetHandle) *lpTargetHandle = hSourceHandle; - + return TRUE; } diff --git a/xbmc/linux/XLCDproc.cpp b/xbmc/linux/XLCDproc.cpp index b1fa55dc16..d807b3c088 100644 --- a/xbmc/linux/XLCDproc.cpp +++ b/xbmc/linux/XLCDproc.cpp @@ -90,14 +90,14 @@ void XLCDproc::Initialize() else { m_initRetryInterval *= 2; - CLog::Log(LOGERROR, "XLCDproc::%s - Unable to connect to host. Retry in %d seconds.", __FUNCTION__, + CLog::Log(LOGERROR, "XLCDproc::%s - Unable to connect to host. Retry in %d seconds.", __FUNCTION__, m_initRetryInterval/1000); } return; } - - // reset the retry interval after a successful connect + + // reset the retry interval after a successful connect m_initRetryInterval = INIT_RETRY_INTERVAL; // Start a new session @@ -164,14 +164,14 @@ bool XLCDproc::IsConnected() void XLCDproc::SetBackLight(int iLight) { - if (sockfd > 0) - { - //Build command - CStdString cmd; + if (sockfd > 0) + { + //Build command + CStdString cmd; if (iLight == 0) { m_bStop = true; - cmd = "screen_set xbmc -backlight off\n"; + cmd = "screen_set xbmc -backlight off\n"; cmd.append("widget_del xbmc line1\n"); cmd.append("widget_del xbmc line2\n"); cmd.append("widget_del xbmc line3\n"); @@ -195,11 +195,11 @@ void XLCDproc::SetBackLight(int iLight) cmd.append("widget_add xbmc line4 string\n"); } } - - //Send to server - if (write(sockfd,cmd.c_str(),cmd.size()) < 0) - CLog::Log(LOGERROR, "XLCDproc::%s - Unable to write to socket", __FUNCTION__); - } + + //Send to server + if (write(sockfd,cmd.c_str(),cmd.size()) < 0) + CLog::Log(LOGERROR, "XLCDproc::%s - Unable to write to socket", __FUNCTION__); + } } void XLCDproc::SetContrast(int iContrast) { @@ -214,39 +214,39 @@ void XLCDproc::Stop() m_bStop = true; } -void XLCDproc::Suspend() -{ - if (!m_bStop) - { - if (sockfd > 0) - { - //Build command to suspend screen - CStdString cmd; - cmd = "screen_set xbmc -priority hidden\n"; - - //Send to server - if (write(sockfd,cmd.c_str(),cmd.size()) < 0) - CLog::Log(LOGERROR, "XLCDproc::%s - Unable to write to socket", __FUNCTION__); - } - } -} - -void XLCDproc::Resume() -{ - if (!m_bStop) - { - if (sockfd > 0) - { - //Build command to resume screen - CStdString cmd; - cmd = "screen_set xbmc -priority info\n"; - - //Send to server - if (write(sockfd,cmd.c_str(),cmd.size()) < 0) - CLog::Log(LOGERROR, "XLCDproc::%s - Unable to write to socket", __FUNCTION__); - } - } -} +void XLCDproc::Suspend() +{ + if (!m_bStop) + { + if (sockfd > 0) + { + //Build command to suspend screen + CStdString cmd; + cmd = "screen_set xbmc -priority hidden\n"; + + //Send to server + if (write(sockfd,cmd.c_str(),cmd.size()) < 0) + CLog::Log(LOGERROR, "XLCDproc::%s - Unable to write to socket", __FUNCTION__); + } + } +} + +void XLCDproc::Resume() +{ + if (!m_bStop) + { + if (sockfd > 0) + { + //Build command to resume screen + CStdString cmd; + cmd = "screen_set xbmc -priority info\n"; + + //Send to server + if (write(sockfd,cmd.c_str(),cmd.size()) < 0) + CLog::Log(LOGERROR, "XLCDproc::%s - Unable to write to socket", __FUNCTION__); + } + } +} void XLCDproc::SetLine(int iLine, const CStdString& strLine) { @@ -267,7 +267,7 @@ void XLCDproc::SetLine(int iLine, const CStdString& strLine) //else if the string doesn't fit the display, lcdproc will scroll it, so we need a space else if (strLineLong.size() > m_iColumns) strLineLong += " "; - + if (strLineLong != m_strLine[iLine]) { int ln = iLine + 1; diff --git a/xbmc/linux/XLCDproc.h b/xbmc/linux/XLCDproc.h index 374d17ef1f..c8882c5701 100644 --- a/xbmc/linux/XLCDproc.h +++ b/xbmc/linux/XLCDproc.h @@ -36,8 +36,8 @@ public: virtual void Initialize(); virtual bool IsConnected(); virtual void Stop(); - virtual void Suspend(); - virtual void Resume(); + virtual void Suspend(); + virtual void Resume(); virtual void SetBackLight(int iLight); virtual void SetContrast(int iContrast); diff --git a/xbmc/linux/XThreadUtils.cpp b/xbmc/linux/XThreadUtils.cpp index 86ee000ada..381020ed3d 100644 --- a/xbmc/linux/XThreadUtils.cpp +++ b/xbmc/linux/XThreadUtils.cpp @@ -156,10 +156,10 @@ BOOL WINAPI GetThreadTimes ( #ifdef __APPLE__ thread_info_data_t threadInfo; mach_msg_type_number_t threadInfoCount = THREAD_INFO_MAX; - + if (hThread->m_machThreadPort == MACH_PORT_NULL) hThread->m_machThreadPort = pthread_mach_thread_np(hThread->m_hThread); - + kern_return_t ret = thread_info(hThread->m_machThreadPort, THREAD_BASIC_INFO, (thread_info_t)threadInfo, &threadInfoCount); if (ret == KERN_SUCCESS) { @@ -217,7 +217,7 @@ BOOL WINAPI SetThreadPriority(HANDLE hThread, int nPriority) struct sched_param sched; pthread_t currentThread = pthread_self(); int rtn, policy; - + rtn = pthread_getschedparam(currentThread, &policy, &sched); int min = sched_get_priority_min(policy); int max = sched_get_priority_max(policy); @@ -228,7 +228,7 @@ BOOL WINAPI SetThreadPriority(HANDLE hThread, int nPriority) sched.sched_priority = max; rtn = pthread_setschedparam(currentThread, policy, &sched); - + return true; #else return true; @@ -240,9 +240,9 @@ int GetThreadPriority(HANDLE hThread) #if defined(__APPLE__) struct sched_param sched; int rtn, policy; - + rtn = pthread_getschedparam(pthread_self(), &policy, &sched); - + return(sched.sched_priority); #else return 0; diff --git a/xbmc/linux/XThreadUtils.h b/xbmc/linux/XThreadUtils.h index 4c4f53c240..2af37bedd2 100644 --- a/xbmc/linux/XThreadUtils.h +++ b/xbmc/linux/XThreadUtils.h @@ -76,24 +76,24 @@ BOOL WINAPI SetThreadPriority( class TLS { public: - TLS() + TLS() { pthread_key_create(&m_key, free); } - + ~TLS() { pthread_key_delete(m_key); } - - void *Get() + + void *Get() { if (pthread_getspecific(m_key) == NULL) pthread_setspecific(m_key, malloc(8)); - - return pthread_getspecific(m_key); + + return pthread_getspecific(m_key); } - + pthread_key_t m_key; }; diff --git a/xbmc/linux/ZeroconfAvahi.cpp b/xbmc/linux/ZeroconfAvahi.cpp index 85cd70a17f..05f81b844b 100644 --- a/xbmc/linux/ZeroconfAvahi.cpp +++ b/xbmc/linux/ZeroconfAvahi.cpp @@ -310,7 +310,7 @@ void CZeroconfAvahi::groupCallback(AvahiEntryGroup *fp_group, AvahiEntryGroupSta void CZeroconfAvahi::shutdownCallback(AvahiTimeout *fp_e, void *fp_data) { CZeroconfAvahi* p_instance = static_cast<CZeroconfAvahi*>(fp_data); - //should only be called on shutdown + //should only be called on shutdown if (p_instance->m_shutdown) { avahi_threaded_poll_quit(p_instance->mp_poll); diff --git a/xbmc/utils/AliasShortcutUtils.cpp b/xbmc/utils/AliasShortcutUtils.cpp index 045a50ddd9..72c21ccfbc 100644 --- a/xbmc/utils/AliasShortcutUtils.cpp +++ b/xbmc/utils/AliasShortcutUtils.cpp @@ -29,15 +29,15 @@ bool IsAliasShortcut(CStdString &path) { bool rtn = false; - + #if defined(__APPLE__) - // Note: regular files that have an .alias extension can be + // Note: regular files that have an .alias extension can be // reported as an alias when clearly, they are not. Trap them out. if (CUtil::GetExtension(path) != ".alias") { FSRef fileRef; Boolean targetIsFolder, wasAliased; - + // It is better to call FSPathMakeRefWithOptions and pass kFSPathMakeRefDefaultOptions // since it will succeed for paths such as "/Volumes" unlike FSPathMakeRef. if (noErr == FSPathMakeRefWithOptions((UInt8*)path.c_str(), kFSPathMakeRefDefaultOptions, &fileRef, NULL)) @@ -69,7 +69,7 @@ void TranslateAliasShortcut(CStdString &path) #if defined(__APPLE__) FSRef fileRef; Boolean targetIsFolder, wasAliased; - + if (noErr == FSPathMakeRefWithOptions((UInt8*)path.c_str(), kFSPathMakeRefDefaultOptions, &fileRef, NULL)) { if (noErr == FSResolveAliasFileWithMountFlags(&fileRef, TRUE, &targetIsFolder, &wasAliased, kResolveAliasFileNoUI)) @@ -92,9 +92,9 @@ void TranslateAliasShortcut(CStdString &path) CComPtr<IShellLink> ipShellLink; // Get a pointer to the IShellLink interface - if (NOERROR == CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&ipShellLink)) + if (NOERROR == CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&ipShellLink)) WCHAR wszTemp[MAX_PATH]; - + // Get a pointer to the IPersistFile interface CComQIPtr<IPersistFile> ipPersistFile(ipShellLink); @@ -106,10 +106,10 @@ void TranslateAliasShortcut(CStdString &path) #endif // Open the shortcut file and initialize it from its contents - if (NOERROR == ipPersistFile->Load(wszTemp, STGM_READ)) + if (NOERROR == ipPersistFile->Load(wszTemp, STGM_READ)) { // Try to find the target of a shortcut even if it has been moved or renamed - if (NOERROR == ipShellLink->Resolve(NULL, SLR_UPDATE)) + if (NOERROR == ipShellLink->Resolve(NULL, SLR_UPDATE)) { WIN32_FIND_DATA wfd; TCHAR real_path[PATH_MAX]; diff --git a/xbmc/utils/Atomics.cpp b/xbmc/utils/Atomics.cpp index c8b6a50680..bc63c43d21 100644 --- a/xbmc/utils/Atomics.cpp +++ b/xbmc/utils/Atomics.cpp @@ -30,7 +30,7 @@ long cas(volatile long *pAddr, long expectedVal, long swapVal) { unsigned int prev; - + __asm__ __volatile__ ( " 1: lwarx %0,0,%2 \n" /* Load the current value of *pAddr(%2) into prev (%0) and lock pAddr, */ " cmpw 0,%0,%3 \n" /* Verify that the current value (%2) == old value (%3) */ @@ -42,7 +42,7 @@ long cas(volatile long *pAddr, long expectedVal, long swapVal) : "=&r" (prev), "+m" (*pAddr) /* Outputs [prev, *pAddr] */ : "r" (pAddr), "r" (expectedVal), "r" (swapVal) /* Inputs [pAddr, expectedVal, swapVal] */ : "cc", "memory"); /* Clobbers */ - + return prev; } @@ -51,21 +51,21 @@ long cas(volatile long *pAddr, long expectedVal, long swapVal) long cas(volatile long* pAddr, long expectedVal, long swapVal) { long prev; - + __asm { // Load parameters mov eax, expectedVal ; mov ebx, pAddr ; mov ecx, swapVal ; - + // Do Swap lock cmpxchg dword ptr [ebx], ecx ; - + // Store the return value mov prev, eax; } - + return prev; } @@ -74,14 +74,14 @@ long cas(volatile long* pAddr, long expectedVal, long swapVal) long cas(volatile long* pAddr,long expectedVal, long swapVal) { long prev; - + __asm__ __volatile__ ( "lock/cmpxchg %1, %2" : "=a" (prev) : "r" (swapVal), "m" (*pAddr), "0" (expectedVal) : "memory" ); return prev; - + } #endif @@ -99,7 +99,7 @@ long cas(volatile long* pAddr,long expectedVal, long swapVal) long long cas2(volatile long long* pAddr, long long expectedVal, long long swapVal) { long long prev; - + __asm { mov esi, pAddr ; @@ -111,8 +111,8 @@ long long cas2(volatile long long* pAddr, long long expectedVal, long long swapV mov dword ptr [prev], eax ; mov dword ptr prev[4], edx ; } - - return prev; + + return prev; } #else // Linux / OSX86 (GCC) @@ -120,7 +120,7 @@ long long cas2(volatile long long* pAddr, long long expectedVal, long long swapV long long cas2(volatile long long* pAddr, long long expectedVal, long long swapVal) { long long prev; - + __asm__ volatile ( " push %%ebx \n" // We have to manually handle ebx, because PIC uses it and the compiler refuses to build anything that touches it " mov %4, %%ebx \n" @@ -149,7 +149,7 @@ long long cas2(volatile long long* pAddr, long long expectedVal, long long swapV long AtomicIncrement(volatile long* pAddr) { long val; - + __asm__ __volatile__ ( "sync \n" "1: lwarx %0, 0, %1 \n" @@ -205,7 +205,7 @@ long AtomicIncrement(volatile long* pAddr) long AtomicAdd(volatile long* pAddr, long amount) { long val; - + __asm__ __volatile__ ( "sync \n" "1: lwarx %0, 0, %1 \n" @@ -216,7 +216,7 @@ long AtomicAdd(volatile long* pAddr, long amount) : "=&r" (val) : "r" (pAddr), "r" (amount) : "cc", "memory"); - return val; + return val; } #elif defined(WIN32) @@ -259,7 +259,7 @@ long AtomicAdd(volatile long* pAddr, long amount) long AtomicDecrement(volatile long* pAddr) { long val; - + __asm__ __volatile__ ( "sync \n" "1: lwarx %0, 0, %1 \n" @@ -318,7 +318,7 @@ long AtomicSubtract(volatile long* pAddr, long amount) { long val; amount *= -1; - + __asm__ __volatile__ ( "sync \n" "1: lwarx %0, 0, %1 \n" @@ -329,7 +329,7 @@ long AtomicSubtract(volatile long* pAddr, long amount) : "=&r" (val) : "r" (pAddr), "r" (amount) : "cc", "memory"); - return val; + return val; } #elif defined(WIN32) diff --git a/xbmc/utils/CPUInfo.cpp b/xbmc/utils/CPUInfo.cpp index 85fbfb121a..92bca500a4 100644 --- a/xbmc/utils/CPUInfo.cpp +++ b/xbmc/utils/CPUInfo.cpp @@ -100,7 +100,7 @@ CCPUInfo::CCPUInfo(void) RegCloseKey(hKey); SYSTEM_INFO siSysInfo; - GetSystemInfo(&siSysInfo); + GetSystemInfo(&siSysInfo); m_cpuCount = siSysInfo.dwNumberOfProcessors; CoreInfo core; @@ -272,7 +272,7 @@ CTemperature CCPUInfo::getTemperature() if (cmd.IsEmpty() && m_fProcTemperature == NULL) return CTemperature(); - if (!cmd.IsEmpty()) + if (!cmd.IsEmpty()) { p = popen (cmd.c_str(), "r"); if (p) @@ -284,13 +284,13 @@ CTemperature CCPUInfo::getTemperature() else { // procfs is deprecated in the linux kernel, we should move away from - // using it for temperature data. It doesn't seem that sysfs has a + // using it for temperature data. It doesn't seem that sysfs has a // general enough interface to bother implementing ATM. rewind(m_fProcTemperature); fflush(m_fProcTemperature); ret = fscanf(m_fProcTemperature, "temperature: %d %c", &value, &scale); } - + if (ret != 2) return CTemperature(); diff --git a/xbmc/utils/CriticalSection.cpp b/xbmc/utils/CriticalSection.cpp index 25d0b7a70e..2a3b48f5a6 100644 --- a/xbmc/utils/CriticalSection.cpp +++ b/xbmc/utils/CriticalSection.cpp @@ -37,11 +37,11 @@ CCriticalSection::CCriticalSection(const CCriticalSection& section) { *this = section; } - + CCriticalSection& CCriticalSection::operator=(const CCriticalSection& section) { if (this == §ion) return * this; - + m_criticalSection.Initialize(); return *this; } diff --git a/xbmc/utils/DbusServer.cpp b/xbmc/utils/DbusServer.cpp index 72ae6594fb..f16b903373 100644 --- a/xbmc/utils/DbusServer.cpp +++ b/xbmc/utils/DbusServer.cpp @@ -337,7 +337,7 @@ DBusHandlerResult CDbusServer::root_Identity( DBusConnection *connection, DBusMe { ADD_STRING( &psz_identity ); free( psz_identity ); - } + } else return DBUS_HANDLER_RESULT_NEED_MEMORY; REPLY_SEND; diff --git a/xbmc/utils/EndianSwap.h b/xbmc/utils/EndianSwap.h index a877b579a1..72572608b5 100644 --- a/xbmc/utils/EndianSwap.h +++ b/xbmc/utils/EndianSwap.h @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * */ - + /* Functions taken from SDL (SDL_endian.h) */ #ifndef __ENDIAN_SWAP_H__ @@ -96,4 +96,4 @@ static __inline__ uint64_t Endian_Swap64(uint64_t x) { } #endif -#endif /* __ENDIAN_SWAP_H__ */ +#endif /* __ENDIAN_SWAP_H__ */ diff --git a/xbmc/utils/Event.cpp b/xbmc/utils/Event.cpp index 179fbbbf8c..3eade6c257 100644 --- a/xbmc/utils/Event.cpp +++ b/xbmc/utils/Event.cpp @@ -65,7 +65,7 @@ CEvent& CEvent::operator=(const CEvent& src) , TRUE , DUPLICATE_SAME_ACCESS )) { - CLog::Log(LOGERROR, "CEvent - failed to duplicate handle"); + CLog::Log(LOGERROR, "CEvent - failed to duplicate handle"); m_hEvent = INVALID_HANDLE_VALUE; } return *this; diff --git a/xbmc/utils/EventClient.cpp b/xbmc/utils/EventClient.cpp index 963b81b80c..e704912873 100644 --- a/xbmc/utils/EventClient.cpp +++ b/xbmc/utils/EventClient.cpp @@ -137,7 +137,7 @@ bool CEventClient::AddPacket(CEventPacket *packet) m_bSequenceError = true; delete m_seqPackets[ packet->Sequence() ]; } - + m_seqPackets[ packet->Sequence() ] = packet; if (m_seqPackets.size() == packet->Size()) { diff --git a/xbmc/utils/EventPacket.h b/xbmc/utils/EventPacket.h index 1b167ea6f4..c369c93960 100644 --- a/xbmc/utils/EventPacket.h +++ b/xbmc/utils/EventPacket.h @@ -228,7 +228,7 @@ namespace EVENTPACKET m_cMajVer = '0'; m_cMinVer = '0'; m_eType = PT_LAST; - + Parse(datasize, data); } diff --git a/xbmc/utils/EventServer.cpp b/xbmc/utils/EventServer.cpp index 4f400d42d9..dc7bdb2ed8 100644 --- a/xbmc/utils/EventServer.cpp +++ b/xbmc/utils/EventServer.cpp @@ -82,7 +82,7 @@ void CEventServer::StartServer() CSingleLock lock(m_critSection); if(m_bRunning) return; - + // set default port string port = (const char*)g_guiSettings.GetString("services.esport"); assert(port.length()); diff --git a/xbmc/utils/Fanart.cpp b/xbmc/utils/Fanart.cpp index 86f6a9b161..b782d218c6 100644 --- a/xbmc/utils/Fanart.cpp +++ b/xbmc/utils/Fanart.cpp @@ -161,7 +161,7 @@ bool CFanart::DownloadImage(const CStdString &url, const CStdString &destination #ifdef RESAMPLE_CACHED_IMAGES CStdString tempFile = "special://temp/fanart_download.jpg"; if (http.Download(url, tempFile)) - { + { CPicture::CacheImage(tempFile, destination); XFILE::CFile::Delete(tempFile); return true; @@ -186,11 +186,11 @@ unsigned int CFanart::GetNumFanarts() bool CFanart::ParseColors(const CStdString &colorsIn, CStdString &colorsOut) { - // Formats: + // Formats: // 0: XBMC ARGB Hexadecimal string comma seperated "FFFFFFFF,DDDDDDDD,AAAAAAAA" // 1: The TVDB RGB Int Triplets, pipe seperate with leading/trailing pipes "|68,69,59|69,70,58|78,78,68|" - // Essentially we read the colors in using the proper format, and store them in our own fixed temporary format (3 DWORDS), and then + // Essentially we read the colors in using the proper format, and store them in our own fixed temporary format (3 DWORDS), and then // write them back in in the specified format. if (colorsIn.IsEmpty()) diff --git a/xbmc/utils/IMDB.cpp b/xbmc/utils/IMDB.cpp index 5e894d35e1..8b44719819 100644 --- a/xbmc/utils/IMDB.cpp +++ b/xbmc/utils/IMDB.cpp @@ -91,8 +91,8 @@ int CIMDB::InternalFindMovie(const CStdString &strMovie, IMDB_MOVIELIST& movieli return 0; } else - scrURL = *pUrl; - + scrURL = *pUrl; + vector<CStdString> strHTML; for (unsigned int i=0;i<scrURL.m_url.size();++i) { @@ -141,7 +141,7 @@ int CIMDB::InternalFindMovie(const CStdString &strMovie, IMDB_MOVIELIST& movieli g_application.getApplicationMessenger().DoModal(dialog,WINDOW_DIALOG_OK); return -1; } - + TiXmlHandle docHandle( &doc ); TiXmlElement* xurl = doc.RootElement()->FirstChildElement("url"); @@ -461,7 +461,7 @@ void CIMDB::GetURL(const CStdString &movieFile, const CStdString &movieName, con // convert to the encoding requested by the parser g_charsetConverter.utf8To(m_parser.GetSearchStringEncoding(), movieName, m_parser.m_param[0]); CUtil::URLEncode(m_parser.m_param[0]); - + scrURL.ParseString(m_parser.Parse("CreateSearchUrl",&m_info.settings)); } @@ -539,7 +539,7 @@ int CIMDB::FindMovie(const CStdString &strMovie, IMDB_MOVIELIST& movieList, CGUI CloseThread(); return found; } - + // unthreaded bool sortList = true; int success = InternalFindMovie(strMovie, movieList, sortList); diff --git a/xbmc/utils/InfoLoader.h b/xbmc/utils/InfoLoader.h index d4b4d05e7f..062f2d8824 100644 --- a/xbmc/utils/InfoLoader.h +++ b/xbmc/utils/InfoLoader.h @@ -32,7 +32,7 @@ public: CStdString GetInfo(int info); void Refresh(); - + virtual void OnJobComplete(unsigned int jobID, bool success, CJob *job); protected: virtual CJob *GetJob() const=0; diff --git a/xbmc/utils/IoSupport.cpp b/xbmc/utils/IoSupport.cpp index de1f6ae409..6a573cb7ef 100644 --- a/xbmc/utils/IoSupport.cpp +++ b/xbmc/utils/IoSupport.cpp @@ -282,7 +282,7 @@ HRESULT CIoSupport::EjectTray( const bool bEject, const char cDriveLetter ) c_cdio->cdio_eject_media(&cdio); c_cdio->cdio_destroy(cdio); } - else + else break; } #endif @@ -409,15 +409,15 @@ INT CIoSupport::ReadSector(HANDLE hDevice, DWORD dwSector, LPSTR lpczBuffer) #ifdef __APPLE__ dk_cd_read_t cd_read; memset( &cd_read, 0, sizeof(cd_read) ); - + cd_read.sectorArea = kCDSectorAreaUser; cd_read.buffer = lpczBuffer; - + cd_read.sectorType = kCDSectorTypeMode1; cd_read.offset = dwSector * kCDSectorSizeMode1; - + cd_read.bufferLength = 2048; - + if( ioctl(hDevice->fd, DKIOCCDREAD, &cd_read ) == -1 ) { return -1; @@ -425,7 +425,7 @@ INT CIoSupport::ReadSector(HANDLE hDevice, DWORD dwSector, LPSTR lpczBuffer) return 2048; #elif defined(_LINUX) if (hDevice->m_bCDROM) - { + { int fd = hDevice->fd; // seek to requested sector @@ -480,12 +480,12 @@ INT CIoSupport::ReadSectorMode2(HANDLE hDevice, DWORD dwSector, LPSTR lpczBuffer #ifdef HAS_DVD_DRIVE #ifdef __APPLE__ dk_cd_read_t cd_read; - + memset( &cd_read, 0, sizeof(cd_read) ); - + cd_read.sectorArea = kCDSectorAreaUser; cd_read.buffer = lpczBuffer; - + cd_read.offset = dwSector * kCDSectorSizeMode2Form2; cd_read.sectorType = kCDSectorTypeMode2Form2; cd_read.bufferLength = kCDSectorSizeMode2Form2; @@ -497,11 +497,11 @@ INT CIoSupport::ReadSectorMode2(HANDLE hDevice, DWORD dwSector, LPSTR lpczBuffer return MODE2_DATA_SIZE; #elif defined(_LINUX) if (hDevice->m_bCDROM) - { + { int fd = hDevice->fd; int lba = (dwSector + CD_MSF_OFFSET) ; int m,s,f; - union + union { struct cdrom_msf msf; char buffer[2356]; @@ -518,7 +518,7 @@ INT CIoSupport::ReadSectorMode2(HANDLE hDevice, DWORD dwSector, LPSTR lpczBuffer arg.msf.cdmsf_min0 = m; arg.msf.cdmsf_sec0 = s; arg.msf.cdmsf_frame0 = f; - + int ret = ioctl(fd, CDROMREADMODE2, &arg); if (ret==0) { @@ -529,7 +529,7 @@ INT CIoSupport::ReadSectorMode2(HANDLE hDevice, DWORD dwSector, LPSTR lpczBuffer CLog::Log(LOGERROR, "CD: ReadSectorMode2 error: %s\n", strerror(errno)); CLog::Log(LOGERROR, "CD: ReadSectorMode2 minute %d, second %d, frame %d\n", m, s, f); OutputDebugString("CD Read error\n"); - return -1; + return -1; } #else DWORD dwBytesReturned; diff --git a/xbmc/utils/IoSupport.h b/xbmc/utils/IoSupport.h index 98aa54aa75..8b02130f64 100644 --- a/xbmc/utils/IoSupport.h +++ b/xbmc/utils/IoSupport.h @@ -126,7 +126,7 @@ public: static INT ReadSectorMode2(HANDLE hDevice, DWORD dwSector, LPSTR lpczBuffer); static INT ReadSectorCDDA(HANDLE hDevice, DWORD dwSector, LPSTR lpczBuffer); static VOID CloseCDROM(HANDLE hDevice); - + static BOOL IsDebug(); static HRESULT Shutdown(); private: diff --git a/xbmc/utils/JobManager.cpp b/xbmc/utils/JobManager.cpp index f4e90e922b..6e7d2fa703 100644 --- a/xbmc/utils/JobManager.cpp +++ b/xbmc/utils/JobManager.cpp @@ -58,7 +58,7 @@ void CJobWorker::Process() CJob *job = m_jobManager->GetNextJob(this); if (!job) break; - + // we have a job to do bool success = job->DoWork(); m_jobManager->OnJobComplete(success, job); @@ -139,14 +139,14 @@ void CJobManager::CancelJobs() { CSingleLock lock(m_section); m_running = false; - + // clear any pending jobs for (unsigned int priority = CJob::PRIORITY_LOW; priority <= CJob::PRIORITY_HIGH; ++priority) { for_each(m_jobQueue[priority].begin(), m_jobQueue[priority].end(), mem_fun_ref(&CWorkItem::FreeJob)); m_jobQueue[priority].clear(); } - + // cancel any callbacks on jobs still processing for_each(m_processing.begin(), m_processing.end(), mem_fun_ref(&CWorkItem::Cancel)); diff --git a/xbmc/utils/JobManager.h b/xbmc/utils/JobManager.h index e3cb9ae56b..9417eebfae 100644 --- a/xbmc/utils/JobManager.h +++ b/xbmc/utils/JobManager.h @@ -43,7 +43,7 @@ private: /*! \ingroup jobs \brief Job Queue class to handle a queue of unique jobs to be processed sequentially - + Holds a queue of jobs to be processed sequentially, either first in,first out or last in, first out. Jobs are unique, so queueing multiple copies of the same job (based on the CJob::operator==) will not add additional jobs. @@ -104,7 +104,7 @@ public: /*! \brief The callback used when a job completes. - + OnJobComplete is called at the completion of the CJob::DoWork function, and is used to return information to the caller on the result of the job. On returning from this function the CJobManager will destroy this job. @@ -112,7 +112,7 @@ public: Subclasses should override this function if they wish to transfer information from the job prior to it's deletion. They must then call this base class function, which will move on to the next job. - + \sa CJobManager, IJobCallback and CJob */ virtual void OnJobComplete(unsigned int jobID, bool success, CJob *job); @@ -134,7 +134,7 @@ private: /*! \ingroup jobs \brief Job Manager class for scheduling asynchronous jobs. - + Controls asynchronous job execution, by allowing clients to add and cancel jobs. Should be accessed via CJobManager::GetInstance(). Jobs are allocated based on priority levels. Lower priority jobs are executed only if there are sufficient @@ -174,7 +174,7 @@ class CJobManager unsigned int m_id; IJobCallback *m_callback; }; - + public: /*! \brief The only way through which the global instance of the CJobManager should be accessed. diff --git a/xbmc/utils/LCD.cpp b/xbmc/utils/LCD.cpp index 932b3fc922..1a30aa8c60 100644 --- a/xbmc/utils/LCD.cpp +++ b/xbmc/utils/LCD.cpp @@ -398,7 +398,7 @@ void ILCD::Initialize() // Note, the big block isn't here, it's in the LCD's ROM } -bool ILCD::IsConnected() +bool ILCD::IsConnected() { return true; } diff --git a/xbmc/utils/LCD.h b/xbmc/utils/LCD.h index 80e4425e75..167cf6d6e7 100644 --- a/xbmc/utils/LCD.h +++ b/xbmc/utils/LCD.h @@ -51,8 +51,8 @@ public: virtual void Initialize(); virtual bool IsConnected(); virtual void Stop() = 0; - virtual void Suspend() = 0; - virtual void Resume() = 0; + virtual void Suspend() = 0; + virtual void Resume() = 0; virtual void SetBackLight(int iLight) = 0; virtual void SetContrast(int iContrast) = 0; virtual void SetLine(int iLine, const CStdString& strLine) = 0; diff --git a/xbmc/utils/LockFree.cpp b/xbmc/utils/LockFree.cpp index 60c10cba30..bf8a17f8ec 100644 --- a/xbmc/utils/LockFree.cpp +++ b/xbmc/utils/LockFree.cpp @@ -24,7 +24,7 @@ /////////////////////////////////////////////////////////////////////////// // Fast stack implementation -// NOTE: non-locking only on systems that support atomic cas2 operations +// NOTE: non-locking only on systems that support atomic cas2 operations /////////////////////////////////////////////////////////////////////////// void lf_stack_init(lf_stack* pStack) { @@ -70,7 +70,7 @@ lf_node* lf_stack_pop(lf_stack* pStack) /////////////////////////////////////////////////////////////////////////// // Fast heap implementation -// NOTE: non-locking only on systems that support atomic cas2 operations +// NOTE: non-locking only on systems that support atomic cas2 operations /////////////////////////////////////////////////////////////////////////// // TODO: Implement auto-shrink based on chunk reference counts @@ -82,30 +82,30 @@ void lf_heap_init(lf_heap* pHeap, size_t blockSize, size_t initialSize /*= 0*/) { pHeap->alloc_lock = 0; // Initialize the allocation lock pHeap->top_chunk = NULL; - + lf_stack_init(&pHeap->free_list); // Initialize the free-list stack - + // Perform a few sanity checks on the parameters if (blockSize < sizeof(lf_node)) // Make sure we have blocks big enough to store in the free-list blockSize = sizeof(lf_node); pHeap->block_size = blockSize; - + if (initialSize < 10 * blockSize) initialSize = 10 * blockSize; // TODO: This should be more intelligent - + lf_heap_grow(pHeap, initialSize); // Allocate the first chunk } void lf_heap_grow(lf_heap* pHeap, size_t size /*= 0*/) { - + long blockSize = pHeap->block_size; // This has already been checked for sanity if (!size || size < MIN_ALLOC - sizeof(lf_heap_chunk)) // Allocate at least one page from the OS (TODO: Try valloc) size = MIN_ALLOC - sizeof(lf_heap_chunk); unsigned int blockCount = size / blockSize; if (size % blockSize) // maxe sure we have complete blocks size = blockSize * ++blockCount; - + // Allocate the first chunk from the general heap and link it into the chunk list long mallocSize = size + sizeof(lf_heap_chunk); lf_heap_chunk* pChunk = (lf_heap_chunk*) malloc(mallocSize); @@ -114,7 +114,7 @@ void lf_heap_grow(lf_heap* pHeap, size_t size /*= 0*/) pChunk->next = pHeap->top_chunk; pHeap->top_chunk = pChunk; // Link it into the list SPINLOCK_RELEASE(pHeap->alloc_lock); // The list is now consistent - + // Add all blocks to the free-list unsigned char* pBlock = (unsigned char*)pChunk + sizeof(lf_heap_chunk); for ( unsigned int block = 0; block < blockCount; block++) @@ -130,7 +130,7 @@ void lf_heap_deinit(lf_heap* pHeap) lf_heap_chunk* pNext; for(lf_heap_chunk* pChunk = pHeap->top_chunk; pChunk; pChunk = pNext) { - pNext = pChunk->next; + pNext = pChunk->next; free(pChunk); } } @@ -149,7 +149,7 @@ void* lf_heap_alloc(lf_heap* pHeap) void lf_heap_free(lf_heap* pHeap, void* p) { - if (!p) // Allow for NULL to pass safely + if (!p) // Allow for NULL to pass safely return; lf_stack_push(&pHeap->free_list, (lf_node*)p); // Return the block to the free list } @@ -185,7 +185,7 @@ void lf_queue_enqueue(lf_queue* pQueue, void* value) next = ((lf_queue_node*)tail.ptr)->next; #if defined(__ppc__) || defined(__powerpc__) if (atomic_ptr_to_long(tail) == atomic_ptr_to_long(pQueue->tail)) // Check consistency -#else +#else if (atomic_ptr_to_long_long(tail) == atomic_ptr_to_long_long(pQueue->tail)) // Check consistency #endif { @@ -194,7 +194,7 @@ void lf_queue_enqueue(lf_queue* pQueue, void* value) node.ptr = pNode; #if defined(__ppc__) || defined(__powerpc__) if (cas((long*)&((lf_queue_node*)tail.ptr)->next, atomic_ptr_to_long(next), atomic_ptr_to_long(node)) == atomic_ptr_to_long(next)) // Try to link node at end -#else +#else node.version = next.version + 1; if (cas2((long long*)&((lf_queue_node*)tail.ptr)->next, atomic_ptr_to_long_long(next), atomic_ptr_to_long_long(node)) == atomic_ptr_to_long_long(next)) // Try to link node at end #endif @@ -205,8 +205,8 @@ void lf_queue_enqueue(lf_queue* pQueue, void* value) node.ptr = next.ptr; #if defined(__ppc__) || defined(__powerpc__) cas((long*)&pQueue->tail, atomic_ptr_to_long(tail), atomic_ptr_to_long(node)); // We don't care if we are successful or not -#else - node.version = tail.version + 1; +#else + node.version = tail.version + 1; cas2((long long*)&pQueue->tail, atomic_ptr_to_long_long(tail), atomic_ptr_to_long_long(node)); // We don't care if we are successful or not #endif } @@ -215,7 +215,7 @@ void lf_queue_enqueue(lf_queue* pQueue, void* value) node.ptr = pNode; #if defined(__ppc__) || defined(__powerpc__) cas((long*)&pQueue->tail, atomic_ptr_to_long(tail), atomic_ptr_to_long(node)); // Try to swing the tail to the new node -#else +#else node.version = tail.version + 1; cas2((long long*)&pQueue->tail, atomic_ptr_to_long_long(tail), atomic_ptr_to_long_long(node)); // Try to swing the tail to the new node #endif @@ -234,9 +234,9 @@ void* lf_queue_dequeue(lf_queue* pQueue) next = ((lf_queue_node*)head.ptr)->next; #if defined(__ppc__) || defined(__powerpc__) if (atomic_ptr_to_long(head) == atomic_ptr_to_long(pQueue->head)) // Check consistency -#else +#else if (atomic_ptr_to_long_long(head) == atomic_ptr_to_long_long(pQueue->head)) // Check consistency -#endif +#endif { if (head.ptr == tail.ptr) // Queue is empty or tail is lagging { @@ -244,8 +244,8 @@ void* lf_queue_dequeue(lf_queue* pQueue) return NULL; node.ptr = next.ptr; #if defined(__ppc__) || defined(__powerpc__) - cas((long*)&pQueue->tail, atomic_ptr_to_long(tail), atomic_ptr_to_long(node)); // Tail is lagging. Try to advance it. -#else + cas((long*)&pQueue->tail, atomic_ptr_to_long(tail), atomic_ptr_to_long(node)); // Tail is lagging. Try to advance it. +#else node.version = tail.version + 1; cas2((long long*)&pQueue->tail, atomic_ptr_to_long_long(tail), atomic_ptr_to_long_long(node)); // Tail is lagging. Try to advance it. #endif @@ -256,7 +256,7 @@ void* lf_queue_dequeue(lf_queue* pQueue) node.ptr = next.ptr; #if defined(__ppc__) || defined(__powerpc__) if (cas((long*)&pQueue->head, atomic_ptr_to_long(head), atomic_ptr_to_long(node)) == atomic_ptr_to_long(head)) -#else +#else node.version = head.version + 1; if (cas2((long long*)&pQueue->head, atomic_ptr_to_long_long(head), atomic_ptr_to_long_long(node)) == atomic_ptr_to_long_long(head)) #endif diff --git a/xbmc/utils/LockFree.h b/xbmc/utils/LockFree.h index 46b6a93c7d..44eb06f5d5 100644 --- a/xbmc/utils/LockFree.h +++ b/xbmc/utils/LockFree.h @@ -25,7 +25,7 @@ #include <cstring> #include "Atomics.h" -#define SPINLOCK_ACQUIRE(l) while(cas(&l, 0, 1)) {} +#define SPINLOCK_ACQUIRE(l) while(cas(&l, 0, 1)) {} #define SPINLOCK_RELEASE(l) l = 0 // A unique-valued pointer. Version is incremented with each write. @@ -34,7 +34,7 @@ struct atomic_ptr void* ptr; #if !defined(__ppc__) && !defined(__powerpc__) long version; -#endif +#endif }; #if defined(__ppc__) || defined(__powerpc__) diff --git a/xbmc/utils/MusicArtistInfo.cpp b/xbmc/utils/MusicArtistInfo.cpp index b9703aa3a2..d8ed90f3a3 100644 --- a/xbmc/utils/MusicArtistInfo.cpp +++ b/xbmc/utils/MusicArtistInfo.cpp @@ -126,7 +126,7 @@ bool CMusicArtistInfo::Load(XFILE::CFileCurl& http, const SScraperInfo& info, co CLog::Log(LOGERROR, "%s: Unable to parse xml",__FUNCTION__); return false; } - + bool ret = Parse(doc.RootElement(),bChained); TiXmlElement* pRoot = doc.RootElement(); TiXmlElement* xurl = pRoot->FirstChildElement("url"); diff --git a/xbmc/utils/Network.cpp b/xbmc/utils/Network.cpp index 8196467182..53b567692c 100644 --- a/xbmc/utils/Network.cpp +++ b/xbmc/utils/Network.cpp @@ -185,11 +185,11 @@ void CNetwork::StopServices(bool bWait) #endif #ifdef HAS_ZEROCONF g_application.StopZeroconf(); -#endif +#endif CLastfmScrobbler::GetInstance()->Term(); CLibrefmScrobbler::GetInstance()->Term(); // smb.Deinit(); if any file is open over samba this will break. - + g_rssManager.Stop(); } diff --git a/xbmc/utils/Network.h b/xbmc/utils/Network.h index 8c3aa2665b..3d901fa7f4 100644 --- a/xbmc/utils/Network.h +++ b/xbmc/utils/Network.h @@ -109,7 +109,7 @@ public: // callback from application controlled thread to handle any setup void NetworkMessage(EMESSAGE message, int param); - + void StartServices(); void StopServices(bool bWait); diff --git a/xbmc/utils/RssReader.cpp b/xbmc/utils/RssReader.cpp index f52cfccd4e..b7ab187fbd 100644 --- a/xbmc/utils/RssReader.cpp +++ b/xbmc/utils/RssReader.cpp @@ -64,7 +64,7 @@ CRssReader::~CRssReader() void CRssReader::Create(IRssObserver* aObserver, const vector<string>& aUrls, const vector<int> ×, int spacesBetweenFeeds, bool rtl) { CSingleLock lock(*this); - + m_pObserver = aObserver; m_spacesBetweenFeeds = spacesBetweenFeeds; m_vecUrls = aUrls; @@ -111,7 +111,7 @@ void CRssReader::OnExit() int CRssReader::GetQueueSize() { CSingleLock lock(*this); - return m_vecQueue.size(); + return m_vecQueue.size(); } void CRssReader::Process() @@ -119,7 +119,7 @@ void CRssReader::Process() while (GetQueueSize()) { EnterCriticalSection(*this); - + int iFeed = m_vecQueue.front(); m_vecQueue.erase(m_vecQueue.begin()); @@ -133,7 +133,7 @@ void CRssReader::Process() CStdString strUrl = m_vecUrls[iFeed]; LeaveCriticalSection(*this); - + int nRetries = 3; CURL url(strUrl); @@ -151,7 +151,7 @@ void CRssReader::Process() CLog::Log(LOGERROR,"Timeout whilst retrieving %s", strUrl.c_str()); http.Cancel(); break; - } + } nRetries--; if (url.GetProtocol() != "http" && url.GetProtocol() != "https") @@ -457,7 +457,7 @@ CRssManager::~CRssManager() } void CRssManager::Start() - { + { m_bActive = true; } diff --git a/xbmc/utils/RssReader.h b/xbmc/utils/RssReader.h index 5869251079..4fd78ee3f4 100644 --- a/xbmc/utils/RssReader.h +++ b/xbmc/utils/RssReader.h @@ -48,7 +48,7 @@ typedef std::vector<character_t> vecText; class IRssObserver; -class CRssReader : public CThread, +class CRssReader : public CThread, public CCriticalSection { public: diff --git a/xbmc/utils/ScraperParser.cpp b/xbmc/utils/ScraperParser.cpp index 6d76f61fd0..0572c9f482 100644 --- a/xbmc/utils/ScraperParser.cpp +++ b/xbmc/utils/ScraperParser.cpp @@ -118,7 +118,7 @@ bool CScraperParser::LoadFromXML() { if (!m_document) return false; - + CStdString strPath; CUtil::GetDirectory(m_strFile,strPath); @@ -134,7 +134,7 @@ bool CScraperParser::LoadFromXML() m_date = m_pRootElement->Attribute("date"); if (m_pRootElement->Attribute("cachePersistence")) m_persistence.SetFromTimeString(m_pRootElement->Attribute("cachePersistence")); - + const char* requiressettings; m_requiressettings = ((requiressettings = m_pRootElement->Attribute("requiressettings")) && strnicmp("true", requiressettings, 4) == 0); @@ -226,7 +226,7 @@ void CScraperParser::ParseExpression(const CStdString& input, CStdString& dest, if (sensitive) if (stricmp(sensitive,"yes") == 0) bInsensitive=false; // match case sensitive - + CRegExp reg(bInsensitive); CStdString strExpression; if (pExpression->FirstChild()) diff --git a/xbmc/utils/ScraperUrl.cpp b/xbmc/utils/ScraperUrl.cpp index 80aff8857d..afea059ff4 100644 --- a/xbmc/utils/ScraperUrl.cpp +++ b/xbmc/utils/ScraperUrl.cpp @@ -139,7 +139,7 @@ bool CScraperUrl::ParseString(CStdString strUrl) m_xml = strUrl; } else - { + { while (pElement) { ParseElement(pElement); @@ -204,7 +204,7 @@ bool CScraperUrl::Get(const SUrlEntry& scrURL, string& strHTML, XFILE::CFileCurl } CStdString strHTML1(strHTML); - + if (scrURL.m_post) { CStdString strOptions = url.GetOptions(); @@ -212,7 +212,7 @@ bool CScraperUrl::Get(const SUrlEntry& scrURL, string& strHTML, XFILE::CFileCurl url.SetOptions(""); if (!http.Post(url.Get(), strOptions, strHTML1)) - return false; + return false; } else if (!http.Get(url.Get(), strHTML1)) diff --git a/xbmc/utils/SingleLock.cpp b/xbmc/utils/SingleLock.cpp index 71e0a806f0..d07f8b8718 100644 --- a/xbmc/utils/SingleLock.cpp +++ b/xbmc/utils/SingleLock.cpp @@ -109,4 +109,4 @@ void CSingleExit::Restore() } } - + diff --git a/xbmc/utils/StreamDetails.cpp b/xbmc/utils/StreamDetails.cpp index 974d4ae472..6314d40b48 100644 --- a/xbmc/utils/StreamDetails.cpp +++ b/xbmc/utils/StreamDetails.cpp @@ -154,7 +154,7 @@ CStreamDetails& CStreamDetails::operator=(const CStreamDetails &that) std::vector<CStreamDetail *>::const_iterator iter; for (iter = that.m_vecItems.begin(); iter != that.m_vecItems.end(); iter++) { - switch ((*iter)->m_eType) + switch ((*iter)->m_eType) { case CStreamDetail::VIDEO: AddStream(new CStreamDetailVideo((const CStreamDetailVideo &)(**iter))); @@ -167,7 +167,7 @@ CStreamDetails& CStreamDetails::operator=(const CStreamDetails &that) break; } } - + DetermineBestStreams(); } /* if this != that */ @@ -251,13 +251,13 @@ const CStreamDetail* CStreamDetails::GetNthStream(CStreamDetail::StreamType type switch (type) { case CStreamDetail::VIDEO: - return m_pBestVideo; + return m_pBestVideo; break; case CStreamDetail::AUDIO: - return m_pBestAudio; + return m_pBestAudio; break; case CStreamDetail::SUBTITLE: - return m_pBestSubtitle; + return m_pBestSubtitle; break; default: return NULL; @@ -398,13 +398,13 @@ void CStreamDetails::DetermineBestStreams(void) switch ((*iter)->m_eType) { case CStreamDetail::VIDEO: - champion = (CStreamDetail **)&m_pBestVideo; + champion = (CStreamDetail **)&m_pBestVideo; break; case CStreamDetail::AUDIO: - champion = (CStreamDetail **)&m_pBestAudio; + champion = (CStreamDetail **)&m_pBestAudio; break; case CStreamDetail::SUBTITLE: - champion = (CStreamDetail **)&m_pBestSubtitle; + champion = (CStreamDetail **)&m_pBestSubtitle; break; default: champion = NULL; @@ -434,7 +434,7 @@ CStdString CStreamDetails::VideoWidthToResolutionDescription(int iWidth) else if (iWidth < 1281) return "720"; // 1920x1080 - else + else return "1080"; } diff --git a/xbmc/utils/StreamDetails.h b/xbmc/utils/StreamDetails.h index f4b973d0ab..f5f0dde5e4 100644 --- a/xbmc/utils/StreamDetails.h +++ b/xbmc/utils/StreamDetails.h @@ -92,7 +92,7 @@ public: static CStdString VideoWidthToResolutionDescription(int iWidth); static CStdString VideoAspectToAspectDescription(float fAspect); - + bool HasItems(void) const { return m_vecItems.size() > 0; }; int GetStreamCount(CStreamDetail::StreamType type) const; int GetVideoStreamCount(void) const; @@ -118,7 +118,7 @@ public: virtual void Serialize(CArchive& ar); // Language to use for "best" subtitle stream - CStdString m_strLanguage; + CStdString m_strLanguage; private: CStreamDetail *NewStream(CStreamDetail::StreamType type); diff --git a/xbmc/utils/SystemInfo.cpp b/xbmc/utils/SystemInfo.cpp index 218561efe0..e2f60c674b 100644 --- a/xbmc/utils/SystemInfo.cpp +++ b/xbmc/utils/SystemInfo.cpp @@ -205,19 +205,19 @@ bool CSysInfo::GetDiskSpace(const CStdString drive,int& iTotal, int& iTotalFree, ULARGE_INTEGER ULTotal= { { 0 } }; ULARGE_INTEGER ULTotalFree= { { 0 } }; - if( !drive.IsEmpty() && !drive.Equals("*") ) - { + if( !drive.IsEmpty() && !drive.Equals("*") ) + { #ifdef _WIN32 UINT uidriveType = GetDriveType(( drive + ":\\" )); if(uidriveType != DRIVE_UNKNOWN && uidriveType != DRIVE_NO_ROOT_DIR) #endif bRet= ( 0 != GetDiskFreeSpaceEx( ( drive + ":\\" ), NULL, &ULTotal, &ULTotalFree) ); } - else + else { ULARGE_INTEGER ULTotalTmp= { { 0 } }; ULARGE_INTEGER ULTotalFreeTmp= { { 0 } }; -#ifdef _WIN32 +#ifdef _WIN32 char* pcBuffer= NULL; DWORD dwStrLength= GetLogicalDriveStrings( 0, pcBuffer ); if( dwStrLength != 0 ) @@ -340,7 +340,7 @@ CStdString CSysInfo::GetKernelVersion() if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 || si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64) strKernel.append(", 64-bit (WoW)"); } - else + else { strKernel.append(", 32-bit"); } @@ -361,7 +361,7 @@ CStdString CSysInfo::GetKernelVersion() strKernel.append("XP "); if( osvi.wSuiteMask & VER_SUITE_PERSONAL ) strKernel.append("Home Edition" ); - else + else strKernel.append("Professional" ); } else if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 ) @@ -577,7 +577,7 @@ CStdString CSysInfo::GetHddSpaceInfo(int& percent, int drive, bool shortText) CStdString CSysInfo::GetLinuxDistro() { CStdString result = ""; - + FILE* pipe = popen("unset PYTHONHOME; unset PYTHONPATH; /usr/bin/lsb_release -d | cut -f2", "r"); if (pipe) { @@ -588,7 +588,7 @@ CStdString CSysInfo::GetLinuxDistro() CLog::Log(LOGWARNING, "Unable to determine Linux distribution"); pclose(pipe); } - + return result.Trim(); } #endif @@ -597,7 +597,7 @@ CStdString CSysInfo::GetLinuxDistro() CStdString CSysInfo::GetUnameVersion() { CStdString result = ""; - + FILE* pipe = popen("uname -rs", "r"); if (pipe) { @@ -608,7 +608,7 @@ CStdString CSysInfo::GetUnameVersion() CLog::Log(LOGWARNING, "Unable to determine Uname version"); pclose(pipe); } - + return result.Trim(); } #endif @@ -634,12 +634,12 @@ CStdString CSysInfo::GetUserAgent() result += GetUnameVersion(); #endif #ifdef SVN_REV - CStdString strRevision; + CStdString strRevision; strRevision.Format("; SVN r%s", SVN_REV); result += strRevision; #endif result += "; http://www.xbmc.org)"; - + return result; } @@ -650,10 +650,10 @@ bool CSysInfo::IsAppleTV() char buffer[512]; size_t len = 512; std::string hw_model = "unknown"; - + if (sysctlbyname("hw.model", &buffer, &len, NULL, 0) == 0) hw_model = buffer; - + if (hw_model.find("AppleTV") != std::string::npos) result = true; #endif diff --git a/xbmc/utils/SystemInfo.h b/xbmc/utils/SystemInfo.h index 6ba6dda150..31354bd2f2 100644 --- a/xbmc/utils/SystemInfo.h +++ b/xbmc/utils/SystemInfo.h @@ -97,7 +97,7 @@ public: #endif #ifdef _LINUX CStdString GetUnameVersion(); -#endif +#endif CStdString GetUserAgent(); bool HasInternet() const; bool IsAppleTV(); diff --git a/xbmc/utils/Teletext.cpp b/xbmc/utils/Teletext.cpp index d70da80128..7d96a3340e 100644 --- a/xbmc/utils/Teletext.cpp +++ b/xbmc/utils/Teletext.cpp @@ -493,7 +493,7 @@ bool CTeletextDecoder::HandleAction(const CAction &action) else if (m_RenderInfo.Boxed) { m_RenderInfo.SubtitleDelay--; - + // display subtitledelay m_RenderInfo.PosY = 0; char ns[10]; diff --git a/xbmc/utils/Thread.cpp b/xbmc/utils/Thread.cpp index 0f1b15100b..0d081e957a 100644 --- a/xbmc/utils/Thread.cpp +++ b/xbmc/utils/Thread.cpp @@ -248,7 +248,7 @@ DWORD WINAPI CThread::staticThread(LPVOID* data) pThread = NULL; } else - CLog::Log(LOGDEBUG,"Thread %"PRIu64" terminating", (uint64_t)CThread::GetCurrentThreadId()); + CLog::Log(LOGDEBUG,"Thread %"PRIu64" terminating", (uint64_t)CThread::GetCurrentThreadId()); // DXMERGE - this looks like it might have used to have been useful for something... // g_graphicsContext.DeleteThreadContext(); @@ -326,12 +326,12 @@ bool CThread::SetPriority(const int iPriority) // Return true for success { bool rtn = false; - + if (m_ThreadHandle) { rtn = SetThreadPriority( m_ThreadHandle, iPriority ) == TRUE; } - + return(rtn); } @@ -340,7 +340,7 @@ int CThread::GetMinPriority(void) #if defined(__APPLE__) struct sched_param sched; int rtn, policy; - + rtn = pthread_getschedparam(pthread_self(), &policy, &sched); int min = sched_get_priority_min(policy); @@ -355,7 +355,7 @@ int CThread::GetMaxPriority(void) #if defined(__APPLE__) struct sched_param sched; int rtn, policy; - + rtn = pthread_getschedparam(pthread_self(), &policy, &sched); int max = sched_get_priority_max(policy); @@ -370,7 +370,7 @@ int CThread::GetNormalPriority(void) #if defined(__APPLE__) struct sched_param sched; int rtn, policy; - + rtn = pthread_getschedparam(pthread_self(), &policy, &sched); int min = sched_get_priority_min(policy); int max = sched_get_priority_max(policy); @@ -458,7 +458,7 @@ float CThread::GetRelativeUsage() if(m_iLastUsage > 0 && m_iLastTime > 0) m_fLastUsage = (float)( iUsage - m_iLastUsage ) / (float)( iTime - m_iLastTime ); - + m_iLastUsage = iUsage; m_iLastTime = iTime; diff --git a/xbmc/utils/TimeUtils.cpp b/xbmc/utils/TimeUtils.cpp index fb8b6af498..178104d0a7 100644 --- a/xbmc/utils/TimeUtils.cpp +++ b/xbmc/utils/TimeUtils.cpp @@ -76,8 +76,8 @@ unsigned int CTimeUtils::GetTimeMS() // best replacement for windows timeGetTime/GetTickCount // 1st call sets start_mstime, subsequent are the diff // between start_mstime and now_mstime to match SDL_GetTick behavior - // of previous usage. We might want to change this as CTimeUtils::GetTimeMS is - // time (ms) since system startup. + // of previous usage. We might want to change this as CTimeUtils::GetTimeMS is + // time (ms) since system startup. #if defined(_WIN32) return timeGetTime(); #elif defined(_LINUX) @@ -91,12 +91,12 @@ unsigned int CTimeUtils::GetTimeMS() if (start_time == 0) { mach_timebase_info_data_t tbinfo; - + mach_timebase_info(&tbinfo); cv = ((long double) tbinfo.numer) / ((long double) tbinfo.denom); start_time = now_time; } - + return( (now_time - start_time) * cv / 1000000.0); #else static uint64_t start_mstime = 0; @@ -109,7 +109,7 @@ unsigned int CTimeUtils::GetTimeMS() { start_mstime = now_mstime; } - + return(now_mstime - start_mstime); #endif #endif diff --git a/xbmc/utils/TuxBoxUtil.cpp b/xbmc/utils/TuxBoxUtil.cpp index e5ef6f0c17..ee903a657e 100644 --- a/xbmc/utils/TuxBoxUtil.cpp +++ b/xbmc/utils/TuxBoxUtil.cpp @@ -106,14 +106,14 @@ void CTuxBoxService::Process() if(g_tuxbox.GetHttpXML(url,"currentservicedata")) { CLog::Log(LOGDEBUG, "%s - receive current service data was successful", __FUNCTION__); - if(!strCurrentServiceName.IsEmpty()&& + if(!strCurrentServiceName.IsEmpty()&& !strCurrentServiceName.Equals("NULL") && !g_tuxbox.sCurSrvData.service_name.IsEmpty() && !g_tuxbox.sCurSrvData.service_name.Equals("-") && !g_tuxbox.vVideoSubChannel.mode) { //Detect Channel Change - //We need to detect the channel on the TuxBox Device! + //We need to detect the channel on the TuxBox Device! //On changing the channel on the device we will loose the stream and mplayer seems not able to detect it to stop if (strCurrentServiceName != g_tuxbox.sCurSrvData.service_name && g_application.IsPlaying()) { @@ -138,7 +138,7 @@ bool CTuxBoxUtil::CreateNewItem(const CFileItem& item, CFileItem& item_new) item_new.SetLabel(item.GetLabel()); item_new.m_strPath = item.m_strPath; item_new.SetThumbnailImage(item.GetThumbnailImage()); - + if(g_tuxbox.GetZapUrl(item.m_strPath, item_new)) { if(vVideoSubChannel.mode) @@ -181,13 +181,13 @@ bool CTuxBoxUtil::ParseBouquets(TiXmlElement *root, CFileItemList &items, CURL & { strPort.Format(":%i",url.GetPort()); } - else + else { strPort = ""; } if (!pRootElement) - { + { CLog::Log(LOGWARNING, "%s - No %s found", __FUNCTION__, strChild.c_str()); return false; } @@ -205,17 +205,17 @@ bool CTuxBoxUtil::ParseBouquets(TiXmlElement *root, CFileItemList &items, CURL & if (pIt) { strItemName = pIt->FirstChild()->Value(); - + pIt = pNode->FirstChild("reference"); if (pIt) { strItemPath = pIt->FirstChild()->Value(); - // add. bouquets to item list! + // add. bouquets to item list! CFileItemPtr pItem(new CFileItem); pItem->m_bIsFolder = true; pItem->SetLabel(strItemName); url.SetOptions("/"+strOptions+"&reference="+strItemPath); - pItem->m_strPath = "tuxbox://"+url.GetUserName()+":"+url.GetPassWord()+"@"+url.GetHostName()+strPort+url.GetOptions(); + pItem->m_strPath = "tuxbox://"+url.GetUserName()+":"+url.GetPassWord()+"@"+url.GetHostName()+strPort+url.GetOptions(); items.Add(pItem); //DEBUG Log CLog::Log(LOGDEBUG, "%s - Name: %s", __FUNCTION__,strItemName.c_str()); @@ -278,13 +278,13 @@ bool CTuxBoxUtil::ParseChannels(TiXmlElement *root, CFileItemList &items, CURL & { strPort.Format(":%i",url.GetPort()); } - else + else { strPort = ""; } if (!pRootElement) - { + { CLog::Log(LOGWARNING, "%s - No %ss found", __FUNCTION__,strChild.c_str()); return false; } @@ -302,7 +302,7 @@ bool CTuxBoxUtil::ParseChannels(TiXmlElement *root, CFileItemList &items, CURL & if (pIt) { strItemName = pIt->FirstChild()->Value(); - + pIt = pNode->FirstChild("reference"); if (strFilter.Equals(pIt->FirstChild()->Value())) { @@ -318,7 +318,7 @@ bool CTuxBoxUtil::ParseChannels(TiXmlElement *root, CFileItemList &items, CURL & if (pIta) { strItemName = pIta->FirstChild()->Value(); - + pIta = pIt->FirstChild("reference"); if (pIta) { @@ -327,13 +327,13 @@ bool CTuxBoxUtil::ParseChannels(TiXmlElement *root, CFileItemList &items, CURL & CFileItemPtr pbItem(new CFileItem); pbItem->m_bIsFolder = false; pbItem->SetLabel(strItemName); - pbItem->m_strPath = "tuxbox://"+url.GetUserName()+":"+url.GetPassWord()+"@"+url.GetHostName()+strPort+"/cgi-bin/zapTo?path="+strItemPath+".ts"; + pbItem->m_strPath = "tuxbox://"+url.GetUserName()+":"+url.GetPassWord()+"@"+url.GetHostName()+strPort+"/cgi-bin/zapTo?path="+strItemPath+".ts"; pbItem->SetThumbnailImage(GetPicon(strItemName)); //Set Picon Image //DEBUG Log CLog::Log(LOGDEBUG, "%s - Name: %s", __FUNCTION__,strItemName.c_str()); CLog::Log(LOGDEBUG, "%s - Adress: %s", __FUNCTION__,pbItem->m_strPath.c_str()); - + //add to the list items.Add(pbItem); } @@ -402,9 +402,9 @@ bool CTuxBoxUtil::ParseChannelsEnigma2(TiXmlElement *root, CFileItemList &items, } return true; } -bool CTuxBoxUtil::ZapToUrl(CURL url, CStdString strOptions, int ipoint) +bool CTuxBoxUtil::ZapToUrl(CURL url, CStdString strOptions, int ipoint) { - // send Zap + // send Zap CStdString strZapUrl, strPostUrl, strZapName, strFilter; //Extract the ZAP to Service String strFilter = strOptions.Right((strOptions.size()-(ipoint+6))); @@ -448,7 +448,7 @@ bool CTuxBoxUtil::ZapToUrl(CURL url, CStdString strOptions, int ipoint) } } } - + //Send ZAP Command CFileCurl http; if(http.Open(strZapUrl+strPostUrl)) @@ -470,7 +470,7 @@ bool CTuxBoxUtil::ZapToUrl(CURL url, CStdString strOptions, int ipoint) iRetry=iRetry+1; Sleep(200); } - + // PMT Not Valid? Try Time 10 reached, checking for advancedSettings m_iTuxBoxZapWaitTime if(sStrmInfo.pmt.Equals("ffffffffh") && g_advancedSettings.m_iTuxBoxZapWaitTime > 0 ) { @@ -489,8 +489,8 @@ bool CTuxBoxUtil::ZapToUrl(CURL url, CStdString strOptions, int ipoint) } } } - - //PMT Failed! No StreamInformations availible.. closing stream + + //PMT Failed! No StreamInformations availible.. closing stream if (sStrmInfo.pmt.Equals("ffffffffh")) { CLog::Log(LOGERROR, "%s-------------------------------------------------------------", __FUNCTION__); @@ -540,14 +540,14 @@ bool CTuxBoxUtil::GetZapUrl(const CStdString& strPath, CFileItem &items ) vVideoSubChannel.current_name = strVideoSubChannelName; } } - else + else vVideoSubChannel.mode= false; } CStdString strStreamURL, strVideoStream; CStdString strLabel, strLabel2; CStdString strAudioChannelName, strAudioChannelPid; - + if (GetAudioChannels(strAudioChannelName, strAudioChannelPid)) { if(strAudioChannelPid.Left(2).Equals("0x")) @@ -557,7 +557,7 @@ bool CTuxBoxUtil::GetZapUrl(const CStdString& strPath, CFileItem &items ) } else { - if(sStrmInfo.apid.Left(2).Equals("0x")) + if(sStrmInfo.apid.Left(2).Equals("0x")) sStrmInfo.apid.Replace("0x",""); if(sCurSrvData.audio_channel_1_pid.Left(2).Equals("0x")) sCurSrvData.audio_channel_1_pid.Replace("0x",""); @@ -566,31 +566,31 @@ bool CTuxBoxUtil::GetZapUrl(const CStdString& strPath, CFileItem &items ) if(g_application.m_eForcedNextPlayer == EPC_DVDPLAYER || g_advancedSettings.m_bTuxBoxSendAllAPids) strVideoStream.Format("0,%s,%s,%s,%s,%s",sStrmInfo.pmt.Left(4).c_str(), sStrmInfo.vpid.Left(4).c_str(), sStrmInfo.apid.Left(4).c_str(), sCurSrvData.audio_channel_1_pid.Left(4).c_str(), sCurSrvData.audio_channel_2_pid.Left(4).c_str()); - else + else strVideoStream.Format("0,%s,%s,%s",sStrmInfo.pmt.Left(4).c_str(), sStrmInfo.vpid.Left(4).c_str(), sStrmInfo.apid.Left(4).c_str()); } - + strStreamURL.Format("http://%s:%s@%s:%i/%s",url.GetUserName().c_str(),url.GetPassWord().c_str(), url.GetHostName().c_str(),TS_STREAM_PORT,strVideoStream.c_str()); strLabel.Format("%s: %s %s-%s",items.GetLabel().c_str(), sCurSrvData.current_event_date.c_str(),sCurSrvData.current_event_start.c_str(), sCurSrvData.current_event_start.c_str()); strLabel2.Format("%s", sCurSrvData.current_event_description.c_str()); - + // Set Event details CStdString strGenre, strTitle; strGenre.Format("%s %s - (%s: %s)",g_localizeStrings.Get(143),sCurSrvData.current_event_description, g_localizeStrings.Get(209),sCurSrvData.next_event_description); strTitle.Format("%s",sCurSrvData.current_event_details); int iDuration = atoi(sCurSrvData.current_event_duration.c_str()); - + items.GetVideoInfoTag()->m_strGenre = strGenre; // VIDEOPLAYER_GENRE: current_event_description (Film Name) items.GetVideoInfoTag()->m_strTitle = strTitle; // VIDEOPLAYER_TITLE: current_event_details (Film beschreibung) StringUtils::SecondsToTimeString(iDuration,items.GetVideoInfoTag()->m_strRuntime); //VIDEOPLAYER_DURATION: current_event_duration (laufzeit in sec.) - + items.m_strPath = strStreamURL; items.m_iDriveType = url.GetPort(); // Dirty Hack! But i need to hold the Port ;) items.SetLabel(items.GetLabel()); // VIDEOPLAYER_DIRECTOR: service_name (Program Name) items.SetLabel2(sCurSrvData.current_event_description); // current_event_description (Film Name) items.m_bIsFolder = false; items.SetContentType("video/x-ms-asf"); - + return true; } } @@ -622,7 +622,7 @@ bool CTuxBoxUtil::GetHttpXML(CURL url,CStdString strRequestType) { url.SetOptions("xml/serviceepg"); } - else + else { CLog::Log(LOGERROR, "%s - Request Type is not defined! You requested: %s", __FUNCTION__,strRequestType.c_str()); return false; @@ -633,20 +633,20 @@ bool CTuxBoxUtil::GetHttpXML(CURL url,CStdString strRequestType) CLog::Log(LOGERROR, "%s - strRequestType Request Type is Empty!", __FUNCTION__); return false; } - + // Clean Up the URL, so we have a clean request! url.SetFileName(""); - - //Open + + //Open CFileCurl http; http.SetTimeout(20); - if(http.Open(url)) + if(http.Open(url)) { CStdString strTmp; - int size_read = 0; + int size_read = 0; int data_size = 0; int size_total = (int)http.GetLength(); - + if(size_total >0) { // read response from server into string buffer @@ -714,7 +714,7 @@ bool CTuxBoxUtil::StreamInformations(TiXmlElement *pRootElement) vpid,pmtpid,pcrpid,apid --> xml/streaminfo apids --> /xml/currentservicedata - + apid: is the defined audio stream! Normal Stereo: http://192.168.0.110:31339/0,0065,01ff,0200,0201,0203,01ff Normal English: http://192.168.0.110:31339/0,0065,01ff,0201,,,01ff @@ -933,7 +933,7 @@ bool CTuxBoxUtil::CurrentServiceData(TiXmlElement *pRootElement) if(i==1) sCurSrvData.audio_channel_1_pid = pVal->FirstChild()->Value(); if(i==2) sCurSrvData.audio_channel_2_pid = pVal->FirstChild()->Value(); } - + pVal = pIt->FirstChild("selected"); if(pVal) { @@ -941,7 +941,7 @@ bool CTuxBoxUtil::CurrentServiceData(TiXmlElement *pRootElement) if(i==1) sCurSrvData.audio_channel_1_selected = pVal->FirstChild()->Value(); if(i==2) sCurSrvData.audio_channel_2_selected = pVal->FirstChild()->Value(); } - + pVal = pIt->FirstChild("name"); if(pVal) { @@ -1405,7 +1405,7 @@ bool CTuxBoxUtil::GetVideoSubChannels(CStdString& strVideoSubChannelName, CStdSt vector<int> btn; for (unsigned int i=0; vVideoSubChannel.name.size() > i; ++i) btn.push_back(pMenu->AddButton(vVideoSubChannel.name[i])); - + pMenu->CenterWindow(); pMenu->DoModal(); // get selected Video Sub Channel name and reference zap @@ -1450,7 +1450,7 @@ CStdString CTuxBoxUtil::GetPicon(CStdString strServiceName) TiXmlDocument piconDoc; if (!CFile::Exists(piconXML)) - { + { return defaultPng; } if (!piconDoc.LoadFile(piconXML)) @@ -1479,7 +1479,7 @@ CStdString CTuxBoxUtil::GetPicon(CStdString strServiceName) { strPng.Format("%s",pService->Attribute("png")); } - + if(strName.Equals(strServiceName)) { strPng.Format("%s%s",piconPath.c_str(), strPng.c_str()); @@ -1498,7 +1498,7 @@ CStdString CTuxBoxUtil::GetPicon(CStdString strServiceName) CStdString CTuxBoxUtil::GetSubMode(int iMode, CStdString& strXMLRootString, CStdString& strXMLChildString) { //Todo: add a setting: "Don't Use Request mode" to advanced.xml - + // MODE: 0 = TV, 1 = Radio, 2 = Data, 3 = Movies, 4 = Root // SUBMODE: 0 = n/a, 1 = All, 2 = Satellites, 2 = Providers, 4 = Bouquets // Default Submode @@ -1512,7 +1512,7 @@ CStdString CTuxBoxUtil::GetSubMode(int iMode, CStdString& strXMLRootString, CStd strXMLChildString.Format("bouquet"); return strSubMode; } - + // popup the context menu CGUIDialogContextMenu *pMenu; pMenu = (CGUIDialogContextMenu *)g_windowManager.GetWindow(WINDOW_DIALOG_CONTEXT_MENU); @@ -1525,7 +1525,7 @@ CStdString CTuxBoxUtil::GetSubMode(int iMode, CStdString& strXMLRootString, CStd int iSubmode_2 = pMenu->AddButton("Satellites"); //; int iSubmode_3 = pMenu->AddButton("Providers"); int iSubmode_4 = pMenu->AddButton("Bouquets"); - + pMenu->CenterWindow(); pMenu->DoModal(); int btnid = pMenu->GetButton(); diff --git a/xbmc/utils/Weather.cpp b/xbmc/utils/Weather.cpp index c7c173616b..af06cd35d5 100644 --- a/xbmc/utils/Weather.cpp +++ b/xbmc/utils/Weather.cpp @@ -457,7 +457,7 @@ void CWeatherJob::LoadLocalizedToken() { // We load the english strings in to get our tokens CStdString strLanguagePath = "special://xbmc/language/English/strings.xml"; - + TiXmlDocument xmlDoc; if (!xmlDoc.LoadFile(strLanguagePath) || !xmlDoc.RootElement()) { diff --git a/xbmc/utils/fastmemcpy.cpp b/xbmc/utils/fastmemcpy.cpp index 7c6f59b35b..db4a8c32e5 100644 --- a/xbmc/utils/fastmemcpy.cpp +++ b/xbmc/utils/fastmemcpy.cpp @@ -11,7 +11,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |