From 8e02133399410cce5f16795938bb3ce1fde0dc39 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 16 Aug 2017 21:17:47 +0200 Subject: [PATCH 001/113] mark classes with pointer members non-copyable --- xbmc/addons/interfaces/Addon/AddonCallbacksAddon.h | 3 +++ xbmc/addons/interfaces/AddonInterfaces.h | 2 ++ xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h | 4 ++++ xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxCC.cpp | 2 ++ xbmc/cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h | 6 ++++++ xbmc/dbwrappers/dataset.h | 2 ++ xbmc/filesystem/DirectoryCache.h | 2 ++ xbmc/guilib/GUIFontCache.h | 3 +++ xbmc/guilib/GUIVisualisationControl.h | 2 ++ xbmc/network/upnp/UPnP.h | 3 +++ xbmc/network/websocket/WebSocket.h | 2 ++ xbmc/platform/XbmcContext.h | 3 +++ xbmc/settings/SettingsBase.h | 3 +++ xbmc/utils/CPUInfo.h | 2 ++ 14 files changed, 39 insertions(+) diff --git a/xbmc/addons/interfaces/Addon/AddonCallbacksAddon.h b/xbmc/addons/interfaces/Addon/AddonCallbacksAddon.h index 08212546e2aa8..ff0e77bfbaf48 100644 --- a/xbmc/addons/interfaces/Addon/AddonCallbacksAddon.h +++ b/xbmc/addons/interfaces/Addon/AddonCallbacksAddon.h @@ -91,6 +91,9 @@ class CAddonCallbacksAddon static bool CURLOpen(const void* addonData, void* curl, unsigned int flags); private: + CAddonCallbacksAddon(const CAddonCallbacksAddon&) = delete; + CAddonCallbacksAddon& operator=(const CAddonCallbacksAddon&) = delete; + ADDON::CAddon* m_addon; /*!< the addon */ CB_AddOnLib *m_callbacks; /*!< callback addresses */ }; diff --git a/xbmc/addons/interfaces/AddonInterfaces.h b/xbmc/addons/interfaces/AddonInterfaces.h index 2d2aaa7bdf02d..cc56fdb2ad490 100644 --- a/xbmc/addons/interfaces/AddonInterfaces.h +++ b/xbmc/addons/interfaces/AddonInterfaces.h @@ -70,6 +70,8 @@ namespace ADDON static void OnApplicationMessage(KODI::MESSAGING::ThreadMessage* pMsg); private: + CAddonInterfaces(const CAddonInterfaces&) = delete; + CAddonInterfaces& operator=(const CAddonInterfaces&) = delete; AddonCB* m_callbacks; CAddon* m_addon; diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h index 20d9fcf5340d7..8094269f4c5d0 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h @@ -121,6 +121,10 @@ class CActiveAEStreamBuffers protected: CActiveAEBufferPoolResample *m_resampleBuffers; CActiveAEBufferPoolAtempo *m_atempoBuffers; + +private: + CActiveAEStreamBuffers(const CActiveAEStreamBuffers&) = delete; + CActiveAEStreamBuffers& operator=(const CActiveAEStreamBuffers&) = delete; }; class CActiveAEStream : public IAEStream diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxCC.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxCC.cpp index 839414319ae86..0304d2dd1536d 100644 --- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxCC.cpp +++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxCC.cpp @@ -74,6 +74,8 @@ class CBitstream class CCaptionBlock { + CCaptionBlock(const CCaptionBlock&) = delete; + CCaptionBlock& operator=(const CCaptionBlock&) = delete; public: explicit CCaptionBlock(int size) { diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h index a32f4feb643a3..c77d000a12605 100644 --- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h +++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h @@ -55,6 +55,9 @@ struct DemuxCryptoSession static const uint8_t FLAG_SECURE_DECODER = 1; uint8_t flags; +private: + DemuxCryptoSession(const DemuxCryptoSession&) = delete; + DemuxCryptoSession& operator=(const DemuxCryptoSession&) = delete; }; //CryptoInfo stores the information to decrypt a sample @@ -82,4 +85,7 @@ struct DemuxCryptoInfo uint8_t iv[16]; // initialization vector uint8_t kid[16]; // key id +private: + DemuxCryptoInfo(const DemuxCryptoInfo&) = delete; + DemuxCryptoInfo& operator=(const DemuxCryptoInfo&) = delete; }; diff --git a/xbmc/dbwrappers/dataset.h b/xbmc/dbwrappers/dataset.h index 223403c062faa..9b85e4f0281ed 100644 --- a/xbmc/dbwrappers/dataset.h +++ b/xbmc/dbwrappers/dataset.h @@ -405,6 +405,8 @@ class Dataset { const sql_record* get_sql_record(); private: + Dataset(const Dataset&) = delete; + Dataset& operator=(const Dataset&) = delete; unsigned int fieldIndexMapID; diff --git a/xbmc/filesystem/DirectoryCache.h b/xbmc/filesystem/DirectoryCache.h index 4fd97436daad9..310fafadf39d0 100644 --- a/xbmc/filesystem/DirectoryCache.h +++ b/xbmc/filesystem/DirectoryCache.h @@ -44,6 +44,8 @@ namespace XFILE CFileItemList* m_Items; DIR_CACHE_TYPE m_cacheType; private: + CDir(const CDir&) = delete; + CDir& operator=(const CDir&) = delete; unsigned int m_lastAccess; }; public: diff --git a/xbmc/guilib/GUIFontCache.h b/xbmc/guilib/GUIFontCache.h index a7fdecf892fa7..75f655f7db467 100644 --- a/xbmc/guilib/GUIFontCache.h +++ b/xbmc/guilib/GUIFontCache.h @@ -140,6 +140,9 @@ class CGUIFontCache { CGUIFontCacheImpl* m_impl; + CGUIFontCache(const CGUIFontCache&) = delete; + const CGUIFontCache& operator=(const CGUIFontCache&) = delete; + public: const CGUIFontTTFBase &m_font; diff --git a/xbmc/guilib/GUIVisualisationControl.h b/xbmc/guilib/GUIVisualisationControl.h index 0df69631b0ec0..7387baf22829f 100644 --- a/xbmc/guilib/GUIVisualisationControl.h +++ b/xbmc/guilib/GUIVisualisationControl.h @@ -36,6 +36,8 @@ class CAudioBuffer int Size() const; void Set(const float* psBuffer, int iSize); private: + CAudioBuffer(const CAudioBuffer&) = delete; + CAudioBuffer& operator=(const CAudioBuffer&) = delete; CAudioBuffer(); float* m_pBuffer; int m_iLen; diff --git a/xbmc/network/upnp/UPnP.h b/xbmc/network/upnp/UPnP.h index 69c4e94afe8cd..26339b5d76e2d 100644 --- a/xbmc/network/upnp/UPnP.h +++ b/xbmc/network/upnp/UPnP.h @@ -84,6 +84,9 @@ class CUPnP static void RegisterUserdata(void* ptr); static void UnregisterUserdata(void* ptr); private: + CUPnP(const CUPnP&) = delete; + CUPnP& operator=(const CUPnP&) = delete; + void CreateControlPoint(); void DestroyControlPoint(); diff --git a/xbmc/network/websocket/WebSocket.h b/xbmc/network/websocket/WebSocket.h index 769156c94c9c0..9877579abbda8 100644 --- a/xbmc/network/websocket/WebSocket.h +++ b/xbmc/network/websocket/WebSocket.h @@ -90,6 +90,8 @@ class CWebSocketFrame private: void reset(); + CWebSocketFrame(const CWebSocketFrame&) = delete; + CWebSocketFrame& operator=(const CWebSocketFrame&) = delete; }; class CWebSocketMessage diff --git a/xbmc/platform/XbmcContext.h b/xbmc/platform/XbmcContext.h index c11454689e8d2..f91169f73da99 100644 --- a/xbmc/platform/XbmcContext.h +++ b/xbmc/platform/XbmcContext.h @@ -35,6 +35,9 @@ namespace XBMC public: Context(); virtual ~Context(); + private: + Context(const Context&) = delete; + Context& operator=(const Context&) = delete; }; } diff --git a/xbmc/settings/SettingsBase.h b/xbmc/settings/SettingsBase.h index fb245e69fc3e9..262e5c6973438 100644 --- a/xbmc/settings/SettingsBase.h +++ b/xbmc/settings/SettingsBase.h @@ -283,4 +283,7 @@ class CSettingsBase bool m_initialized; CSettingsManager* m_settingsManager; CCriticalSection m_critical; +private: + CSettingsBase(const CSettingsBase&) = delete; + CSettingsBase& operator=(const CSettingsBase&) = delete; }; diff --git a/xbmc/utils/CPUInfo.h b/xbmc/utils/CPUInfo.h index f94abad6c5415..aa5fdc7519f0d 100644 --- a/xbmc/utils/CPUInfo.h +++ b/xbmc/utils/CPUInfo.h @@ -102,6 +102,8 @@ class CCPUInfo unsigned int GetCPUFeatures() const { return m_cpuFeatures; } private: + CCPUInfo(const CCPUInfo&) = delete; + CCPUInfo& operator=(const CCPUInfo&) = delete; bool readProcStat(unsigned long long& user, unsigned long long& nice, unsigned long long& system, unsigned long long& idle, unsigned long long& io); void ReadCPUFeatures(); From 40085cddc03c2cfbf255728d48e389460b3b41dd Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 16 Aug 2017 21:13:41 +0200 Subject: [PATCH 002/113] add default constructors --- xbmc/ContextMenuItem.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xbmc/ContextMenuItem.h b/xbmc/ContextMenuItem.h index b0692a8ba2984..3b8d141f90795 100644 --- a/xbmc/ContextMenuItem.h +++ b/xbmc/ContextMenuItem.h @@ -62,6 +62,8 @@ class CStaticContextMenuAction : public IContextMenuItem class CContextMenuItem : public IContextMenuItem { public: + CContextMenuItem() = default; + std::string GetLabel(const CFileItem& item) const override { return m_label; } bool IsVisible(const CFileItem& item) const override ; bool IsParentOf(const CContextMenuItem& menuItem) const; From 81ba09675fffb899b06fe841d53b04f2d000c66f Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 16 Aug 2017 22:42:37 +0200 Subject: [PATCH 003/113] make classes non-copyable c++11 style --- xbmc/ContextMenuManager.h | 4 ++-- xbmc/DatabaseManager.h | 4 ++-- xbmc/FileItemListModification.h | 4 ++-- xbmc/PasswordManager.h | 4 ++-- xbmc/TextureCache.h | 4 ++-- xbmc/addons/AddonInstaller.h | 4 ++-- xbmc/addons/Scraper.h | 8 ++++---- xbmc/cdrip/CDDARipper.h | 4 ++-- .../VideoRenderers/VideoShaders/ConvolutionKernels.h | 4 ++-- xbmc/cores/playercorefactory/PlayerCoreFactory.h | 4 ++-- xbmc/events/EventLog.h | 4 ++-- xbmc/filesystem/XbtManager.h | 4 ++-- xbmc/guilib/GUIControlProfiler.h | 4 ++-- xbmc/guilib/GUIFontTTF.h | 4 ++-- xbmc/guilib/GUIImage.h | 4 ++-- xbmc/input/KeyboardLayoutManager.h | 4 ++-- xbmc/input/touch/generic/GenericTouchActionHandler.h | 4 ++-- xbmc/interfaces/AnnouncementManager.h | 4 ++-- xbmc/interfaces/builtins/Builtins.h | 4 ++-- xbmc/interfaces/generic/ScriptInvocationManager.h | 6 +++--- xbmc/interfaces/legacy/AddonClass.h | 2 +- xbmc/network/ZeroconfBrowser.h | 3 ++- xbmc/network/upnp/UPnPSettings.h | 4 ++-- xbmc/platform/darwin/osx/XBMCHelper.h | 4 ++-- xbmc/profiles/ProfilesManager.h | 4 ++-- xbmc/pvr/channels/PVRChannelGroupsContainer.h | 4 ++-- xbmc/settings/DisplaySettings.h | 4 ++-- xbmc/settings/MediaSettings.h | 4 ++-- xbmc/settings/MediaSourceSettings.h | 4 ++-- xbmc/settings/SkinSettings.h | 6 +++--- xbmc/test/TestUtils.h | 4 ++-- xbmc/utils/CryptThreading.h | 4 ++-- xbmc/utils/JobManager.h | 4 ++-- xbmc/utils/RssManager.h | 4 ++-- xbmc/utils/SeekHandler.h | 4 ++-- xbmc/utils/Splash.h | 4 ++-- xbmc/utils/auto_buffer.h | 4 ++-- xbmc/video/PlayerController.h | 4 ++-- xbmc/video/VideoLibraryQueue.h | 4 ++-- xbmc/view/ViewStateSettings.h | 4 ++-- 40 files changed, 83 insertions(+), 82 deletions(-) diff --git a/xbmc/ContextMenuManager.h b/xbmc/ContextMenuManager.h index 806839a8d73ed..b9326724b9469 100644 --- a/xbmc/ContextMenuManager.h +++ b/xbmc/ContextMenuManager.h @@ -47,8 +47,8 @@ class CContextMenuManager ContextMenuView GetAddonItems(const CFileItem& item, const CContextMenuItem& root = MAIN) const; private: - CContextMenuManager(const CContextMenuManager&); - CContextMenuManager const& operator=(CContextMenuManager const&); + CContextMenuManager(const CContextMenuManager&) = delete; + CContextMenuManager& operator=(CContextMenuManager const&) = delete; bool IsVisible( const CContextMenuItem& menuItem, diff --git a/xbmc/DatabaseManager.h b/xbmc/DatabaseManager.h index 59e683b476555..87a23dc951157 100644 --- a/xbmc/DatabaseManager.h +++ b/xbmc/DatabaseManager.h @@ -69,8 +69,8 @@ class CDatabaseManager private: // private construction, and no assignments; use the provided singleton methods CDatabaseManager(); - CDatabaseManager(const CDatabaseManager&); - CDatabaseManager const& operator=(CDatabaseManager const&); + CDatabaseManager(const CDatabaseManager&) = delete; + CDatabaseManager const& operator=(CDatabaseManager const&) = delete; virtual ~CDatabaseManager(); enum DB_STATUS { DB_CLOSED, DB_UPDATING, DB_READY, DB_FAILED }; diff --git a/xbmc/FileItemListModification.h b/xbmc/FileItemListModification.h index da8cdbfddd8af..a2c2ec5436cf5 100644 --- a/xbmc/FileItemListModification.h +++ b/xbmc/FileItemListModification.h @@ -35,8 +35,8 @@ class CFileItemListModification : public IFileItemListModifier private: CFileItemListModification(); - CFileItemListModification(const CFileItemListModification&); - CFileItemListModification const& operator=(CFileItemListModification const&); + CFileItemListModification(const CFileItemListModification&) = delete; + CFileItemListModification& operator=(CFileItemListModification const&) = delete; std::set m_modifiers; }; diff --git a/xbmc/PasswordManager.h b/xbmc/PasswordManager.h index fa295c0072f4a..afb5500d31617 100644 --- a/xbmc/PasswordManager.h +++ b/xbmc/PasswordManager.h @@ -87,8 +87,8 @@ class CPasswordManager private: // private construction, and no assignments; use the provided singleton methods CPasswordManager(); - CPasswordManager(const CPasswordManager&); - CPasswordManager const & operator=(CPasswordManager const&); + CPasswordManager(const CPasswordManager&) = delete; + CPasswordManager& operator=(CPasswordManager const&) = delete; ~CPasswordManager() = default; void Load(); diff --git a/xbmc/TextureCache.h b/xbmc/TextureCache.h index f321778116345..558c0f3dcbbdc 100644 --- a/xbmc/TextureCache.h +++ b/xbmc/TextureCache.h @@ -158,8 +158,8 @@ class CTextureCache : public CJobQueue private: // private construction, and no assignments; use the provided singleton methods CTextureCache(); - CTextureCache(const CTextureCache&); - CTextureCache const& operator=(CTextureCache const&); + CTextureCache(const CTextureCache&) = delete; + CTextureCache const& operator=(CTextureCache const&) = delete; ~CTextureCache() override; /*! \brief Check if the given image is a cached image diff --git a/xbmc/addons/AddonInstaller.h b/xbmc/addons/AddonInstaller.h index aec4fbe07b2ff..260ecae00ddda 100644 --- a/xbmc/addons/AddonInstaller.h +++ b/xbmc/addons/AddonInstaller.h @@ -118,8 +118,8 @@ class CAddonInstaller : public IJobCallback private: // private construction, and no assignments; use the provided singleton methods CAddonInstaller(); - CAddonInstaller(const CAddonInstaller&); - CAddonInstaller const& operator=(CAddonInstaller const&); + CAddonInstaller(const CAddonInstaller&) = delete; + CAddonInstaller const& operator=(CAddonInstaller const&) = delete; ~CAddonInstaller() override; /*! \brief Install an addon from a repository or zip diff --git a/xbmc/addons/Scraper.h b/xbmc/addons/Scraper.h index 9087d0f2f1599..1112fa47ecd3f 100644 --- a/xbmc/addons/Scraper.h +++ b/xbmc/addons/Scraper.h @@ -155,10 +155,10 @@ class CScraper : public CAddon bool GetArtwork(XFILE::CCurlFile &fcurl, CVideoInfoTag &details); private: - CScraper(const CScraper &rhs); - CScraper& operator=(const CScraper&); - CScraper(CScraper&&); - CScraper& operator=(CScraper&&); + CScraper(const CScraper &rhs) = delete; + CScraper& operator=(const CScraper&) = delete; + CScraper(CScraper&&) = delete; + CScraper& operator=(CScraper&&) = delete; std::string SearchStringEncoding() const { return m_parser.GetSearchStringEncoding(); } diff --git a/xbmc/cdrip/CDDARipper.h b/xbmc/cdrip/CDDARipper.h index c8ac90c94247d..f765b1804651f 100644 --- a/xbmc/cdrip/CDDARipper.h +++ b/xbmc/cdrip/CDDARipper.h @@ -65,9 +65,9 @@ class CCDDARipper : public CJobQueue private: // private construction and no assignments CCDDARipper(); - CCDDARipper(const CCDDARipper&); + CCDDARipper(const CCDDARipper&) = delete; ~CCDDARipper() override; - CCDDARipper const& operator=(CCDDARipper const&); + CCDDARipper const& operator=(CCDDARipper const&) = delete; /*! \brief Return track file name extension for the given encoder type \param[in] iEncoder encoder type (see CDDARIP_ENCODER_... constants) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/ConvolutionKernels.h b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/ConvolutionKernels.h index 0f33b4a1f80c3..02c76f639036f 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/ConvolutionKernels.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/ConvolutionKernels.h @@ -36,8 +36,8 @@ class CConvolutionKernel uint8_t* GetUint8Pixels() { return m_uint8pixels; } private: - CConvolutionKernel(const CConvolutionKernel&); - CConvolutionKernel& operator=(const CConvolutionKernel&); + CConvolutionKernel(const CConvolutionKernel&) = delete; + CConvolutionKernel& operator=(const CConvolutionKernel&) = delete; void Lanczos2(); void Lanczos3Fast(); void Lanczos3(); diff --git a/xbmc/cores/playercorefactory/PlayerCoreFactory.h b/xbmc/cores/playercorefactory/PlayerCoreFactory.h index 0484f15bdbc5f..915eeb91f1941 100644 --- a/xbmc/cores/playercorefactory/PlayerCoreFactory.h +++ b/xbmc/cores/playercorefactory/PlayerCoreFactory.h @@ -61,8 +61,8 @@ class CPlayerCoreFactory : public ISettingsHandler protected: CPlayerCoreFactory(); - CPlayerCoreFactory(const CPlayerCoreFactory&); - CPlayerCoreFactory& operator=(CPlayerCoreFactory const&); + CPlayerCoreFactory(const CPlayerCoreFactory&) = delete; + CPlayerCoreFactory& operator=(CPlayerCoreFactory const&) = delete; ~CPlayerCoreFactory() override; int GetPlayerIndex(const std::string& strCoreName) const; std::string GetPlayerName(size_t idx) const; diff --git a/xbmc/events/EventLog.h b/xbmc/events/EventLog.h index 2ff457adbc7ee..459c24ce42127 100644 --- a/xbmc/events/EventLog.h +++ b/xbmc/events/EventLog.h @@ -64,8 +64,8 @@ class CEventLog : public ISettingCallback protected: CEventLog() = default; - CEventLog(const CEventLog&); - CEventLog const& operator=(CEventLog const&); + CEventLog(const CEventLog&) = delete; + CEventLog& operator=(CEventLog const&) = delete; // implementation of ISettingCallback void OnSettingAction(std::shared_ptr setting) override; diff --git a/xbmc/filesystem/XbtManager.h b/xbmc/filesystem/XbtManager.h index 8932c06ac088f..613615042c718 100644 --- a/xbmc/filesystem/XbtManager.h +++ b/xbmc/filesystem/XbtManager.h @@ -47,8 +47,8 @@ class CXbtManager private: CXbtManager(); - CXbtManager(const CXbtManager&); - CXbtManager& operator=(const CXbtManager&); + CXbtManager(const CXbtManager&) = delete; + CXbtManager& operator=(const CXbtManager&) = delete; struct XBTFReader { diff --git a/xbmc/guilib/GUIControlProfiler.h b/xbmc/guilib/GUIControlProfiler.h index d15d3aec45949..be3e1250405ee 100644 --- a/xbmc/guilib/GUIControlProfiler.h +++ b/xbmc/guilib/GUIControlProfiler.h @@ -82,8 +82,8 @@ class CGUIControlProfiler private: CGUIControlProfiler(void); ~CGUIControlProfiler(void) = default; - CGUIControlProfiler(const CGUIControlProfiler &that); - CGUIControlProfiler &operator=(const CGUIControlProfiler &that); + CGUIControlProfiler(const CGUIControlProfiler &that) = delete; + CGUIControlProfiler &operator=(const CGUIControlProfiler &that) = delete; CGUIControlProfilerItem m_ItemHead; CGUIControlProfilerItem *m_pLastItem; diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h index e469d0eb0de00..3413e26a73869 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h @@ -202,8 +202,8 @@ class CGUIFontTTFBase private: virtual bool FirstBegin() = 0; virtual void LastEnd() = 0; - CGUIFontTTFBase(const CGUIFontTTFBase&); - CGUIFontTTFBase& operator=(const CGUIFontTTFBase&); + CGUIFontTTFBase(const CGUIFontTTFBase&) = delete; + CGUIFontTTFBase& operator=(const CGUIFontTTFBase&) = delete; int m_referenceCount; }; diff --git a/xbmc/guilib/GUIImage.h b/xbmc/guilib/GUIImage.h index 940ec4f5720ec..b34e7d1092f39 100644 --- a/xbmc/guilib/GUIImage.h +++ b/xbmc/guilib/GUIImage.h @@ -63,8 +63,8 @@ class CGUIImage : public CGUIControl bool m_fading; ///< whether we're fading out private: - CFadingTexture(const CFadingTexture&); - CFadingTexture& operator=(const CFadingTexture&); + CFadingTexture(const CFadingTexture&) = delete; + CFadingTexture& operator=(const CFadingTexture&) = delete; }; CGUIImage(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& texture); diff --git a/xbmc/input/KeyboardLayoutManager.h b/xbmc/input/KeyboardLayoutManager.h index e9217245aea6e..d384a79aad58b 100644 --- a/xbmc/input/KeyboardLayoutManager.h +++ b/xbmc/input/KeyboardLayoutManager.h @@ -47,8 +47,8 @@ class CKeyboardLayoutManager private: CKeyboardLayoutManager() = default; - CKeyboardLayoutManager(const CKeyboardLayoutManager&); - CKeyboardLayoutManager const& operator=(CKeyboardLayoutManager const&); + CKeyboardLayoutManager(const CKeyboardLayoutManager&) = delete; + CKeyboardLayoutManager const& operator=(CKeyboardLayoutManager const&) = delete; KeyboardLayouts m_layouts; }; diff --git a/xbmc/input/touch/generic/GenericTouchActionHandler.h b/xbmc/input/touch/generic/GenericTouchActionHandler.h index dfca407233811..1430d5e7c33f9 100644 --- a/xbmc/input/touch/generic/GenericTouchActionHandler.h +++ b/xbmc/input/touch/generic/GenericTouchActionHandler.h @@ -73,8 +73,8 @@ class CGenericTouchActionHandler : public ITouchActionHandler private: // private construction, and no assignments; use the provided singleton methods CGenericTouchActionHandler() = default; - CGenericTouchActionHandler(const CGenericTouchActionHandler&); - CGenericTouchActionHandler const& operator=(CGenericTouchActionHandler const&); + CGenericTouchActionHandler(const CGenericTouchActionHandler&) = delete; + CGenericTouchActionHandler const& operator=(CGenericTouchActionHandler const&) = delete; ~CGenericTouchActionHandler() override = default; void sendEvent(int actionId, float x, float y, float x2 = 0.0f, float y2 = 0.0f, float x3 = 0.0f, float y3 = 0.0f, int pointers = 1); diff --git a/xbmc/interfaces/AnnouncementManager.h b/xbmc/interfaces/AnnouncementManager.h index 0048f730cc5c4..36f9932812594 100644 --- a/xbmc/interfaces/AnnouncementManager.h +++ b/xbmc/interfaces/AnnouncementManager.h @@ -69,8 +69,8 @@ namespace ANNOUNCEMENT CEvent m_queueEvent; private: - CAnnouncementManager(const CAnnouncementManager&); - CAnnouncementManager const& operator=(CAnnouncementManager const&); + CAnnouncementManager(const CAnnouncementManager&) = delete; + CAnnouncementManager const& operator=(CAnnouncementManager const&) = delete; CCriticalSection m_critSection; std::vector m_announcers; diff --git a/xbmc/interfaces/builtins/Builtins.h b/xbmc/interfaces/builtins/Builtins.h index 87fdd0a482ceb..8984c5ae45ba3 100644 --- a/xbmc/interfaces/builtins/Builtins.h +++ b/xbmc/interfaces/builtins/Builtins.h @@ -47,8 +47,8 @@ class CBuiltins protected: CBuiltins(); - CBuiltins(const CBuiltins&); - const CBuiltins& operator=(const CBuiltins&); + CBuiltins(const CBuiltins&) = delete; + const CBuiltins& operator=(const CBuiltins&) = delete; virtual ~CBuiltins(); private: diff --git a/xbmc/interfaces/generic/ScriptInvocationManager.h b/xbmc/interfaces/generic/ScriptInvocationManager.h index aa5a1628847d8..5a34227e2d493 100644 --- a/xbmc/interfaces/generic/ScriptInvocationManager.h +++ b/xbmc/interfaces/generic/ScriptInvocationManager.h @@ -113,8 +113,8 @@ class CScriptInvocationManager private: CScriptInvocationManager(); - CScriptInvocationManager(const CScriptInvocationManager&); - CScriptInvocationManager const& operator=(CScriptInvocationManager const&); + CScriptInvocationManager(const CScriptInvocationManager&) = delete; + CScriptInvocationManager const& operator=(CScriptInvocationManager const&) = delete; virtual ~CScriptInvocationManager(); typedef struct { @@ -132,4 +132,4 @@ class CScriptInvocationManager std::map m_scriptPaths; int m_nextId; CCriticalSection m_critSection; -}; \ No newline at end of file +}; diff --git a/xbmc/interfaces/legacy/AddonClass.h b/xbmc/interfaces/legacy/AddonClass.h index 9a58ba3c01047..885366f8372f7 100644 --- a/xbmc/interfaces/legacy/AddonClass.h +++ b/xbmc/interfaces/legacy/AddonClass.h @@ -72,7 +72,7 @@ namespace XBMCAddon bool m_isDeallocating; // no copying - inline AddonClass(const AddonClass&); + inline AddonClass(const AddonClass&) = delete; #ifdef XBMC_ADDON_DEBUG_MEMORY bool isDeleted; diff --git a/xbmc/network/ZeroconfBrowser.h b/xbmc/network/ZeroconfBrowser.h index dbbb54eea0550..99613f624f0bf 100644 --- a/xbmc/network/ZeroconfBrowser.h +++ b/xbmc/network/ZeroconfBrowser.h @@ -143,7 +143,8 @@ class CZeroconfBrowser protected: //singleton: we don't want to get instantiated nor copied or deleted from outside CZeroconfBrowser(); - CZeroconfBrowser(const CZeroconfBrowser&); + CZeroconfBrowser(const CZeroconfBrowser&) = delete; + CZeroconfBrowser& operator=(const CZeroconfBrowser&) = delete; virtual ~CZeroconfBrowser(); // pure virtual methods to implement for OS specific implementations diff --git a/xbmc/network/upnp/UPnPSettings.h b/xbmc/network/upnp/UPnPSettings.h index 4657fd14d7f7a..098008b3a37a3 100644 --- a/xbmc/network/upnp/UPnPSettings.h +++ b/xbmc/network/upnp/UPnPSettings.h @@ -48,8 +48,8 @@ class CUPnPSettings : public ISettingsHandler protected: CUPnPSettings(); - CUPnPSettings(const CUPnPSettings&); - CUPnPSettings const& operator=(CUPnPSettings const&); + CUPnPSettings(const CUPnPSettings&) = delete; + CUPnPSettings& operator=(CUPnPSettings const&) = delete; ~CUPnPSettings() override; private: diff --git a/xbmc/platform/darwin/osx/XBMCHelper.h b/xbmc/platform/darwin/osx/XBMCHelper.h index 857d35f81b9bf..62ec7a45f335b 100644 --- a/xbmc/platform/darwin/osx/XBMCHelper.h +++ b/xbmc/platform/darwin/osx/XBMCHelper.h @@ -53,8 +53,8 @@ class XBMCHelper : public ISettingCallback private: XBMCHelper(); - XBMCHelper(XBMCHelper const& ); - XBMCHelper& operator=(XBMCHelper const&); + XBMCHelper(XBMCHelper const& ) = delete; + XBMCHelper& operator=(XBMCHelper const&) = delete; void HandleLaunchAgent(); void Install(); diff --git a/xbmc/profiles/ProfilesManager.h b/xbmc/profiles/ProfilesManager.h index 3bd58148d20b5..0c3ff2b629fce 100644 --- a/xbmc/profiles/ProfilesManager.h +++ b/xbmc/profiles/ProfilesManager.h @@ -179,8 +179,8 @@ class CProfilesManager : public ISettingsHandler protected: CProfilesManager(); - CProfilesManager(const CProfilesManager&); - CProfilesManager const& operator=(CProfilesManager const&); + CProfilesManager(const CProfilesManager&) = delete; + CProfilesManager& operator=(CProfilesManager const&) = delete; ~CProfilesManager() override; private: diff --git a/xbmc/pvr/channels/PVRChannelGroupsContainer.h b/xbmc/pvr/channels/PVRChannelGroupsContainer.h index 9a6e2a8cb9e27..a84772f6ccd2b 100644 --- a/xbmc/pvr/channels/PVRChannelGroupsContainer.h +++ b/xbmc/pvr/channels/PVRChannelGroupsContainer.h @@ -207,8 +207,8 @@ namespace PVR CPVRChannelGroupPtr m_lastPlayedGroups[2]; /*!< used to store the last played groups */ private : - CPVRChannelGroupsContainer& operator=(const CPVRChannelGroupsContainer&); - CPVRChannelGroupsContainer(const CPVRChannelGroupsContainer&); + CPVRChannelGroupsContainer& operator=(const CPVRChannelGroupsContainer&) = delete; + CPVRChannelGroupsContainer(const CPVRChannelGroupsContainer&) = delete; bool FilterDirectory(const CURL &url, CFileItemList &results) const; diff --git a/xbmc/settings/DisplaySettings.h b/xbmc/settings/DisplaySettings.h index 0086b505037b6..93a708f11491d 100644 --- a/xbmc/settings/DisplaySettings.h +++ b/xbmc/settings/DisplaySettings.h @@ -106,8 +106,8 @@ class CDisplaySettings : public ISettingCallback, public ISubSettings, protected: CDisplaySettings(); - CDisplaySettings(const CDisplaySettings&); - CDisplaySettings& operator=(CDisplaySettings const&); + CDisplaySettings(const CDisplaySettings&) = delete; + CDisplaySettings& operator=(CDisplaySettings const&) = delete; ~CDisplaySettings() override; DisplayMode GetCurrentDisplayMode() const; diff --git a/xbmc/settings/MediaSettings.h b/xbmc/settings/MediaSettings.h index faad0cce4f7b7..5813b27774cbe 100644 --- a/xbmc/settings/MediaSettings.h +++ b/xbmc/settings/MediaSettings.h @@ -105,8 +105,8 @@ class CMediaSettings : public ISettingCallback, public ISettingsHandler, public protected: CMediaSettings(); - CMediaSettings(const CMediaSettings&); - CMediaSettings& operator=(CMediaSettings const&); + CMediaSettings(const CMediaSettings&) = delete; + CMediaSettings& operator=(CMediaSettings const&) = delete; ~CMediaSettings() override; static std::string GetWatchedContent(const std::string &content); diff --git a/xbmc/settings/MediaSourceSettings.h b/xbmc/settings/MediaSourceSettings.h index 9f0250dbc21c2..82a09b01d5880 100644 --- a/xbmc/settings/MediaSourceSettings.h +++ b/xbmc/settings/MediaSourceSettings.h @@ -53,8 +53,8 @@ class CMediaSourceSettings : public ISettingsHandler protected: CMediaSourceSettings(); - CMediaSourceSettings(const CMediaSourceSettings&); - CMediaSourceSettings& operator=(CMediaSourceSettings const&); + CMediaSourceSettings(const CMediaSourceSettings&) = delete; + CMediaSourceSettings& operator=(CMediaSourceSettings const&) = delete; ~CMediaSourceSettings() override; private: diff --git a/xbmc/settings/SkinSettings.h b/xbmc/settings/SkinSettings.h index e6de5ad0401c5..134c59d79b281 100644 --- a/xbmc/settings/SkinSettings.h +++ b/xbmc/settings/SkinSettings.h @@ -52,11 +52,11 @@ class CSkinSettings : public ISubSettings protected: CSkinSettings(); - CSkinSettings(const CSkinSettings&); - CSkinSettings& operator=(CSkinSettings const&); + CSkinSettings(const CSkinSettings&) = delete; + CSkinSettings& operator=(CSkinSettings const&) = delete; ~CSkinSettings() override; private: CCriticalSection m_critical; std::set m_settings; -}; \ No newline at end of file +}; diff --git a/xbmc/test/TestUtils.h b/xbmc/test/TestUtils.h index 1ad1ffeb00bfc..e429b997bb58e 100644 --- a/xbmc/test/TestUtils.h +++ b/xbmc/test/TestUtils.h @@ -92,8 +92,8 @@ class CXBMCTestUtils std::string getNewLineCharacters() const; private: CXBMCTestUtils(); - CXBMCTestUtils(CXBMCTestUtils const&); - void operator=(CXBMCTestUtils const&); + CXBMCTestUtils(CXBMCTestUtils const&) = delete; + CXBMCTestUtils& operator=(CXBMCTestUtils const&) = delete; std::vector TestFileFactoryReadUrls; std::vector TestFileFactoryWriteUrls; diff --git a/xbmc/utils/CryptThreading.h b/xbmc/utils/CryptThreading.h index 32a4c0743bce8..f76d2070f9a3b 100644 --- a/xbmc/utils/CryptThreading.h +++ b/xbmc/utils/CryptThreading.h @@ -36,8 +36,8 @@ class CryptThreadingInitializer CCriticalSection* get_lock(int index); private: - CryptThreadingInitializer(const CryptThreadingInitializer &rhs); - CryptThreadingInitializer& operator=(const CryptThreadingInitializer&); + CryptThreadingInitializer(const CryptThreadingInitializer &rhs) = delete; + CryptThreadingInitializer& operator=(const CryptThreadingInitializer&) = delete; }; XBMC_GLOBAL_REF(CryptThreadingInitializer,g_cryptThreadingInitializer); diff --git a/xbmc/utils/JobManager.h b/xbmc/utils/JobManager.h index 9d50136582d3d..8816473e40cfd 100644 --- a/xbmc/utils/JobManager.h +++ b/xbmc/utils/JobManager.h @@ -331,8 +331,8 @@ class CJobManager private: // private construction, and no assignments; use the provided singleton methods CJobManager(); - CJobManager(const CJobManager&); - CJobManager const& operator=(CJobManager const&); + CJobManager(const CJobManager&) = delete; + CJobManager const& operator=(CJobManager const&) = delete; virtual ~CJobManager(); /*! \brief Pop a job off the job queue and add to the processing queue ready to process diff --git a/xbmc/utils/RssManager.h b/xbmc/utils/RssManager.h index 082347c1082a5..ee52afe785ac5 100644 --- a/xbmc/utils/RssManager.h +++ b/xbmc/utils/RssManager.h @@ -64,8 +64,8 @@ class CRssManager : public ISettingCallback, public ISettingsHandler ~CRssManager() override; private: - CRssManager(const CRssManager&); - CRssManager& operator=(const CRssManager&); + CRssManager(const CRssManager&) = delete; + CRssManager& operator=(const CRssManager&) = delete; struct READERCONTROL { int controlID; diff --git a/xbmc/utils/SeekHandler.h b/xbmc/utils/SeekHandler.h index 8be676551bd18..37becc09f599f 100644 --- a/xbmc/utils/SeekHandler.h +++ b/xbmc/utils/SeekHandler.h @@ -59,8 +59,8 @@ class CSeekHandler : public ISettingCallback, public IActionListener protected: CSeekHandler(); - CSeekHandler(const CSeekHandler&); - CSeekHandler& operator=(CSeekHandler const&); + CSeekHandler(const CSeekHandler&) = delete; + CSeekHandler& operator=(CSeekHandler const&) = delete; ~CSeekHandler() override; bool SeekTimeCode(const CAction &action); void ChangeTimeCode(int remote); diff --git a/xbmc/utils/Splash.h b/xbmc/utils/Splash.h index 3563da47c8623..c45b7bb9f4d0f 100644 --- a/xbmc/utils/Splash.h +++ b/xbmc/utils/Splash.h @@ -35,8 +35,8 @@ class CSplash protected: CSplash(); - CSplash(const CSplash&); - CSplash& operator=(CSplash const&); + CSplash(const CSplash&) = delete; + CSplash& operator=(CSplash const&) = delete; virtual ~CSplash() = default; private: diff --git a/xbmc/utils/auto_buffer.h b/xbmc/utils/auto_buffer.h index 43c9be86ecf3b..83b5f84de78cc 100644 --- a/xbmc/utils/auto_buffer.h +++ b/xbmc/utils/auto_buffer.h @@ -96,8 +96,8 @@ namespace XUTILS void* detach(void); private: - auto_buffer(const auto_buffer& other); // disallow copy constructor - auto_buffer& operator=(const auto_buffer& other); // disallow assignment + auto_buffer(const auto_buffer& other) = delete; // disallow copy constructor + auto_buffer& operator=(const auto_buffer& other) = delete; // disallow assignment void* p; size_t s; diff --git a/xbmc/video/PlayerController.h b/xbmc/video/PlayerController.h index 002abf20b0e66..dbb023efc1339 100644 --- a/xbmc/video/PlayerController.h +++ b/xbmc/video/PlayerController.h @@ -48,8 +48,8 @@ class CPlayerController : public ISliderCallback, public IActionListener protected: CPlayerController(); - CPlayerController(const CPlayerController&); - CPlayerController& operator=(CPlayerController const&); + CPlayerController(const CPlayerController&) = delete; + CPlayerController& operator=(CPlayerController const&) = delete; ~CPlayerController() override; private: diff --git a/xbmc/video/VideoLibraryQueue.h b/xbmc/video/VideoLibraryQueue.h index b72393aae48c7..cbb9858807fbe 100644 --- a/xbmc/video/VideoLibraryQueue.h +++ b/xbmc/video/VideoLibraryQueue.h @@ -146,8 +146,8 @@ class CVideoLibraryQueue : protected CJobQueue private: CVideoLibraryQueue(); - CVideoLibraryQueue(const CVideoLibraryQueue&); - CVideoLibraryQueue const& operator=(CVideoLibraryQueue const&); + CVideoLibraryQueue(const CVideoLibraryQueue&) = delete; + CVideoLibraryQueue const& operator=(CVideoLibraryQueue const&) = delete; typedef std::set VideoLibraryJobs; typedef std::map VideoLibraryJobMap; diff --git a/xbmc/view/ViewStateSettings.h b/xbmc/view/ViewStateSettings.h index a9443db6a7bfe..b79dfee0f5955 100644 --- a/xbmc/view/ViewStateSettings.h +++ b/xbmc/view/ViewStateSettings.h @@ -58,8 +58,8 @@ class CViewStateSettings : public ISubSettings protected: CViewStateSettings(); - CViewStateSettings(const CViewStateSettings&); - CViewStateSettings const& operator=(CViewStateSettings const&); + CViewStateSettings(const CViewStateSettings&) = delete; + CViewStateSettings& operator=(CViewStateSettings const&) = delete; ~CViewStateSettings() override; private: From 5ffd8e92b6564391c7c05b56ee7f32b70658b0ef Mon Sep 17 00:00:00 2001 From: DaveTBlake Date: Wed, 30 Aug 2017 15:56:19 +0100 Subject: [PATCH 004/113] Fix GetGenresByArtist to return the song genres for an artist derived via album as a priority to those via song artist --- xbmc/music/MusicDatabase.cpp | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp index feb55aeaf13f5..62e09be0b8cdb 100644 --- a/xbmc/music/MusicDatabase.cpp +++ b/xbmc/music/MusicDatabase.cpp @@ -1782,17 +1782,34 @@ bool CMusicDatabase::GetGenresByArtist(int idArtist, CFileItem* item) { try { - std::string strSQL = PrepareSQL("SELECT DISTINCT song_genre.idGenre, genre.strGenre FROM " - "song_artist JOIN song ON song_artist.idSong = song.idSong JOIN " - "song_genre ON song.idSong = song_genre.idSong JOIN " - "genre ON song_genre.idGenre = genre.idGenre " - "WHERE song_artist.idArtist = %i ORDER BY song_genre.idGenre", idArtist); + std::string strSQL; + strSQL = PrepareSQL("SELECT DISTINCT song_genre.idGenre, genre.strGenre FROM " + "album_artist JOIN song ON album_artist.idAlbum = song.idAlbum " + "JOIN song_genre ON song.idSong = song_genre.idSong " + "JOIN genre ON song_genre.idGenre = genre.idGenre " + "WHERE album_artist.idArtist = %i " + "ORDER BY song_genre.idGenre", idArtist); if (!m_pDS->query(strSQL)) return false; if (m_pDS->num_rows() == 0) { + // Artist does have any song genres via albums may not be an album artist. + // Check via songs artist to fetch song genres from compilations or where they are guest artist m_pDS->close(); - return true; + strSQL = PrepareSQL("SELECT DISTINCT song_genre.idGenre, genre.strGenre FROM " + "song_artist JOIN song ON song_artist.idSong = song.idSong JOIN " + "song_genre ON song.idSong = song_genre.idSong " + "JOIN genre ON song_genre.idGenre = genre.idGenre " + "WHERE song_artist.idArtist = %i " + "ORDER BY song_genre.idGenre", idArtist); + if (!m_pDS->query(strSQL)) + return false; + if (m_pDS->num_rows() == 0) + { + //No song genres, but query sucessfull + m_pDS->close(); + return true; + } } CVariant artistSongGenres(CVariant::VariantTypeArray); From 83f1f8d2c6723d2296260626eb0dcbc9a5c094e7 Mon Sep 17 00:00:00 2001 From: peak3d Date: Fri, 1 Sep 2017 16:58:21 +0200 Subject: [PATCH 005/113] Support for passing MimeType for PVR streams --- xbmc/addons/PVRClient.cpp | 18 +++++++++++++++--- .../kodi-addon-dev-kit/include/kodi/versions.h | 2 +- .../include/kodi/xbmc_pvr_types.h | 1 + 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/xbmc/addons/PVRClient.cpp b/xbmc/addons/PVRClient.cpp index 28bf1ce8e8b36..1010fa0210e9f 100644 --- a/xbmc/addons/PVRClient.cpp +++ b/xbmc/addons/PVRClient.cpp @@ -825,7 +825,11 @@ bool CPVRClient::FillEpgTagStreamFileItem(CFileItem &fileItem) { if (strncmp(properties[i].strName, PVR_STREAM_PROPERTY_STREAMURL, strlen(PVR_STREAM_PROPERTY_STREAMURL)) == 0) fileItem.SetDynPath(properties[i].strValue); - + else if (strncmp(properties[i].strName, PVR_STREAM_PROPERTY_MIMETYPE, strlen(PVR_STREAM_PROPERTY_MIMETYPE)) == 0) + { + fileItem.SetMimeType(properties[i].strValue); + fileItem.SetContentLookup(false); + } fileItem.SetProperty(properties[i].strName, properties[i].strValue); } @@ -1299,7 +1303,11 @@ bool CPVRClient::FillChannelStreamFileItem(CFileItem &fileItem) { if (strncmp(properties[i].strName, PVR_STREAM_PROPERTY_STREAMURL, strlen(PVR_STREAM_PROPERTY_STREAMURL)) == 0) fileItem.SetDynPath(properties[i].strValue); - + else if (strncmp(properties[i].strName, PVR_STREAM_PROPERTY_MIMETYPE, strlen(PVR_STREAM_PROPERTY_MIMETYPE)) == 0) + { + fileItem.SetMimeType(properties[i].strValue); + fileItem.SetContentLookup(false); + } fileItem.SetProperty(properties[i].strName, properties[i].strValue); } return true; @@ -1328,7 +1336,11 @@ bool CPVRClient::FillRecordingStreamFileItem(CFileItem &fileItem) { if (strncmp(properties[i].strName, PVR_STREAM_PROPERTY_STREAMURL, strlen(PVR_STREAM_PROPERTY_STREAMURL)) == 0) fileItem.SetDynPath(properties[i].strValue); - + else if (strncmp(properties[i].strName, PVR_STREAM_PROPERTY_MIMETYPE, strlen(PVR_STREAM_PROPERTY_MIMETYPE)) == 0) + { + fileItem.SetMimeType(properties[i].strValue); + fileItem.SetContentLookup(false); + } fileItem.SetProperty(properties[i].strName, properties[i].strValue); } return true; diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h index 32e6b1afada41..1f37a96d3e747 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h @@ -114,7 +114,7 @@ #define ADDON_INSTANCE_VERSION_PERIPHERAL_DEPENDS "addon-instance/Peripheral.h" \ "addon-instance/PeripheralUtils.h" -#define ADDON_INSTANCE_VERSION_PVR "5.7.0" +#define ADDON_INSTANCE_VERSION_PVR "5.7.1" #define ADDON_INSTANCE_VERSION_PVR_MIN "5.7.0" #define ADDON_INSTANCE_VERSION_PVR_XML_ID "kodi.binary.instance.pvr" #define ADDON_INSTANCE_VERSION_PVR_DEPENDS "xbmc_pvr_dll.h" \ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h index a7d21ed7cc43a..7e6079ccf6a45 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h @@ -81,6 +81,7 @@ struct DemuxPacket; #define PVR_STREAM_MAX_PROPERTIES 20 #define PVR_STREAM_PROPERTY_STREAMURL "streamurl" /*!< @brief the URL of the stream that should be played. */ #define PVR_STREAM_PROPERTY_INPUTSTREAMADDON "inputstreamaddon" /*!< @brief the name of the inputstream add-on that should be used by Kodi to play the stream denoted by PVR_STREAM_PROPERTY_STREAMURL. Leave blank to use Kodi's built-in playing capabilities. */ +#define PVR_STREAM_PROPERTY_MIMETYPE "mimetype" /*!< @brief the Mime-Type of the stream that should be played. */ /* using the default avformat's MAX_STREAMS value to be safe */ #define PVR_STREAM_MAX_STREAMS 20 From 89393ba9e49c1b6e4805374778416053383cb32e Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Sat, 2 Sep 2017 16:35:03 +0200 Subject: [PATCH 006/113] [PVR] Change context menu items for 'in progress' recordings. --- xbmc/pvr/PVRContextMenus.cpp | 10 ++++++++-- xbmc/pvr/recordings/PVRRecording.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/xbmc/pvr/PVRContextMenus.cpp b/xbmc/pvr/PVRContextMenus.cpp index 65a93bd069724..cb73dce8b39f7 100644 --- a/xbmc/pvr/PVRContextMenus.cpp +++ b/xbmc/pvr/PVRContextMenus.cpp @@ -236,6 +236,10 @@ namespace PVR bool StopRecording::IsVisible(const CFileItem &item) const { + const CPVRRecordingPtr recording(item.GetPVRRecordingInfoTag()); + if (recording && recording->IsInProgress()) + return true; + const CPVRChannelPtr channel(item.GetPVRChannelInfoTag()); if (channel) return channel->IsRecording(); @@ -258,7 +262,7 @@ namespace PVR bool EditRecording::IsVisible(const CFileItem &item) const { const CPVRRecordingPtr recording(item.GetPVRRecordingInfoTag()); - if (recording && !recording->IsDeleted()) + if (recording && !recording->IsDeleted() && !recording->IsInProgress()) return true; return false; @@ -277,6 +281,7 @@ namespace PVR const CPVRRecordingPtr recording(item.GetPVRRecordingInfoTag()); if (recording && !recording->IsDeleted() && + !recording->IsInProgress() && CServiceBroker::GetPVRManager().Clients()->GetClientCapabilities(recording->ClientID()).SupportsRecordingsRename()) return true; @@ -302,7 +307,8 @@ namespace PVR bool DeleteRecording::IsVisible(const CFileItem &item) const { - if (item.GetPVRRecordingInfoTag()) + const CPVRRecordingPtr recording(item.GetPVRRecordingInfoTag()); + if (recording && !recording->IsInProgress()) return true; // recordings folder? diff --git a/xbmc/pvr/recordings/PVRRecording.h b/xbmc/pvr/recordings/PVRRecording.h index 53990e944a26b..e852fd350fdf9 100644 --- a/xbmc/pvr/recordings/PVRRecording.h +++ b/xbmc/pvr/recordings/PVRRecording.h @@ -287,7 +287,7 @@ namespace PVR std::string EpisodeName(void) const { return m_strShowTitle; } /*! - * @brief check whether this recording is currently in progress (according to its start time and duration) + * @brief check whether this recording is currently in progress * @return true if the recording is in progress, false otherwise */ bool IsInProgress() const; From 63562c57345f06e2ebe2e1da0225c8b4c5b316ba Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Sat, 2 Sep 2017 21:28:23 +0200 Subject: [PATCH 007/113] [PVR] Implement CPVRGUIActions::StopRecording for recording items. --- xbmc/pvr/PVRGUIActions.cpp | 9 ++++++++- xbmc/pvr/timers/PVRTimers.cpp | 9 +++++++-- xbmc/pvr/timers/PVRTimers.h | 7 +++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/xbmc/pvr/PVRGUIActions.cpp b/xbmc/pvr/PVRGUIActions.cpp index 20aef53f7c695..52f72acab522d 100644 --- a/xbmc/pvr/PVRGUIActions.cpp +++ b/xbmc/pvr/PVRGUIActions.cpp @@ -714,7 +714,14 @@ namespace PVR bool CPVRGUIActions::DeleteTimer(const CFileItemPtr &item, bool bIsRecording, bool bDeleteRule) const { - CPVRTimerInfoTagPtr timer(CPVRItem(item).GetTimerInfoTag()); + CPVRTimerInfoTagPtr timer; + const CPVRRecordingPtr recording(CPVRItem(item).GetRecording()); + if (recording) + timer = CServiceBroker::GetPVRManager().Timers()->GetRecordingTimerForRecording(*recording); + + if (!timer) + timer = CPVRItem(item).GetTimerInfoTag(); + if (!timer) { CLog::Log(LOGERROR, "CPVRGUIActions - %s - no timer!", __FUNCTION__); diff --git a/xbmc/pvr/timers/PVRTimers.cpp b/xbmc/pvr/timers/PVRTimers.cpp index c45b792a06eb9..a5b10d29ee184 100644 --- a/xbmc/pvr/timers/PVRTimers.cpp +++ b/xbmc/pvr/timers/PVRTimers.cpp @@ -804,6 +804,11 @@ CPVRTimerInfoTagPtr CPVRTimers::GetTimerForEpgTag(const CPVREpgInfoTagPtr &epgTa } bool CPVRTimers::HasRecordingTimerForRecording(const CPVRRecording &recording) const +{ + return GetRecordingTimerForRecording(recording) != nullptr; +} + +CPVRTimerInfoTagPtr CPVRTimers::GetRecordingTimerForRecording(const CPVRRecording &recording) const { CSingleLock lock(m_critSection); @@ -818,12 +823,12 @@ bool CPVRTimers::HasRecordingTimerForRecording(const CPVRRecording &recording) c timersEntry->StartAsUTC() <= recording.RecordingTimeAsUTC() && timersEntry->EndAsUTC() >= recording.EndTimeAsUTC()) { - return true; + return timersEntry; } } } - return false; + return CPVRTimerInfoTagPtr(); } CPVRTimerInfoTagPtr CPVRTimers::GetTimerRule(const CPVRTimerInfoTagPtr &timer) const diff --git a/xbmc/pvr/timers/PVRTimers.h b/xbmc/pvr/timers/PVRTimers.h index e9fe5be34994e..124b75d6747dd 100644 --- a/xbmc/pvr/timers/PVRTimers.h +++ b/xbmc/pvr/timers/PVRTimers.h @@ -250,6 +250,13 @@ namespace PVR */ bool HasRecordingTimerForRecording(const CPVRRecording &recording) const; + /*! + * @brief Get the timer currently recording the given recording, if any. + * @param recording The recording to check. + * @return The requested timer tag, or an null if none was found. + */ + CPVRTimerInfoTagPtr GetRecordingTimerForRecording(const CPVRRecording &recording) const; + /*! * Get the timer rule for a given timer tag * @param timer The timer to query the timer rule for From 28d160945240e4cb20c10e69059b3608f0749180 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Fri, 1 Sep 2017 10:45:28 +0200 Subject: [PATCH 008/113] VideoPlayer: vdpau - fix black screen after reset --- .../VideoPlayer/DVDCodecs/Video/VDPAU.cpp | 49 +++++++++++++------ .../cores/VideoPlayer/DVDCodecs/Video/VDPAU.h | 3 +- .../HwDecRender/RendererVDPAU.cpp | 4 +- .../VideoRenderers/HwDecRender/VdpauGL.cpp | 8 +-- .../VideoRenderers/HwDecRender/VdpauGL.h | 6 +-- 5 files changed, 44 insertions(+), 26 deletions(-) diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp index d2b4a8fdced4d..3509e4be3bbfe 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp @@ -491,6 +491,7 @@ CDecoder::CDecoder(CProcessInfo& processInfo) : m_DisplayState = VDPAU_OPEN; m_vdpauConfig.context = 0; m_vdpauConfig.processInfo = &m_processInfo; + m_vdpauConfig.resetCounter = 0; } bool CDecoder::Open(AVCodecContext* avctx, AVCodecContext* mainctx, const enum AVPixelFormat fmt) @@ -934,6 +935,7 @@ bool CDecoder::ConfigVDPAU(AVCodecContext* avctx, int ref_frames) m_inMsgEvent.Reset(); m_vdpauConfigured = true; m_ErrorCount = 0; + m_vdpauConfig.resetCounter++; return true; } @@ -1308,6 +1310,7 @@ class VDPAU::CVdpauBufferPool : public IVideoBufferPool bool HasFree(); void QueueReturnPicture(CVdpauRenderPicture *pic); CVdpauRenderPicture* ProcessSyncPicture(); + void InvalidateUsed(); unsigned short numOutputSurfaces; std::vector outputSurfaces; @@ -1439,6 +1442,16 @@ CVdpauRenderPicture* CVdpauBufferPool::ProcessSyncPicture() return retPic; } +void CVdpauBufferPool::InvalidateUsed() +{ + std::deque::iterator it; + for (it = usedRenderPics.begin(); it != usedRenderPics.end(); ++it) + { + allRenderPics[*it]->procPic.outputSurface = VDP_INVALID_HANDLE; + allRenderPics[*it]->procPic.videoSurface = VDP_INVALID_HANDLE; + } +} + //----------------------------------------------------------------------------- // Mixer //----------------------------------------------------------------------------- @@ -2911,7 +2924,6 @@ void COutput::StateMachine(int signal, Protocol *port, Message *msg) switch (signal) { case COutputControlProtocol::TIMEOUT: - m_bufferPool->ProcessSyncPicture(); m_extTimeout = 100; if (HasWork()) { @@ -3073,12 +3085,14 @@ void COutput::Flush() } Message *msg; - while (m_mixer.m_dataPort.ReceiveInMessage(&msg)) + + while (m_dataPort.ReceiveInMessage(&msg)) { - if (msg->signal == CMixerDataProtocol::PICTURE) + if (msg->signal == COutputDataProtocol::PICTURE) { - CVdpauProcessedPicture pic = *reinterpret_cast(msg->data); - m_bufferPool->processedPics.push(pic); + CVdpauRenderPicture *pic; + pic = *((CVdpauRenderPicture**)msg->data); + pic->Release(); } msg->Release(); } @@ -3099,13 +3113,12 @@ void COutput::Flush() msg->Release(); } - while (m_dataPort.ReceiveInMessage(&msg)) + while (m_mixer.m_dataPort.ReceiveInMessage(&msg)) { - if (msg->signal == COutputDataProtocol::PICTURE) + if (msg->signal == CMixerDataProtocol::PICTURE) { - CVdpauRenderPicture *pic; - pic = *((CVdpauRenderPicture**)msg->data); - QueueReturnPicture(pic); + CVdpauProcessedPicture pic = *reinterpret_cast(msg->data); + m_bufferPool->processedPics.push(pic); } msg->Release(); } @@ -3156,7 +3169,7 @@ CVdpauRenderPicture* COutput::ProcessMixerPicture() retPic->procPic = procPic; retPic->device = reinterpret_cast(m_config.context->GetDevice()); retPic->procFunc = reinterpret_cast(m_config.context->GetProcs().vdp_get_proc_address); - retPic->decoder = m_config.vdpau; + retPic->ident = m_config.vdpau + m_config.resetCounter; retPic->DVDPic.SetParams(procPic.DVDPic); if (!procPic.isYuv) @@ -3197,9 +3210,10 @@ void COutput::ProcessSyncPicture() pic = m_bufferPool->ProcessSyncPicture(); - if (pic) + while (pic != nullptr) { ProcessReturnPicture(pic); + pic = m_bufferPool->ProcessSyncPicture(); } } @@ -3211,13 +3225,15 @@ void COutput::ProcessReturnPicture(CVdpauRenderPicture *pic) { if (pic->procPic.isYuv) { - VdpVideoSurface surf = it->videoSurface; - m_config.videoSurfaces->ClearRender(surf); + VdpVideoSurface surf = pic->procPic.videoSurface; + if (surf != VDP_INVALID_HANDLE) + m_config.videoSurfaces->ClearRender(surf); } else { - VdpOutputSurface outSurf = it->outputSurface; - m_mixer.m_dataPort.SendOutMessage(CMixerDataProtocol::BUFFER, &outSurf, sizeof(outSurf)); + VdpOutputSurface outSurf = pic->procPic.outputSurface; + if (outSurf != VDP_INVALID_HANDLE) + m_mixer.m_dataPort.SendOutMessage(CMixerDataProtocol::BUFFER, &outSurf, sizeof(outSurf)); } m_bufferPool->processedPicsAway.erase(it); break; @@ -3255,6 +3271,7 @@ void COutput::ReleaseBufferPool() VdpStatus vdp_st; // release all output surfaces + m_bufferPool->InvalidateUsed(); for (unsigned int i = 0; i < m_bufferPool->outputSurfaces.size(); ++i) { if (m_bufferPool->outputSurfaces[i] == VDP_INVALID_HANDLE) diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.h index a91b7c73d06ac..732f4234eafaa 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.h +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.h @@ -174,6 +174,7 @@ struct CVdpauConfig bool useInteropYuv; CVDPAUContext *context; CProcessInfo *processInfo; + int resetCounter; }; /** @@ -239,7 +240,7 @@ class CVdpauRenderPicture : public CVideoBuffer CRect crop; void *device; void *procFunc; - void *decoder; + void *ident; }; //----------------------------------------------------------------------------- diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVDPAU.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVDPAU.cpp index c65c5af09e5e6..0ad6b5cd6e41e 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVDPAU.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVDPAU.cpp @@ -64,7 +64,7 @@ bool CRendererVDPAU::Configure(const VideoPicture &picture, float fps, unsigned else m_isYuv = false; - if (!m_interopState.Init(pic->device, pic->procFunc, pic->decoder)) + if (!m_interopState.Init(pic->device, pic->procFunc, pic->ident)) return false; for (auto &tex : m_vdpauTextures) @@ -85,7 +85,7 @@ bool CRendererVDPAU::ConfigChanged(const VideoPicture &picture) if (pic->procPic.isYuv && !m_isYuv) return true; - if (m_interopState.NeedInit(pic->device, pic->procFunc, pic->decoder)) + if (m_interopState.NeedInit(pic->device, pic->procFunc, pic->ident)) return true; return false; diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VdpauGL.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VdpauGL.cpp index fa8ee7895d1d5..1e5a61561b3e8 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VdpauGL.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VdpauGL.cpp @@ -29,11 +29,11 @@ using namespace VDPAU; // interop state //----------------------------------------------------------------------------- -bool CInteropState::Init(void *device, void *procFunc, void *decoder) +bool CInteropState::Init(void *device, void *procFunc, void *ident) { m_device = device; m_procFunc = procFunc; - m_decoder = decoder; + m_ident = ident; m_interop.glVDPAUInitNV = (PFNGLVDPAUINITNVPROC)glXGetProcAddress((GLubyte *) "glVDPAUInitNV"); m_interop.glVDPAUFiniNV = (PFNGLVDPAUFININVPROC)glXGetProcAddress((GLubyte *) "glVDPAUFiniNV"); @@ -72,13 +72,13 @@ InteropInfo &CInteropState::GetInterop() return m_interop; } -bool CInteropState::NeedInit(void *device, void *procFunc, void *decoder) +bool CInteropState::NeedInit(void *device, void *procFunc, void *ident) { if (m_device != device) return true; if (m_procFunc != procFunc) return true; - if (m_decoder != decoder) + if (m_ident != ident) return true; return false; diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VdpauGL.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VdpauGL.h index 06f28fc26b702..b47fe7cb840ac 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VdpauGL.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VdpauGL.h @@ -46,15 +46,15 @@ struct InteropInfo class CInteropState { public: - bool Init(void *device, void *procFunc, void *decoder); + bool Init(void *device, void *procFunc, void *ident); void Finish(); InteropInfo &GetInterop(); - bool NeedInit(void *device, void *procFunc, void *decoder); + bool NeedInit(void *device, void *procFunc, void *ident); protected: void *m_device = nullptr; void *m_procFunc = nullptr; - void *m_decoder = nullptr; + void *m_ident = nullptr; InteropInfo m_interop; }; From 5f4599b8ad3c3b9ee801d2083ba902c08dc06d44 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Sun, 3 Sep 2017 17:23:59 +0200 Subject: [PATCH 009/113] [PVR] Fix title missing in recordings OSD. --- xbmc/pvr/PVRGUIInfo.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xbmc/pvr/PVRGUIInfo.cpp b/xbmc/pvr/PVRGUIInfo.cpp index 50d4e5390ee38..7dcba19dd51af 100644 --- a/xbmc/pvr/PVRGUIInfo.cpp +++ b/xbmc/pvr/PVRGUIInfo.cpp @@ -589,6 +589,9 @@ bool CPVRGUIInfo::GetVideoLabel(const CFileItem &item, int iLabel, std::string & // 'Now playing' infos case VIDEOPLAYER_TITLE: { + if (recording) + return false; // CPVRRecording is derived from CVideoInfoTag. Base class properties will be handled by CGUIInfoManager. + GET_CURRENT_VIDEO_LABEL_OR_DEFAULT(epgTag->Title(), CServiceBroker::GetSettings().GetBool(CSettings::SETTING_EPG_HIDENOINFOAVAILABLE) ? "" From bf38b6a6626c8bc8da9a0e3a5e1b27f8ad9a75e5 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Sun, 3 Sep 2017 17:45:01 +0200 Subject: [PATCH 010/113] [PVR] Refactored CPVRGUIInfo::GetVideoLabel. No functional changes (sorry for the almost unreadable diff ;-) --- xbmc/pvr/PVRGUIInfo.cpp | 400 +++++++++++++++++++++------------------- 1 file changed, 213 insertions(+), 187 deletions(-) diff --git a/xbmc/pvr/PVRGUIInfo.cpp b/xbmc/pvr/PVRGUIInfo.cpp index 7dcba19dd51af..f2e67c54287f7 100644 --- a/xbmc/pvr/PVRGUIInfo.cpp +++ b/xbmc/pvr/PVRGUIInfo.cpp @@ -577,227 +577,253 @@ int CPVRGUIInfo::TranslateIntInfo(DWORD dwInfo) const bool CPVRGUIInfo::GetVideoLabel(const CFileItem &item, int iLabel, std::string &strValue) const { - CPVRChannelPtr channel(item.GetPVRChannelInfoTag()); - CPVREpgInfoTagPtr epgTag(item.GetEPGInfoTag()); - CPVRRecordingPtr recording(item.GetPVRRecordingInfoTag()); - - if (!channel && !epgTag && !recording) - return false; - - switch (iLabel) + const CPVRRecordingPtr recording(item.GetPVRRecordingInfoTag()); + if (recording) { - // 'Now playing' infos - case VIDEOPLAYER_TITLE: - { - if (recording) - return false; // CPVRRecording is derived from CVideoInfoTag. Base class properties will be handled by CGUIInfoManager. - - GET_CURRENT_VIDEO_LABEL_OR_DEFAULT(epgTag->Title(), - CServiceBroker::GetSettings().GetBool(CSettings::SETTING_EPG_HIDENOINFOAVAILABLE) - ? "" - : g_localizeStrings.Get(19055)); // no information available - } - case VIDEOPLAYER_GENRE: - { - GET_CURRENT_VIDEO_LABEL(StringUtils::Join(epgTag->Genre(), g_advancedSettings.m_videoItemSeparator)); - } - case VIDEOPLAYER_PLOT: - { - GET_CURRENT_VIDEO_LABEL(epgTag->Plot()); - } - case VIDEOPLAYER_PLOT_OUTLINE: - { - GET_CURRENT_VIDEO_LABEL(epgTag->PlotOutline()); - } - case VIDEOPLAYER_STARTTIME: + // Note: CPVRRecoding is derived from CVideoInfoTag. All base class properties will be handled + // by CGUIInfoManager. Only properties introduced by CPVRRecording need to be handled here. + switch (iLabel) { - if (recording) + // 'Now playing' infos + case VIDEOPLAYER_STARTTIME: { strValue = recording->RecordingTimeAsLocalTime().GetAsLocalizedTime("", false); return true; } - - GET_CURRENT_VIDEO_LABEL_OR_DEFAULT(epgTag->StartAsLocalTime().GetAsLocalizedTime("", false), - CDateTime::GetCurrentDateTime().GetAsLocalizedTime("", false)); // @todo: really current time? - } - case VIDEOPLAYER_ENDTIME: - { - if (recording) + case VIDEOPLAYER_ENDTIME: { strValue = recording->EndTimeAsLocalTime().GetAsLocalizedTime("", false); return true; } - - GET_CURRENT_VIDEO_LABEL_OR_DEFAULT(epgTag->EndAsLocalTime().GetAsLocalizedTime("", false), - CDateTime::GetCurrentDateTime().GetAsLocalizedTime("", false)); // @todo: really current time? - } - case VIDEOPLAYER_IMDBNUMBER: - { - GET_CURRENT_VIDEO_LABEL(epgTag->IMDBNumber()); - } - case VIDEOPLAYER_ORIGINALTITLE: - { - GET_CURRENT_VIDEO_LABEL(epgTag->OriginalTitle()); - } - case VIDEOPLAYER_YEAR: - { - GET_CURRENT_VIDEO_LABEL_WITH_CONDITION(StringUtils::Format("%i", epgTag->Year()), epgTag->Year() > 0); - } - case VIDEOPLAYER_EPISODE: - { - if (channel) - epgTag = channel->GetEPGNow(); - - if (epgTag && epgTag->EpisodeNumber() > 0) - { - if (epgTag->SeriesNumber() == 0) // prefix episode with 'S' - strValue = StringUtils::Format("S%i", epgTag->EpisodeNumber()); - else - strValue = StringUtils::Format("%i", epgTag->EpisodeNumber()); - - return true; - } - return false; - } - case VIDEOPLAYER_SEASON: - { - GET_CURRENT_VIDEO_LABEL_WITH_CONDITION(StringUtils::Format("%i", epgTag->SeriesNumber()), epgTag->SeriesNumber() > 0); - } - case VIDEOPLAYER_EPISODENAME: - { - if (recording) + case VIDEOPLAYER_EPISODENAME: { strValue = recording->EpisodeName(); return true; } - GET_CURRENT_VIDEO_LABEL(epgTag->EpisodeName()); - } - case VIDEOPLAYER_CAST: - { - GET_CURRENT_VIDEO_LABEL(epgTag->Cast()); - } - case VIDEOPLAYER_DIRECTOR: - { - GET_CURRENT_VIDEO_LABEL(epgTag->Director()); - } - case VIDEOPLAYER_WRITER: - { - GET_CURRENT_VIDEO_LABEL(epgTag->Writer()); - } - case VIDEOPLAYER_PARENTAL_RATING: - { - GET_CURRENT_VIDEO_LABEL_WITH_CONDITION(StringUtils::Format("%i", epgTag->ParentalRating()), epgTag->ParentalRating() > 0); - } - - // 'Next playing' infos - case VIDEOPLAYER_NEXT_TITLE: - { - GET_NEXT_VIDEO_LABEL_OR_DEFAULT(epgTag->Title(), - CServiceBroker::GetSettings().GetBool(CSettings::SETTING_EPG_HIDENOINFOAVAILABLE) - ? "" - : g_localizeStrings.Get(19055)); // no information available - } - case VIDEOPLAYER_NEXT_GENRE: - { - GET_NEXT_VIDEO_LABEL(StringUtils::Join(epgTag->Genre(), g_advancedSettings.m_videoItemSeparator)); - } - case VIDEOPLAYER_NEXT_PLOT: - { - GET_NEXT_VIDEO_LABEL(epgTag->Plot()); - } - case VIDEOPLAYER_NEXT_PLOT_OUTLINE: - { - GET_NEXT_VIDEO_LABEL(epgTag->PlotOutline()); - } - case VIDEOPLAYER_NEXT_STARTTIME: - { - GET_NEXT_VIDEO_LABEL(epgTag->StartAsLocalTime().GetAsLocalizedTime("", false)); - } - case VIDEOPLAYER_NEXT_ENDTIME: - { - GET_NEXT_VIDEO_LABEL(epgTag->EndAsLocalTime().GetAsLocalizedTime("", false)); - } - case VIDEOPLAYER_NEXT_DURATION: - { - GET_NEXT_VIDEO_LABEL_WITH_CONDITION(StringUtils::SecondsToTimeString(epgTag->GetDuration()), epgTag->GetDuration() > 0); - } - - // General channel infos - case VIDEOPLAYER_CHANNEL_NAME: - { - if (recording) + // General channel infos + case VIDEOPLAYER_CHANNEL_NAME: { strValue = recording->m_strChannelName; return true; } - - if (!channel && epgTag) - channel = epgTag->Channel(); - - if (channel) + case VIDEOPLAYER_SUB_CHANNEL_NUMBER: { - strValue = channel->ChannelName(); - return true; + const CPVRChannelPtr channel = recording->Channel(); + if (channel) + { + strValue = StringUtils::Format("%i", channel->SubChannelNumber()); + return true; + } + break; } - return false; - } - case VIDEOPLAYER_CHANNEL_NUMBER: - { - if (!channel && recording) - channel = recording->Channel(); - - if (!channel && epgTag) - channel = epgTag->Channel(); - - if (channel) + case VIDEOPLAYER_CHANNEL_NUMBER_LBL: { - strValue = StringUtils::Format("%i", channel->ChannelNumber()); - return true; + const CPVRChannelPtr channel = recording->Channel(); + if (channel) + { + strValue = channel->FormattedChannelNumber(); + return true; + } + break; + } + case VIDEOPLAYER_CHANNEL_GROUP: + { + if (!recording->IsRadio()) + { + strValue = CServiceBroker::GetPVRManager().GetPlayingTVGroupName(); + return true; + } + break; } - return false; } - case VIDEOPLAYER_SUB_CHANNEL_NUMBER: - { - if (!channel && recording) - channel = recording->Channel(); + return false; + } - if (!channel && epgTag) - channel = epgTag->Channel(); + CPVRChannelPtr channel(item.GetPVRChannelInfoTag()); + CPVREpgInfoTagPtr epgTag(item.GetEPGInfoTag()); - if (channel) + if (channel || epgTag) + { + switch (iLabel) + { + // 'Now playing' infos + case VIDEOPLAYER_TITLE: { - strValue = StringUtils::Format("%i", channel->SubChannelNumber()); - return true; + GET_CURRENT_VIDEO_LABEL_OR_DEFAULT(epgTag->Title(), + CServiceBroker::GetSettings().GetBool(CSettings::SETTING_EPG_HIDENOINFOAVAILABLE) + ? "" + : g_localizeStrings.Get(19055)); // no information available + } + case VIDEOPLAYER_GENRE: + { + GET_CURRENT_VIDEO_LABEL(StringUtils::Join(epgTag->Genre(), g_advancedSettings.m_videoItemSeparator)); + } + case VIDEOPLAYER_PLOT: + { + GET_CURRENT_VIDEO_LABEL(epgTag->Plot()); + } + case VIDEOPLAYER_PLOT_OUTLINE: + { + GET_CURRENT_VIDEO_LABEL(epgTag->PlotOutline()); + } + case VIDEOPLAYER_STARTTIME: + { + GET_CURRENT_VIDEO_LABEL_OR_DEFAULT(epgTag->StartAsLocalTime().GetAsLocalizedTime("", false), + CDateTime::GetCurrentDateTime().GetAsLocalizedTime("", false)); // @todo: really current time? + } + case VIDEOPLAYER_ENDTIME: + { + GET_CURRENT_VIDEO_LABEL_OR_DEFAULT(epgTag->EndAsLocalTime().GetAsLocalizedTime("", false), + CDateTime::GetCurrentDateTime().GetAsLocalizedTime("", false)); // @todo: really current time? + } + case VIDEOPLAYER_IMDBNUMBER: + { + GET_CURRENT_VIDEO_LABEL(epgTag->IMDBNumber()); + } + case VIDEOPLAYER_ORIGINALTITLE: + { + GET_CURRENT_VIDEO_LABEL(epgTag->OriginalTitle()); + } + case VIDEOPLAYER_YEAR: + { + GET_CURRENT_VIDEO_LABEL_WITH_CONDITION(StringUtils::Format("%i", epgTag->Year()), epgTag->Year() > 0); + } + case VIDEOPLAYER_EPISODE: + { + if (channel) + epgTag = channel->GetEPGNow(); + + if (epgTag && epgTag->EpisodeNumber() > 0) + { + if (epgTag->SeriesNumber() == 0) // prefix episode with 'S' + strValue = StringUtils::Format("S%i", epgTag->EpisodeNumber()); + else + strValue = StringUtils::Format("%i", epgTag->EpisodeNumber()); + + return true; + } + break; + } + case VIDEOPLAYER_SEASON: + { + GET_CURRENT_VIDEO_LABEL_WITH_CONDITION(StringUtils::Format("%i", epgTag->SeriesNumber()), epgTag->SeriesNumber() > 0); + } + case VIDEOPLAYER_EPISODENAME: + { + GET_CURRENT_VIDEO_LABEL(epgTag->EpisodeName()); + } + case VIDEOPLAYER_CAST: + { + GET_CURRENT_VIDEO_LABEL(epgTag->Cast()); + } + case VIDEOPLAYER_DIRECTOR: + { + GET_CURRENT_VIDEO_LABEL(epgTag->Director()); + } + case VIDEOPLAYER_WRITER: + { + GET_CURRENT_VIDEO_LABEL(epgTag->Writer()); + } + case VIDEOPLAYER_PARENTAL_RATING: + { + GET_CURRENT_VIDEO_LABEL_WITH_CONDITION(StringUtils::Format("%i", epgTag->ParentalRating()), epgTag->ParentalRating() > 0); } - return false; - } - case VIDEOPLAYER_CHANNEL_NUMBER_LBL: - { - if (!channel && recording) - channel = recording->Channel(); - - if (!channel && epgTag) - channel = epgTag->Channel(); - if (channel) + // 'Next playing' infos + case VIDEOPLAYER_NEXT_TITLE: { - strValue = channel->FormattedChannelNumber(); - return true; + GET_NEXT_VIDEO_LABEL_OR_DEFAULT(epgTag->Title(), + CServiceBroker::GetSettings().GetBool(CSettings::SETTING_EPG_HIDENOINFOAVAILABLE) + ? "" + : g_localizeStrings.Get(19055)); // no information available + } + case VIDEOPLAYER_NEXT_GENRE: + { + GET_NEXT_VIDEO_LABEL(StringUtils::Join(epgTag->Genre(), g_advancedSettings.m_videoItemSeparator)); + } + case VIDEOPLAYER_NEXT_PLOT: + { + GET_NEXT_VIDEO_LABEL(epgTag->Plot()); + } + case VIDEOPLAYER_NEXT_PLOT_OUTLINE: + { + GET_NEXT_VIDEO_LABEL(epgTag->PlotOutline()); + } + case VIDEOPLAYER_NEXT_STARTTIME: + { + GET_NEXT_VIDEO_LABEL(epgTag->StartAsLocalTime().GetAsLocalizedTime("", false)); + } + case VIDEOPLAYER_NEXT_ENDTIME: + { + GET_NEXT_VIDEO_LABEL(epgTag->EndAsLocalTime().GetAsLocalizedTime("", false)); + } + case VIDEOPLAYER_NEXT_DURATION: + { + GET_NEXT_VIDEO_LABEL_WITH_CONDITION(StringUtils::SecondsToTimeString(epgTag->GetDuration()), epgTag->GetDuration() > 0); } - return false; - } - case VIDEOPLAYER_CHANNEL_GROUP: - { - if (!channel && epgTag) - channel = epgTag->Channel(); - if ((channel && !channel->IsRadio()) || (recording && !recording->IsRadio())) + // General channel infos + case VIDEOPLAYER_CHANNEL_NAME: { - strValue = CServiceBroker::GetPVRManager().GetPlayingTVGroupName(); - return true; + if (!channel && epgTag) + channel = epgTag->Channel(); + + if (channel) + { + strValue = channel->ChannelName(); + return true; + } + break; + } + case VIDEOPLAYER_CHANNEL_NUMBER: + { + if (!channel && epgTag) + channel = epgTag->Channel(); + + if (channel) + { + strValue = StringUtils::Format("%i", channel->ChannelNumber()); + return true; + } + break; + } + case VIDEOPLAYER_SUB_CHANNEL_NUMBER: + { + if (!channel && epgTag) + channel = epgTag->Channel(); + + if (channel) + { + strValue = StringUtils::Format("%i", channel->SubChannelNumber()); + return true; + } + break; + } + case VIDEOPLAYER_CHANNEL_NUMBER_LBL: + { + if (!channel && epgTag) + channel = epgTag->Channel(); + + if (channel) + { + strValue = channel->FormattedChannelNumber(); + return true; + } + break; + } + case VIDEOPLAYER_CHANNEL_GROUP: + { + if (!channel && epgTag) + channel = epgTag->Channel(); + + if (channel && !channel->IsRadio()) + { + strValue = CServiceBroker::GetPVRManager().GetPlayingTVGroupName(); + return true; + } + break; } - return false; } } From b2a5afe30fbeafc954e894f1b603473b76b57aba Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Sun, 3 Sep 2017 17:52:49 +0200 Subject: [PATCH 011/113] [PVR] CPVRManager::OnPlayback(Started|Stopped): Removed wrong error log message. Of course these methods will not only called for PVR items. --- xbmc/pvr/PVRManager.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/xbmc/pvr/PVRManager.cpp b/xbmc/pvr/PVRManager.cpp index 1e156d4b203d9..3cb5ca8238f80 100644 --- a/xbmc/pvr/PVRManager.cpp +++ b/xbmc/pvr/PVRManager.cpp @@ -814,10 +814,6 @@ void CPVRManager::OnPlaybackStarted(const CFileItemPtr item) m_addons->ClearPlayingChannel(); m_addons->SetPlayingEpgTag(item->GetEPGInfoTag()); } - else - { - CLog::Log(LOGERROR,"PVRManager - %s - unsupported item type", __FUNCTION__); - } } void CPVRManager::OnPlaybackStopped(const CFileItemPtr item) @@ -842,10 +838,6 @@ void CPVRManager::OnPlaybackStopped(const CFileItemPtr item) { m_addons->ClearPlayingEpgTag(); } - else - { - CLog::Log(LOGERROR,"PVRManager - %s - unsupported item type", __FUNCTION__); - } } void CPVRManager::OnPlaybackEnded(const CFileItemPtr item) From 5b3badc4697f69081b8ecd1d59d123e20a3c5452 Mon Sep 17 00:00:00 2001 From: Alwin Esch Date: Mon, 28 Aug 2017 23:10:06 +0200 Subject: [PATCH 012/113] [addons] add binary addon callback to get used skin name This add a callback who also present on python and becomes needed on e.g. Web browser addon to know used skin name. The change is more general and included to a new request. --- xbmc/addons/interfaces/General.cpp | 14 +++++++ xbmc/addons/interfaces/General.h | 1 + .../kodi-addon-dev-kit/include/kodi/General.h | 42 +++++++++++++++++++ .../include/kodi/versions.h | 2 +- 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/xbmc/addons/interfaces/General.cpp b/xbmc/addons/interfaces/General.cpp index ab4a736c8505b..55b1bdf1361b8 100644 --- a/xbmc/addons/interfaces/General.cpp +++ b/xbmc/addons/interfaces/General.cpp @@ -35,6 +35,7 @@ #ifdef TARGET_POSIX #include "linux/XMemUtils.h" #endif +#include "settings/Settings.h" #include "utils/CharsetConverter.h" #include "utils/log.h" #include "utils/LangCodeExpander.h" @@ -64,6 +65,7 @@ void Interface_General::Init(AddonGlobalInterface* addonInterface) addonInterface->toKodi->kodi->get_region = get_region; addonInterface->toKodi->kodi->get_free_mem = get_free_mem; addonInterface->toKodi->kodi->get_global_idle_time = get_global_idle_time; + addonInterface->toKodi->kodi->get_current_skin_id = get_current_skin_id; addonInterface->toKodi->kodi->kodi_version = kodi_version; } @@ -413,6 +415,18 @@ int Interface_General::get_global_idle_time(void* kodiBase) return g_application.GlobalIdleTime(); } +char* Interface_General::get_current_skin_id(void* kodiBase) +{ + CAddonDll* addon = static_cast(kodiBase); + if (addon == nullptr) + { + CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p')", __FUNCTION__, addon); + return nullptr; + } + + return strdup(CServiceBroker::GetSettings().GetString(CSettings::SETTING_LOOKANDFEEL_SKIN).c_str()); +} + void Interface_General::kodi_version(void* kodiBase, char** compile_name, int* major, int* minor, char** revision, char** tag, char** tagversion) { CAddonDll* addon = static_cast(kodiBase); diff --git a/xbmc/addons/interfaces/General.h b/xbmc/addons/interfaces/General.h index ac55b478cc0ab..eee3348c65818 100644 --- a/xbmc/addons/interfaces/General.h +++ b/xbmc/addons/interfaces/General.h @@ -62,6 +62,7 @@ namespace ADDON static char* get_region(void* kodiBase, const char* id); static void get_free_mem(void* kodiInstance, long* free, long* total, bool as_bytes); static int get_global_idle_time(void* kodiBase); + static char* get_current_skin_id(void* kodiBase); static void kodi_version(void* kodiBase, char** compile_name, int* major, int* minor, char** revision, char** tag, char** tagversion); //@} }; diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h index f4295ea7d8e98..6c31e0a5f5634 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h @@ -46,6 +46,7 @@ typedef struct AddonToKodiFuncTable_kodi void (*get_free_mem)(void* kodiBase, long* free, long* total, bool as_bytes); int (*get_global_idle_time)(void* kodiBase); void (*kodi_version)(void* kodiBase, char** compile_name, int* major, int* minor, char** revision, char** tag, char** tagversion); + char* (*get_current_skin_id)(void* kodiBase); } AddonToKodiFuncTable_kodi; //============================================================================== @@ -619,6 +620,47 @@ inline int GetGlobalIdleTime() } /* namespace kodi */ //------------------------------------------------------------------------------ +//============================================================================== +namespace kodi { +/// +/// \ingroup cpp_kodi +/// @brief Get the currently used skin identification name from Kodi +///----------------------------------------------------------------------- +/// +/// @return The active skin id name as a string +/// +/// +/// @note This is not the full path like 'special://home/addons/MediaCenter', +/// but only 'MediaCenter'. +/// +/// +/// ------------------------------------------------------------------------ +/// +/// **Example:** +/// ~~~~~~~~~~~~~{.cpp} +/// #include +/// .. +/// std::string skinid = kodi::GetCurrentSkinId(); +/// .. +/// ~~~~~~~~~~~~~ +/// +inline std::string GetCurrentSkinId() +{ + AddonToKodiFuncTable_Addon* toKodi = ::kodi::addon::CAddonBase::m_interface->toKodi; + + std::string strReturn; + char* strMsg = toKodi->kodi->get_current_skin_id(toKodi->kodiBase); + if (strMsg != nullptr) + { + if (std::strlen(strMsg)) + strReturn = strMsg; + toKodi->free_string(toKodi->kodiBase, strMsg); + } + return strReturn; +} +} /* namespace kodi */ +//------------------------------------------------------------------------------ + //============================================================================== namespace kodi { /// diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h index 32e6b1afada41..99a2e11fb990a 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h @@ -50,7 +50,7 @@ "libXBMC_addon.h" \ "addon-instance/" -#define ADDON_GLOBAL_VERSION_GENERAL "1.0.2" +#define ADDON_GLOBAL_VERSION_GENERAL "1.0.3" #define ADDON_GLOBAL_VERSION_GENERAL_MIN "1.0.2" #define ADDON_GLOBAL_VERSION_GENERAL_XML_ID "kodi.binary.global.general" #define ADDON_GLOBAL_VERSION_GENERAL_DEPENDS "General.h" From 8889c7d06a57e12a08fa67669d4fdf7b49db30b6 Mon Sep 17 00:00:00 2001 From: Alwin Esch Date: Mon, 31 Jul 2017 18:21:15 +0200 Subject: [PATCH 013/113] [addons] allow binary addon to use label id with every id This change the id usage of strings on new binary addons to override a kodi string id with a own for him itself. --- xbmc/addons/interfaces/General.cpp | 13 +++++-------- xbmc/addons/interfaces/General.h | 2 +- .../kodi-addon-dev-kit/include/kodi/General.h | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/xbmc/addons/interfaces/General.cpp b/xbmc/addons/interfaces/General.cpp index 55b1bdf1361b8..d09b2b1a60470 100644 --- a/xbmc/addons/interfaces/General.cpp +++ b/xbmc/addons/interfaces/General.cpp @@ -146,7 +146,7 @@ bool Interface_General::open_settings_dialog(void* kodiBase) return CGUIDialogAddonSettings::ShowForAddon(addonInfo); } -char* Interface_General::get_localized_string(void* kodiBase, long dwCode) +char* Interface_General::get_localized_string(void* kodiBase, long label_id) { CAddonDll* addon = static_cast(kodiBase); if (!addon) @@ -158,13 +158,10 @@ char* Interface_General::get_localized_string(void* kodiBase, long dwCode) if (g_application.m_bStop) return nullptr; - std::string string; - if ((dwCode >= 30000 && dwCode <= 30999) || (dwCode >= 32000 && dwCode <= 32999)) - string = g_localizeStrings.GetAddonString(addon->ID(), dwCode).c_str(); - else - string = g_localizeStrings.Get(dwCode).c_str(); - - char* buffer = strdup(string.c_str()); + std::string label = g_localizeStrings.GetAddonString(addon->ID(), label_id); + if (label.empty()) + label = g_localizeStrings.Get(label_id); + char* buffer = strdup(label.c_str()); return buffer; } diff --git a/xbmc/addons/interfaces/General.h b/xbmc/addons/interfaces/General.h index eee3348c65818..a3444cb5cb784 100644 --- a/xbmc/addons/interfaces/General.h +++ b/xbmc/addons/interfaces/General.h @@ -53,7 +53,7 @@ namespace ADDON //@{ static char* get_addon_info(void* kodiBase, const char* id); static bool open_settings_dialog(void* kodiBase); - static char* get_localized_string(void* kodiBase, long dwCode); + static char* get_localized_string(void* kodiBase, long label_id); static char* unknown_to_utf8(void* kodiBase, const char* source, bool* ret, bool failOnBadChar); static char* get_language(void* kodiBase, int format, bool region); static bool queue_notification(void* kodiBase, int type, const char* header, const char* message, const char* imageFile, unsigned int displayTime, bool withSound, unsigned int messageTime); diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h index 6c31e0a5f5634..22d31f10e910c 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h @@ -37,7 +37,7 @@ typedef struct AddonToKodiFuncTable_kodi char* (*get_addon_info)(void* kodiBase, const char* id); bool (*open_settings_dialog)(void* kodiBase); char* (*unknown_to_utf8)(void* kodiBase, const char* source, bool* ret, bool failOnBadChar); - char* (*get_localized_string)(void* kodiBase, long dwCode); + char* (*get_localized_string)(void* kodiBase, long label_id); char* (*get_language)(void* kodiBase, int format, bool region); bool (*queue_notification)(void* kodiBase, int type, const char* header, const char* message, const char* imageFile, unsigned int displayTime, bool withSound, unsigned int messageTime); void (*get_md5)(void* kodiBase, const char* text, char* md5); From 8df114c313877424247a239dc7b67423eae05c60 Mon Sep 17 00:00:00 2001 From: BigNoid Date: Mon, 4 Sep 2017 11:44:37 +0200 Subject: [PATCH 014/113] [videoinfo] get aspectratio from CDataCacheCore --- xbmc/GUIInfoManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index b3e62cf7bea0d..e54428b22eeca 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -6207,7 +6207,7 @@ std::string CGUIInfoManager::GetLabel(int info, int contextWindow, std::string * case VIDEOPLAYER_VIDEO_ASPECT: if (g_application.m_pPlayer->IsPlaying()) { - strLabel = CStreamDetails::VideoAspectToAspectDescription(m_videoInfo.videoAspectRatio); + strLabel = CStreamDetails::VideoAspectToAspectDescription(CServiceBroker::GetDataCacheCore().GetVideoDAR()); } break; case VIDEOPLAYER_AUDIO_CHANNELS: From 0a8fcddd9833fc130470f0e946bcbc00e0298802 Mon Sep 17 00:00:00 2001 From: Nuno Senica Date: Wed, 24 May 2017 08:09:53 +0000 Subject: [PATCH 015/113] FindFmt can now be compiled internally --- CMakeLists.txt | 1 + cmake/modules/FindFmt.cmake | 44 +++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f8858abeaae1f..40ddec2f6ace4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,7 @@ if(UNIX) option(FFMPEG_PATH "Path to external ffmpeg?" "") option(ENABLE_INTERNAL_CROSSGUID "Enable internal crossguid?" ON) option(ENABLE_INTERNAL_RapidJSON "Enable internal rapidjson?" OFF) + option(ENABLE_INTERNAL_FMT "Enable internal fmt?" OFF) option(ENABLE_OPENSSL "Enable OpenSSL?" ON) endif() # System options diff --git a/cmake/modules/FindFmt.cmake b/cmake/modules/FindFmt.cmake index 5473ed5b76d28..06ffc24c4a2c1 100644 --- a/cmake/modules/FindFmt.cmake +++ b/cmake/modules/FindFmt.cmake @@ -12,6 +12,48 @@ # # Fmt::Fmt - The Fmt library +if(ENABLE_INTERNAL_FMT) + include(ExternalProject) + file(STRINGS ${CMAKE_SOURCE_DIR}/tools/depends/target/libfmt/Makefile VER REGEX "^[ ]*VERSION[ ]*=.+$") + string(REGEX REPLACE "^[ ]*VERSION[ ]*=[ ]*" "" FMT_VERSION "${VER}") + + # allow user to override the download URL with a local tarball + # needed for offline build envs + if(FMT_URL) + get_filename_component(FMT_URL "${FMT_URL}" ABSOLUTE) + else() + set(FMT_URL http://mirrors.kodi.tv/build-deps/sources/fmt-${FMT_VERSION}.tar.gz) + endif() + if(VERBOSE) + message(STATUS "FMT_URL: ${FMT_URL}") + endif() + + if(APPLE) + set(EXTRA_ARGS "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}") + endif() + + set(FMT_LIBRARY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/libfmt.a) + set(FMT_INCLUDE_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include) + externalproject_add(fmt + URL ${FMT_URL} + DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/download + PREFIX ${CORE_BUILD_DIR}/fmt + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + "${EXTRA_ARGS}" + BUILD_BYPRODUCTS ${FMT_LIBRARY}) + set_target_properties(fmt PROPERTIES FOLDER "External Projects") + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(Fmt + REQUIRED_VARS FMT_LIBRARY FMT_INCLUDE_DIR + VERSION_VAR FMT_VERSION) + + set(FMT_LIBRARIES ${FMT_LIBRARY}) + set(FMT_INCLUDE_DIRS ${FMT_INCLUDE_DIR}) + +else() + if(CORE_SYSTEM_NAME STREQUAL windows OR CORE_SYSTEM_NAME STREQUAL windowsstore) # TODO: fix windows fmt package to include fmt-config.cmake and fmt-config-version.cmake set(FMT_VERSION 3.0.1) @@ -55,3 +97,5 @@ if(FMT_FOUND) endif() mark_as_advanced(FMT_INCLUDE_DIR FMT_LIBRARY) + +endif() From f67cec9a10f2e79fc10894e828d09174b93fe4e6 Mon Sep 17 00:00:00 2001 From: Lukas Obermann Date: Mon, 4 Sep 2017 21:44:30 +0200 Subject: [PATCH 016/113] [imdb] partial revert of crashfix due to a introduced bug one part of the fix for the crashed on imdb caused an issue that it is no longer possible to manually add content to the videolibrary. Removing one of the checks for a non existing VideoInfoTag is getting rid of that bug. --- xbmc/video/windows/GUIWindowVideoBase.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp index 908cd2c8ff711..3a5c8b237136f 100644 --- a/xbmc/video/windows/GUIWindowVideoBase.cpp +++ b/xbmc/video/windows/GUIWindowVideoBase.cpp @@ -398,10 +398,6 @@ bool CGUIWindowVideoBase::ShowIMDB(CFileItemPtr item, const ScraperPtr &info2, b CGUIDialogOK::ShowAndGetInput(CVariant{13346}, CVariant{14057}); return false; } - - // If the scraper failed above and no videoinfotag was created, return - if (!item->HasVideoInfoTag()) - return false; bool listNeedsUpdating = false; // 3. Run a loop so that if we Refresh we re-run this block From 4525436f532a132de7ef6d80ee0d720a4789e013 Mon Sep 17 00:00:00 2001 From: Nuno Senica Date: Tue, 5 Sep 2017 08:27:43 +0000 Subject: [PATCH 017/113] Fixes rapidjson bug --- cmake/modules/FindRapidJSON.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindRapidJSON.cmake b/cmake/modules/FindRapidJSON.cmake index 3c3dc3f721570..fb77b646f00c9 100644 --- a/cmake/modules/FindRapidJSON.cmake +++ b/cmake/modules/FindRapidJSON.cmake @@ -10,7 +10,7 @@ # if(ENABLE_INTERNAL_RapidJSON) include(ExternalProject) - file(STRINGS ${CMAKE_SOURCE_DIR}/tools/depends/target/rapidjson/Makefile VER REGEX MATCH "^[ ]*VERSION[ ]*=.+$") + file(STRINGS ${CMAKE_SOURCE_DIR}/tools/depends/target/rapidjson/Makefile VER REGEX "^[ ]*VERSION[ ]*=.+$") string(REGEX REPLACE "^[ ]*VERSION[ ]*=[ ]*" "" RJSON_VER "${VER}") # allow user to override the download URL with a local tarball From 41e7a727115ab426ec89cd32cd07b74053d25d4a Mon Sep 17 00:00:00 2001 From: Nuno Senica Date: Wed, 30 Aug 2017 20:14:21 +0000 Subject: [PATCH 018/113] Rbpi: Add a prefix to EGL and OpenGLES library names --- cmake/modules/FindEGL.cmake | 8 ++++++-- cmake/modules/FindOpenGLES.cmake | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cmake/modules/FindEGL.cmake b/cmake/modules/FindEGL.cmake index 93fa530a8607f..331ac3975a998 100644 --- a/cmake/modules/FindEGL.cmake +++ b/cmake/modules/FindEGL.cmake @@ -14,14 +14,18 @@ # # EGL::EGL - The EGL library +if(CORE_PLATFORM_NAME_LC STREQUAL rbpi) + set(_brcmprefix brcm) +endif() + if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_EGL egl QUIET) + pkg_check_modules(PC_EGL ${_brcmprefix}egl QUIET) endif() find_path(EGL_INCLUDE_DIR EGL/egl.h PATHS ${PC_EGL_INCLUDEDIR}) -find_library(EGL_LIBRARY NAMES EGL egl +find_library(EGL_LIBRARY NAMES ${_brcmprefix}EGL egl PATHS ${PC_EGL_LIBDIR}) set(EGL_VERSION ${PC_EGL_VERSION}) diff --git a/cmake/modules/FindOpenGLES.cmake b/cmake/modules/FindOpenGLES.cmake index 4333a69d618c5..8e94e5c48a739 100644 --- a/cmake/modules/FindOpenGLES.cmake +++ b/cmake/modules/FindOpenGLES.cmake @@ -10,14 +10,18 @@ # OPENGLES_LIBRARIES - the OpenGLES libraries # OPENGLES_DEFINITIONS - the OpenGLES definitions +if(CORE_PLATFORM_NAME_LC STREQUAL rbpi) + set(_brcmprefix brcm) +endif() + if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_OPENGLES glesv2 QUIET) + pkg_check_modules(PC_OPENGLES ${_brcmprefix}glesv2 QUIET) endif() if(NOT CORE_SYSTEM_NAME STREQUAL ios) find_path(OPENGLES_INCLUDE_DIR GLES2/gl2.h PATHS ${PC_OPENGLES_INCLUDEDIR}) - find_library(OPENGLES_gl_LIBRARY NAMES GLESv2 + find_library(OPENGLES_gl_LIBRARY NAMES ${_brcmprefix}GLESv2 PATHS ${PC_OPENGLES_LIBDIR}) else() find_library(OPENGLES_gl_LIBRARY NAMES OpenGLES From b4da46357d58e4b0398165fdc78c3cbf88273124 Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Tue, 5 Sep 2017 18:33:31 +0200 Subject: [PATCH 019/113] [videoinfoscanner] properly handle excludes (fixes #16444) --- xbmc/video/VideoInfoScanner.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp index 973fc8d7b734d..c0c14a80b318a 100644 --- a/xbmc/video/VideoInfoScanner.cpp +++ b/xbmc/video/VideoInfoScanner.cpp @@ -429,8 +429,8 @@ namespace VIDEO continue; // Discard all exclude files defined by regExExclude - if (CUtil::ExcludeFileOrFolder(pItem->GetPath(), (content == CONTENT_TVSHOWS) ? g_advancedSettings.m_tvshowExcludeFromScanRegExps - : g_advancedSettings.m_moviesExcludeFromScanRegExps)) + if (IsExcluded(pItem->GetPath(), (content == CONTENT_TVSHOWS) ? g_advancedSettings.m_tvshowExcludeFromScanRegExps + : g_advancedSettings.m_moviesExcludeFromScanRegExps)) continue; if (info2->Content() == CONTENT_MOVIES || info2->Content() == CONTENT_MUSICVIDEOS) @@ -881,7 +881,7 @@ namespace VIDEO continue; // Discard all exclude files defined by regExExcludes - if (CUtil::ExcludeFileOrFolder(items[i]->GetPath(), regexps)) + if (IsExcluded(items[i]->GetPath(), regexps)) continue; /* From 888826f734a757ddf912c86c94d38f40fb22f488 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Tue, 5 Sep 2017 16:38:48 +0200 Subject: [PATCH 020/113] [PVR] CPVRClient: Refactor writing addon stream properties to file item. --- xbmc/addons/PVRClient.cpp | 55 +++++++++++++++------------------------ xbmc/addons/PVRClient.h | 8 ++++++ 2 files changed, 29 insertions(+), 34 deletions(-) diff --git a/xbmc/addons/PVRClient.cpp b/xbmc/addons/PVRClient.cpp index 1010fa0210e9f..5618815a71796 100644 --- a/xbmc/addons/PVRClient.cpp +++ b/xbmc/addons/PVRClient.cpp @@ -808,6 +808,24 @@ PVR_ERROR CPVRClient::IsPlayable(const CConstPVREpgInfoTagPtr &tag, bool &bIsPla return retVal; } +void CPVRClient::WriteFileItemProperties(const PVR_NAMED_VALUE *properties, unsigned int iPropertyCount, CFileItem &fileItem) +{ + for (unsigned int i = 0; i < iPropertyCount; ++i) + { + if (strncmp(properties[i].strName, PVR_STREAM_PROPERTY_STREAMURL, strlen(PVR_STREAM_PROPERTY_STREAMURL)) == 0) + { + fileItem.SetDynPath(properties[i].strValue); + } + else if (strncmp(properties[i].strName, PVR_STREAM_PROPERTY_MIMETYPE, strlen(PVR_STREAM_PROPERTY_MIMETYPE)) == 0) + { + fileItem.SetMimeType(properties[i].strValue); + fileItem.SetContentLookup(false); + } + + fileItem.SetProperty(properties[i].strName, properties[i].strValue); + } +} + bool CPVRClient::FillEpgTagStreamFileItem(CFileItem &fileItem) { if (!m_bReadyToUse) @@ -821,18 +839,7 @@ bool CPVRClient::FillEpgTagStreamFileItem(CFileItem &fileItem) if (m_struct.toAddon.GetEPGTagStreamProperties(&addonTag, properties, &iPropertyCount) != PVR_ERROR_NO_ERROR) return false; - for (unsigned int i = 0; i < iPropertyCount; ++i) - { - if (strncmp(properties[i].strName, PVR_STREAM_PROPERTY_STREAMURL, strlen(PVR_STREAM_PROPERTY_STREAMURL)) == 0) - fileItem.SetDynPath(properties[i].strValue); - else if (strncmp(properties[i].strName, PVR_STREAM_PROPERTY_MIMETYPE, strlen(PVR_STREAM_PROPERTY_MIMETYPE)) == 0) - { - fileItem.SetMimeType(properties[i].strValue); - fileItem.SetContentLookup(false); - } - fileItem.SetProperty(properties[i].strName, properties[i].strValue); - } - + WriteFileItemProperties(properties, iPropertyCount, fileItem); return true; } @@ -1299,17 +1306,7 @@ bool CPVRClient::FillChannelStreamFileItem(CFileItem &fileItem) if (m_struct.toAddon.GetChannelStreamProperties(&tag, properties, &iPropertyCount) != PVR_ERROR_NO_ERROR) return false; - for (unsigned int i = 0; i < iPropertyCount; ++i) - { - if (strncmp(properties[i].strName, PVR_STREAM_PROPERTY_STREAMURL, strlen(PVR_STREAM_PROPERTY_STREAMURL)) == 0) - fileItem.SetDynPath(properties[i].strValue); - else if (strncmp(properties[i].strName, PVR_STREAM_PROPERTY_MIMETYPE, strlen(PVR_STREAM_PROPERTY_MIMETYPE)) == 0) - { - fileItem.SetMimeType(properties[i].strValue); - fileItem.SetContentLookup(false); - } - fileItem.SetProperty(properties[i].strName, properties[i].strValue); - } + WriteFileItemProperties(properties, iPropertyCount, fileItem); return true; } @@ -1332,17 +1329,7 @@ bool CPVRClient::FillRecordingStreamFileItem(CFileItem &fileItem) if (m_struct.toAddon.GetRecordingStreamProperties(&tag, properties, &iPropertyCount) != PVR_ERROR_NO_ERROR) return false; - for (unsigned int i = 0; i < iPropertyCount; ++i) - { - if (strncmp(properties[i].strName, PVR_STREAM_PROPERTY_STREAMURL, strlen(PVR_STREAM_PROPERTY_STREAMURL)) == 0) - fileItem.SetDynPath(properties[i].strValue); - else if (strncmp(properties[i].strName, PVR_STREAM_PROPERTY_MIMETYPE, strlen(PVR_STREAM_PROPERTY_MIMETYPE)) == 0) - { - fileItem.SetMimeType(properties[i].strValue); - fileItem.SetContentLookup(false); - } - fileItem.SetProperty(properties[i].strName, properties[i].strValue); - } + WriteFileItemProperties(properties, iPropertyCount, fileItem); return true; } diff --git a/xbmc/addons/PVRClient.h b/xbmc/addons/PVRClient.h index d60b72bc3fd74..98541efc71dd7 100644 --- a/xbmc/addons/PVRClient.h +++ b/xbmc/addons/PVRClient.h @@ -890,6 +890,14 @@ namespace PVR */ static void WriteClientChannelInfo(const CPVRChannelPtr &xbmcChannel, PVR_CHANNEL &addonChannel); + /*! + * @brief Write the given addon properties to the properties of the given file item. + * @param properties Pointer to an array of addon properties. + * @param iPropertyCount The number of properties contained in the addon properties array. + * @param fileItem The item the addon properties shall be written to. + */ + static void WriteFileItemProperties(const PVR_NAMED_VALUE *properties, unsigned int iPropertyCount, CFileItem &fileItem); + /*! * @brief Whether a channel can be played by this add-on * @param channel The channel to check. From 4e7f401b8fd1860d7af427ae130186ab64ab7ace Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Tue, 5 Sep 2017 19:04:13 +0200 Subject: [PATCH 021/113] [PVR] CPVRClient::LogError: Cleanup method signature and document the method. --- xbmc/addons/PVRClient.cpp | 2 +- xbmc/addons/PVRClient.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/xbmc/addons/PVRClient.cpp b/xbmc/addons/PVRClient.cpp index 5618815a71796..e11c60a78c403 100644 --- a/xbmc/addons/PVRClient.cpp +++ b/xbmc/addons/PVRClient.cpp @@ -1424,7 +1424,7 @@ const char *CPVRClient::ToString(const PVR_ERROR error) } } -bool CPVRClient::LogError(const PVR_ERROR error, const char *strMethod) const +bool CPVRClient::LogError(PVR_ERROR error, const char *strMethod) const { if (error != PVR_ERROR_NO_ERROR && error != PVR_ERROR_NOT_IMPLEMENTED) { diff --git a/xbmc/addons/PVRClient.h b/xbmc/addons/PVRClient.h index 98541efc71dd7..cee6399b2fd64 100644 --- a/xbmc/addons/PVRClient.h +++ b/xbmc/addons/PVRClient.h @@ -910,7 +910,12 @@ namespace PVR */ void StopRunningInstance(); - bool LogError(const PVR_ERROR error, const char *strMethod) const; + /*! + * @brief Write an error to the error log. + * @param error The error code. + * @param strMethod The name of the (member) function that produced the error. + */ + bool LogError(PVR_ERROR error, const char *strMethod) const; /*! * @brief Callback functions from addon to kodi From 736853cc2b75e249a6b14b1af5def4c2e5b9618d Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Tue, 5 Sep 2017 20:25:43 +0200 Subject: [PATCH 022/113] [PVR] CPVRClient::GetDriveSpace: Cleanup method signature (prefer references over pointers as we're doing c++). --- xbmc/addons/PVRClient.cpp | 16 ++++++++++++---- xbmc/addons/PVRClient.h | 2 +- xbmc/pvr/addons/PVRClients.cpp | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/xbmc/addons/PVRClient.cpp b/xbmc/addons/PVRClient.cpp index e11c60a78c403..84e5461441216 100644 --- a/xbmc/addons/PVRClient.cpp +++ b/xbmc/addons/PVRClient.cpp @@ -541,16 +541,24 @@ const std::string& CPVRClient::GetFriendlyName(void) const return m_strFriendlyName; } -PVR_ERROR CPVRClient::GetDriveSpace(long long *iTotal, long long *iUsed) +PVR_ERROR CPVRClient::GetDriveSpace(long long &iTotal, long long &iUsed) { /* default to 0 in case of error */ - *iTotal = 0; - *iUsed = 0; + iTotal = 0; + iUsed = 0; if (!m_bReadyToUse) return PVR_ERROR_SERVER_ERROR; - return m_struct.toAddon.GetDriveSpace(iTotal, iUsed); + long long iTotalSpace = 0; + long long iUsedSpace = 0; + PVR_ERROR error = m_struct.toAddon.GetDriveSpace(&iTotalSpace, &iUsedSpace); + if (error == PVR_ERROR_NO_ERROR) + { + iTotal = iTotalSpace; + iUsed = iUsedSpace; + } + return error; } PVR_ERROR CPVRClient::StartChannelScan(void) diff --git a/xbmc/addons/PVRClient.h b/xbmc/addons/PVRClient.h index cee6399b2fd64..f0d8f05bdbb4c 100644 --- a/xbmc/addons/PVRClient.h +++ b/xbmc/addons/PVRClient.h @@ -325,7 +325,7 @@ namespace PVR * @param iUsed The used disk space. * @return PVR_ERROR_NO_ERROR if the drive space has been fetched successfully. */ - PVR_ERROR GetDriveSpace(long long *iTotal, long long *iUsed); + PVR_ERROR GetDriveSpace(long long &iTotal, long long &iUsed); /*! * @brief Start a channel scan on the server. diff --git a/xbmc/pvr/addons/PVRClients.cpp b/xbmc/pvr/addons/PVRClients.cpp index 0637fb7e04aea..7d71cdb9afdfd 100644 --- a/xbmc/pvr/addons/PVRClients.cpp +++ b/xbmc/pvr/addons/PVRClients.cpp @@ -305,7 +305,7 @@ std::vector CPVRClients::GetBackendProperties() const SBackend properties; - if (client->GetDriveSpace(&properties.diskTotal, &properties.diskUsed) == PVR_ERROR_NO_ERROR) + if (client->GetDriveSpace(properties.diskTotal, properties.diskUsed) == PVR_ERROR_NO_ERROR) { properties.diskTotal *= 1024; properties.diskUsed *= 1024; From 4c5e636430e9012276dd5d9247f73ae320a9ba2c Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Tue, 5 Sep 2017 20:40:36 +0200 Subject: [PATCH 023/113] [PVR] CPVRClient: rework menu hook methods. --- xbmc/addons/PVRClient.cpp | 24 +++++++++++------------- xbmc/addons/PVRClient.h | 4 ++-- xbmc/pvr/PVRGUIActions.cpp | 16 +++++++++------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/xbmc/addons/PVRClient.cpp b/xbmc/addons/PVRClient.cpp index 84e5461441216..1c8229a62963b 100644 --- a/xbmc/addons/PVRClient.cpp +++ b/xbmc/addons/PVRClient.cpp @@ -636,7 +636,7 @@ PVR_ERROR CPVRClient::RenameChannel(const CPVRChannelPtr &channel) return retVal; } -void CPVRClient::CallMenuHook(const PVR_MENUHOOK &hook, const CFileItem *item) +void CPVRClient::CallMenuHook(const PVR_MENUHOOK &hook, const CFileItemPtr item) { if (!m_bReadyToUse) return; @@ -1399,9 +1399,9 @@ bool CPVRClient::HasMenuHooks(PVR_MENUHOOK_CAT cat) const return bReturn; } -PVR_MENUHOOKS *CPVRClient::GetMenuHooks(void) +PVR_MENUHOOKS& CPVRClient::GetMenuHooks(void) { - return &m_menuhooks; + return m_menuhooks; } const char *CPVRClient::ToString(const PVR_ERROR error) @@ -1889,17 +1889,15 @@ void CPVRClient::cb_add_menu_hook(void *kodiInstance, PVR_MENUHOOK *hook) return; } - PVR_MENUHOOKS *hooks = client->GetMenuHooks(); - if (hooks) - { - PVR_MENUHOOK hookInt; - hookInt.iHookId = hook->iHookId; - hookInt.iLocalizedStringId = hook->iLocalizedStringId; - hookInt.category = hook->category; + PVR_MENUHOOKS& hooks = client->GetMenuHooks(); - /* add this new hook */ - hooks->push_back(hookInt); - } + PVR_MENUHOOK hookInt; + hookInt.iHookId = hook->iHookId; + hookInt.iLocalizedStringId = hook->iLocalizedStringId; + hookInt.category = hook->category; + + /* add this new hook */ + hooks.emplace_back(hookInt); } void CPVRClient::cb_recording(void *kodiInstance, const char *strName, const char *strFileName, bool bOnOff) diff --git a/xbmc/addons/PVRClient.h b/xbmc/addons/PVRClient.h index f0d8f05bdbb4c..1a7c1586081f7 100644 --- a/xbmc/addons/PVRClient.h +++ b/xbmc/addons/PVRClient.h @@ -392,14 +392,14 @@ namespace PVR /*! * @return The menu hooks for this add-on. */ - PVR_MENUHOOKS *GetMenuHooks(void); + PVR_MENUHOOKS& GetMenuHooks(); /*! * @brief Call one of the menu hooks of this client. * @param hook The hook to call. * @param item The selected file item for which the hook was called. */ - void CallMenuHook(const PVR_MENUHOOK &hook, const CFileItem *item); + void CallMenuHook(const PVR_MENUHOOK &hook, const CFileItemPtr item); //@} /** @name PVR EPG methods */ diff --git a/xbmc/pvr/PVRGUIActions.cpp b/xbmc/pvr/PVRGUIActions.cpp index 52f72acab522d..4139acc297a67 100644 --- a/xbmc/pvr/PVRGUIActions.cpp +++ b/xbmc/pvr/PVRGUIActions.cpp @@ -1406,19 +1406,21 @@ namespace PVR pDialog->Reset(); pDialog->SetHeading(CVariant{19196}); // "PVR client specific actions" - PVR_MENUHOOKS *hooks = client->GetMenuHooks(); + PVR_MENUHOOKS& hooks = client->GetMenuHooks(); std::vector hookIDs; - int selection = 0; + unsigned int i = 0; - for (unsigned int i = 0; i < hooks->size(); ++i) + for (const auto& hook : hooks) { - if (hooks->at(i).category == menuCategory || hooks->at(i).category == PVR_MENUHOOK_ALL) + if (hook.category == menuCategory || hook.category == PVR_MENUHOOK_ALL) { - pDialog->Add(g_localizeStrings.GetAddonString(client->ID(), hooks->at(i).iLocalizedStringId)); - hookIDs.push_back(i); + pDialog->Add(g_localizeStrings.GetAddonString(client->ID(), hook.iLocalizedStringId)); + hookIDs.emplace_back(i); } + ++i; } + int selection = 0; if (hookIDs.size() > 1) { pDialog->Open(); @@ -1426,7 +1428,7 @@ namespace PVR } if (selection >= 0) - client->CallMenuHook(hooks->at(hookIDs.at(selection)), item.get()); + client->CallMenuHook(hooks.at(hookIDs.at(selection)), item); else return false; } From d924076af6835c2d18c9c8422b63c4b7502129b6 Mon Sep 17 00:00:00 2001 From: Kolja Lampe Date: Tue, 22 Aug 2017 22:01:11 +0200 Subject: [PATCH 024/113] Add contextmenu option to remove resume points --- .../resources/strings.po | 8 ++++- xbmc/ContextMenuManager.cpp | 1 + xbmc/video/ContextMenus.cpp | 20 ++++++++++++ xbmc/video/ContextMenus.h | 7 ++++ xbmc/video/VideoDatabase.cpp | 32 +++++++++++++++++-- xbmc/video/VideoDatabase.h | 2 +- 6 files changed, 65 insertions(+), 5 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po index fbb919689b9c6..0d0a2afbd1e65 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -20656,7 +20656,13 @@ msgctxt "#38208" msgid "If EXIF information exists (date, time, camera used, etc.), it will be displayed." msgstr "" -#empty strings from id 38209 to 38999 +#. Contextmenu entry to remove the resume point of the currently selected item +#: xbmc/video/ContextMenus.h +msgctxt "#38209" +msgid "Reset resume position" +msgstr "" + +#empty strings from id 38210 to 38999 #: system/settings/settings.xml msgctxt "#39000" diff --git a/xbmc/ContextMenuManager.cpp b/xbmc/ContextMenuManager.cpp index b6edd1e0f474b..1adb37fb28333 100644 --- a/xbmc/ContextMenuManager.cpp +++ b/xbmc/ContextMenuManager.cpp @@ -82,6 +82,7 @@ void CContextMenuManager::Init() std::make_shared(), std::make_shared(), std::make_shared(), + std::make_shared(), std::make_shared(), std::make_shared(), std::make_shared(), diff --git a/xbmc/video/ContextMenus.cpp b/xbmc/video/ContextMenus.cpp index 3e7b7cf241a93..bad143eb4f9c9 100644 --- a/xbmc/video/ContextMenus.cpp +++ b/xbmc/video/ContextMenus.cpp @@ -49,6 +49,26 @@ bool CVideoInfo::Execute(const CFileItemPtr& item) const return true; } +bool CRemoveResumePoint::IsVisible(const CFileItem& itemIn) const +{ + CFileItem item(itemIn.GetItemToPlay()); + if (item.IsDeleted()) // e.g. trashed pvr recording + return false; + + return CGUIWindowVideoBase::HasResumeItemOffset(&item); +} + +bool CRemoveResumePoint::Execute(const CFileItemPtr& item) const +{ + CVideoDatabase videoDatabase; + if (videoDatabase.Open()) + { + videoDatabase.DeleteResumeBookMark(*item); + } + + return true; +} + bool CMarkWatched::IsVisible(const CFileItem& item) const { if (item.IsDeleted()) // e.g. trashed pvr recording diff --git a/xbmc/video/ContextMenus.h b/xbmc/video/ContextMenus.h index 33cbd62c4f297..fb4e9f9e56bfb 100644 --- a/xbmc/video/ContextMenus.h +++ b/xbmc/video/ContextMenus.h @@ -56,6 +56,13 @@ struct CMovieInfo : CVideoInfo CMovieInfo() : CVideoInfo(MediaTypeMovie) {} }; +struct CRemoveResumePoint : CStaticContextMenuAction +{ + CRemoveResumePoint() : CStaticContextMenuAction(38209) {} + bool IsVisible(const CFileItem& item) const override; + bool Execute(const CFileItemPtr& item) const override; +}; + struct CMarkWatched : CStaticContextMenuAction { CMarkWatched() : CStaticContextMenuAction(16103) {} diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index 411a5329823d6..4c5bc5ac500f9 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -3066,12 +3066,12 @@ bool CVideoDatabase::GetResumeBookMark(const std::string& strFilenameAndPath, CB return false; } -void CVideoDatabase::DeleteResumeBookMark(const std::string &strFilenameAndPath) +void CVideoDatabase::DeleteResumeBookMark(const CFileItem& item) { if (!m_pDB.get() || !m_pDS.get()) return; - int fileID = GetFileId(strFilenameAndPath); + int fileID = item.GetVideoInfoTag()->m_iFileId; if (fileID < -1) return; @@ -3079,10 +3079,36 @@ void CVideoDatabase::DeleteResumeBookMark(const std::string &strFilenameAndPath) { std::string sql = PrepareSQL("delete from bookmark where idFile=%i and type=%i", fileID, CBookmark::RESUME); m_pDS->exec(sql); + + VIDEODB_CONTENT_TYPE iType = static_cast(item.GetVideoContentType()); + std::string content; + switch (iType) + { + case VIDEODB_CONTENT_MOVIES: + content = MediaTypeMovie; + break; + case VIDEODB_CONTENT_EPISODES: + content = MediaTypeEpisode; + break; + case VIDEODB_CONTENT_TVSHOWS: + content = MediaTypeTvShow; + break; + case VIDEODB_CONTENT_MUSICVIDEOS: + content = MediaTypeMusicVideo; + break; + default: + break; + } + + if (!content.empty()) + { + AnnounceUpdate(content, item.GetVideoInfoTag()->m_iDbId); + } + } catch(...) { - CLog::Log(LOGERROR, "%s (%s) failed", __FUNCTION__, strFilenameAndPath.c_str()); + CLog::Log(LOGERROR, "%s (%s) failed", __FUNCTION__, item.GetVideoInfoTag()->m_strFileNameAndPath.c_str()); } } diff --git a/xbmc/video/VideoDatabase.h b/xbmc/video/VideoDatabase.h index a53edb85ac6b7..83b481b4fcf22 100644 --- a/xbmc/video/VideoDatabase.h +++ b/xbmc/video/VideoDatabase.h @@ -603,7 +603,7 @@ class CVideoDatabase : public CDatabase void GetBookMarksForFile(const std::string& strFilenameAndPath, VECBOOKMARKS& bookmarks, CBookmark::EType type = CBookmark::STANDARD, bool bAppend=false, long partNumber=0); void AddBookMarkToFile(const std::string& strFilenameAndPath, const CBookmark &bookmark, CBookmark::EType type = CBookmark::STANDARD); bool GetResumeBookMark(const std::string& strFilenameAndPath, CBookmark &bookmark); - void DeleteResumeBookMark(const std::string &strFilenameAndPath); + void DeleteResumeBookMark(const CFileItem& item); void ClearBookMarkOfFile(const std::string& strFilenameAndPath, CBookmark& bookmark, CBookmark::EType type = CBookmark::STANDARD); void ClearBookMarksOfFile(const std::string& strFilenameAndPath, CBookmark::EType type = CBookmark::STANDARD); void ClearBookMarksOfFile(int idFile, CBookmark::EType type = CBookmark::STANDARD); From 23d382ee36ad0d2f3eec7dcacab68768c32ee55b Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Wed, 6 Sep 2017 11:25:30 +0200 Subject: [PATCH 025/113] [PVR] Fix CPVRManager::OnPlaybackStarted to always clear playing flags for pvr components. --- xbmc/pvr/PVRManager.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/xbmc/pvr/PVRManager.cpp b/xbmc/pvr/PVRManager.cpp index 3cb5ca8238f80..322e43e6b8698 100644 --- a/xbmc/pvr/PVRManager.cpp +++ b/xbmc/pvr/PVRManager.cpp @@ -786,16 +786,17 @@ void CPVRManager::CloseStream(void) void CPVRManager::OnPlaybackStarted(const CFileItemPtr item) { + m_addons->ClearPlayingChannel(); + m_addons->ClearPlayingRecording(); + m_addons->ClearPlayingEpgTag(); + if (item->HasPVRChannelInfoTag()) { const CPVRChannelPtr channel(item->GetPVRChannelInfoTag()); - m_addons->ClearPlayingRecording(); - m_addons->ClearPlayingEpgTag(); m_addons->SetPlayingChannel(channel); m_guiActions->GetChannelNavigator().SetPlayingChannel(channel); - SetPlayingGroup(channel); UpdateLastWatched(channel); @@ -804,14 +805,10 @@ void CPVRManager::OnPlaybackStarted(const CFileItemPtr item) } else if (item->HasPVRRecordingInfoTag()) { - m_addons->ClearPlayingEpgTag(); - m_addons->ClearPlayingChannel(); m_addons->SetPlayingRecording(item->GetPVRRecordingInfoTag()); } else if (item->HasEPGInfoTag()) { - m_addons->ClearPlayingRecording(); - m_addons->ClearPlayingChannel(); m_addons->SetPlayingEpgTag(item->GetEPGInfoTag()); } } From e2039a21eec9da0629981f58e774865320b07782 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Wed, 6 Sep 2017 13:11:35 +0200 Subject: [PATCH 026/113] [addons][cmake] add header-only directories in xbmc/addons/kodi-addon-dev-kit. --- cmake/treedata/common/subdirs.txt | 12 +++++++--- xbmc/addons/interfaces/Addon/CMakeLists.txt | 2 +- xbmc/addons/interfaces/CMakeLists.txt | 2 +- .../include/kodi/CMakeLists.txt | 24 +++++++++++++++++++ .../kodi/addon-instance/CMakeLists.txt | 15 ++++++++++++ .../include/kodi/gui/CMakeLists.txt | 8 +++++++ .../include/kodi/gui/controls/CMakeLists.txt | 16 +++++++++++++ .../include/kodi/gui/dialogs/CMakeLists.txt | 14 +++++++++++ .../include/kodi/tools/CMakeLists.txt | 5 ++++ xbmc/addons/settings/CMakeLists.txt | 2 +- 10 files changed, 94 insertions(+), 6 deletions(-) create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/CMakeLists.txt create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/CMakeLists.txt create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/CMakeLists.txt create mode 100644 xbmc/addons/kodi-addon-dev-kit/include/kodi/tools/CMakeLists.txt diff --git a/cmake/treedata/common/subdirs.txt b/cmake/treedata/common/subdirs.txt index ee4e83c7b126a..ec1af634c4c70 100644 --- a/cmake/treedata/common/subdirs.txt +++ b/cmake/treedata/common/subdirs.txt @@ -1,12 +1,18 @@ xbmc xbmc xbmc/addons addons xbmc/addons/binary-addons addons_binary-addons -xbmc/addons/interfaces addonsBinaryInterfaces -xbmc/addons/interfaces/Addon addonCallbacks_Addon +xbmc/addons/interfaces addons_interfaces +xbmc/addons/interfaces/Addon addons_interfaces_addon xbmc/addons/interfaces/GUI addons_interfaces_gui xbmc/addons/interfaces/GUI/controls addons_interfaces_gui_controls xbmc/addons/interfaces/GUI/dialogs addons_interfaces_gui_dialogs -xbmc/addons/settings addonsSettings +xbmc/addons/kodi-addon-dev-kit/include/kodi addons_kodi-addon-dev-kit_include_kodi +xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance addons_kodi-addon-dev-kit_include_kodi_addon-instance +xbmc/addons/kodi-addon-dev-kit/include/kodi/gui addons_kodi-addon-dev-kit_include_kodi_gui +xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls addons_kodi-addon-dev-kit_include_kodi_gui_controls +xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs addons_kodi-addon-dev-kit_include_kodi_gui_dialogs +xbmc/addons/kodi-addon-dev-kit/include/kodi/tools addons_kodi-addon-dev-kit_include_kodi_tools +xbmc/addons/settings addons_settings xbmc/commons commons xbmc/dbwrappers dbwrappers xbmc/dialogs dialogs diff --git a/xbmc/addons/interfaces/Addon/CMakeLists.txt b/xbmc/addons/interfaces/Addon/CMakeLists.txt index 1dbb94cf82a6d..de94db4b15fb0 100644 --- a/xbmc/addons/interfaces/Addon/CMakeLists.txt +++ b/xbmc/addons/interfaces/Addon/CMakeLists.txt @@ -2,4 +2,4 @@ set(SOURCES AddonCallbacksAddon.cpp) set(HEADERS AddonCallbacksAddon.h) -core_add_library(addonInterface_Addon) +core_add_library(addons_interfaces_addon) diff --git a/xbmc/addons/interfaces/CMakeLists.txt b/xbmc/addons/interfaces/CMakeLists.txt index 33a52a13db2c8..940cd360fb627 100644 --- a/xbmc/addons/interfaces/CMakeLists.txt +++ b/xbmc/addons/interfaces/CMakeLists.txt @@ -10,4 +10,4 @@ set(HEADERS AddonInterfaces.h Filesystem.h Network.h) -core_add_library(addonsBinaryInterfaces) +core_add_library(addons_interfaces) diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt new file mode 100644 index 0000000000000..80e9275e99371 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/CMakeLists.txt @@ -0,0 +1,24 @@ +set(HEADERS AddonBase.h + AudioEngine.h + Filesystem.h + General.h + Network.h + StreamCodec.h + StreamCrypto.h + kodi_game_dll.h + kodi_game_types.h + kodi_vfs_types.h + libKODI_game.h + libKODI_guilib.h + libXBMC_addon.h + libXBMC_pvr.h + versions.h + xbmc_addon_dll.h + xbmc_addon_types.h + xbmc_epg_types.h + xbmc_pvr_dll.h + xbmc_pvr_types.h) + +if(NOT ENABLE_STATIC_LIBS) + core_add_library(addons_kodi-addon-dev-kit_include_kodi) +endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt new file mode 100644 index 0000000000000..ba4f88944414d --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/CMakeLists.txt @@ -0,0 +1,15 @@ +set(HEADERS AudioDSP.h + AudioDecoder.h + AudioEncoder.h + ImageDecoder.h + Inputstream.h + Peripheral.h + PeripheralUtils.h + Screensaver.h + VFS.h + VideoCodec.h + Visualization.h) + +if(NOT ENABLE_STATIC_LIBS) + core_add_library(addons_kodi-addon-dev-kit_include_kodi_addon-instance) +endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/CMakeLists.txt new file mode 100644 index 0000000000000..91cef7f5adac9 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/CMakeLists.txt @@ -0,0 +1,8 @@ +set(HEADERS General.h + ListItem.h + Window.h + definitions.h) + +if(NOT ENABLE_STATIC_LIBS) + core_add_library(addons_kodi-addon-dev-kit_include_kodi_gui) +endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/CMakeLists.txt new file mode 100644 index 0000000000000..c7cc1ddcd9cd0 --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/CMakeLists.txt @@ -0,0 +1,16 @@ +set(HEADERS Button.h + Edit.h + FadeLabel.h + Image.h + Label.h + Progress.h + RadioButton.h + Rendering.h + SettingsSlider.h + Slider.h + Spin.h + TextBox.h) + +if(NOT ENABLE_STATIC_LIBS) + core_add_library(addons_kodi-addon-dev-kit_include_kodi_gui_controls) +endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/CMakeLists.txt new file mode 100644 index 0000000000000..7227343d1ad0f --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/CMakeLists.txt @@ -0,0 +1,14 @@ +set(HEADERS ContextMenu.h + ExtendedProgress.h + FileBrowser.h + Keyboard.h + Numeric.h + OK.h + Progress.h + Select.h + TextViewer.h + YesNo.h) + +if(NOT ENABLE_STATIC_LIBS) + core_add_library(addons_kodi-addon-dev-kit_include_kodi_gui_dialogs) +endif() diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/tools/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/tools/CMakeLists.txt new file mode 100644 index 0000000000000..939585c963e0c --- /dev/null +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/tools/CMakeLists.txt @@ -0,0 +1,5 @@ +set(HEADERS DllHelper.h ) + +if(NOT ENABLE_STATIC_LIBS) + core_add_library(addons_kodi-addon-dev-kit_include_kodi_tools) +endif() diff --git a/xbmc/addons/settings/CMakeLists.txt b/xbmc/addons/settings/CMakeLists.txt index 3810201b556b8..eaf10e2b4cbd1 100644 --- a/xbmc/addons/settings/CMakeLists.txt +++ b/xbmc/addons/settings/CMakeLists.txt @@ -6,4 +6,4 @@ set(HEADERS AddonSettings.h GUIDialogAddonSettings.h SettingUrlEncodedString.h) -core_add_library(addonsSettings) +core_add_library(addons_settings) From 9420c9d553f5bb85985067867070f9ca76ccdbf2 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Wed, 6 Sep 2017 13:23:35 +0200 Subject: [PATCH 027/113] [guiinfo][cmake] add header-only directory xbmc/guiinfo. --- cmake/treedata/common/subdirs.txt | 1 + xbmc/guiinfo/CMakeLists.txt | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 xbmc/guiinfo/CMakeLists.txt diff --git a/cmake/treedata/common/subdirs.txt b/cmake/treedata/common/subdirs.txt index ec1af634c4c70..0c34a281722ab 100644 --- a/cmake/treedata/common/subdirs.txt +++ b/cmake/treedata/common/subdirs.txt @@ -17,6 +17,7 @@ xbmc/commons commons xbmc/dbwrappers dbwrappers xbmc/dialogs dialogs xbmc/favourites favourites +xbmc/guiinfo guiinfo xbmc/guilib guilib xbmc/input input xbmc/input/joysticks input/joysticks diff --git a/xbmc/guiinfo/CMakeLists.txt b/xbmc/guiinfo/CMakeLists.txt new file mode 100644 index 0000000000000..4c01446be34f7 --- /dev/null +++ b/xbmc/guiinfo/CMakeLists.txt @@ -0,0 +1,5 @@ +set(HEADERS GUIInfoLabels.h) + +if(NOT ENABLE_STATIC_LIBS) + core_add_library(guiinfo) +endif() From 61dd70e032c6e25e6aebb05857941ffe8b6919ba Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Mon, 4 Sep 2017 20:00:59 +0200 Subject: [PATCH 028/113] [PVR][video] Rework 'reset resume point' implementation; make it work also for PVR recordings. --- xbmc/pvr/recordings/PVRRecordings.cpp | 20 +++- xbmc/pvr/recordings/PVRRecordings.h | 10 +- xbmc/video/ContextMenus.cpp | 7 +- xbmc/video/VideoLibraryQueue.cpp | 9 ++ xbmc/video/VideoLibraryQueue.h | 7 ++ xbmc/video/jobs/CMakeLists.txt | 6 +- .../jobs/VideoLibraryResetResumePointJob.cpp | 94 +++++++++++++++++++ .../jobs/VideoLibraryResetResumePointJob.h | 47 ++++++++++ 8 files changed, 190 insertions(+), 10 deletions(-) create mode 100644 xbmc/video/jobs/VideoLibraryResetResumePointJob.cpp create mode 100644 xbmc/video/jobs/VideoLibraryResetResumePointJob.h diff --git a/xbmc/pvr/recordings/PVRRecordings.cpp b/xbmc/pvr/recordings/PVRRecordings.cpp index 2109c9eb03ac5..9535f5fe2ec9e 100644 --- a/xbmc/pvr/recordings/PVRRecordings.cpp +++ b/xbmc/pvr/recordings/PVRRecordings.cpp @@ -523,7 +523,7 @@ bool CPVRRecordings::ChangeRecordingsPlayCount(const CFileItemPtr &item, int cou items.Add(item); CLog::Log(LOGDEBUG, "CPVRRecordings - %s - will set watched for %d items", __FUNCTION__, items.Size()); - for (int i=0;iGetPVRRecordingInfoTag(); + if (recording && m_database.IsOpen()) + { + bResult = true; + + m_database.ClearBookMarksOfFile(item->GetPath(), CBookmark::RESUME); + recording->SetResumePoint(CBookmark()); + + CServiceBroker::GetPVRManager().PublishEvent(RecordingsInvalidated); + } + + return bResult; +} diff --git a/xbmc/pvr/recordings/PVRRecordings.h b/xbmc/pvr/recordings/PVRRecordings.h index ec77edc7503f4..8ac042e8ea864 100644 --- a/xbmc/pvr/recordings/PVRRecordings.h +++ b/xbmc/pvr/recordings/PVRRecordings.h @@ -52,11 +52,12 @@ namespace PVR bool HasDeletedRadioRecordings() const; /** - * Deletes the item in question, be it a directory or a file + * @brief Deletes the item in question, be it a directory or a file * @param item the item to delete * @return whether the item was deleted successfully */ bool Delete(const CFileItem &item); + bool Undelete(const CFileItem &item); bool DeleteAllRecordingsFromTrash(); bool RenameRecording(CFileItem &item, std::string &strNewName); @@ -64,6 +65,13 @@ namespace PVR bool IncrementRecordingsPlayCount(const CFileItemPtr &item); bool MarkWatched(const CFileItemPtr &item, bool bWatched); + /** + * @brief Resets a recording's resume point, if any + * @param item The item to process + * @return True, if the item's resume point was reset successfully, false otherwise + */ + bool ResetResumePoint(const CFileItemPtr item); + bool GetDirectory(const std::string& strPath, CFileItemList &items); CFileItemPtr GetByPath(const std::string &path); CPVRRecordingPtr GetById(int iClientId, const std::string &strRecordingId) const; diff --git a/xbmc/video/ContextMenus.cpp b/xbmc/video/ContextMenus.cpp index bad143eb4f9c9..014b08f300b78 100644 --- a/xbmc/video/ContextMenus.cpp +++ b/xbmc/video/ContextMenus.cpp @@ -60,12 +60,7 @@ bool CRemoveResumePoint::IsVisible(const CFileItem& itemIn) const bool CRemoveResumePoint::Execute(const CFileItemPtr& item) const { - CVideoDatabase videoDatabase; - if (videoDatabase.Open()) - { - videoDatabase.DeleteResumeBookMark(*item); - } - + CVideoLibraryQueue::GetInstance().ResetResumePoint(item); return true; } diff --git a/xbmc/video/VideoLibraryQueue.cpp b/xbmc/video/VideoLibraryQueue.cpp index bd6e5e3711396..923e060f61ff7 100644 --- a/xbmc/video/VideoLibraryQueue.cpp +++ b/xbmc/video/VideoLibraryQueue.cpp @@ -30,6 +30,7 @@ #include "video/jobs/VideoLibraryJob.h" #include "video/jobs/VideoLibraryMarkWatchedJob.h" #include "video/jobs/VideoLibraryRefreshingJob.h" +#include "video/jobs/VideoLibraryResetResumePointJob.h" #include "video/jobs/VideoLibraryScanningJob.h" CVideoLibraryQueue::CVideoLibraryQueue() @@ -153,6 +154,14 @@ void CVideoLibraryQueue::MarkAsWatched(const CFileItemPtr &item, bool watched) AddJob(new CVideoLibraryMarkWatchedJob(item, watched)); } +void CVideoLibraryQueue::ResetResumePoint(const CFileItemPtr item) +{ + if (item == nullptr) + return; + + AddJob(new CVideoLibraryResetResumePointJob(item)); +} + void CVideoLibraryQueue::AddJob(CVideoLibraryJob *job) { if (job == NULL) diff --git a/xbmc/video/VideoLibraryQueue.h b/xbmc/video/VideoLibraryQueue.h index b72393aae48c7..22fc062e5d86f 100644 --- a/xbmc/video/VideoLibraryQueue.h +++ b/xbmc/video/VideoLibraryQueue.h @@ -111,6 +111,13 @@ class CVideoLibraryQueue : protected CJobQueue */ void MarkAsWatched(const CFileItemPtr &item, bool watched); + /*! + \brief Queue a reset resume point job. + + \param[in] item Item to reset the resume point for + */ + void ResetResumePoint(const CFileItemPtr item); + /*! \brief Adds the given job to the queue. diff --git a/xbmc/video/jobs/CMakeLists.txt b/xbmc/video/jobs/CMakeLists.txt index 5a71f7cf41a3e..b63d8fec11fb4 100644 --- a/xbmc/video/jobs/CMakeLists.txt +++ b/xbmc/video/jobs/CMakeLists.txt @@ -3,13 +3,15 @@ set(SOURCES VideoLibraryCleaningJob.cpp VideoLibraryMarkWatchedJob.cpp VideoLibraryProgressJob.cpp VideoLibraryRefreshingJob.cpp - VideoLibraryScanningJob.cpp) + VideoLibraryScanningJob.cpp + VideoLibraryResetResumePointJob.cpp) set(HEADERS VideoLibraryCleaningJob.h VideoLibraryJob.h VideoLibraryMarkWatchedJob.h VideoLibraryProgressJob.h VideoLibraryRefreshingJob.h - VideoLibraryScanningJob.h) + VideoLibraryScanningJob.h + VideoLibraryResetResumePointJob.h) core_add_library(video_jobs) diff --git a/xbmc/video/jobs/VideoLibraryResetResumePointJob.cpp b/xbmc/video/jobs/VideoLibraryResetResumePointJob.cpp new file mode 100644 index 0000000000000..7dc2b91cc9e15 --- /dev/null +++ b/xbmc/video/jobs/VideoLibraryResetResumePointJob.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2017 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include "VideoLibraryResetResumePointJob.h" + +#include + +#include "FileItem.h" +#include "ServiceBroker.h" +#include "Util.h" +#include "filesystem/IDirectory.h" +#ifdef HAS_UPNP +#include "network/upnp/UPnP.h" +#endif +#include "profiles/ProfilesManager.h" +#include "pvr/PVRManager.h" +#include "pvr/recordings/PVRRecordings.h" +#include "utils/URIUtils.h" +#include "video/VideoDatabase.h" + +CVideoLibraryResetResumePointJob::CVideoLibraryResetResumePointJob(const CFileItemPtr item) + : m_item(item) +{ +} + +bool CVideoLibraryResetResumePointJob::operator==(const CJob* job) const +{ + if (strcmp(job->GetType(), GetType()) != 0) + return false; + + const CVideoLibraryResetResumePointJob* resetJob = dynamic_cast(job); + if (!resetJob) + return false; + + return m_item->IsSamePath(resetJob->m_item.get()); +} + +bool CVideoLibraryResetResumePointJob::Work(CVideoDatabase &db) +{ + if (!CProfilesManager::GetInstance().GetCurrentProfile().canWriteDatabases()) + return false; + + CFileItemList items; + items.Add(std::make_shared(*m_item)); + + if (m_item->m_bIsFolder) + CUtil::GetRecursiveListing(m_item->GetPath(), items, "", XFILE::DIR_FLAG_NO_FILE_INFO); + + std::vector resetItems; + for (const auto& item : items) + { +#ifdef HAS_UPNP + if (URIUtils::IsUPnP(item->GetPath()) && UPNP::CUPnP::SaveFileState(*item, CBookmark(), false /* updatePlayCount */)) + continue; +#endif + + if (item->HasPVRRecordingInfoTag() && CServiceBroker::GetPVRManager().Recordings()->ResetResumePoint(item)) + continue; + + resetItems.emplace_back(item); + } + + if (resetItems.empty()) + return true; + + db.BeginTransaction(); + + for (const auto& resetItem : resetItems) + { + db.DeleteResumeBookMark(*resetItem); + } + + db.CommitTransaction(); + db.Close(); + + return true; +} diff --git a/xbmc/video/jobs/VideoLibraryResetResumePointJob.h b/xbmc/video/jobs/VideoLibraryResetResumePointJob.h new file mode 100644 index 0000000000000..0afa0e249fb3a --- /dev/null +++ b/xbmc/video/jobs/VideoLibraryResetResumePointJob.h @@ -0,0 +1,47 @@ +#pragma once +/* + * Copyright (C) 2017 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include "FileItem.h" +#include "video/jobs/VideoLibraryJob.h" + +/*! + \brief Video library job implementation for resetting a resume point. + */ +class CVideoLibraryResetResumePointJob : public CVideoLibraryJob +{ +public: + /*! + \brief Creates a new job for resetting a given item's resume point. + + \param[in] item Item for that the resume point shall be reset. + */ + CVideoLibraryResetResumePointJob(const CFileItemPtr item); + ~CVideoLibraryResetResumePointJob() override = default; + + const char *GetType() const override { return "CVideoLibraryResetResumePointJob"; } + bool operator==(const CJob* job) const override; + +protected: + bool Work(CVideoDatabase &db) override; + +private: + CFileItemPtr m_item; +}; From 4a1edd8408ecc6ab750cb07e88bb6c12332d326b Mon Sep 17 00:00:00 2001 From: phate89 Date: Mon, 7 Nov 2016 15:06:13 +0100 Subject: [PATCH 029/113] Add helpers for GUIDialogOK --- xbmc/dialogs/GUIDialogOK.cpp | 16 +++++ xbmc/dialogs/GUIDialogOK.h | 10 +++ xbmc/guilib/GUIWindowManager.cpp | 28 ++++++++- xbmc/messaging/ApplicationMessenger.h | 3 +- xbmc/messaging/helpers/CMakeLists.txt | 6 +- xbmc/messaging/helpers/DialogOKHelper.cpp | 56 +++++++++++++++++ xbmc/messaging/helpers/DialogOKHelper.h | 76 +++++++++++++++++++++++ 7 files changed, 191 insertions(+), 4 deletions(-) create mode 100644 xbmc/messaging/helpers/DialogOKHelper.cpp create mode 100644 xbmc/messaging/helpers/DialogOKHelper.h diff --git a/xbmc/dialogs/GUIDialogOK.cpp b/xbmc/dialogs/GUIDialogOK.cpp index 0374fb1644d82..4c0a5dc17acd3 100644 --- a/xbmc/dialogs/GUIDialogOK.cpp +++ b/xbmc/dialogs/GUIDialogOK.cpp @@ -71,6 +71,22 @@ bool CGUIDialogOK::ShowAndGetInput(CVariant heading, CVariant line0, CVariant li return dialog->IsConfirmed(); } +bool CGUIDialogOK::ShowAndGetInput(const KODI::MESSAGING::HELPERS::DialogOKMessage & options) +{ + if (!options.heading.isNull()) + SetHeading(options.heading); + if (!options.text.isNull()) + SetText(options.text); + + for (size_t i = 0; i < 3; ++i) + { + if (!options.lines[i].isNull()) + SetLine(i, options.lines[i]); + } + Open(); + return IsConfirmed(); +} + void CGUIDialogOK::OnInitWindow() { SET_CONTROL_HIDDEN(CONTROL_NO_BUTTON); diff --git a/xbmc/dialogs/GUIDialogOK.h b/xbmc/dialogs/GUIDialogOK.h index 6ba50580df9ba..d458eec00eaa7 100644 --- a/xbmc/dialogs/GUIDialogOK.h +++ b/xbmc/dialogs/GUIDialogOK.h @@ -21,6 +21,7 @@ */ #include "GUIDialogBoxBase.h" +#include "messaging/helpers/DialogOKHelper.h" class CGUIMessage; class CVariant; @@ -34,6 +35,15 @@ class CGUIDialogOK : bool OnMessage(CGUIMessage& message) override; static bool ShowAndGetInput(CVariant heading, CVariant text); static bool ShowAndGetInput(CVariant heading, CVariant line0, CVariant line1, CVariant line2); + /*! + \brief Open a OK dialog and wait for input + + \param[in] options a struct of type DialogOKMessage containing + the options to set for this dialog. + + \sa KODI::MESSAGING::HELPERS::DialogOKMessage + */ + bool ShowAndGetInput(const KODI::MESSAGING::HELPERS::DialogOKMessage& options); protected: void OnInitWindow() override; int GetDefaultLabelID(int controlId) const override; diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp index 8ea3703e232cd..3717302434129 100644 --- a/xbmc/guilib/GUIWindowManager.cpp +++ b/xbmc/guilib/GUIWindowManager.cpp @@ -956,6 +956,8 @@ void CGUIWindowManager::OnApplicationMessage(ThreadMessage* pMsg) break; case TMSG_GUI_DIALOG_YESNO: + { + if (!pMsg->lpVoid && pMsg->param1 < 0 && pMsg->param2 < 0) return; @@ -973,7 +975,31 @@ void CGUIWindowManager::OnApplicationMessage(ThreadMessage* pMsg) pMsg->SetResult(dialog->ShowAndGetInput(options)); } - break; + } + break; + + case TMSG_GUI_DIALOG_OK: + { + + if (!pMsg->lpVoid && pMsg->param1 < 0 && pMsg->param2 < 0) + return; + + auto dialogOK = static_cast(GetWindow(WINDOW_DIALOG_OK)); + if (!dialogOK) + return; + + if (pMsg->lpVoid) + dialogOK->ShowAndGetInput(*static_cast(pMsg->lpVoid)); + else + { + HELPERS::DialogOKMessage options; + options.heading = pMsg->param1; + options.text = pMsg->param2; + dialogOK->ShowAndGetInput(options); + } + pMsg->SetResult(static_cast(dialogOK->IsConfirmed())); + } + break; } } diff --git a/xbmc/messaging/ApplicationMessenger.h b/xbmc/messaging/ApplicationMessenger.h index 78beb461f129c..b81f4fd41544b 100644 --- a/xbmc/messaging/ApplicationMessenger.h +++ b/xbmc/messaging/ApplicationMessenger.h @@ -133,6 +133,7 @@ \sa HELPERS::DialogYesNoMessage */ #define TMSG_GUI_DIALOG_YESNO TMSG_MASK_WINDOWMANAGER + 8 +#define TMSG_GUI_DIALOG_OK TMSG_MASK_WINDOWMANAGER + 9 /*! \def TMSG_GUI_PREVIOUS_WINDOW @@ -141,7 +142,7 @@ This is an alternative to TMSG_GUI_ACTIVATE_WINDOW, but it keeps all configured parameters, like startup directory. */ -#define TMSG_GUI_PREVIOUS_WINDOW TMSG_MASK_WINDOWMANAGER + 9 +#define TMSG_GUI_PREVIOUS_WINDOW TMSG_MASK_WINDOWMANAGER + 10 #define TMSG_CALLBACK 800 diff --git a/xbmc/messaging/helpers/CMakeLists.txt b/xbmc/messaging/helpers/CMakeLists.txt index 918bc369ae2a9..288ba7cc3e00e 100644 --- a/xbmc/messaging/helpers/CMakeLists.txt +++ b/xbmc/messaging/helpers/CMakeLists.txt @@ -1,5 +1,7 @@ -set(SOURCES DialogHelper.cpp) +set(SOURCES DialogHelper.cpp + DialogOKHelper.cpp) -set(HEADERS DialogHelper.h) +set(HEADERS DialogHelper.h + DialogOKHelper.h) core_add_library(messagingHelpers) diff --git a/xbmc/messaging/helpers/DialogOKHelper.cpp b/xbmc/messaging/helpers/DialogOKHelper.cpp new file mode 100644 index 0000000000000..747aada614293 --- /dev/null +++ b/xbmc/messaging/helpers/DialogOKHelper.cpp @@ -0,0 +1,56 @@ +/* +* Copyright (C) 2005-2015 Team Kodi +* http://kodi.tv +* +* This Program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2, 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 +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Kodi; see the file COPYING. If not, see +* . +* +*/ + +#include "DialogOKHelper.h" +#include "messaging/ApplicationMessenger.h" + +namespace KODI +{ +namespace MESSAGING +{ +namespace HELPERS +{ +bool ShowOKDialogText(CVariant heading, CVariant text) +{ + DialogOKMessage options; + options.heading = std::move(heading); + options.text = std::move(text); + + if (CApplicationMessenger::GetInstance().SendMsg(TMSG_GUI_DIALOG_OK, -1, -1, static_cast(&options)) > 0) + return true; + return false; +} + +bool ShowOKDialogLines(CVariant heading, CVariant line0, CVariant line1, CVariant line2) +{ + DialogOKMessage options; + options.heading = std::move(heading); + options.lines[0] = std::move(line0); + options.lines[1] = std::move(line1); + options.lines[2] = std::move(line2); + + if (CApplicationMessenger::GetInstance().SendMsg(TMSG_GUI_DIALOG_OK, -1, -1, static_cast(&options)) > 0) + return true; + return false; +} + +} +} +} \ No newline at end of file diff --git a/xbmc/messaging/helpers/DialogOKHelper.h b/xbmc/messaging/helpers/DialogOKHelper.h new file mode 100644 index 0000000000000..18371fdfac79a --- /dev/null +++ b/xbmc/messaging/helpers/DialogOKHelper.h @@ -0,0 +1,76 @@ +#pragma once +/* +* Copyright (C) 2005-2015 Team Kodi +* http://kodi.tv +* +* This Program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2, 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 +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Kodi; see the file COPYING. If not, see +* . +* +*/ + +#include "utils/Variant.h" + +#include +#include + +namespace KODI +{ +namespace MESSAGING +{ +namespace HELPERS +{ + +/*! \struct DialogOkMessage DialogHelper.h "messaging/helpers/DialogHelper.h" + \brief Payload sent for message TMSG_GUI_DIALOG_OK + + \sa ShowOKDialogText + \sa ShowOKDialogLines +*/ +struct DialogOKMessage +{ + CVariant heading; //!< Heading to be displayed in the dialog box + CVariant text; //!< Body text to be displayed, this is mutually exclusive with lines below + std::array lines; //!< Body text to be displayed, specified as three lines. This is mutually exclusive with the text above +}; + +/*! + \brief This is a helper method to send a threadmessage to open a Ok dialog box + + \param[in] heading The text to display as the dialog box header + \param[in] text The text to display in the dialog body + \return if it's confirmed + \sa ShowOKDialogLines + \sa CGUIDialogOK::ShowAndGetInput + \sa DialogOKMessage +*/ +bool ShowOKDialogText(CVariant heading, CVariant text); + +/*! + \brief This is a helper method to send a threadmessage to open a OK dialog box + + \param[in] heading The text to display as the dialog box header + \param[in] line0 The text to display on the first line + \param[in] line1 The text to display on the second line + \param[in] line2 The text to display on the third line + \return if it's confirmed + \sa ShowOKDialogText + \sa CGUIDialogOK::ShowAndGetInput + \sa DialogOKMessage +*/ +bool ShowOKDialogLines(CVariant heading, CVariant line0, CVariant line1 = CVariant(), + CVariant line2 = CVariant()); + +} +} +} \ No newline at end of file From 95caad3cead87b05fc3aa9b9a80e9e6cd464ea07 Mon Sep 17 00:00:00 2001 From: phate89 Date: Sat, 19 Aug 2017 17:23:21 +0200 Subject: [PATCH 030/113] Use the helper class instead of CGUIDialogOK and remove the dependency --- xbmc/Application.cpp | 8 ++-- xbmc/GUIPassword.cpp | 10 ++--- xbmc/PartyModeManager.cpp | 5 ++- xbmc/PlayListPlayer.cpp | 4 +- xbmc/addons/AddonInstaller.cpp | 6 +-- xbmc/addons/AddonStatusHandler.cpp | 10 +---- xbmc/addons/GUIDialogAddonInfo.cpp | 6 +-- xbmc/addons/binary-addons/AddonDll.cpp | 39 +++++-------------- .../interfaces/GUI/AddonCallbacksGUI.cpp | 6 +-- xbmc/addons/interfaces/GUI/dialogs/OK.cpp | 8 ++-- .../settings/GUIDialogAddonSettings.cpp | 6 ++- xbmc/cdrip/CDDARipper.cpp | 5 ++- .../ActiveAE/AudioDSPAddons/ActiveAEDSP.cpp | 1 - xbmc/dialogs/GUIDialogFileBrowser.cpp | 11 +++--- xbmc/dialogs/GUIDialogGamepad.cpp | 8 ++-- xbmc/dialogs/GUIDialogKeyboardGeneric.cpp | 1 - xbmc/dialogs/GUIDialogNumeric.cpp | 7 ++-- xbmc/dialogs/GUIDialogOK.h | 4 +- xbmc/filesystem/AddonsDirectory.cpp | 5 ++- xbmc/filesystem/IDirectory.cpp | 5 ++- xbmc/games/GameUtils.cpp | 4 +- xbmc/games/addons/GameClient.cpp | 7 ++-- .../dialogs/GUIDialogButtonCapture.cpp | 4 +- .../windows/GUIControllerWindow.cpp | 7 ++-- .../dialogs/GUIDialogSelectGameClient.cpp | 5 ++- xbmc/guilib/GUIKeyboardFactory.cpp | 4 +- xbmc/interfaces/legacy/Dialog.cpp | 19 +-------- xbmc/music/MusicDatabase.cpp | 12 +++--- xbmc/music/windows/GUIWindowMusicBase.cpp | 19 ++++----- xbmc/music/windows/GUIWindowMusicNav.cpp | 4 +- xbmc/network/NetworkServices.cpp | 24 ++++++------ xbmc/peripherals/Peripherals.cpp | 5 ++- xbmc/pictures/GUIWindowPictures.cpp | 5 ++- xbmc/profiles/ProfilesManager.cpp | 1 - xbmc/pvr/PVRGUIActions.cpp | 26 ++++++------- xbmc/pvr/channels/PVRChannelGroupInternal.cpp | 5 ++- .../dialogs/GUIDialogPVRChannelManager.cpp | 17 ++++---- xbmc/pvr/dialogs/GUIDialogPVRGroupManager.cpp | 5 ++- xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp | 4 +- xbmc/pvr/recordings/PVRRecording.cpp | 3 +- xbmc/pvr/timers/PVRTimerInfoTag.cpp | 11 +++--- xbmc/pvr/windows/GUIWindowPVRBase.cpp | 4 +- xbmc/pvr/windows/GUIWindowPVRSearch.cpp | 6 ++- xbmc/pvr/windows/GUIWindowPVRTimersBase.cpp | 5 ++- xbmc/settings/DiscSettings.cpp | 6 ++- .../dialogs/GUIDialogAudioDSPManager.cpp | 5 ++- xbmc/settings/windows/GUIControlSettings.cpp | 1 - xbmc/video/VideoDatabase.cpp | 4 +- xbmc/video/VideoInfoDownloader.cpp | 10 +---- xbmc/video/VideoInfoScanner.cpp | 4 +- xbmc/video/dialogs/GUIDialogVideoInfo.cpp | 10 ++--- xbmc/video/jobs/VideoLibraryRefreshingJob.cpp | 8 ++-- xbmc/video/windows/GUIWindowVideoBase.cpp | 15 +++---- xbmc/video/windows/GUIWindowVideoNav.cpp | 8 ++-- xbmc/windows/GUIMediaWindow.cpp | 8 ++-- xbmc/windows/GUIWindowFileManager.cpp | 12 +++--- xbmc/windows/GUIWindowLoginScreen.cpp | 4 +- xbmc/windows/GUIWindowWeather.cpp | 2 +- 58 files changed, 220 insertions(+), 238 deletions(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 8ee9a7b530da1..ed2122cf36bac 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -66,6 +66,7 @@ #include "messaging/ThreadMessage.h" #include "messaging/ApplicationMessenger.h" #include "messaging/helpers/DialogHelper.h" +#include "messaging/helpers/DialogOKHelper.h" #include "SectionLoader.h" #include "cores/DllLoader/DllLoaderContainer.h" #include "GUIUserMessages.h" @@ -139,7 +140,6 @@ // Dialog includes #include "video/dialogs/GUIDialogVideoBookmarks.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogKaiToast.h" #include "dialogs/GUIDialogSubMenu.h" #include "dialogs/GUIDialogButtonMenu.h" @@ -3201,7 +3201,7 @@ PlayBackRet CApplication::PlayFile(CFileItem item, const std::string& player, bo } else #endif - CGUIDialogOK::ShowAndGetInput(CVariant{435}, CVariant{436}); + HELPERS::ShowOKDialogText(CVariant{435}, CVariant{436}); return PLAYBACK_OK; } @@ -4165,7 +4165,7 @@ bool CApplication::OnMessage(CGUIMessage& message) { auto addonList = StringUtils::Join(m_incompatibleAddons, ", "); auto msg = StringUtils::Format(g_localizeStrings.Get(24149).c_str(), addonList.c_str()); - CGUIDialogOK::ShowAndGetInput(CVariant{24148}, CVariant{std::move(msg)}); + HELPERS::ShowOKDialogText(CVariant{24148}, CVariant{std::move(msg)}); m_incompatibleAddons.clear(); } @@ -4428,7 +4428,7 @@ void CApplication::ShowAppMigrationMessage() if (CFile::Exists("special://home/.kodi_data_was_migrated") && !CFile::Exists("special://home/.kodi_migration_info_shown")) { - CGUIDialogOK::ShowAndGetInput(CVariant{24128}, CVariant{24129}); + HELPERS::ShowOKDialogText(CVariant{24128}, CVariant{24129}); CFile tmpFile; // create the file which will prevent this dialog from appearing in the future tmpFile.OpenForWrite("special://home/.kodi_migration_info_shown"); diff --git a/xbmc/GUIPassword.cpp b/xbmc/GUIPassword.cpp index e2e7040c49811..472446ab6ce63 100644 --- a/xbmc/GUIPassword.cpp +++ b/xbmc/GUIPassword.cpp @@ -25,7 +25,6 @@ #include "dialogs/GUIDialogGamepad.h" #include "guilib/GUIKeyboardFactory.h" #include "dialogs/GUIDialogNumeric.h" -#include "dialogs/GUIDialogOK.h" #include "profiles/ProfilesManager.h" #include "profiles/dialogs/GUIDialogLockSettings.h" #include "profiles/dialogs/GUIDialogProfileSettings.h" @@ -35,6 +34,7 @@ #include "guilib/GUIWindowManager.h" #include "FileItem.h" #include "guilib/LocalizeStrings.h" +#include "messaging/helpers/DialogOKHelper.h" #include "utils/StringUtils.h" #include "view/ViewStateSettings.h" #include "utils/Variant.h" @@ -73,7 +73,7 @@ bool CGUIPassword::IsItemUnlocked(CFileItem* pItem, const std::string &strType) { if (0 != CServiceBroker::GetSettings().GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES) && pItem->m_iBadPwdCount >= CServiceBroker::GetSettings().GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES)) { // user previously exhausted all retries, show access denied error - CGUIDialogOK::ShowAndGetInput(CVariant{12345}, CVariant{12346}); + HELPERS::ShowOKDialogText(CVariant{12345}, CVariant{12346}); return false; } // show the appropriate lock dialog @@ -148,7 +148,7 @@ bool CGUIPassword::CheckStartUpLock() std::string strLabel = StringUtils::Format("%i %s", iLeft, strLabel1.c_str()); // PopUp OK and Display: MasterLock mode has changed but no new Mastercode has been set! - CGUIDialogOK::ShowAndGetInput(CVariant{12360}, CVariant{12367}, CVariant{strLabel}, CVariant{""}); + HELPERS::ShowOKDialogLines(CVariant{12360}, CVariant{12367}, CVariant{strLabel}, CVariant{""}); } else i=g_passwordManager.iMasterLockRetriesLeft; @@ -285,7 +285,7 @@ void CGUIPassword::UpdateMasterLockRetryCount(bool bResetCount) // user has run out of retry attempts g_passwordManager.iMasterLockRetriesLeft = 0; // Tell the user they ran out of retry attempts - CGUIDialogOK::ShowAndGetInput(CVariant{12345}, CVariant{12346}); + HELPERS::ShowOKDialogText(CVariant{12345}, CVariant{12346}); return ; } } @@ -294,7 +294,7 @@ void CGUIPassword::UpdateMasterLockRetryCount(bool bResetCount) dlgLine1 = StringUtils::Format("%d %s", g_passwordManager.iMasterLockRetriesLeft, g_localizeStrings.Get(12343).c_str()); - CGUIDialogOK::ShowAndGetInput(CVariant{20075}, CVariant{12345}, CVariant{std::move(dlgLine1)}, CVariant{0}); + HELPERS::ShowOKDialogLines(CVariant{20075}, CVariant{12345}, CVariant{std::move(dlgLine1)}, CVariant{0}); } else g_passwordManager.iMasterLockRetriesLeft = CServiceBroker::GetSettings().GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES); // user entered correct mastercode, reset retries to max allowed diff --git a/xbmc/PartyModeManager.cpp b/xbmc/PartyModeManager.cpp index 980eb907445f5..1b380e889d2b4 100644 --- a/xbmc/PartyModeManager.cpp +++ b/xbmc/PartyModeManager.cpp @@ -23,11 +23,11 @@ #include #include "Application.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogProgress.h" #include "guilib/GUIWindowManager.h" #include "GUIUserMessages.h" #include "interfaces/AnnouncementManager.h" +#include "messaging/helpers/DialogOKHelper.h" #include "music/MusicDatabase.h" #include "music/windows/GUIWindowMusicPlaylist.h" #include "PlayListPlayer.h" @@ -41,6 +41,7 @@ #include "utils/Variant.h" #include "video/VideoDatabase.h" +using namespace KODI::MESSAGING; using namespace PLAYLIST; #define QUEUE_DEPTH 10 @@ -514,7 +515,7 @@ void CPartyModeManager::Play(int iPos) void CPartyModeManager::OnError(int iError, const std::string& strLogMessage) { // open error dialog - CGUIDialogOK::ShowAndGetInput(CVariant{257}, CVariant{16030}, CVariant{iError}, CVariant{0}); + HELPERS::ShowOKDialogLines(CVariant{257}, CVariant{16030}, CVariant{iError}, CVariant{0}); CLog::Log(LOGERROR, "PARTY MODE MANAGER: %s", strLogMessage.c_str()); m_bEnabled = false; SendUpdateMessage(); diff --git a/xbmc/PlayListPlayer.cpp b/xbmc/PlayListPlayer.cpp index 61ea7d766593a..fc115f5ebc58f 100644 --- a/xbmc/PlayListPlayer.cpp +++ b/xbmc/PlayListPlayer.cpp @@ -25,7 +25,6 @@ #include "settings/AdvancedSettings.h" #include "GUIUserMessages.h" #include "guilib/GUIWindowManager.h" -#include "dialogs/GUIDialogOK.h" #include "playlists/PlayList.h" #include "utils/log.h" #include "utils/StringUtils.h" @@ -38,6 +37,7 @@ #include "URL.h" #include "messaging/ApplicationMessenger.h" #include "filesystem/VideoDatabaseFile.h" +#include "messaging/helpers/DialogOKHelper.h" using namespace PLAYLIST; using namespace KODI::MESSAGING; @@ -327,7 +327,7 @@ bool CPlayListPlayer::Play(int iSong, std::string player, bool bAutoPlay /* = fa CLog::Log(LOGDEBUG,"Playlist Player: one or more items failed to play... aborting playback"); // open error dialog - CGUIDialogOK::ShowAndGetInput(CVariant{16026}, CVariant{16027}); + HELPERS::ShowOKDialogText(CVariant{16026}, CVariant{16027}); CGUIMessage msg(GUI_MSG_PLAYLISTPLAYER_STOPPED, 0, 0, m_iCurrentPlayList, m_iCurrentSong); g_windowManager.SendThreadMessage(msg); diff --git a/xbmc/addons/AddonInstaller.cpp b/xbmc/addons/AddonInstaller.cpp index b2028e4840daf..1e9862fe37816 100644 --- a/xbmc/addons/AddonInstaller.cpp +++ b/xbmc/addons/AddonInstaller.cpp @@ -34,6 +34,7 @@ #include "settings/Settings.h" #include "messaging/ApplicationMessenger.h" #include "messaging/helpers/DialogHelper.h" +#include "messaging/helpers/DialogOKHelper.h" #include "favourites/FavouritesService.h" #include "FilesystemInstaller.h" #include "utils/JobManager.h" @@ -42,7 +43,6 @@ #include "guilib/GUIWindowManager.h" // for callback #include "GUIUserMessages.h" // for callback #include "utils/StringUtils.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogExtendedProgressBar.h" #include "URL.h" #ifdef TARGET_POSIX @@ -809,7 +809,7 @@ void CAddonInstallJob::ReportInstallError(const std::string& addonID, const std: activity = EventPtr(new CAddonManagementEvent(addon, EventLevel::Error, msg)); if (IsModal()) - CGUIDialogOK::ShowAndGetInput(CVariant{m_addon->Name()}, CVariant{msg}); + HELPERS::ShowOKDialogText(CVariant{m_addon->Name()}, CVariant{msg}); } else { @@ -818,7 +818,7 @@ void CAddonInstallJob::ReportInstallError(const std::string& addonID, const std: EventLevel::Error)); if (IsModal()) - CGUIDialogOK::ShowAndGetInput(CVariant{fileName}, CVariant{msg}); + HELPERS::ShowOKDialogText(CVariant{fileName}, CVariant{msg}); } CEventLog::GetInstance().Add(activity, !IsModal(), false); diff --git a/xbmc/addons/AddonStatusHandler.cpp b/xbmc/addons/AddonStatusHandler.cpp index e703d9aa67563..31d66327d1f62 100644 --- a/xbmc/addons/AddonStatusHandler.cpp +++ b/xbmc/addons/AddonStatusHandler.cpp @@ -24,8 +24,8 @@ #include "messaging/ApplicationMessenger.h" #include "guilib/GUIWindowManager.h" #include "dialogs/GUIDialogYesNo.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogKaiToast.h" +#include "messaging/helpers/DialogOKHelper.h" #include "settings/Settings.h" #include "utils/log.h" #include "utils/StringUtils.h" @@ -93,13 +93,7 @@ void CAddonStatusHandler::Process() /* Request to restart the AddOn and data structures need updated */ if (m_status == ADDON_STATUS_NEED_RESTART) { - CGUIDialogOK* pDialog = g_windowManager.GetWindow(WINDOW_DIALOG_OK); - if (!pDialog) return; - - pDialog->SetHeading(CVariant{heading}); - pDialog->SetLine(1, CVariant{24074}); - pDialog->Open(); - + HELPERS::ShowOKDialogLines(CVariant{heading}, CVariant{24074}); CAddonMgr::GetInstance().GetCallbackForType(m_addon->Type())->RequestRestart(m_addon, true); } /* Some required settings are missing/invalid */ diff --git a/xbmc/addons/GUIDialogAddonInfo.cpp b/xbmc/addons/GUIDialogAddonInfo.cpp index 5bf9c1d460e32..6725f787ad27e 100644 --- a/xbmc/addons/GUIDialogAddonInfo.cpp +++ b/xbmc/addons/GUIDialogAddonInfo.cpp @@ -31,7 +31,6 @@ #include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h" #include "dialogs/GUIDialogContextMenu.h" #include "dialogs/GUIDialogTextViewer.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogSelect.h" #include "dialogs/GUIDialogYesNo.h" #include "games/GameUtils.h" @@ -40,6 +39,7 @@ #include "guilib/GUIWindowManager.h" #include "input/Key.h" #include "messaging/helpers/DialogHelper.h" +#include "messaging/helpers/DialogOKHelper.h" #include "pictures/GUIWindowSlideShow.h" #include "settings/Settings.h" #include "utils/JobManager.h" @@ -294,7 +294,7 @@ void CGUIDialogAddonInfo::OnUpdate() } if (versions.empty()) - CGUIDialogOK::ShowAndGetInput(CVariant{21341}, CVariant{21342}); + HELPERS::ShowOKDialogText(CVariant{21341}, CVariant{21342}); else { int i = AskForVersion(versions); @@ -421,7 +421,7 @@ bool CGUIDialogAddonInfo::PromptIfDependency(int heading, int line2) { std::string line0 = StringUtils::Format(g_localizeStrings.Get(24046).c_str(), m_localAddon->Name().c_str()); std::string line1 = StringUtils::Join(deps, ", "); - CGUIDialogOK::ShowAndGetInput(CVariant{heading}, CVariant{std::move(line0)}, CVariant{std::move(line1)}, CVariant{line2}); + HELPERS::ShowOKDialogLines(CVariant{heading}, CVariant{std::move(line0)}, CVariant{std::move(line1)}, CVariant{line2}); return true; } return false; diff --git a/xbmc/addons/binary-addons/AddonDll.cpp b/xbmc/addons/binary-addons/AddonDll.cpp index 667255c59741a..237a3a3e1ddfb 100644 --- a/xbmc/addons/binary-addons/AddonDll.cpp +++ b/xbmc/addons/binary-addons/AddonDll.cpp @@ -28,11 +28,11 @@ #include "events/EventLog.h" #include "events/NotificationEvent.h" #include "guilib/GUIWindowManager.h" -#include "dialogs/GUIDialogOK.h" #include "utils/URIUtils.h" #include "filesystem/File.h" #include "filesystem/SpecialProtocol.h" #include "filesystem/Directory.h" +#include "messaging/helpers/DialogOKHelper.h" #include "settings/lib/SettingSection.h" #include "utils/log.h" #include "utils/StringUtils.h" @@ -46,6 +46,7 @@ #include "addons/interfaces/Network.h" #include "addons/interfaces/GUI/General.h" +using namespace KODI::MESSAGING; namespace ADDON { @@ -135,16 +136,8 @@ bool CAddonDll::LoadDll() delete m_pDll; m_pDll = NULL; - CGUIDialogOK* pDialog = g_windowManager.GetWindow(WINDOW_DIALOG_OK); - if (pDialog) - { - std::string heading = StringUtils::Format("%s: %s", CAddonInfo::TranslateType(Type(), true).c_str(), Name().c_str()); - pDialog->SetHeading(CVariant{heading}); - pDialog->SetLine(1, CVariant{24070}); - pDialog->SetLine(2, CVariant{24071}); - pDialog->SetLine(2, CVariant{"Can't load shared library"}); - pDialog->Open(); - } + std::string heading = StringUtils::Format("%s: %s", CAddonInfo::TranslateType(Type(), true).c_str(), Name().c_str()); + HELPERS::ShowOKDialogLines(CVariant{heading}, CVariant{24070}, CVariant{24071}); return false; } @@ -202,16 +195,9 @@ ADDON_STATUS CAddonDll::Create(ADDON_TYPE type, void* funcTable, void* info) else { // Addon failed initialization CLog::Log(LOGERROR, "ADDON: Dll %s - Client returned bad status (%i) from Create and is not usable", Name().c_str(), status); - - CGUIDialogOK* pDialog = g_windowManager.GetWindow(WINDOW_DIALOG_OK); - if (pDialog) - { - std::string heading = StringUtils::Format("%s: %s", CAddonInfo::TranslateType(Type(), true).c_str(), Name().c_str()); - pDialog->SetHeading(CVariant{heading}); - pDialog->SetLine(1, CVariant{24070}); - pDialog->SetLine(2, CVariant{24071}); - pDialog->Open(); - } + + std::string heading = StringUtils::Format("%s: %s", CAddonInfo::TranslateType(Type(), true).c_str(), Name().c_str()); + HELPERS::ShowOKDialogLines(CVariant{ heading }, CVariant{ 24070 }, CVariant{ 24071 }); } return status; @@ -258,15 +244,8 @@ ADDON_STATUS CAddonDll::Create(KODI_HANDLE firstKodiInstance) CLog::Log(LOGERROR, "ADDON: Dll %s - Client returned bad status (%i) from Create and is not usable", Name().c_str(), status); // @todo currently a copy and paste from other function and becomes improved. - CGUIDialogOK* pDialog = g_windowManager.GetWindow(WINDOW_DIALOG_OK); - if (pDialog) - { - std::string heading = StringUtils::Format("%s: %s", CAddonInfo::TranslateType(Type(), true).c_str(), Name().c_str()); - pDialog->SetHeading(CVariant{heading}); - pDialog->SetLine(1, CVariant{24070}); - pDialog->SetLine(2, CVariant{24071}); - pDialog->Open(); - } + std::string heading = StringUtils::Format("%s: %s", CAddonInfo::TranslateType(Type(), true).c_str(), Name().c_str()); + HELPERS::ShowOKDialogLines(CVariant{ heading }, CVariant{ 24070 }, CVariant{ 24071 }); } return status; diff --git a/xbmc/addons/interfaces/GUI/AddonCallbacksGUI.cpp b/xbmc/addons/interfaces/GUI/AddonCallbacksGUI.cpp index 4690c90c7319b..6aa3bcf5cf0e4 100644 --- a/xbmc/addons/interfaces/GUI/AddonCallbacksGUI.cpp +++ b/xbmc/addons/interfaces/GUI/AddonCallbacksGUI.cpp @@ -28,7 +28,6 @@ #include "addons/Addon.h" #include "addons/Skin.h" #include "dialogs/GUIDialogNumeric.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogFileBrowser.h" #include "dialogs/GUIDialogTextViewer.h" #include "dialogs/GUIDialogSelect.h" @@ -43,6 +42,7 @@ #include "input/Key.h" #include "messaging/ApplicationMessenger.h" #include "messaging/helpers/DialogHelper.h" +#include "messaging/helpers/DialogOKHelper.h" #include "utils/log.h" #include "utils/URIUtils.h" #include "utils/StringUtils.h" @@ -1854,12 +1854,12 @@ bool CAddonCallbacksGUI::Dialog_FileBrowser_ShowAndGetFile(const char *directory //@{ void CAddonCallbacksGUI::Dialog_OK_ShowAndGetInputSingleText(const char *heading, const char *text) { - CGUIDialogOK::ShowAndGetInput(CVariant{heading}, CVariant{text}); + HELPERS::ShowOKDialogText(CVariant{heading}, CVariant{text}); } void CAddonCallbacksGUI::Dialog_OK_ShowAndGetInputLineText(const char *heading, const char *line0, const char *line1, const char *line2) { - CGUIDialogOK::ShowAndGetInput(CVariant{heading}, CVariant{line0}, CVariant{line1}, CVariant{line2}); + HELPERS::ShowOKDialogLines(CVariant{heading}, CVariant{line0}, CVariant{line1}, CVariant{line2}); } //@} diff --git a/xbmc/addons/interfaces/GUI/dialogs/OK.cpp b/xbmc/addons/interfaces/GUI/dialogs/OK.cpp index b6fbc58893bf4..d74e59025529f 100644 --- a/xbmc/addons/interfaces/GUI/dialogs/OK.cpp +++ b/xbmc/addons/interfaces/GUI/dialogs/OK.cpp @@ -22,9 +22,10 @@ #include "addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/OK.h" #include "addons/binary-addons/AddonDll.h" -#include "dialogs/GUIDialogOK.h" +#include "messaging/helpers/DialogOKHelper.h" #include "utils/log.h" #include "utils/Variant.h" +using namespace KODI::MESSAGING; extern "C" { @@ -54,7 +55,7 @@ void Interface_GUIDialogOK::show_and_get_input_single_text(void* kodiBase, const return; } - CGUIDialogOK::ShowAndGetInput(CVariant{heading}, CVariant{text}); + HELPERS::ShowOKDialogText(CVariant{heading}, CVariant{text}); } void Interface_GUIDialogOK::show_and_get_input_line_text(void* kodiBase, const char *heading, const char *line0, const char *line1, const char *line2) @@ -66,8 +67,7 @@ void Interface_GUIDialogOK::show_and_get_input_line_text(void* kodiBase, const c __FUNCTION__, addon, heading, line0, line1, line2); return; } - - CGUIDialogOK::ShowAndGetInput(CVariant{heading}, CVariant{line0}, CVariant{line1}, CVariant{line2}); + HELPERS::ShowOKDialogLines(CVariant{ heading }, CVariant{ line0 }, CVariant{ line1 }, CVariant{ line2 }); } } /* namespace ADDON */ diff --git a/xbmc/addons/settings/GUIDialogAddonSettings.cpp b/xbmc/addons/settings/GUIDialogAddonSettings.cpp index fc9d3092ed4cb..b5978da028954 100644 --- a/xbmc/addons/settings/GUIDialogAddonSettings.cpp +++ b/xbmc/addons/settings/GUIDialogAddonSettings.cpp @@ -22,14 +22,16 @@ #include "GUIPassword.h" #include "GUIUserMessages.h" #include "addons/settings/AddonSettings.h" -#include "dialogs/GUIDialogOK.h" #include "guilib/GUIWindowManager.h" #include "guilib/WindowIDs.h" #include "guilib/LocalizeStrings.h" +#include "messaging/helpers/DialogOKHelper.h" #include "settings/lib/SettingsManager.h" #include "utils/StringUtils.h" #include "utils/Variant.h" +using namespace KODI::MESSAGING; + CGUIDialogAddonSettings::CGUIDialogAddonSettings() : CGUIDialogSettingsManagerBase(WINDOW_DIALOG_ADDON_SETTINGS, "DialogAddonSettings.xml") { } @@ -80,7 +82,7 @@ bool CGUIDialogAddonSettings::ShowForAddon(const ADDON::AddonPtr &addon, bool sa if (!addon->HasSettings()) { // addon does not support settings, inform user - CGUIDialogOK::ShowAndGetInput(CVariant{ 24000 }, CVariant{ 24030 }); + HELPERS::ShowOKDialogText(CVariant{ 24000 }, CVariant{ 24030 }); return false; } diff --git a/xbmc/cdrip/CDDARipper.cpp b/xbmc/cdrip/CDDARipper.cpp index a47100c35e36f..8fda15ecdea35 100644 --- a/xbmc/cdrip/CDDARipper.cpp +++ b/xbmc/cdrip/CDDARipper.cpp @@ -33,7 +33,6 @@ #include "music/tags/MusicInfoTag.h" #include "guilib/GUIWindowManager.h" #include "guilib/LocalizeStrings.h" -#include "dialogs/GUIDialogOK.h" #include "settings/AdvancedSettings.h" #include "settings/SettingPath.h" #include "settings/Settings.h" @@ -48,10 +47,12 @@ #include "music/MusicDatabase.h" #include "addons/AudioEncoder.h" #include "addons/binary-addons/BinaryAddonBase.h" +#include "messaging/helpers/DialogOKHelper.h" using namespace ADDON; using namespace XFILE; using namespace MUSIC_INFO; +using namespace KODI::MESSAGING; CCDDARipper& CCDDARipper::GetInstance() { @@ -168,7 +169,7 @@ bool CCDDARipper::CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag, std:: // no rip path has been set, show error CLog::Log(LOGERROR, "Error: CDDARipPath has not been set"); g_graphicsContext.Lock(); - CGUIDialogOK::ShowAndGetInput(CVariant{257}, CVariant{608}); + HELPERS::ShowOKDialogText(CVariant{257}, CVariant{608}); g_graphicsContext.Unlock(); return false; } diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.cpp index 2cfdc479508c5..3f9399936b32e 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.cpp @@ -37,7 +37,6 @@ extern "C" { #include "cores/AudioEngine/Interfaces/AEResample.h" #include "cores/AudioEngine/Utils/AEUtil.h" #include "dialogs/GUIDialogKaiToast.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogSelect.h" #include "guiinfo/GUIInfoLabels.h" #include "guilib/GUIWindowManager.h" diff --git a/xbmc/dialogs/GUIDialogFileBrowser.cpp b/xbmc/dialogs/GUIDialogFileBrowser.cpp index f373d08ca1597..346346b50778c 100644 --- a/xbmc/dialogs/GUIDialogFileBrowser.cpp +++ b/xbmc/dialogs/GUIDialogFileBrowser.cpp @@ -31,7 +31,6 @@ #include "GUIPassword.h" #include "guilib/GUIWindowManager.h" #include "Application.h" -#include "GUIDialogOK.h" #include "GUIDialogYesNo.h" #include "guilib/GUIKeyboardFactory.h" #include "GUIUserMessages.h" @@ -47,7 +46,9 @@ #include "URL.h" #include "utils/Variant.h" #include "settings/AdvancedSettings.h" +#include "messaging/helpers/DialogOKHelper.h" +using namespace KODI::MESSAGING; using namespace XFILE; #define CONTROL_LIST 450 @@ -223,7 +224,7 @@ bool CGUIDialogFileBrowser::OnMessage(CGUIMessage& message) Close(); } else - CGUIDialogOK::ShowAndGetInput(CVariant{257}, CVariant{20072}); + HELPERS::ShowOKDialogText(CVariant{257}, CVariant{20072}); } else { @@ -255,7 +256,7 @@ bool CGUIDialogFileBrowser::OnMessage(CGUIMessage& message) if (CDirectory::Create(strPath)) Update(m_vecItems->GetPath()); else - CGUIDialogOK::ShowAndGetInput(CVariant{20069}, CVariant{20072}); + HELPERS::ShowOKDialogText(CVariant{20069}, CVariant{20072}); } } else if (message.GetSenderId() == CONTROL_FLIP) @@ -568,7 +569,7 @@ bool CGUIDialogFileBrowser::HaveDiscOrConnection( int iDriveType ) { if ( !g_mediaManager.IsDiscInDrive() ) { - CGUIDialogOK::ShowAndGetInput(CVariant{218}, CVariant{219}); + HELPERS::ShowOKDialogText(CVariant{218}, CVariant{219}); return false; } } @@ -577,7 +578,7 @@ bool CGUIDialogFileBrowser::HaveDiscOrConnection( int iDriveType ) //! @todo Handle not connected to a remote share if ( !g_application.getNetwork().IsConnected() ) { - CGUIDialogOK::ShowAndGetInput(CVariant{220}, CVariant{221}); + HELPERS::ShowOKDialogText(CVariant{220}, CVariant{221}); return false; } } diff --git a/xbmc/dialogs/GUIDialogGamepad.cpp b/xbmc/dialogs/GUIDialogGamepad.cpp index d839147a1b029..d0bd1152aacd5 100644 --- a/xbmc/dialogs/GUIDialogGamepad.cpp +++ b/xbmc/dialogs/GUIDialogGamepad.cpp @@ -23,13 +23,15 @@ #include "utils/StringUtils.h" #include "guilib/GUIAudioManager.h" #include "guilib/GUIWindowManager.h" -#include "GUIDialogOK.h" #include "input/Key.h" #include "guilib/LocalizeStrings.h" +#include "messaging/helpers/DialogOKHelper.h" #include "utils/Variant.h" #include +using namespace KODI::MESSAGING; + CGUIDialogGamepad::CGUIDialogGamepad(void) : CGUIDialogBoxBase(WINDOW_DIALOG_GAMEPAD, "DialogConfirm.xml") { @@ -208,7 +210,7 @@ bool CGUIDialogGamepad::ShowAndVerifyNewPassword(std::string& strNewPassword) if (ShowAndVerifyInput(strUserInput, "12340", "12330", "12331", "", true, true)) { //! @todo Show error to user saying the password entry was blank - CGUIDialogOK::ShowAndGetInput(CVariant{12357}, CVariant{12358}); // Password is empty/blank + HELPERS::ShowOKDialogText(CVariant{12357}, CVariant{12358}); // Password is empty/blank return false; } @@ -220,7 +222,7 @@ bool CGUIDialogGamepad::ShowAndVerifyNewPassword(std::string& strNewPassword) if (!ShowAndVerifyInput(strUserInput, "12341", "12330", "12331", "", false, true)) { //! @todo Show error to user saying the password re-entry failed - CGUIDialogOK::ShowAndGetInput(CVariant{12357}, CVariant{12344}); // Password do not match + HELPERS::ShowOKDialogText(CVariant{12357}, CVariant{12344}); // Password do not match return false; } diff --git a/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp b/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp index f33d3c98a79ff..19c3e909079ce 100644 --- a/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp +++ b/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp @@ -29,7 +29,6 @@ #include "guilib/LocalizeStrings.h" #include "GUIUserMessages.h" #include "GUIDialogNumeric.h" -#include "GUIDialogOK.h" #include "GUIDialogKeyboardGeneric.h" #include "ServiceBroker.h" #include "settings/Settings.h" diff --git a/xbmc/dialogs/GUIDialogNumeric.cpp b/xbmc/dialogs/GUIDialogNumeric.cpp index d130cff205bc2..8bad8e3398b38 100644 --- a/xbmc/dialogs/GUIDialogNumeric.cpp +++ b/xbmc/dialogs/GUIDialogNumeric.cpp @@ -25,13 +25,13 @@ #include "guilib/GUILabelControl.h" #include "utils/md5.h" #include "guilib/GUIWindowManager.h" -#include "GUIDialogOK.h" #include "input/XBMC_vkeys.h" #include "utils/StringUtils.h" #include "utils/Variant.h" #include "input/Key.h" #include "guilib/LocalizeStrings.h" #include "interfaces/AnnouncementManager.h" +#include "messaging/helpers/DialogOKHelper.h" #define CONTROL_HEADING_LABEL 1 #define CONTROL_INPUT_LABEL 4 @@ -42,6 +42,7 @@ #define CONTROL_NEXT 22 #define CONTROL_BACKSPACE 23 +using namespace KODI::MESSAGING; CGUIDialogNumeric::CGUIDialogNumeric(void) : CGUIDialog(WINDOW_DIALOG_NUMERIC, "DialogNumeric.xml") @@ -565,7 +566,7 @@ bool CGUIDialogNumeric::ShowAndVerifyNewPassword(std::string& strNewPassword) if (!ShowAndVerifyInput(strUserInput, g_localizeStrings.Get(12340), false)) { // Show error to user saying the password entry was blank - CGUIDialogOK::ShowAndGetInput(CVariant{12357}, CVariant{12358}); // Password is empty/blank + HELPERS::ShowOKDialogText(CVariant{12357}, CVariant{12358}); // Password is empty/blank return false; } @@ -577,7 +578,7 @@ bool CGUIDialogNumeric::ShowAndVerifyNewPassword(std::string& strNewPassword) if (!ShowAndVerifyInput(strUserInput, g_localizeStrings.Get(12341), true)) { // Show error to user saying the password re-entry failed - CGUIDialogOK::ShowAndGetInput(CVariant{12357}, CVariant{12344}); // Password do not match + HELPERS::ShowOKDialogText(CVariant{12357}, CVariant{12344}); // Password do not match return false; } diff --git a/xbmc/dialogs/GUIDialogOK.h b/xbmc/dialogs/GUIDialogOK.h index d458eec00eaa7..899c53e73b381 100644 --- a/xbmc/dialogs/GUIDialogOK.h +++ b/xbmc/dialogs/GUIDialogOK.h @@ -26,6 +26,8 @@ class CGUIMessage; class CVariant; +using namespace KODI::MESSAGING; + class CGUIDialogOK : public CGUIDialogBoxBase { @@ -43,7 +45,7 @@ class CGUIDialogOK : \sa KODI::MESSAGING::HELPERS::DialogOKMessage */ - bool ShowAndGetInput(const KODI::MESSAGING::HELPERS::DialogOKMessage& options); + bool ShowAndGetInput(const HELPERS::DialogOKMessage& options); protected: void OnInitWindow() override; int GetDefaultLabelID(int controlId) const override; diff --git a/xbmc/filesystem/AddonsDirectory.cpp b/xbmc/filesystem/AddonsDirectory.cpp index 0013af6b8b0b0..746776013b155 100644 --- a/xbmc/filesystem/AddonsDirectory.cpp +++ b/xbmc/filesystem/AddonsDirectory.cpp @@ -33,11 +33,11 @@ #include "addons/BinaryAddonCache.h" #include "addons/PluginSource.h" #include "addons/RepositoryUpdater.h" -#include "dialogs/GUIDialogOK.h" #include "games/addons/GameClient.h" #include "games/GameUtils.h" #include "guilib/TextureManager.h" #include "File.h" +#include "messaging/helpers/DialogOKHelper.h" #include "settings/Settings.h" #include "SpecialProtocol.h" #include "utils/URIUtils.h" @@ -46,6 +46,7 @@ using namespace KODI; using namespace ADDON; +using namespace KODI::MESSAGING; namespace XFILE { @@ -558,7 +559,7 @@ static bool Browse(const CURL& path, CFileItemList &items) if (!database.GetRepositoryContent(addon->ID(), addons)) { - CGUIDialogOK::ShowAndGetInput(CVariant{addon->Name()}, CVariant{24991}); + HELPERS::ShowOKDialogText(CVariant{addon->Name()}, CVariant{24991}); return false; } } diff --git a/xbmc/filesystem/IDirectory.cpp b/xbmc/filesystem/IDirectory.cpp index 0037c9a40bee8..0a54e2670c056 100644 --- a/xbmc/filesystem/IDirectory.cpp +++ b/xbmc/filesystem/IDirectory.cpp @@ -19,13 +19,14 @@ */ #include "IDirectory.h" -#include "dialogs/GUIDialogOK.h" #include "guilib/GUIKeyboardFactory.h" +#include "messaging/helpers/DialogOKHelper.h" #include "URL.h" #include "PasswordManager.h" #include "utils/URIUtils.h" #include "utils/StringUtils.h" +using namespace KODI::MESSAGING; using namespace XFILE; IDirectory::IDirectory(void) @@ -141,7 +142,7 @@ bool IDirectory::ProcessRequirements() } else if (type == "error") { - CGUIDialogOK::ShowAndGetInput(m_requirements["heading"], m_requirements["line1"], m_requirements["line2"], m_requirements["line3"]); + HELPERS::ShowOKDialogLines(CVariant{m_requirements["heading"]}, CVariant{m_requirements["line1"]}, CVariant{m_requirements["line2"]}, CVariant{m_requirements["line3"]}); } m_requirements.clear(); return false; diff --git a/xbmc/games/GameUtils.cpp b/xbmc/games/GameUtils.cpp index e813233d140a7..88d2aa9da2879 100644 --- a/xbmc/games/GameUtils.cpp +++ b/xbmc/games/GameUtils.cpp @@ -22,11 +22,11 @@ #include "addons/Addon.h" #include "addons/AddonManager.h" #include "addons/BinaryAddonCache.h" -#include "dialogs/GUIDialogOK.h" #include "games/addons/GameClient.h" #include "games/dialogs/GUIDialogSelectGameClient.h" #include "games/tags/GameInfoTag.h" #include "filesystem/SpecialProtocol.h" +#include "messaging/helpers/DialogOKHelper.h" #include "utils/StringUtils.h" #include "utils/URIUtils.h" #include "FileItem.h" @@ -64,7 +64,7 @@ bool CGameUtils::FillInGameClient(CFileItem &item, bool bPrompt) 35212; // "This game isn't compatible with any available emulators." // "Failed to play game" - CGUIDialogOK::ShowAndGetInput(CVariant{ 35210 }, CVariant{ errorTextId }); + KODI::MESSAGING::HELPERS::ShowOKDialogText(CVariant{ 35210 }, CVariant{ errorTextId }); } else if (candidates.size() == 1 && installable.empty()) { diff --git a/xbmc/games/addons/GameClient.cpp b/xbmc/games/addons/GameClient.cpp index 9461b2a5287ea..f4e455f02f6d1 100644 --- a/xbmc/games/addons/GameClient.cpp +++ b/xbmc/games/addons/GameClient.cpp @@ -29,7 +29,6 @@ #include "addons/AddonManager.h" #include "addons/BinaryAddonCache.h" #include "cores/AudioEngine/Utils/AEChannelInfo.h" -#include "dialogs/GUIDialogOK.h" #include "filesystem/Directory.h" #include "filesystem/SpecialProtocol.h" #include "games/addons/playback/GameClientRealtimePlayback.h" @@ -43,6 +42,7 @@ #include "input/joysticks/JoystickTypes.h" #include "input/InputManager.h" #include "messaging/ApplicationMessenger.h" +#include "messaging/helpers/DialogOKHelper.h" #include "peripherals/Peripherals.h" #include "profiles/ProfilesManager.h" #include "settings/Settings.h" @@ -61,6 +61,7 @@ using namespace KODI; using namespace GAME; +using namespace KODI::MESSAGING; #define EXTENSION_SEPARATOR "|" #define EXTENSION_WILDCARD "*" @@ -428,13 +429,13 @@ void CGameClient::NotifyError(GAME_ERROR error) { // Failed to play game // This game requires the following add-on: %s - CGUIDialogOK::ShowAndGetInput(CVariant{ 35210 }, StringUtils::Format(g_localizeStrings.Get(35211).c_str(), missingResource.c_str())); + HELPERS::ShowOKDialogText(CVariant{ 35210 }, CVariant{ StringUtils::Format(g_localizeStrings.Get(35211).c_str(), missingResource.c_str()) }); } else { // Failed to play game // The emulator "%s" had an internal error. - CGUIDialogOK::ShowAndGetInput(CVariant{ 35210 }, StringUtils::Format(g_localizeStrings.Get(35213).c_str(), Name().c_str())); + HELPERS::ShowOKDialogText(CVariant{ 35210 }, CVariant{ StringUtils::Format(g_localizeStrings.Get(35213).c_str(), Name().c_str()) }); } } diff --git a/xbmc/games/controllers/dialogs/GUIDialogButtonCapture.cpp b/xbmc/games/controllers/dialogs/GUIDialogButtonCapture.cpp index eed7f099040e7..4de158e0e1ef9 100644 --- a/xbmc/games/controllers/dialogs/GUIDialogButtonCapture.cpp +++ b/xbmc/games/controllers/dialogs/GUIDialogButtonCapture.cpp @@ -28,6 +28,7 @@ #include "input/joysticks/JoystickUtils.h" #include "input/IKeymap.h" #include "input/ActionIDs.h" +#include "messaging/helpers/DialogOKHelper.h" #include "peripherals/Peripherals.h" #include "utils/Variant.h" #include "ServiceBroker.h" @@ -37,6 +38,7 @@ using namespace KODI; using namespace GAME; +using namespace KODI::MESSAGING; CGUIDialogButtonCapture::CGUIDialogButtonCapture() : CThread("ButtonCaptureDlg") @@ -56,7 +58,7 @@ void CGUIDialogButtonCapture::Show() Create(); - bool bAccepted = CGUIDialogOK::ShowAndGetInput(CVariant{ GetDialogHeader() }, CVariant{ GetDialogText() }); + bool bAccepted = HELPERS::ShowOKDialogText(CVariant{ GetDialogHeader() }, CVariant{ GetDialogText() }); StopThread(false); diff --git a/xbmc/games/controllers/windows/GUIControllerWindow.cpp b/xbmc/games/controllers/windows/GUIControllerWindow.cpp index fa9a1a62abdc0..fde2822ebc96c 100644 --- a/xbmc/games/controllers/windows/GUIControllerWindow.cpp +++ b/xbmc/games/controllers/windows/GUIControllerWindow.cpp @@ -34,7 +34,7 @@ #include "ServiceBroker.h" // To check for button mapping support -#include "dialogs/GUIDialogOK.h" +#include "messaging/helpers/DialogOKHelper.h" #include "peripherals/bus/virtual/PeripheralBusAddon.h" #include "peripherals/Peripherals.h" #include "utils/log.h" @@ -44,6 +44,7 @@ using namespace KODI; using namespace GAME; +using namespace KODI::MESSAGING; CGUIControllerWindow::CGUIControllerWindow(void) : CGUIDialog(WINDOW_DIALOG_GAME_CONTROLLERS, "DialogGameControllers.xml"), @@ -295,7 +296,7 @@ void CGUIControllerWindow::GetMoreControllers(void) { // "Controller profiles" // "All available controller profiles are installed." - CGUIDialogOK::ShowAndGetInput(CVariant{ 35050 }, CVariant{ 35062 }); + HELPERS::ShowOKDialogText(CVariant{ 35050 }, CVariant{ 35062 }); return; } } @@ -310,7 +311,7 @@ void CGUIControllerWindow::ShowHelp(void) { // "Help" // - CGUIDialogOK::ShowAndGetInput(CVariant{10043}, CVariant{35055}); + HELPERS::ShowOKDialogText(CVariant{10043}, CVariant{35055}); } void CGUIControllerWindow::ShowButtonCaptureDialog(void) diff --git a/xbmc/games/dialogs/GUIDialogSelectGameClient.cpp b/xbmc/games/dialogs/GUIDialogSelectGameClient.cpp index 3f70d0d8fb97f..4d86ba52b8d19 100644 --- a/xbmc/games/dialogs/GUIDialogSelectGameClient.cpp +++ b/xbmc/games/dialogs/GUIDialogSelectGameClient.cpp @@ -23,13 +23,14 @@ #include "addons/AddonManager.h" #include "addons/GUIWindowAddonBrowser.h" #include "dialogs/GUIDialogContextMenu.h" -#include "dialogs/GUIDialogOK.h" #include "games/addons/GameClient.h" #include "guilib/GUIWindowManager.h" #include "guilib/WindowIDs.h" +#include "messaging/helpers/DialogOKHelper.h" #include "utils/log.h" using namespace KODI; +using namespace KODI::MESSAGING; using namespace GAME; std::string CGUIDialogSelectGameClient::ShowAndGetGameClient(const GameClientVector& candidates, const GameClientVector& installable) @@ -144,7 +145,7 @@ std::string CGUIDialogSelectGameClient::InstallGameClient(const GameClientVector CLog::Log(LOGERROR, "Select game client dialog: Failed to install %s", gameClientId.c_str()); // "Error" // "Failed to install add-on." - CGUIDialogOK::ShowAndGetInput(257, 35256); + HELPERS::ShowOKDialogText(257, 35256); } } else if (result == iAddonBrowser) diff --git a/xbmc/guilib/GUIKeyboardFactory.cpp b/xbmc/guilib/GUIKeyboardFactory.cpp index c561a172f3f01..e2ad6060eece6 100644 --- a/xbmc/guilib/GUIKeyboardFactory.cpp +++ b/xbmc/guilib/GUIKeyboardFactory.cpp @@ -23,9 +23,9 @@ #include "messaging/ApplicationMessenger.h" #include "LocalizeStrings.h" #include "GUIKeyboardFactory.h" -#include "dialogs/GUIDialogOK.h" #include "GUIUserMessages.h" #include "GUIWindowManager.h" +#include "messaging/helpers/DialogOKHelper.h" #include "settings/Settings.h" #include "utils/md5.h" #include "utils/StringUtils.h" @@ -169,7 +169,7 @@ bool CGUIKeyboardFactory::ShowAndVerifyNewPassword(std::string& newPassword, CVa StringUtils::ToLower(newPassword); return true; } - CGUIDialogOK::ShowAndGetInput(CVariant{12341}, CVariant{12344}); + HELPERS::ShowOKDialogText(CVariant{12341}, CVariant{12344}); return false; } diff --git a/xbmc/interfaces/legacy/Dialog.cpp b/xbmc/interfaces/legacy/Dialog.cpp index 7fed605c4b269..cfffce71beaf6 100644 --- a/xbmc/interfaces/legacy/Dialog.cpp +++ b/xbmc/interfaces/legacy/Dialog.cpp @@ -19,7 +19,6 @@ */ #include "LanguageHook.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogYesNo.h" #include "dialogs/GUIDialogSelect.h" #include "dialogs/GUIDialogContextMenu.h" @@ -37,6 +36,7 @@ #include "utils/Variant.h" #include "WindowException.h" #include "messaging/ApplicationMessenger.h" +#include "messaging/helpers/DialogOKHelper.h" #include "Dialog.h" #include "ListItem.h" #ifdef TARGET_POSIX @@ -182,22 +182,7 @@ namespace XBMCAddon const String& line3) { DelayedCallGuard dcguard(languageHook); - CGUIDialogOK* pDialog = g_windowManager.GetWindow(WINDOW_DIALOG_OK); - if (pDialog == NULL) - throw WindowException("Error: Window is NULL, this is not possible :-)"); - - if (!heading.empty()) - pDialog->SetHeading(CVariant{heading}); - if (!line1.empty()) - pDialog->SetLine(0, CVariant{line1}); - if (!line2.empty()) - pDialog->SetLine(1, CVariant{line2}); - if (!line3.empty()) - pDialog->SetLine(2, CVariant{line3}); - - pDialog->Open(); - - return pDialog->IsConfirmed(); + return HELPERS::ShowOKDialogLines(CVariant{heading}, CVariant{line1}, CVariant{line2}, CVariant{line3}); } void Dialog::textviewer(const String& heading, const String& text) diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp index 62e09be0b8cdb..c37a132b75c5a 100644 --- a/xbmc/music/MusicDatabase.cpp +++ b/xbmc/music/MusicDatabase.cpp @@ -30,7 +30,6 @@ #include "Artist.h" #include "dbwrappers/dataset.h" #include "dialogs/GUIDialogKaiToast.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogProgress.h" #include "dialogs/GUIDialogSelect.h" #include "FileItem.h" @@ -44,6 +43,7 @@ #include "guilib/LocalizeStrings.h" #include "interfaces/AnnouncementManager.h" #include "messaging/helpers/DialogHelper.h" +#include "messaging/helpers/DialogOKHelper.h" #include "music/tags/MusicInfoTag.h" #include "network/cddb.h" #include "network/Network.h" @@ -3402,7 +3402,7 @@ bool CMusicDatabase::LookupCDDBInfo(bool bRequery/*=false*/) pCdInfo->SetNoCDDBInfo(); // ..no, an error occured, display it to the user std::string strErrorText = StringUtils::Format("[%d] %s", cddb.getLastError(), cddb.getLastErrorText()); - CGUIDialogOK::ShowAndGetInput(CVariant{255}, CVariant{257}, CVariant{std::move(strErrorText)}, CVariant{0}); + HELPERS::ShowOKDialogLines(CVariant{255}, CVariant{257}, CVariant{std::move(strErrorText)}, CVariant{0}); } } // if ( !cddb.queryCDinfo( pCdInfo ) ) else @@ -3423,7 +3423,7 @@ void CMusicDatabase::DeleteCDDBInfo() CFileItemList items; if (!CDirectory::GetDirectory(CProfilesManager::GetInstance().GetCDDBFolder(), items, ".cddb", DIR_FLAG_NO_FILE_DIRS)) { - CGUIDialogOK::ShowAndGetInput(CVariant{313}, CVariant{426}); + HELPERS::ShowOKDialogText(CVariant{313}, CVariant{426}); return ; } // Show a selectdialog that the user can select the album to delete @@ -3494,7 +3494,7 @@ void CMusicDatabase::Clean() // other writing access to the database is prohibited. if (g_application.IsMusicScanning()) { - CGUIDialogOK::ShowAndGetInput(CVariant{189}, CVariant{14057}); + HELPERS::ShowOKDialogText(CVariant{189}, CVariant{14057}); return; } @@ -3508,7 +3508,7 @@ void CMusicDatabase::Clean() if (iReturnString != ERROR_OK) { - CGUIDialogOK::ShowAndGetInput(CVariant{313}, CVariant{iReturnString}); + HELPERS::ShowOKDialogText(CVariant{313}, CVariant{iReturnString}); } } } @@ -6432,7 +6432,7 @@ void CMusicDatabase::ExportToXML(const std::string &xmlFile, bool singleFile, bo progress->Close(); if (iFailCount > 0) - CGUIDialogOK::ShowAndGetInput(CVariant{20196}, CVariant{StringUtils::Format(g_localizeStrings.Get(15011).c_str(), iFailCount)}); + HELPERS::ShowOKDialogLines(CVariant{20196}, CVariant{StringUtils::Format(g_localizeStrings.Get(15011).c_str(), iFailCount)}); } void CMusicDatabase::ImportFromXML(const std::string &xmlFile) diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp index f431b1cfd73eb..3a961251065a5 100644 --- a/xbmc/music/windows/GUIWindowMusicBase.cpp +++ b/xbmc/music/windows/GUIWindowMusicBase.cpp @@ -45,11 +45,11 @@ #include "music/tags/MusicInfoTag.h" #include "guilib/GUIWindowManager.h" #include "input/Key.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogYesNo.h" #include "dialogs/GUIDialogProgress.h" #include "FileItem.h" #include "filesystem/File.h" +#include "messaging/helpers/DialogOKHelper.h" #include "profiles/ProfilesManager.h" #include "storage/MediaManager.h" #include "settings/AdvancedSettings.h" @@ -78,6 +78,7 @@ using namespace MUSICDATABASEDIRECTORY; using namespace PLAYLIST; using namespace MUSIC_GRABBER; using namespace MUSIC_INFO; +using namespace KODI::MESSAGING; #define CONTROL_BTNVIEWASICONS 2 #define CONTROL_BTNSORTBY 3 @@ -380,7 +381,7 @@ void CGUIWindowMusicBase::ShowArtistInfo(const CFileItem *pItem, bool bShowInfo if (g_application.IsMusicScanning()) { - CGUIDialogOK::ShowAndGetInput(CVariant{189}, CVariant{14057}); + HELPERS::ShowOKDialogText(CVariant{189}, CVariant{14057}); break; } @@ -397,7 +398,7 @@ void CGUIWindowMusicBase::ShowArtistInfo(const CFileItem *pItem, bool bShowInfo CMusicInfoScanner scanner; if (scanner.UpdateDatabaseArtistInfo(artist, scraper, bShowInfo, m_dlgProgress) != INFO_ADDED) { - CGUIDialogOK::ShowAndGetInput(CVariant{21889}, CVariant{20199}); + HELPERS::ShowOKDialogText(CVariant{21889}, CVariant{20199}); break; } } @@ -457,7 +458,7 @@ bool CGUIWindowMusicBase::ShowAlbumInfo(const CFileItem *pItem, bool bShowInfo / if (g_application.IsMusicScanning()) { - CGUIDialogOK::ShowAndGetInput(CVariant{189}, CVariant{14057}); + HELPERS::ShowOKDialogText(CVariant{189}, CVariant{14057}); if (m_dlgProgress) m_dlgProgress->Close(); return false; @@ -476,7 +477,7 @@ bool CGUIWindowMusicBase::ShowAlbumInfo(const CFileItem *pItem, bool bShowInfo / CMusicInfoScanner scanner; if (scanner.UpdateDatabaseAlbumInfo(album, scraper, bShowInfo, m_dlgProgress) != INFO_ADDED) { - CGUIDialogOK::ShowAndGetInput(CVariant{185}, CVariant{500}); + HELPERS::ShowOKDialogText(CVariant{185}, CVariant{500}); if (m_dlgProgress) m_dlgProgress->Close(); return false; @@ -688,7 +689,7 @@ void CGUIWindowMusicBase::AddItemToPlayList(const CFileItemPtr &pItem, CFileItem // load it if (!pPlayList->Load(pItem->GetPath())) { - CGUIDialogOK::ShowAndGetInput(CVariant{6}, CVariant{477}); + HELPERS::ShowOKDialogText(CVariant{6}, CVariant{477}); return; //hmmm unable to load playlist? } @@ -964,7 +965,7 @@ void CGUIWindowMusicBase::OnRipCD() #endif } else - CGUIDialogOK::ShowAndGetInput(CVariant{257}, CVariant{20099}); + HELPERS::ShowOKDialogText(CVariant{257}, CVariant{20099}); } } @@ -980,7 +981,7 @@ void CGUIWindowMusicBase::OnRipTrack(int iItem) #endif } else - CGUIDialogOK::ShowAndGetInput(CVariant{257}, CVariant{20099}); + HELPERS::ShowOKDialogText(CVariant{257}, CVariant{20099}); } } @@ -1062,7 +1063,7 @@ void CGUIWindowMusicBase::LoadPlayList(const std::string& strPlayList) // load it if (!pPlayList->Load(strPlayList)) { - CGUIDialogOK::ShowAndGetInput(CVariant{6}, CVariant{477}); + HELPERS::ShowOKDialogText(CVariant{6}, CVariant{477}); return; //hmmm unable to load playlist? } } diff --git a/xbmc/music/windows/GUIWindowMusicNav.cpp b/xbmc/music/windows/GUIWindowMusicNav.cpp index 003106e387291..18b5c5a75986b 100644 --- a/xbmc/music/windows/GUIWindowMusicNav.cpp +++ b/xbmc/music/windows/GUIWindowMusicNav.cpp @@ -38,7 +38,6 @@ #include "video/windows/GUIWindowVideoNav.h" #include "music/tags/MusicInfoTag.h" #include "guilib/GUIWindowManager.h" -#include "dialogs/GUIDialogOK.h" #include "guilib/GUIKeyboardFactory.h" #include "view/GUIViewState.h" #include "input/Key.h" @@ -47,6 +46,7 @@ #include "GUIUserMessages.h" #include "FileItem.h" #include "Application.h" +#include "messaging/helpers/DialogOKHelper.h" #include "messaging/ApplicationMessenger.h" #include "settings/Settings.h" #include "guilib/LocalizeStrings.h" @@ -854,7 +854,7 @@ bool CGUIWindowMusicNav::GetSongsFromPlayList(const std::string& strPlayList, CF // load it if (!pPlayList->Load(strPlayList)) { - CGUIDialogOK::ShowAndGetInput(CVariant{6}, CVariant{477}); + HELPERS::ShowOKDialogText(CVariant{6}, CVariant{477}); return false; //hmmm unable to load playlist? } CPlayList playlist = *pPlayList; diff --git a/xbmc/network/NetworkServices.cpp b/xbmc/network/NetworkServices.cpp index bb5f2c7f753c3..bcef8ff86a9c0 100644 --- a/xbmc/network/NetworkServices.cpp +++ b/xbmc/network/NetworkServices.cpp @@ -25,10 +25,10 @@ #include "Application.h" #include "ServiceBroker.h" #include "dialogs/GUIDialogKaiToast.h" -#include "dialogs/GUIDialogOK.h" #include "guilib/LocalizeStrings.h" #include "messaging/ApplicationMessenger.h" #include "messaging/helpers/DialogHelper.h" +#include "messaging/helpers/DialogOKHelper.h" #include "network/Network.h" #include "settings/AdvancedSettings.h" #include "settings/lib/Setting.h" @@ -188,7 +188,7 @@ bool CNetworkServices::OnSettingChanging(std::shared_ptr setting { if (!StartWebserver()) { - CGUIDialogOK::ShowAndGetInput(CVariant{33101}, CVariant{33100}); + HELPERS::ShowOKDialogText(CVariant{33101}, CVariant{33100}); return false; } } @@ -210,7 +210,7 @@ bool CNetworkServices::OnSettingChanging(std::shared_ptr setting // cannot disable if (IsAirPlayServerRunning() || IsAirTunesServerRunning()) { - CGUIDialogOK::ShowAndGetInput(CVariant{1259}, CVariant{34303}); + HELPERS::ShowOKDialogText(CVariant{1259}, CVariant{34303}); return false; } @@ -230,7 +230,7 @@ bool CNetworkServices::OnSettingChanging(std::shared_ptr setting // AirPlay needs zeroconf if (!CServiceBroker::GetSettings().GetBool(CSettings::SETTING_SERVICES_ZEROCONF)) { - CGUIDialogOK::ShowAndGetInput(CVariant{1273}, CVariant{34302}); + HELPERS::ShowOKDialogText(CVariant{1273}, CVariant{34302}); return false; } #endif //HAS_ZEROCONF @@ -239,14 +239,14 @@ bool CNetworkServices::OnSettingChanging(std::shared_ptr setting #ifdef HAS_AIRTUNES if (!StartAirTunesServer()) { - CGUIDialogOK::ShowAndGetInput(CVariant{1274}, CVariant{33100}); + HELPERS::ShowOKDialogText(CVariant{1274}, CVariant{33100}); return false; } #endif //HAS_AIRTUNES if (!StartAirPlayServer()) { - CGUIDialogOK::ShowAndGetInput(CVariant{1273}, CVariant{33100}); + HELPERS::ShowOKDialogText(CVariant{1273}, CVariant{33100}); return false; } } @@ -271,7 +271,7 @@ bool CNetworkServices::OnSettingChanging(std::shared_ptr setting { if (!StartAirPlayServer()) { - CGUIDialogOK::ShowAndGetInput(CVariant{1273}, CVariant{33100}); + HELPERS::ShowOKDialogText(CVariant{1273}, CVariant{33100}); return false; } } @@ -353,7 +353,7 @@ bool CNetworkServices::OnSettingChanging(std::shared_ptr setting #ifdef HAS_EVENT_SERVER if (!StartEventServer()) { - CGUIDialogOK::ShowAndGetInput(CVariant{33102}, CVariant{33100}); + HELPERS::ShowOKDialogText(CVariant{33102}, CVariant{33100}); result = false; } #endif // HAS_EVENT_SERVER @@ -361,7 +361,7 @@ bool CNetworkServices::OnSettingChanging(std::shared_ptr setting #ifdef HAS_JSONRPC if (!StartJSONRPCServer()) { - CGUIDialogOK::ShowAndGetInput(CVariant{33103}, CVariant{33100}); + HELPERS::ShowOKDialogText(CVariant{33103}, CVariant{33100}); result = false; } #endif // HAS_JSONRPC @@ -388,7 +388,7 @@ bool CNetworkServices::OnSettingChanging(std::shared_ptr setting if (!StartEventServer()) { - CGUIDialogOK::ShowAndGetInput(CVariant{33102}, CVariant{33100}); + HELPERS::ShowOKDialogText(CVariant{33102}, CVariant{33100}); return false; } @@ -408,7 +408,7 @@ bool CNetworkServices::OnSettingChanging(std::shared_ptr setting if (!StartEventServer()) { - CGUIDialogOK::ShowAndGetInput(CVariant{33102}, CVariant{33100}); + HELPERS::ShowOKDialogText(CVariant{33102}, CVariant{33100}); return false; } } @@ -422,7 +422,7 @@ bool CNetworkServices::OnSettingChanging(std::shared_ptr setting if (!StartJSONRPCServer()) { - CGUIDialogOK::ShowAndGetInput(CVariant{33103}, CVariant{33100}); + HELPERS::ShowOKDialogText(CVariant{33103}, CVariant{33100}); return false; } } diff --git a/xbmc/peripherals/Peripherals.cpp b/xbmc/peripherals/Peripherals.cpp index 1670202f209ec..61a1a0e748cb1 100644 --- a/xbmc/peripherals/Peripherals.cpp +++ b/xbmc/peripherals/Peripherals.cpp @@ -44,7 +44,6 @@ #include "devices/PeripheralNyxboard.h" #include "devices/PeripheralTuner.h" #include "dialogs/GUIDialogKaiToast.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogPeripheralSettings.h" #include "dialogs/GUIDialogSelect.h" #include "FileItem.h" @@ -58,6 +57,7 @@ #include "GUIUserMessages.h" #include "input/Key.h" #include "messaging/ApplicationMessenger.h" +#include "messaging/helpers/DialogOKHelper.h" #include "messaging/ThreadMessage.h" #include "settings/lib/Setting.h" #include "settings/Settings.h" @@ -77,6 +77,7 @@ using namespace KODI; using namespace JOYSTICK; using namespace PERIPHERALS; using namespace XFILE; +using namespace KODI::MESSAGING; CPeripherals::CPeripherals(ANNOUNCEMENT::CAnnouncementManager &announcements) : m_announcements(announcements), @@ -959,7 +960,7 @@ void CPeripherals::OnSettingAction(std::shared_ptr setting) PeripheralPtr peripheral = GetByPath(pItem->GetPath()); if (!peripheral || peripheral->GetSettings().empty()) { - CGUIDialogOK::ShowAndGetInput(CVariant{35000}, CVariant{35004}); + HELPERS::ShowOKDialogText(CVariant{35000}, CVariant{35004}); continue; } diff --git a/xbmc/pictures/GUIWindowPictures.cpp b/xbmc/pictures/GUIWindowPictures.cpp index a4283b5158795..6c2510c2949c1 100644 --- a/xbmc/pictures/GUIWindowPictures.cpp +++ b/xbmc/pictures/GUIWindowPictures.cpp @@ -34,8 +34,8 @@ #include "PictureInfoLoader.h" #include "guilib/GUIWindowManager.h" #include "input/Key.h" -#include "dialogs/GUIDialogOK.h" #include "view/GUIViewState.h" +#include "messaging/helpers/DialogOKHelper.h" #include "PlayListPlayer.h" #include "playlists/PlayList.h" #include "settings/MediaSourceSettings.h" @@ -60,6 +60,7 @@ using namespace XFILE; using namespace PLAYLIST; +using namespace KODI::MESSAGING; #define CONTROL_BTNSLIDESHOW 6 #define CONTROL_BTNSLIDESHOW_RECURSIVE 7 @@ -548,7 +549,7 @@ void CGUIWindowPictures::LoadPlayList(const std::string& strPlayList) { if (!pPlayList->Load(strPlayList)) { - CGUIDialogOK::ShowAndGetInput(CVariant{6}, CVariant{477}); + HELPERS::ShowOKDialogText(CVariant{6}, CVariant{477}); return ; //hmmm unable to load playlist? } } diff --git a/xbmc/profiles/ProfilesManager.cpp b/xbmc/profiles/ProfilesManager.cpp index c34524c99be9a..3c1ba3478ef21 100644 --- a/xbmc/profiles/ProfilesManager.cpp +++ b/xbmc/profiles/ProfilesManager.cpp @@ -32,7 +32,6 @@ #include "ServiceBroker.h" #include "Util.h" #include "addons/Skin.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogYesNo.h" #include "filesystem/Directory.h" #include "filesystem/DirectoryCache.h" diff --git a/xbmc/pvr/PVRGUIActions.cpp b/xbmc/pvr/PVRGUIActions.cpp index 4139acc297a67..25507e7a2669c 100644 --- a/xbmc/pvr/PVRGUIActions.cpp +++ b/xbmc/pvr/PVRGUIActions.cpp @@ -26,7 +26,6 @@ #include "dialogs/GUIDialogBusy.h" #include "dialogs/GUIDialogKaiToast.h" #include "dialogs/GUIDialogNumeric.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogProgress.h" #include "dialogs/GUIDialogSelect.h" #include "dialogs/GUIDialogYesNo.h" @@ -46,6 +45,7 @@ #include "pvr/PVRDatabase.h" #include "pvr/PVRItem.h" #include "pvr/PVRManager.h" +#include "messaging/helpers/DialogOKHelper.h" #include "pvr/addons/PVRClients.h" #include "pvr/channels/PVRChannelGroupsContainer.h" #include "pvr/dialogs/GUIDialogPVRChannelGuide.h" @@ -309,14 +309,14 @@ namespace PVR CPVRTimerInfoTagPtr rule (bCreateRule ? CServiceBroker::GetPVRManager().Timers()->GetTimerRule(timer) : nullptr); if (timer || rule) { - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19034}); // "Information", "There is already a timer set for this event" + HELPERS::ShowOKDialogText(CVariant{ 19033 }, CVariant{ 19034 }); // "Information", "There is already a timer set for this event" return false; } CPVRTimerInfoTagPtr newTimer(epgTag ? CPVRTimerInfoTag::CreateFromEpg(epgTag, bCreateRule) : CPVRTimerInfoTag::CreateInstantTimerTag(channel)); if (!newTimer) { - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, + HELPERS::ShowOKDialogText(CVariant{19033}, bCreateRule ? CVariant{19095} // "Information", "Timer rule creation failed. The PVR add-on does not support a suitable timer rule type." : CVariant{19094}); // "Information", "Timer creation failed. The PVR add-on does not support a suitable timer type." @@ -337,19 +337,19 @@ namespace PVR if (!item->Channel() && item->GetTimerType() && !item->GetTimerType()->IsEpgBasedTimerRule()) { CLog::Log(LOGERROR, "CPVRGUIActions - %s - no channel given", __FUNCTION__); - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19109}); // "Information", "Couldn't save timer. Check the log for more information about this message." + HELPERS::ShowOKDialogText(CVariant{19033}, CVariant{19109}); // "Information", "Couldn't save timer. Check the log for more information about this message." return false; } if (!CServiceBroker::GetPVRManager().Clients()->GetClientCapabilities(item->m_iClientId).SupportsTimers()) { - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19215}); // "Information", "The PVR backend does not support timers." + HELPERS::ShowOKDialogText(CVariant{19033}, CVariant{19215}); // "Information", "The PVR backend does not support timers." return false; } if (!item->IsTimerRule() && item->GetEpgInfoTag() && !item->GetEpgInfoTag()->IsRecordable()) { - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19189}); // "Information", "The PVR backend does not allow to record this event." + HELPERS::ShowOKDialogText(CVariant{19033}, CVariant{19189}); // "Information", "The PVR backend does not allow to record this event." return false; } @@ -587,7 +587,7 @@ namespace PVR bReturn = CServiceBroker::GetPVRManager().Timers()->AddTimer(newTimer); if (!bReturn) - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19164}); // "Information", "Can't start recording. Check the log for more information about this message." + HELPERS::ShowOKDialogText(CVariant{19033}, CVariant{19164}); // "Information", "Can't start recording. Check the log for more information about this message." } else if (!bOnOff && channel->IsRecording()) { @@ -854,7 +854,7 @@ namespace PVR if (!AsyncRenameRecording(strNewName).Execute(item)) { - CGUIDialogOK::ShowAndGetInput(CVariant{257}, CVariant{19111}); // "Error", "PVR backend error. Check the log for more information about this message." + HELPERS::ShowOKDialogText(CVariant{257}, CVariant{19111}); // "Error", "PVR backend error. Check the log for more information about this message." return false; } @@ -871,7 +871,7 @@ namespace PVR if (!AsyncDeleteRecording().Execute(item)) { - CGUIDialogOK::ShowAndGetInput(CVariant{257}, CVariant{19111}); // "Error", "PVR backend error. Check the log for more information about this message." + HELPERS::ShowOKDialogText(CVariant{257}, CVariant{19111}); // "Error", "PVR backend error. Check the log for more information about this message." return false; } @@ -914,7 +914,7 @@ namespace PVR if (!AsyncUndeleteRecording().Execute(item)) { - CGUIDialogOK::ShowAndGetInput(CVariant{257}, CVariant{19111}); // "Error", "PVR backend error. Check the log for more information about this message." + HELPERS::ShowOKDialogText(CVariant{257}, CVariant{19111}); // "Error", "PVR backend error. Check the log for more information about this message." return false; } @@ -1286,7 +1286,7 @@ namespace PVR /* no clients found */ else if (!scanClient) { - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, // "Information" + HELPERS::ShowOKDialogText(CVariant{19033}, // "Information" CVariant{19192}); // "None of the connected PVR backends supports scanning for channels." m_bChannelScanRunning = false; return false; @@ -1299,7 +1299,7 @@ namespace PVR /* do the scan */ if (scanClient->StartChannelScan() != PVR_ERROR_NO_ERROR) - CGUIDialogOK::ShowAndGetInput(CVariant{257}, // "Error" + HELPERS::ShowOKDialogText(CVariant{257}, // "Error" CVariant{19193}); // "The channel scan can't be started. Check the log for more information about this message." CLog::Log(LOGNOTICE, "CPVRGUIActions - %s - channel scan finished after %li.%li seconds", @@ -1567,7 +1567,7 @@ namespace PVR if (!bValidPIN) { // display message: The entered PIN number was incorrect - CGUIDialogOK::ShowAndGetInput(CVariant{19264}, CVariant{19265}); // "Incorrect PIN", "The entered PIN was incorrect." + HELPERS::ShowOKDialogText(CVariant{19264}, CVariant{19265}); // "Incorrect PIN", "The entered PIN was incorrect." } else { diff --git a/xbmc/pvr/channels/PVRChannelGroupInternal.cpp b/xbmc/pvr/channels/PVRChannelGroupInternal.cpp index 8fe11d0f3315f..7aa286f0a54f4 100644 --- a/xbmc/pvr/channels/PVRChannelGroupInternal.cpp +++ b/xbmc/pvr/channels/PVRChannelGroupInternal.cpp @@ -23,8 +23,8 @@ #include #include "ServiceBroker.h" -#include "dialogs/GUIDialogOK.h" #include "guilib/LocalizeStrings.h" +#include "messaging/helpers/DialogOKHelper.h" #include "settings/AdvancedSettings.h" #include "utils/Variant.h" #include "utils/log.h" @@ -37,6 +37,7 @@ #include "pvr/timers/PVRTimers.h" using namespace PVR; +using namespace KODI::MESSAGING; CPVRChannelGroupInternal::CPVRChannelGroupInternal(bool bRadio) : m_iHiddenChannels(0) @@ -166,7 +167,7 @@ bool CPVRChannelGroupInternal::RemoveFromGroup(const CPVRChannelPtr &channel) CPVRChannelPtr currentChannel(CServiceBroker::GetPVRManager().GetCurrentChannel()); if (currentChannel && currentChannel == channel) { - CGUIDialogOK::ShowAndGetInput(CVariant{19098}, CVariant{19102}); + HELPERS::ShowOKDialogText(CVariant{19098}, CVariant{19102}); return false; } diff --git a/xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp b/xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp index e9861ef9a0872..89db67d345780 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp @@ -25,7 +25,6 @@ #include "FileItem.h" #include "ServiceBroker.h" #include "dialogs/GUIDialogFileBrowser.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogProgress.h" #include "dialogs/GUIDialogSelect.h" #include "dialogs/GUIDialogYesNo.h" @@ -34,6 +33,7 @@ #include "guilib/GUIWindowManager.h" #include "guilib/LocalizeStrings.h" #include "input/Key.h" +#include "messaging/helpers/DialogOKHelper.h" #include "profiles/ProfilesManager.h" #include "settings/Settings.h" #include "storage/MediaManager.h" @@ -62,6 +62,7 @@ #define BUTTON_RADIO_TV 34 using namespace PVR; +using namespace KODI::MESSAGING; CGUIDialogPVRChannelManager::CGUIDialogPVRChannelManager(void) : CGUIDialog(WINDOW_DIALOG_PVR_CHANNEL_MANAGER, "DialogPVRChannelManager.xml"), @@ -475,9 +476,9 @@ bool CGUIDialogPVRChannelManager::OnClickButtonNewChannel() if (ret == PVR_ERROR_NO_ERROR) Update(); else if (ret == PVR_ERROR_NOT_IMPLEMENTED) - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19038}); // "Information", "Not supported by the PVR backend." + HELPERS::ShowOKDialogText(CVariant{19033}, CVariant{19038}); // "Information", "Not supported by the PVR backend." else - CGUIDialogOK::ShowAndGetInput(CVariant{2103}, CVariant{16029}); // "Add-on error", "Check the log for more information about this message." + HELPERS::ShowOKDialogText(CVariant{2103}, CVariant{16029}); // "Add-on error", "Check the log for more information about this message." } return true; } @@ -605,9 +606,9 @@ bool CGUIDialogPVRChannelManager::OnContextButton(int itemNumber, CONTEXT_BUTTON { PVR_ERROR ret = CServiceBroker::GetPVRManager().Clients()->OpenDialogChannelSettings(pItem->GetPVRChannelInfoTag()); if (ret == PVR_ERROR_NOT_IMPLEMENTED) - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19038}); // "Information", "Not supported by the PVR backend." + HELPERS::ShowOKDialogText(CVariant{19033}, CVariant{19038}); // "Information", "Not supported by the PVR backend." else if (ret != PVR_ERROR_NO_ERROR) - CGUIDialogOK::ShowAndGetInput(CVariant{2103}, CVariant{16029}); // "Add-on error", "Check the log for more information about this message." + HELPERS::ShowOKDialogText(CVariant{2103}, CVariant{16029}); // "Add-on error", "Check the log for more information about this message." } else if (button == CONTEXT_BUTTON_DELETE) { @@ -631,9 +632,9 @@ bool CGUIDialogPVRChannelManager::OnContextButton(int itemNumber, CONTEXT_BUTTON Renumber(); } else if (ret == PVR_ERROR_NOT_IMPLEMENTED) - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19038}); // "Information", "Not supported by the PVR backend." + HELPERS::ShowOKDialogText(CVariant{19033}, CVariant{19038}); // "Information", "Not supported by the PVR backend." else - CGUIDialogOK::ShowAndGetInput(CVariant{2103}, CVariant{16029}); // "Add-on error", "Check the log for more information about this message." + HELPERS::ShowOKDialogText(CVariant{2103}, CVariant{16029}); // "Add-on error", "Check the log for more information about this message." } } return true; @@ -735,7 +736,7 @@ void CGUIDialogPVRChannelManager::RenameChannel(const CFileItemPtr &pItem) channel->SetChannelName(strChannelName); if (!CServiceBroker::GetPVRManager().Clients()->RenameChannel(channel)) - CGUIDialogOK::ShowAndGetInput(CVariant{2103}, CVariant{16029}); // Add-on error;Check the log file for details. + HELPERS::ShowOKDialogText(CVariant{2103}, CVariant{16029}); // Add-on error;Check the log file for details. } } diff --git a/xbmc/pvr/dialogs/GUIDialogPVRGroupManager.cpp b/xbmc/pvr/dialogs/GUIDialogPVRGroupManager.cpp index 257692f83aa2b..ccc715c5e9f20 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRGroupManager.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRGroupManager.cpp @@ -22,19 +22,20 @@ #include "FileItem.h" #include "ServiceBroker.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogYesNo.h" #include "guilib/GUIKeyboardFactory.h" #include "guilib/GUIRadioButtonControl.h" #include "guilib/GUIWindowManager.h" #include "guilib/LocalizeStrings.h" #include "input/Key.h" +#include "messaging/helpers//DialogOKHelper.h" #include "utils/StringUtils.h" #include "utils/Variant.h" #include "pvr/PVRManager.h" #include "pvr/channels/PVRChannelGroupsContainer.h" +using namespace KODI::MESSAGING; using namespace PVR; #define CONTROL_LIST_CHANNELS_LEFT 11 @@ -203,7 +204,7 @@ bool CGUIDialogPVRGroupManager::ActionButtonUngroupedChannels(CGUIMessage &messa { if (m_channelGroups->GetFolderCount() == 0) { - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19137}); + HELPERS::ShowOKDialogText(CVariant{19033}, CVariant{19137}); } else if (m_ungroupedChannels->GetFileCount() > 0) { diff --git a/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp b/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp index d59f624abf364..23efa315ce6c0 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp @@ -24,11 +24,11 @@ #include "Application.h" #include "ServiceBroker.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogYesNo.h" #include "guilib/GUIWindowManager.h" #include "guilib/LocalizeStrings.h" #include "messaging/ApplicationMessenger.h" +#include "messaging/helpers/DialogOKHelper.h" #include "utils/StringUtils.h" #include "utils/Variant.h" @@ -82,7 +82,7 @@ bool CGUIDialogPVRGuideInfo::OnClickButtonRecord(CGUIMessage &message) if (!m_progItem || !m_progItem->HasChannel()) { /* invalid channel */ - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19067}); + HELPERS::ShowOKDialogText(CVariant{19033}, CVariant{19067}); Close(); return bReturn; } diff --git a/xbmc/pvr/recordings/PVRRecording.cpp b/xbmc/pvr/recordings/PVRRecording.cpp index 7052cf8b18c77..4f0044db5fbc6 100644 --- a/xbmc/pvr/recordings/PVRRecording.cpp +++ b/xbmc/pvr/recordings/PVRRecording.cpp @@ -21,8 +21,8 @@ #include "PVRRecording.h" #include "ServiceBroker.h" -#include "dialogs/GUIDialogOK.h" #include "guilib/LocalizeStrings.h" +#include "messaging/helpers/DialogOKHelper.h" #include "settings/AdvancedSettings.h" #include "utils/StringUtils.h" #include "utils/Variant.h" @@ -38,6 +38,7 @@ #include "pvr/timers/PVRTimers.h" using namespace PVR; +using namespace KODI::MESSAGING; CPVRRecordingUid::CPVRRecordingUid(int iClientId, const std::string& strRecordingId) : m_iClientId(iClientId), diff --git a/xbmc/pvr/timers/PVRTimerInfoTag.cpp b/xbmc/pvr/timers/PVRTimerInfoTag.cpp index f8c664b61ea85..a6a5bde6eca19 100644 --- a/xbmc/pvr/timers/PVRTimerInfoTag.cpp +++ b/xbmc/pvr/timers/PVRTimerInfoTag.cpp @@ -21,10 +21,11 @@ #include "PVRTimerInfoTag.h" #include "ServiceBroker.h" -#include "dialogs/GUIDialogOK.h" #include "guilib/LocalizeStrings.h" +#include "dialogs/GUIDialogYesNo.h" #include "messaging/ApplicationMessenger.h" #include "messaging/helpers/DialogHelper.h" +#include "messaging/helpers/DialogOKHelper.h" #include "settings/AdvancedSettings.h" #include "settings/Settings.h" #include "utils/StringUtils.h" @@ -674,13 +675,13 @@ bool CPVRTimerInfoTag::UpdateOnClient() void CPVRTimerInfoTag::DisplayError(PVR_ERROR err) const { if (err == PVR_ERROR_SERVER_ERROR) - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19111}); /* print info dialog "Server error!" */ + HELPERS::ShowOKDialogText(CVariant{19033}, CVariant{19111}); /* print info dialog "Server error!" */ else if (err == PVR_ERROR_REJECTED) - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19109}); /* print info dialog "Couldn't save timer!" */ + HELPERS::ShowOKDialogText(CVariant{19033}, CVariant{19109}); /* print info dialog "Couldn't save timer!" */ else if (err == PVR_ERROR_ALREADY_PRESENT) - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19067}); /* print info dialog */ + HELPERS::ShowOKDialogText(CVariant{19033}, CVariant{19067}); /* print info dialog */ else - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19110}); /* print info dialog "Unknown error!" */ + HELPERS::ShowOKDialogText(CVariant{19033}, CVariant{19110}); /* print info dialog "Unknown error!" */ } int CPVRTimerInfoTag::ChannelNumber() const diff --git a/xbmc/pvr/windows/GUIWindowPVRBase.cpp b/xbmc/pvr/windows/GUIWindowPVRBase.cpp index b6d6fbc4ca925..24438efb3b652 100644 --- a/xbmc/pvr/windows/GUIWindowPVRBase.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRBase.cpp @@ -24,13 +24,13 @@ #include "ServiceBroker.h" #include "addons/AddonManager.h" #include "dialogs/GUIDialogExtendedProgressBar.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogSelect.h" #include "guilib/GUIMessage.h" #include "guilib/GUIWindowManager.h" #include "guilib/LocalizeStrings.h" #include "input/Key.h" #include "messaging/ApplicationMessenger.h" +#include "messaging/helpers/DialogOKHelper.h" #include "utils/Variant.h" #include "utils/log.h" @@ -255,7 +255,7 @@ bool CGUIWindowPVRBase::CanBeActivated() const // check if there is at least one enabled PVR add-on if (!ADDON::CAddonMgr::GetInstance().HasAddons(ADDON::ADDON_PVRDLL)) { - CGUIDialogOK::ShowAndGetInput(CVariant{19296}, CVariant{19272}); // No PVR add-on enabled, You need a tuner, backend software... + HELPERS::ShowOKDialogText(CVariant{19296}, CVariant{19272}); // No PVR add-on enabled, You need a tuner, backend software... return false; } diff --git a/xbmc/pvr/windows/GUIWindowPVRSearch.cpp b/xbmc/pvr/windows/GUIWindowPVRSearch.cpp index 75ca0fb192008..de2e83e06f9a3 100644 --- a/xbmc/pvr/windows/GUIWindowPVRSearch.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRSearch.cpp @@ -21,11 +21,12 @@ #include "GUIWindowPVRSearch.h" #include "ServiceBroker.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogBusy.h" +#include "dialogs/GUIDialogProgress.h" #include "guilib/GUIWindowManager.h" #include "guilib/LocalizeStrings.h" #include "input/Key.h" +#include "messaging/helpers/DialogOKHelper.h" #include "utils/URIUtils.h" #include "utils/Variant.h" @@ -38,6 +39,7 @@ #include "pvr/epg/EpgContainer.h" using namespace PVR; +using namespace KODI::MESSAGING; namespace { @@ -127,7 +129,7 @@ void CGUIWindowPVRSearchBase::OnPrepareFileItems(CFileItemList &items) AsyncSearchAction(&items, &m_searchfilter).Execute(); if (items.IsEmpty()) - CGUIDialogOK::ShowAndGetInput(CVariant{284}, // "No results found" + HELPERS::ShowOKDialogText(CVariant{284}, // "No results found" m_searchfilter.GetSearchTerm()); } diff --git a/xbmc/pvr/windows/GUIWindowPVRTimersBase.cpp b/xbmc/pvr/windows/GUIWindowPVRTimersBase.cpp index 2f3c77807da13..d9f4f2d90e29e 100644 --- a/xbmc/pvr/windows/GUIWindowPVRTimersBase.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRTimersBase.cpp @@ -22,8 +22,8 @@ #include "GUIInfoManager.h" #include "ServiceBroker.h" -#include "dialogs/GUIDialogOK.h" #include "input/Key.h" +#include "messaging/helpers/DialogOKHelper.h" #include "settings/Settings.h" #include "threads/SingleLock.h" #include "utils/URIUtils.h" @@ -35,6 +35,7 @@ #include "pvr/timers/PVRTimers.h" using namespace PVR; +using namespace KODI::MESSAGING; CGUIWindowPVRTimersBase::CGUIWindowPVRTimersBase(bool bRadio, int id, const std::string &xmlFile) : CGUIWindowPVRBase(bRadio, id, xmlFile) @@ -179,7 +180,7 @@ bool CGUIWindowPVRTimersBase::ActionShowTimer(const CFileItemPtr &item) { if (!CServiceBroker::GetPVRManager().Clients()->SupportsTimers()) { - CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19215}); // "Information", "The PVR backend does not support timers." + HELPERS::ShowOKDialogText(CVariant{19033}, CVariant{19215}); // "Information", "The PVR backend does not support timers." return false; } diff --git a/xbmc/settings/DiscSettings.cpp b/xbmc/settings/DiscSettings.cpp index f755ca4291066..0714b54b8df6c 100644 --- a/xbmc/settings/DiscSettings.cpp +++ b/xbmc/settings/DiscSettings.cpp @@ -28,11 +28,13 @@ #include "dialogs/GUIDialogKaiToast.h" #include "guilib/LocalizeStrings.h" #include "utils/log.h" -#include "dialogs/GUIDialogOK.h" +#include "messaging/helpers/DialogOKHelper.h" #include "utils/Variant.h" #include +using namespace KODI::MESSAGING; + CDiscSettings::CDiscSettings(void) { @@ -77,7 +79,7 @@ void CDiscSettings::OnSettingChanged(std::shared_ptr setting) if (!info->libjvm_detected) { CLog::Log(LOGDEBUG, "DiscSettings - Could not load the java vm."); - CGUIDialogOK::ShowAndGetInput(CVariant{ 29803 }, CVariant{ 29804 }); + HELPERS::ShowOKDialogText(CVariant{ 29803 }, CVariant{ 29804 }); } CLog::Log(LOGDEBUG, "DiscSettings - Could not load the libbluray.jar."); } diff --git a/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp b/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp index 20ab8ee8aa61e..52feb9388d62d 100644 --- a/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp +++ b/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp @@ -24,7 +24,6 @@ #include "Util.h" #include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h" #include "dialogs/GUIDialogTextViewer.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogBusy.h" #include "dialogs/GUIDialogYesNo.h" #include "guilib/GUIWindowManager.h" @@ -32,6 +31,7 @@ #include "guilib/GUIListContainer.h" #include "guilib/GUIRadioButtonControl.h" #include "input/Key.h" +#include "messaging/helpers/DialogOKHelper.h" #include "utils/log.h" #include "utils/StringUtils.h" @@ -52,6 +52,7 @@ #define LIST_OUTPUT_RESAMPLE 4 using namespace ActiveAE; +using namespace KODI::MESSAGING; typedef struct { @@ -641,7 +642,7 @@ bool CGUIDialogAudioDSPManager::OnContextButton(int itemNumber, CONTEXT_BUTTON b } else if (button == CONTEXT_BUTTON_SETTINGS) { - CGUIDialogOK::ShowAndGetInput(19033, 0, 15040, 0); + HELPERS::ShowOKDialogLines(CVariant{19033}, CVariant{0}, CVariant{15040}, CVariant{0}); } return true; diff --git a/xbmc/settings/windows/GUIControlSettings.cpp b/xbmc/settings/windows/GUIControlSettings.cpp index 7f5b0e7ac6222..0a886568e0c50 100644 --- a/xbmc/settings/windows/GUIControlSettings.cpp +++ b/xbmc/settings/windows/GUIControlSettings.cpp @@ -28,7 +28,6 @@ #include "addons/settings/SettingUrlEncodedString.h" #include "dialogs/GUIDialogFileBrowser.h" #include "dialogs/GUIDialogNumeric.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogSelect.h" #include "dialogs/GUIDialogSlider.h" #include "FileItem.h" diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index 4c5bc5ac500f9..e6bf0dcec35a6 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -33,7 +33,6 @@ #include "dbwrappers/dataset.h" #include "dialogs/GUIDialogExtendedProgressBar.h" #include "dialogs/GUIDialogKaiToast.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogProgress.h" #include "dialogs/GUIDialogYesNo.h" #include "FileItem.h" @@ -47,6 +46,7 @@ #include "guilib/LocalizeStrings.h" #include "GUIPassword.h" #include "interfaces/AnnouncementManager.h" +#include "messaging/helpers/DialogOKHelper.h" #include "playlists/SmartPlayList.h" #include "profiles/ProfilesManager.h" #include "settings/AdvancedSettings.h" @@ -9324,7 +9324,7 @@ void CVideoDatabase::ExportToXML(const std::string &path, bool singleFile /* = t progress->Close(); if (iFailCount > 0) - CGUIDialogOK::ShowAndGetInput(CVariant{647}, CVariant{StringUtils::Format(g_localizeStrings.Get(15011).c_str(), iFailCount)}); + HELPERS::ShowOKDialogText(CVariant{647}, CVariant{StringUtils::Format(g_localizeStrings.Get(15011).c_str(), iFailCount)}); } void CVideoDatabase::ExportActorThumbs(const std::string &strDir, const CVideoInfoTag &tag, bool singleFiles, bool overwrite /*=false*/) diff --git a/xbmc/video/VideoInfoDownloader.cpp b/xbmc/video/VideoInfoDownloader.cpp index 45691995dcdf0..27fed595e06ec 100644 --- a/xbmc/video/VideoInfoDownloader.cpp +++ b/xbmc/video/VideoInfoDownloader.cpp @@ -20,9 +20,8 @@ #include "VideoInfoDownloader.h" #include "dialogs/GUIDialogProgress.h" -#include "dialogs/GUIDialogOK.h" #include "messaging/ApplicationMessenger.h" -#include "guilib/GUIWindowManager.h" +#include "messaging/helpers/DialogOKHelper.h" #include "utils/log.h" #include "utils/Variant.h" @@ -64,12 +63,7 @@ int CVideoInfoDownloader::InternalFindMovie(const std::string &strMovie, void CVideoInfoDownloader::ShowErrorDialog(const ADDON::CScraperError &sce) { if (!sce.Title().empty()) - { - CGUIDialogOK *pdlg = g_windowManager.GetWindow(WINDOW_DIALOG_OK); - pdlg->SetHeading(CVariant{sce.Title()}); - pdlg->SetLine(0, CVariant{sce.Message()}); - pdlg->Open(); - } + HELPERS::ShowOKDialogText(CVariant{ sce.Title() }, CVariant{ sce.Message() }); } // threaded functions diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp index 973fc8d7b734d..981244f30227a 100644 --- a/xbmc/video/VideoInfoScanner.cpp +++ b/xbmc/video/VideoInfoScanner.cpp @@ -24,7 +24,6 @@ #include "ServiceBroker.h" #include "dialogs/GUIDialogExtendedProgressBar.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogProgress.h" #include "events/EventLog.h" #include "events/MediaLibraryEvent.h" @@ -40,6 +39,7 @@ #include "interfaces/AnnouncementManager.h" #include "messaging/ApplicationMessenger.h" #include "messaging/helpers/DialogHelper.h" +#include "messaging/helpers/DialogOKHelper.h" #include "NfoFile.h" #include "settings/AdvancedSettings.h" #include "settings/Settings.h" @@ -2078,7 +2078,7 @@ namespace VIDEO if (pDialog) { - CGUIDialogOK::ShowAndGetInput(CVariant{20448}, CVariant{20449}); + HELPERS::ShowOKDialogText(CVariant{20448}, CVariant{20449}); return false; } return HELPERS::ShowYesNoDialogText(CVariant{20448}, CVariant{20450}) == DialogResponse::YES; diff --git a/xbmc/video/dialogs/GUIDialogVideoInfo.cpp b/xbmc/video/dialogs/GUIDialogVideoInfo.cpp index e7ad2f5a10b87..2e31462ced9cc 100644 --- a/xbmc/video/dialogs/GUIDialogVideoInfo.cpp +++ b/xbmc/video/dialogs/GUIDialogVideoInfo.cpp @@ -34,7 +34,6 @@ #include "video/VideoInfoTag.h" #include "guilib/GUIKeyboardFactory.h" #include "guilib/GUIWindowManager.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogYesNo.h" #include "dialogs/GUIDialogSelect.h" #include "dialogs/GUIDialogProgress.h" @@ -57,6 +56,7 @@ #include "filesystem/VideoDatabaseDirectory/QueryParams.h" #include "utils/FileUtils.h" #include "utils/Variant.h" +#include "messaging/helpers/DialogOKHelper.h" #include @@ -507,7 +507,7 @@ void CGUIDialogVideoInfo::OnSearch(std::string& strSearch) } else { - CGUIDialogOK::ShowAndGetInput(CVariant{194}, CVariant{284}); + HELPERS::ShowOKDialogText(CVariant{194}, CVariant{284}); } } @@ -1150,7 +1150,7 @@ bool CGUIDialogVideoInfo::UpdateVideoItemTitle(const CFileItemPtr &pItem) // dont allow update while scanning if (g_application.IsVideoScanning()) { - CGUIDialogOK::ShowAndGetInput(CVariant{257}, CVariant{14057}); + HELPERS::ShowOKDialogText(CVariant{257}, CVariant{14057}); return false; } @@ -1239,7 +1239,7 @@ bool CGUIDialogVideoInfo::DeleteVideoItemFromDatabase(const CFileItemPtr &item, // dont allow update while scanning if (g_application.IsVideoScanning()) { - CGUIDialogOK::ShowAndGetInput(CVariant{257}, CVariant{14057}); + HELPERS::ShowOKDialogText(CVariant{257}, CVariant{14057}); return false; } @@ -1884,7 +1884,7 @@ bool CGUIDialogVideoInfo::UpdateVideoItemSortTitle(const CFileItemPtr &pItem) // dont allow update while scanning if (g_application.IsVideoScanning()) { - CGUIDialogOK::ShowAndGetInput(CVariant{257}, CVariant{14057}); + HELPERS::ShowOKDialogText(CVariant{257}, CVariant{14057}); return false; } diff --git a/xbmc/video/jobs/VideoLibraryRefreshingJob.cpp b/xbmc/video/jobs/VideoLibraryRefreshingJob.cpp index 060a5e60d96f3..b0b9141a31926 100644 --- a/xbmc/video/jobs/VideoLibraryRefreshingJob.cpp +++ b/xbmc/video/jobs/VideoLibraryRefreshingJob.cpp @@ -23,7 +23,6 @@ #include "TextureDatabase.h" #include "addons/Scraper.h" #include "dialogs/GUIDialogExtendedProgressBar.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogProgress.h" #include "dialogs/GUIDialogSelect.h" #include "dialogs/GUIDialogYesNo.h" @@ -31,6 +30,7 @@ #include "guilib/GUIWindowManager.h" #include "guilib/LocalizeStrings.h" #include "media/MediaType.h" +#include "messaging/helpers/DialogOKHelper.h" #include "utils/log.h" #include "utils/StringUtils.h" #include "utils/URIUtils.h" @@ -38,6 +38,8 @@ #include "video/VideoInfoDownloader.h" #include "video/VideoInfoScanner.h" +using namespace KODI::MESSAGING; + CVideoLibraryRefreshingJob::CVideoLibraryRefreshingJob(CFileItemPtr item, bool forceRefresh, bool refreshAll, bool ignoreNfo /* = false */, const std::string& searchTitle /* = "" */) : CVideoLibraryProgressJob(nullptr), m_item(item), @@ -302,7 +304,7 @@ bool CVideoLibraryRefreshingJob::Work(CVideoDatabase &db) // check if the user cancelled if (!IsCancelled() && IsModal()) - CGUIDialogOK::ShowAndGetInput(195, itemTitle); + HELPERS::ShowOKDialogText(CVariant{195}, CVariant{itemTitle}); return false; } @@ -327,7 +329,7 @@ bool CVideoLibraryRefreshingJob::Work(CVideoDatabase &db) } while (needsRefresh); if (failure && IsModal()) - CGUIDialogOK::ShowAndGetInput(195, itemTitle); + HELPERS::ShowOKDialogText(CVariant{195}, CVariant{itemTitle}); return true; } diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp index 7dd37e1b7bc0d..b7e44858d12a7 100644 --- a/xbmc/video/windows/GUIWindowVideoBase.cpp +++ b/xbmc/video/windows/GUIWindowVideoBase.cpp @@ -41,10 +41,10 @@ #include "filesystem/VideoDatabaseDirectory.h" #include "PartyModeManager.h" #include "guilib/GUIWindowManager.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogSelect.h" #include "guilib/GUIKeyboardFactory.h" #include "filesystem/Directory.h" +#include "messaging/helpers/DialogOKHelper.h" #include "playlists/PlayList.h" #include "profiles/ProfilesManager.h" #include "settings/Settings.h" @@ -71,6 +71,7 @@ using namespace VIDEODATABASEDIRECTORY; using namespace VIDEO; using namespace ADDON; using namespace PVR; +using namespace KODI::MESSAGING; #define CONTROL_BTNVIEWASICONS 2 #define CONTROL_BTNSORTBY 3 @@ -242,7 +243,7 @@ void CGUIWindowVideoBase::OnItemInfo(const CFileItem& fileItem, ADDON::ScraperPt // no video file in this folder if (!bFoundFile) { - CGUIDialogOK::ShowAndGetInput(CVariant{13346}, CVariant{20349}); + HELPERS::ShowOKDialogText(CVariant{13346}, CVariant{20349}); return; } } @@ -390,7 +391,7 @@ bool CGUIWindowVideoBase::ShowIMDB(CFileItemPtr item, const ScraperPtr &info2, b if (g_application.IsVideoScanning()) { - CGUIDialogOK::ShowAndGetInput(CVariant{13346}, CVariant{14057}); + HELPERS::ShowOKDialogText(CVariant{13346}, CVariant{14057}); return false; } @@ -522,7 +523,7 @@ void CGUIWindowVideoBase::AddItemToPlayList(const CFileItemPtr &pItem, CFileItem // load it if (!pPlayList->Load(pItem->GetPath())) { - CGUIDialogOK::ShowAndGetInput(CVariant{6}, CVariant{477}); + HELPERS::ShowOKDialogText(CVariant{6}, CVariant{477}); return; //hmmm unable to load playlist? } @@ -1164,7 +1165,7 @@ void CGUIWindowVideoBase::LoadPlayList(const std::string& strPlayList, int iPlay // load it if (!pPlayList->Load(strPlayList)) { - CGUIDialogOK::ShowAndGetInput(CVariant{6}, CVariant{477}); + HELPERS::ShowOKDialogText(CVariant{6}, CVariant{477}); return; //hmmm unable to load playlist? } } @@ -1400,7 +1401,7 @@ void CGUIWindowVideoBase::AddToDatabase(int iItem) m_database.Close(); // done... - CGUIDialogOK::ShowAndGetInput(CVariant{20177}, CVariant{movie.m_strTitle}, + HELPERS::ShowOKDialogLines(CVariant{20177}, CVariant{movie.m_strTitle}, CVariant{StringUtils::Join(movie.m_genre, g_advancedSettings.m_videoItemSeparator)}, CVariant{movie.GetUniqueID()}); @@ -1453,7 +1454,7 @@ void CGUIWindowVideoBase::OnSearch() } else { - CGUIDialogOK::ShowAndGetInput(CVariant{194}, CVariant{284}); + HELPERS::ShowOKDialogText(CVariant{194}, CVariant{284}); } } diff --git a/xbmc/video/windows/GUIWindowVideoNav.cpp b/xbmc/video/windows/GUIWindowVideoNav.cpp index 2e161fc7db943..978e2dfec679c 100644 --- a/xbmc/video/windows/GUIWindowVideoNav.cpp +++ b/xbmc/video/windows/GUIWindowVideoNav.cpp @@ -29,7 +29,6 @@ #include "filesystem/VideoDatabaseDirectory.h" #include "filesystem/VideoDatabaseFile.h" #include "view/GUIViewState.h" -#include "dialogs/GUIDialogOK.h" #include "PartyModeManager.h" #include "music/MusicDatabase.h" #include "guilib/GUIWindowManager.h" @@ -39,6 +38,7 @@ #include "FileItem.h" #include "Application.h" #include "messaging/ApplicationMessenger.h" +#include "messaging/helpers/DialogOKHelper.h" #include "profiles/ProfilesManager.h" #include "settings/AdvancedSettings.h" #include "settings/MediaSettings.h" @@ -1140,7 +1140,7 @@ bool CGUIWindowVideoNav::OnClick(int iItem, const std::string &player) } else { - CGUIDialogOK::ShowAndGetInput(CVariant{257}, CVariant{662}); + HELPERS::ShowOKDialogText(CVariant{257}, CVariant{662}); return true; } } @@ -1149,7 +1149,7 @@ bool CGUIWindowVideoNav::OnClick(int iItem, const std::string &player) // dont allow update while scanning if (g_application.IsVideoScanning()) { - CGUIDialogOK::ShowAndGetInput(CVariant{257}, CVariant{14057}); + HELPERS::ShowOKDialogText(CVariant{257}, CVariant{14057}); return true; } @@ -1172,7 +1172,7 @@ bool CGUIWindowVideoNav::OnClick(int iItem, const std::string &player) if (!videodb.GetSingleValue("tag", "tag.tag_id", videodb.PrepareSQL("tag.name = '%s' AND tag.tag_id IN (SELECT tag_link.tag_id FROM tag_link WHERE tag_link.media_type = '%s')", strTag.c_str(), mediaType.c_str())).empty()) { std::string strError = StringUtils::Format(g_localizeStrings.Get(20463).c_str(), strTag.c_str()); - CGUIDialogOK::ShowAndGetInput(CVariant{20462}, CVariant{std::move(strError)}); + HELPERS::ShowOKDialogText(CVariant{20462}, CVariant{std::move(strError)}); return true; } diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp index abe0f2fd2eb64..504876ce023a2 100644 --- a/xbmc/windows/GUIMediaWindow.cpp +++ b/xbmc/windows/GUIMediaWindow.cpp @@ -37,7 +37,6 @@ #endif #include "dialogs/GUIDialogKaiToast.h" #include "dialogs/GUIDialogMediaFilter.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogProgress.h" #include "dialogs/GUIDialogSmartPlaylistEditor.h" #include "favourites/FavouritesService.h" @@ -52,6 +51,7 @@ #include "guilib/LocalizeStrings.h" #include "interfaces/generic/ScriptInvocationManager.h" #include "input/Key.h" +#include "messaging/helpers/DialogOKHelper.h" #include "network/Network.h" #include "playlists/PlayList.h" #include "profiles/ProfilesManager.h" @@ -1117,7 +1117,7 @@ bool CGUIMediaWindow::HaveDiscOrConnection(const std::string& strPath, int iDriv { if (!g_mediaManager.IsDiscInDrive(strPath)) { - CGUIDialogOK::ShowAndGetInput(CVariant{218}, CVariant{219}); + HELPERS::ShowOKDialogText(CVariant{218}, CVariant{219}); return false; } } @@ -1126,7 +1126,7 @@ bool CGUIMediaWindow::HaveDiscOrConnection(const std::string& strPath, int iDriv //! @todo Handle not connected to a remote share if ( !g_application.getNetwork().IsConnected() ) { - CGUIDialogOK::ShowAndGetInput(CVariant{220}, CVariant{221}); + HELPERS::ShowOKDialogText(CVariant{220}, CVariant{221}); return false; } } @@ -1152,7 +1152,7 @@ void CGUIMediaWindow::ShowShareErrorMessage(CFileItem* pItem) const else idMessageText = 15300; // Path not found or invalid - CGUIDialogOK::ShowAndGetInput(CVariant{220}, CVariant{idMessageText}); + HELPERS::ShowOKDialogText(CVariant{220}, CVariant{idMessageText}); } /*! diff --git a/xbmc/windows/GUIWindowFileManager.cpp b/xbmc/windows/GUIWindowFileManager.cpp index ddf3b000fcb8b..e5be9eec68b15 100644 --- a/xbmc/windows/GUIWindowFileManager.cpp +++ b/xbmc/windows/GUIWindowFileManager.cpp @@ -37,7 +37,6 @@ #include "network/Network.h" #include "guilib/GUIWindowManager.h" #include "input/Key.h" -#include "dialogs/GUIDialogOK.h" #include "dialogs/GUIDialogYesNo.h" #include "guilib/GUIKeyboardFactory.h" #include "dialogs/GUIDialogProgress.h" @@ -50,6 +49,7 @@ #include "settings/Settings.h" #include "input/InputManager.h" #include "guilib/LocalizeStrings.h" +#include "messaging/helpers/DialogOKHelper.h" #include "utils/StringUtils.h" #include "utils/log.h" #include "utils/JobManager.h" @@ -615,7 +615,7 @@ void CGUIWindowFileManager::OnStart(CFileItem *pItem, const std::string &player) { if (!pPlayList->Load(strPlayList)) { - CGUIDialogOK::ShowAndGetInput(CVariant{6}, CVariant{477}); + HELPERS::ShowOKDialogText(CVariant{6}, CVariant{477}); return; } } @@ -661,7 +661,7 @@ bool CGUIWindowFileManager::HaveDiscOrConnection( std::string& strPath, int iDri { if ( !g_mediaManager.IsDiscInDrive(strPath) ) { - CGUIDialogOK::ShowAndGetInput(CVariant{218}, CVariant{219}); + HELPERS::ShowOKDialogText(CVariant{218}, CVariant{219}); int iList = GetFocusedList(); int iItem = GetSelectedItem(iList); Update(iList, ""); @@ -674,7 +674,7 @@ bool CGUIWindowFileManager::HaveDiscOrConnection( std::string& strPath, int iDri //! @todo Handle not connected to a remote share if ( !g_application.getNetwork().IsConnected() ) { - CGUIDialogOK::ShowAndGetInput(CVariant{220}, CVariant{221}); + HELPERS::ShowOKDialogText(CVariant{220}, CVariant{221}); return false; } } @@ -1162,7 +1162,7 @@ void CGUIWindowFileManager::OnJobComplete(unsigned int jobID, bool success, CJob if(!success) { CFileOperationJob* fileJob = static_cast(job); - CGUIDialogOK::ShowAndGetInput(CVariant{fileJob->GetHeading()}, + HELPERS::ShowOKDialogLines(CVariant{fileJob->GetHeading()}, CVariant{fileJob->GetLine()}, CVariant{16200}, CVariant{0}); } @@ -1187,7 +1187,7 @@ void CGUIWindowFileManager::ShowShareErrorMessage(CFileItem* pItem) else idMessageText = 15300; // Path not found or invalid - CGUIDialogOK::ShowAndGetInput(CVariant{220}, CVariant{idMessageText}); + HELPERS::ShowOKDialogText(CVariant{220}, CVariant{idMessageText}); } void CGUIWindowFileManager::OnInitWindow() diff --git a/xbmc/windows/GUIWindowLoginScreen.cpp b/xbmc/windows/GUIWindowLoginScreen.cpp index f6316c26fdccb..d87c187b20d65 100644 --- a/xbmc/windows/GUIWindowLoginScreen.cpp +++ b/xbmc/windows/GUIWindowLoginScreen.cpp @@ -31,7 +31,6 @@ #include "addons/Skin.h" #include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h" #include "dialogs/GUIDialogContextMenu.h" -#include "dialogs/GUIDialogOK.h" #include "favourites/FavouritesService.h" #include "guilib/GUIMessage.h" #include "guilib/GUIWindowManager.h" @@ -43,6 +42,7 @@ #include "interfaces/json-rpc/JSONRPC.h" #endif #include "messaging/ApplicationMessenger.h" +#include "messaging/helpers/DialogOKHelper.h" #include "network/Network.h" #include "PlayListPlayer.h" #include "profiles/Profile.h" @@ -121,7 +121,7 @@ bool CGUIWindowLoginScreen::OnMessage(CGUIMessage& message) else { if (!bCanceled && iItem != 0) - CGUIDialogOK::ShowAndGetInput(CVariant{20068}, CVariant{20117}); + HELPERS::ShowOKDialogText(CVariant{20068}, CVariant{20117}); } } } diff --git a/xbmc/windows/GUIWindowWeather.cpp b/xbmc/windows/GUIWindowWeather.cpp index 801e653ff6305..9622fa868caf7 100644 --- a/xbmc/windows/GUIWindowWeather.cpp +++ b/xbmc/windows/GUIWindowWeather.cpp @@ -22,7 +22,7 @@ #include -#include "dialogs/GUIDialogOK.h" +#include "guilib/WindowIDs.h" #include "GUIUserMessages.h" #include "LangInfo.h" #include "utils/StringUtils.h" From 2753adec18ce92395350aea0819a35b02e3bba46 Mon Sep 17 00:00:00 2001 From: phate89 Date: Mon, 14 Aug 2017 21:57:23 +0200 Subject: [PATCH 031/113] Add a helper to update the text of the already displayed dialog box --- xbmc/dialogs/GUIDialogOK.cpp | 2 +- xbmc/messaging/helpers/DialogOKHelper.cpp | 10 ++++++++++ xbmc/messaging/helpers/DialogOKHelper.h | 11 +++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/xbmc/dialogs/GUIDialogOK.cpp b/xbmc/dialogs/GUIDialogOK.cpp index 4c0a5dc17acd3..1db3e9ee40463 100644 --- a/xbmc/dialogs/GUIDialogOK.cpp +++ b/xbmc/dialogs/GUIDialogOK.cpp @@ -71,7 +71,7 @@ bool CGUIDialogOK::ShowAndGetInput(CVariant heading, CVariant line0, CVariant li return dialog->IsConfirmed(); } -bool CGUIDialogOK::ShowAndGetInput(const KODI::MESSAGING::HELPERS::DialogOKMessage & options) +bool CGUIDialogOK::ShowAndGetInput(const HELPERS::DialogOKMessage & options) { if (!options.heading.isNull()) SetHeading(options.heading); diff --git a/xbmc/messaging/helpers/DialogOKHelper.cpp b/xbmc/messaging/helpers/DialogOKHelper.cpp index 747aada614293..2928c25f35d46 100644 --- a/xbmc/messaging/helpers/DialogOKHelper.cpp +++ b/xbmc/messaging/helpers/DialogOKHelper.cpp @@ -38,6 +38,16 @@ bool ShowOKDialogText(CVariant heading, CVariant text) return false; } +void UpdateOKDialogText(CVariant heading, CVariant text) +{ + DialogOKMessage options; + options.heading = std::move(heading); + options.text = std::move(text); + options.show = false; + + CApplicationMessenger::GetInstance().SendMsg(TMSG_GUI_DIALOG_OK, -1, -1, static_cast(&options)); +} + bool ShowOKDialogLines(CVariant heading, CVariant line0, CVariant line1, CVariant line2) { DialogOKMessage options; diff --git a/xbmc/messaging/helpers/DialogOKHelper.h b/xbmc/messaging/helpers/DialogOKHelper.h index 18371fdfac79a..e9a4a0c1a6368 100644 --- a/xbmc/messaging/helpers/DialogOKHelper.h +++ b/xbmc/messaging/helpers/DialogOKHelper.h @@ -42,6 +42,7 @@ struct DialogOKMessage CVariant heading; //!< Heading to be displayed in the dialog box CVariant text; //!< Body text to be displayed, this is mutually exclusive with lines below std::array lines; //!< Body text to be displayed, specified as three lines. This is mutually exclusive with the text above + bool show = true; //!< bool to see if the dialog needs to be shown }; /*! @@ -54,6 +55,16 @@ struct DialogOKMessage \sa CGUIDialogOK::ShowAndGetInput \sa DialogOKMessage */ +void UpdateOKDialogText(CVariant heading, CVariant text); + +/*! +\brief This is a helper method to send a threadmessage to update a Ok dialog text +\param[in] heading The text to display as the dialog box header +\param[in] text The text to display in the dialog body +\sa UpdateOKDialogLines +\sa CGUIDialogOK::ShowAndGetInput +\sa DialogOKMessage +*/ bool ShowOKDialogText(CVariant heading, CVariant text); /*! From ba6d3f0c7e536837f5d04760f4c739b0fff0ce20 Mon Sep 17 00:00:00 2001 From: phate89 Date: Mon, 23 Jan 2017 11:23:15 +0100 Subject: [PATCH 032/113] Use the helper class to update the text too --- xbmc/games/controllers/dialogs/GUIDialogButtonCapture.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/xbmc/games/controllers/dialogs/GUIDialogButtonCapture.cpp b/xbmc/games/controllers/dialogs/GUIDialogButtonCapture.cpp index 4de158e0e1ef9..ab10d2dba01f7 100644 --- a/xbmc/games/controllers/dialogs/GUIDialogButtonCapture.cpp +++ b/xbmc/games/controllers/dialogs/GUIDialogButtonCapture.cpp @@ -19,7 +19,6 @@ */ #include "GUIDialogButtonCapture.h" -#include "dialogs/GUIDialogOK.h" #include "guilib/GUIWindowManager.h" #include "guilib/WindowIDs.h" #include "input/joysticks/JoystickIDs.h" @@ -80,9 +79,7 @@ void CGUIDialogButtonCapture::Process() break; //! @todo Move to rendering thread when there is a rendering thread - auto dialog = g_windowManager.GetWindow(WINDOW_DIALOG_OK); - if (dialog) - dialog->SetText(GetDialogText()); + HELPERS::UpdateOKDialogText(CVariant{ 35013 }, CVariant{ GetDialogText() }); } } From acd30c1bf3298aa858dfb2648b42a9e52f557a5e Mon Sep 17 00:00:00 2001 From: Garrett Brown Date: Fri, 1 Sep 2017 12:45:29 -0700 Subject: [PATCH 033/113] Implement FullscreenGame window --- addons/skin.estuary/xml/DialogBusy.xml | 2 +- .../xml/DialogExtendedProgressBar.xml | 2 +- addons/skin.estuary/xml/DialogSeekBar.xml | 2 +- addons/skin.estuary/xml/DialogVolumeBar.xml | 2 +- addons/skin.estuary/xml/Includes.xml | 2 +- addons/skin.estuary/xml/MyWeather.xml | 2 +- addons/skin.estuary/xml/PlayerControls.xml | 2 +- cmake/treedata/common/retroplayer.txt | 1 + xbmc/Application.cpp | 58 +++++++++++++++---- xbmc/GUIInfoManager.cpp | 3 +- xbmc/PlayListPlayer.cpp | 2 + xbmc/addons/RepositoryUpdater.cpp | 1 + xbmc/cores/RetroPlayer/windows/CMakeLists.txt | 7 +++ .../windows/GameWindowFullScreen.cpp | 30 ++++++++++ .../windows/GameWindowFullScreen.h | 35 +++++++++++ xbmc/guilib/GUIWindow.cpp | 4 +- xbmc/guilib/GUIWindowManager.cpp | 10 ++-- xbmc/input/InputManager.cpp | 3 +- xbmc/input/WindowTranslator.cpp | 2 +- xbmc/interfaces/builtins/PlayerBuiltins.cpp | 1 + xbmc/pictures/GUIWindowSlideShow.cpp | 3 +- xbmc/video/windows/GUIWindowFullScreen.cpp | 4 +- xbmc/video/windows/GUIWindowFullScreen.h | 3 +- 23 files changed, 151 insertions(+), 30 deletions(-) create mode 100644 xbmc/cores/RetroPlayer/windows/CMakeLists.txt create mode 100644 xbmc/cores/RetroPlayer/windows/GameWindowFullScreen.cpp create mode 100644 xbmc/cores/RetroPlayer/windows/GameWindowFullScreen.h diff --git a/addons/skin.estuary/xml/DialogBusy.xml b/addons/skin.estuary/xml/DialogBusy.xml index 3d6fe2eee12a1..f09f57bb11292 100644 --- a/addons/skin.estuary/xml/DialogBusy.xml +++ b/addons/skin.estuary/xml/DialogBusy.xml @@ -11,7 +11,7 @@ colors/black.png FullScreenDimensions Conditional - Conditional + Conditional DepthMax diff --git a/addons/skin.estuary/xml/DialogExtendedProgressBar.xml b/addons/skin.estuary/xml/DialogExtendedProgressBar.xml index e0f09a6f449fe..93bb34275598d 100644 --- a/addons/skin.estuary/xml/DialogExtendedProgressBar.xml +++ b/addons/skin.estuary/xml/DialogExtendedProgressBar.xml @@ -10,7 +10,7 @@ 80 0 conditional - conditional + conditional 20 10 diff --git a/addons/skin.estuary/xml/DialogSeekBar.xml b/addons/skin.estuary/xml/DialogSeekBar.xml index 8cc0da9dde8ee..8ce6adcb39ab8 100644 --- a/addons/skin.estuary/xml/DialogSeekBar.xml +++ b/addons/skin.estuary/xml/DialogSeekBar.xml @@ -1,6 +1,6 @@ - Player.Seeking | Player.DisplayAfterSeek | [Player.Paused + !Player.Caching] | Player.Forwarding | Player.Rewinding | Player.ShowInfo | Window.IsActive(videoosd) | Window.IsActive(musicosd) | Window.IsActive(GameOSD) | Window.IsActive(playerprocessinfo) | !String.IsEmpty(Player.SeekNumeric) | !String.IsEmpty(PVR.ChannelNumberInput) + Player.Seeking | Player.DisplayAfterSeek | [Player.Paused + !Player.Caching] | Player.Forwarding | Player.Rewinding | Player.ShowInfo | Window.IsActive(videoosd) | Window.IsActive(musicosd) | Window.IsActive(playerprocessinfo) | !String.IsEmpty(Player.SeekNumeric) | !String.IsEmpty(PVR.ChannelNumberInput) ![Window.IsActive(sliderdialog) | Window.IsActive(pvrosdchannels)] Window.IsActive(fullscreenvideo) | Window.IsActive(visualisation) Animation_BottomSlide diff --git a/addons/skin.estuary/xml/DialogVolumeBar.xml b/addons/skin.estuary/xml/DialogVolumeBar.xml index 222150b7bd708..f605285c901ad 100644 --- a/addons/skin.estuary/xml/DialogVolumeBar.xml +++ b/addons/skin.estuary/xml/DialogVolumeBar.xml @@ -20,7 +20,7 @@ 88 88 osd/buffer-bg.png - Window.IsActive(fullscreenvideo) | Window.IsActive(slideshow) + Window.IsActive(fullscreenvideo) | Window.IsActive(FullscreenGame) | Window.IsActive(slideshow) 22 diff --git a/addons/skin.estuary/xml/Includes.xml b/addons/skin.estuary/xml/Includes.xml index 1e6975ad57508..1197b6098ede9 100644 --- a/addons/skin.estuary/xml/Includes.xml +++ b/addons/skin.estuary/xml/Includes.xml @@ -1120,7 +1120,7 @@ conditional Conditional - WindowOpen + WindowOpen ColoredBackgroundImages diff --git a/addons/skin.estuary/xml/MyWeather.xml b/addons/skin.estuary/xml/MyWeather.xml index 3abdb7e77428f..404e922211c8c 100644 --- a/addons/skin.estuary/xml/MyWeather.xml +++ b/addons/skin.estuary/xml/MyWeather.xml @@ -35,7 +35,7 @@ conditional Conditional - WindowOpen + WindowOpen ColoredBackgroundImages diff --git a/addons/skin.estuary/xml/PlayerControls.xml b/addons/skin.estuary/xml/PlayerControls.xml index 674cca84a20f4..bf1aca89f4485 100644 --- a/addons/skin.estuary/xml/PlayerControls.xml +++ b/addons/skin.estuary/xml/PlayerControls.xml @@ -1,7 +1,7 @@ 201 - Player.HasMedia + Window.IsActive(PlayerControls) + !Window.IsActive(FullscreenVideo) + !Window.IsActive(Visualisation) + Player.HasMedia + Window.IsActive(PlayerControls) + !Window.IsActive(FullscreenVideo) + !Window.IsActive(FullscreenGame) + !Window.IsActive(Visualisation) Animation_DialogPopupOpenClose diff --git a/cmake/treedata/common/retroplayer.txt b/cmake/treedata/common/retroplayer.txt index ab18c3c9252c8..c9fa2ef8ff2f9 100644 --- a/cmake/treedata/common/retroplayer.txt +++ b/cmake/treedata/common/retroplayer.txt @@ -1,3 +1,4 @@ xbmc/cores/RetroPlayer cores/RetroPlayer xbmc/cores/RetroPlayer/guicontrols cores/RetroPlayer/guicontrols xbmc/cores/RetroPlayer/rendering cores/RetroPlayer/rendering +xbmc/cores/RetroPlayer/windows cores/RetroPlayer/windows diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 8ee9a7b530da1..696fa78371f60 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -1570,7 +1570,14 @@ bool CApplication::LoadSkin(const std::string& skinID) // store player and rendering state bool bPreviousPlayingState = false; - bool bPreviousRenderingState = false; + + enum class RENDERING_STATE + { + NONE, + VIDEO, + GAME, + } previousRenderingState = RENDERING_STATE::NONE; + if (m_pPlayer->IsPlayingVideo()) { bPreviousPlayingState = !m_pPlayer->IsPausedPlayback(); @@ -1580,8 +1587,14 @@ bool CApplication::LoadSkin(const std::string& skinID) if (g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO) { g_windowManager.ActivateWindow(WINDOW_HOME); - bPreviousRenderingState = true; + previousRenderingState = RENDERING_STATE::VIDEO; + } + else if (g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_GAME) + { + g_windowManager.ActivateWindow(WINDOW_HOME); + previousRenderingState = RENDERING_STATE::GAME; } + } CSingleLock lock(g_graphicsContext); @@ -1683,8 +1696,18 @@ bool CApplication::LoadSkin(const std::string& skinID) { if (bPreviousPlayingState) m_pPlayer->Pause(); - if (bPreviousRenderingState) + + switch (previousRenderingState) + { + case RENDERING_STATE::VIDEO: g_windowManager.ActivateWindow(WINDOW_FULLSCREEN_VIDEO); + break; + case RENDERING_STATE::GAME: + g_windowManager.ActivateWindow(WINDOW_FULLSCREEN_GAME); + break; + default: + break; + } } return true; @@ -2101,6 +2124,7 @@ bool CApplication::OnAction(const CAction &action) // Now check with the player if action can be handled. bool bIsPlayingPVRChannel = (CServiceBroker::GetPVRManager().IsStarted() && g_application.CurrentFileItem().IsPVRChannel()); if (g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO || + g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_GAME || (g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION && bIsPlayingPVRChannel) || ((g_windowManager.GetActiveWindow() == WINDOW_DIALOG_VIDEO_OSD || (g_windowManager.GetActiveWindow() == WINDOW_DIALOG_MUSIC_OSD && bIsPlayingPVRChannel)) && (action.GetID() == ACTION_NEXT_ITEM || action.GetID() == ACTION_PREV_ITEM || action.GetID() == ACTION_CHANNEL_UP || action.GetID() == ACTION_CHANNEL_DOWN)) || @@ -2438,7 +2462,8 @@ void CApplication::OnApplicationMessage(ThreadMessage* pMsg) case TMSG_SWITCHTOFULLSCREEN: - if (g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_VIDEO) + if (g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_VIDEO && + g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_GAME) SwitchToFullScreen(true); break; @@ -3432,13 +3457,15 @@ PlayBackRet CApplication::PlayFile(CFileItem item, const std::string& player, bo { // if player didn't manage to switch to fullscreen by itself do it here if (options.fullscreen && m_pPlayer->IsRenderingVideo() && - g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_VIDEO ) + g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_VIDEO && + g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_GAME) SwitchToFullScreen(true); } else { if (g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION || - g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO) + g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO || + g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_GAME) g_windowManager.PreviousWindow(); } @@ -3793,7 +3820,8 @@ void CApplication::StopPlaying() // turn off visualisation window when stopping if ((iWin == WINDOW_VISUALISATION - || iWin == WINDOW_FULLSCREEN_VIDEO) + || iWin == WINDOW_FULLSCREEN_VIDEO + || iWin == WINDOW_FULLSCREEN_GAME) && !m_bStop) g_windowManager.PreviousWindow(); @@ -4311,7 +4339,8 @@ bool CApplication::OnMessage(CGUIMessage& message) if (!m_pPlayer->IsPlayingVideo()) { - if(g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO) + if(g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO || + g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_GAME) { g_windowManager.PreviousWindow(); } @@ -4505,7 +4534,11 @@ void CApplication::ProcessSlow() // Temporarily pause pausable jobs when viewing video/picture int currentWindow = g_windowManager.GetActiveWindow(); - if (CurrentFileItem().IsVideo() || CurrentFileItem().IsPicture() || currentWindow == WINDOW_FULLSCREEN_VIDEO || currentWindow == WINDOW_SLIDESHOW) + if (CurrentFileItem().IsVideo() || + CurrentFileItem().IsPicture() || + currentWindow == WINDOW_FULLSCREEN_VIDEO || + currentWindow == WINDOW_FULLSCREEN_GAME || + currentWindow == WINDOW_SLIDESHOW) { CJobManager::GetInstance().PauseJobs(); } @@ -4953,8 +4986,13 @@ bool CApplication::SwitchToFullScreen(bool force /* = false */) } int windowID = WINDOW_INVALID; + + // See if we're playing a game, and are in GUI mode + if (m_pPlayer->IsPlayingGame() && g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_GAME) + windowID = WINDOW_FULLSCREEN_GAME; + // See if we're playing a video, and are in GUI mode - if (m_pPlayer->IsPlayingVideo() && g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_VIDEO) + else if (m_pPlayer->IsPlayingVideo() && g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_VIDEO) windowID = WINDOW_FULLSCREEN_VIDEO; // special case for switching between GUI & visualisation mode. (only if we're playing an audio song) diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index b3e62cf7bea0d..b38ae2e1043a1 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -7314,7 +7314,8 @@ bool CGUIInfoManager::GetBool(int condition1, int contextWindow, const CGUIListI bReturn = (CServiceBroker::GetSettings().GetInt(CSettings::SETTING_VIDEOPLAYER_RENDERMETHOD) == RENDER_OVERLAYS); break; case VIDEOPLAYER_ISFULLSCREEN: - bReturn = g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO; + bReturn = g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO || + g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_GAME; break; case VIDEOPLAYER_HASMENU: bReturn = g_application.m_pPlayer->HasMenu(); diff --git a/xbmc/PlayListPlayer.cpp b/xbmc/PlayListPlayer.cpp index 61ea7d766593a..5c72be34c9c00 100644 --- a/xbmc/PlayListPlayer.cpp +++ b/xbmc/PlayListPlayer.cpp @@ -850,6 +850,7 @@ void PLAYLIST::CPlayListPlayer::OnApplicationMessage(KODI::MESSAGING::ThreadMess // restore to previous window if needed if (g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW || g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO || + g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_GAME || g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION) g_windowManager.PreviousWindow(); @@ -929,6 +930,7 @@ void PLAYLIST::CPlayListPlayer::OnApplicationMessage(KODI::MESSAGING::ThreadMess if ((stopSlideshow && g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW) || (stopVideo && g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO) || + (stopVideo && g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_GAME) || (stopMusic && g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION)) g_windowManager.PreviousWindow(); diff --git a/xbmc/addons/RepositoryUpdater.cpp b/xbmc/addons/RepositoryUpdater.cpp index fa08c1cfbde2a..93c82fb4075f6 100644 --- a/xbmc/addons/RepositoryUpdater.cpp +++ b/xbmc/addons/RepositoryUpdater.cpp @@ -169,6 +169,7 @@ void CRepositoryUpdater::OnTimeout() { //workaround if (g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO || + g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_GAME || g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW) { CLog::Log(LOGDEBUG,"CRepositoryUpdater: busy playing. postponing scheduled update"); diff --git a/xbmc/cores/RetroPlayer/windows/CMakeLists.txt b/xbmc/cores/RetroPlayer/windows/CMakeLists.txt new file mode 100644 index 0000000000000..b1c4709789480 --- /dev/null +++ b/xbmc/cores/RetroPlayer/windows/CMakeLists.txt @@ -0,0 +1,7 @@ +set(SOURCES GameWindowFullScreen.cpp +) + +set(HEADERS GameWindowFullScreen.h +) + +core_add_library(retroplayer_windows) diff --git a/xbmc/cores/RetroPlayer/windows/GameWindowFullScreen.cpp b/xbmc/cores/RetroPlayer/windows/GameWindowFullScreen.cpp new file mode 100644 index 0000000000000..851a70b4f7fef --- /dev/null +++ b/xbmc/cores/RetroPlayer/windows/GameWindowFullScreen.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2017 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Program; see the file COPYING. If not, see + * . + * + */ + +#include "GameWindowFullScreen.h" +#include "guilib/WindowIDs.h" + +using namespace KODI; +using namespace RETRO; + +CGameWindowFullScreen::CGameWindowFullScreen(void) : + CGUIWindowFullScreen(WINDOW_FULLSCREEN_GAME) +{ +} diff --git a/xbmc/cores/RetroPlayer/windows/GameWindowFullScreen.h b/xbmc/cores/RetroPlayer/windows/GameWindowFullScreen.h new file mode 100644 index 0000000000000..95db3ef51ae27 --- /dev/null +++ b/xbmc/cores/RetroPlayer/windows/GameWindowFullScreen.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2017 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Program; see the file COPYING. If not, see + * . + * + */ +#pragma once + +#include "video/windows/GUIWindowFullScreen.h" //! @todo + +namespace KODI +{ +namespace RETRO +{ + class CGameWindowFullScreen : public CGUIWindowFullScreen + { + public: + CGameWindowFullScreen(); + ~CGameWindowFullScreen() override = default; + }; +} +} diff --git a/xbmc/guilib/GUIWindow.cpp b/xbmc/guilib/GUIWindow.cpp index 7d02a56547dda..1cfee56c76957 100644 --- a/xbmc/guilib/GUIWindow.cpp +++ b/xbmc/guilib/GUIWindow.cpp @@ -392,7 +392,9 @@ void CGUIWindow::Close_Internal(bool forceClose /*= false*/, int nextWindowID /* if (!m_active) return; - forceClose |= (nextWindowID == WINDOW_FULLSCREEN_VIDEO); + forceClose |= (nextWindowID == WINDOW_FULLSCREEN_VIDEO || + nextWindowID == WINDOW_FULLSCREEN_GAME); + if (!forceClose && HasAnimation(ANIM_TYPE_WINDOW_CLOSE)) { if (!m_closing) diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp index 8ea3703e232cd..f308d81239213 100644 --- a/xbmc/guilib/GUIWindowManager.cpp +++ b/xbmc/guilib/GUIWindowManager.cpp @@ -147,6 +147,7 @@ #include "addons/interfaces/AddonInterfaces.h" /* Game related include files */ +#include "cores/RetroPlayer/windows/GameWindowFullScreen.h" #include "games/controllers/windows/GUIControllerWindow.h" #include "games/windows/GUIWindowGames.h" #include "games/dialogs/osd/DialogGameOSD.h" @@ -305,6 +306,7 @@ void CGUIWindowManager::CreateWindows() Add(new GAME::CDialogGameOSD); Add(new GAME::CDialogGameVideoFilter); Add(new GAME::CDialogGameViewMode); + Add(new RETRO::CGameWindowFullScreen); } bool CGUIWindowManager::DestroyWindows() @@ -410,6 +412,7 @@ bool CGUIWindowManager::DestroyWindows() DestroyWindow(WINDOW_DIALOG_GAME_OSD); DestroyWindow(WINDOW_DIALOG_GAME_VIDEO_FILTER); DestroyWindow(WINDOW_DIALOG_GAME_VIEW_MODE); + DestroyWindow(WINDOW_FULLSCREEN_GAME); Remove(WINDOW_SETTINGS_SERVICE); Remove(WINDOW_SETTINGS_MYPVR); @@ -808,9 +811,9 @@ void CGUIWindowManager::ActivateWindow_Internal(int iWindowID, const std::vector // pause game when leaving fullscreen or resume game when entering fullscreen if (g_application.m_pPlayer->IsPlayingGame()) { - if (GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO && !g_application.m_pPlayer->IsPaused()) + if (GetActiveWindow() == WINDOW_FULLSCREEN_GAME && !g_application.m_pPlayer->IsPaused()) g_application.OnAction(ACTION_PAUSE); - else if (iWindowID == WINDOW_FULLSCREEN_VIDEO && g_application.m_pPlayer->IsPaused()) + else if (iWindowID == WINDOW_FULLSCREEN_GAME && g_application.m_pPlayer->IsPaused()) g_application.OnAction(ACTION_PAUSE); } @@ -1474,9 +1477,6 @@ int CGUIWindowManager::GetActiveWindowID() const // special casing for numeric seek else if (CSeekHandler::GetInstance().HasTimeCode()) iWin = WINDOW_VIDEO_TIME_SEEK; - // check if a game is playing - else if (g_application.m_pPlayer->IsPlayingGame()) - iWin = WINDOW_FULLSCREEN_GAME; } if (iWin == WINDOW_VISUALISATION) { diff --git a/xbmc/input/InputManager.cpp b/xbmc/input/InputManager.cpp index 737396fb57844..f24c73f265d92 100644 --- a/xbmc/input/InputManager.cpp +++ b/xbmc/input/InputManager.cpp @@ -566,7 +566,8 @@ bool CInputManager::OnKey(const CKey& key) return true; } - if (iWin != WINDOW_FULLSCREEN_VIDEO) + if (iWin != WINDOW_FULLSCREEN_VIDEO || + iWin != WINDOW_FULLSCREEN_GAME) { // current active window isnt the fullscreen window // just use corresponding section from keymap.xml diff --git a/xbmc/input/WindowTranslator.cpp b/xbmc/input/WindowTranslator.cpp index a43fe26d11c79..e08615fcf2d02 100644 --- a/xbmc/input/WindowTranslator.cpp +++ b/xbmc/input/WindowTranslator.cpp @@ -127,7 +127,7 @@ const CWindowTranslator::WindowMapByName CWindowTranslator::WindowMappingByName { "fullscreenvideo" , WINDOW_FULLSCREEN_VIDEO }, { "fullscreenlivetv" , WINDOW_FULLSCREEN_LIVETV }, // virtual window/keymap section for PVR specific bindings in fullscreen playback (which internally uses WINDOW_FULLSCREEN_VIDEO) { "fullscreenradio" , WINDOW_FULLSCREEN_RADIO }, // virtual window for fullscreen radio, uses WINDOW_VISUALISATION as fallback - { "fullscreengame" , WINDOW_FULLSCREEN_GAME }, // virtual window for fullscreen games, uses WINDOW_FULLSCREEN_VIDEO as fallback + { "fullscreengame" , WINDOW_FULLSCREEN_GAME }, { "visualisation" , WINDOW_VISUALISATION }, { "slideshow" , WINDOW_SLIDESHOW }, { "weather" , WINDOW_WEATHER }, diff --git a/xbmc/interfaces/builtins/PlayerBuiltins.cpp b/xbmc/interfaces/builtins/PlayerBuiltins.cpp index ccb9e6c4516c9..08d5d1c5b6934 100644 --- a/xbmc/interfaces/builtins/PlayerBuiltins.cpp +++ b/xbmc/interfaces/builtins/PlayerBuiltins.cpp @@ -389,6 +389,7 @@ static int PlayMedia(const std::vector& params) // restore to previous window if needed if( g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW || g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO || + g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_GAME || g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION ) g_windowManager.PreviousWindow(); diff --git a/xbmc/pictures/GUIWindowSlideShow.cpp b/xbmc/pictures/GUIWindowSlideShow.cpp index 853e70ee608be..e5bf1b7a6c111 100644 --- a/xbmc/pictures/GUIWindowSlideShow.cpp +++ b/xbmc/pictures/GUIWindowSlideShow.cpp @@ -246,7 +246,8 @@ void CGUIWindowSlideShow::OnDeinitWindow(int nextWindowID) //g_graphicsContext.SetVideoResolution(CDisplaySettings::GetInstance().GetCurrentResolution(), TRUE); } - if (nextWindowID != WINDOW_FULLSCREEN_VIDEO) + if (nextWindowID != WINDOW_FULLSCREEN_VIDEO || + nextWindowID != WINDOW_FULLSCREEN_GAME) { // wait for any outstanding picture loads if (m_pBackgroundLoader) diff --git a/xbmc/video/windows/GUIWindowFullScreen.cpp b/xbmc/video/windows/GUIWindowFullScreen.cpp index f809248e999af..dfbbe3c56f584 100644 --- a/xbmc/video/windows/GUIWindowFullScreen.cpp +++ b/xbmc/video/windows/GUIWindowFullScreen.cpp @@ -77,8 +77,8 @@ using namespace KODI::MESSAGING; static CLinuxResourceCounter m_resourceCounter; #endif -CGUIWindowFullScreen::CGUIWindowFullScreen(void) - : CGUIWindow(WINDOW_FULLSCREEN_VIDEO, "VideoFullScreen.xml") +CGUIWindowFullScreen::CGUIWindowFullScreen(int windowId) + : CGUIWindow(windowId, "VideoFullScreen.xml") { m_viewModeChanged = true; m_dwShowViewModeTimeout = 0; diff --git a/xbmc/video/windows/GUIWindowFullScreen.h b/xbmc/video/windows/GUIWindowFullScreen.h index 30adde89d26c4..89ef6be2e1f7e 100644 --- a/xbmc/video/windows/GUIWindowFullScreen.h +++ b/xbmc/video/windows/GUIWindowFullScreen.h @@ -21,13 +21,14 @@ */ #include "guilib/GUIWindow.h" +#include "guilib/WindowIDs.h" //! @todo class CGUIDialog; class CGUIWindowFullScreen : public CGUIWindow { public: - CGUIWindowFullScreen(void); + CGUIWindowFullScreen(int windowId = WINDOW_FULLSCREEN_VIDEO); //! @todo ~CGUIWindowFullScreen(void) override; bool OnMessage(CGUIMessage& message) override; bool OnAction(const CAction &action) override; From 3c62d66e16f5bf6a0c8c71830ad9a17d50afb17e Mon Sep 17 00:00:00 2001 From: Garrett Brown Date: Fri, 1 Sep 2017 14:41:44 -0700 Subject: [PATCH 034/113] Separate CGUIWindowFullScreen and CGameWindowFullScreen --- xbmc/cores/RetroPlayer/windows/CMakeLists.txt | 2 + .../windows/GameWindowFullScreen.cpp | 190 +++++++++++++++++- .../windows/GameWindowFullScreen.h | 36 +++- .../windows/GameWindowFullScreenText.cpp | 137 +++++++++++++ .../windows/GameWindowFullScreenText.h | 95 +++++++++ .../dialogs/osd/DialogGameVideoSelect.cpp | 2 + xbmc/video/windows/CMakeLists.txt | 1 + xbmc/video/windows/GUIWindowFullScreen.cpp | 26 +-- xbmc/video/windows/GUIWindowFullScreen.h | 3 +- .../windows/GUIWindowFullScreenDefines.h | 36 ++++ 10 files changed, 500 insertions(+), 28 deletions(-) create mode 100644 xbmc/cores/RetroPlayer/windows/GameWindowFullScreenText.cpp create mode 100644 xbmc/cores/RetroPlayer/windows/GameWindowFullScreenText.h create mode 100644 xbmc/video/windows/GUIWindowFullScreenDefines.h diff --git a/xbmc/cores/RetroPlayer/windows/CMakeLists.txt b/xbmc/cores/RetroPlayer/windows/CMakeLists.txt index b1c4709789480..9c0c6cce18a10 100644 --- a/xbmc/cores/RetroPlayer/windows/CMakeLists.txt +++ b/xbmc/cores/RetroPlayer/windows/CMakeLists.txt @@ -1,7 +1,9 @@ set(SOURCES GameWindowFullScreen.cpp + GameWindowFullScreenText.cpp ) set(HEADERS GameWindowFullScreen.h + GameWindowFullScreenText.h ) core_add_library(retroplayer_windows) diff --git a/xbmc/cores/RetroPlayer/windows/GameWindowFullScreen.cpp b/xbmc/cores/RetroPlayer/windows/GameWindowFullScreen.cpp index 851a70b4f7fef..a31358a755b3d 100644 --- a/xbmc/cores/RetroPlayer/windows/GameWindowFullScreen.cpp +++ b/xbmc/cores/RetroPlayer/windows/GameWindowFullScreen.cpp @@ -19,12 +19,200 @@ */ #include "GameWindowFullScreen.h" +#include "GameWindowFullScreenText.h" +#include "guilib/GraphicContext.h" //! @todo Remove me +#include "guilib/GUIDialog.h" +#include "guilib/GUIControl.h" +#include "guilib/GUIWindowManager.h" //! @todo Remove me #include "guilib/WindowIDs.h" +#include "input/Action.h" +#include "input/ActionIDs.h" +#include "Application.h" //! @todo Remove me +#include "ApplicationPlayer.h" //! @todo Remove me +#include "GUIInfoManager.h" //! @todo Remove me using namespace KODI; using namespace RETRO; CGameWindowFullScreen::CGameWindowFullScreen(void) : - CGUIWindowFullScreen(WINDOW_FULLSCREEN_GAME) + CGUIWindow(WINDOW_FULLSCREEN_GAME, "VideoFullScreen.xml"), + m_fullscreenText(new CGameWindowFullScreenText(*this)) { + // initialize CGUIControl + m_controlStats = new GUICONTROLSTATS; + + // initialize CGUIWindow + m_loadType = KEEP_IN_MEMORY; +} + +CGameWindowFullScreen::~CGameWindowFullScreen() +{ + delete m_controlStats; +} + +void CGameWindowFullScreen::Process(unsigned int currentTime, CDirtyRegionList &dirtyregion) +{ + MarkDirtyRegion(); + + m_controlStats->Reset(); + + CGUIWindow::Process(currentTime, dirtyregion); + + //! @todo This isn't quite optimal - ideally we'd only be dirtying up the actual video render rect + //! which is probably the job of the renderer as it can more easily track resizing etc. + m_renderRegion.SetRect(0, 0, static_cast(g_graphicsContext.GetWidth()), static_cast(g_graphicsContext.GetHeight())); +} + +void CGameWindowFullScreen::Render() +{ + g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetVideoResolution(), false); + g_application.m_pPlayer->Render(true, 255); + g_graphicsContext.SetRenderingResolution(m_coordsRes, m_needsScaling); + CGUIWindow::Render(); +} + +void CGameWindowFullScreen::RenderEx() +{ + CGUIWindow::RenderEx(); + g_graphicsContext.SetRenderingResolution(g_graphicsContext.GetVideoResolution(), false); + g_application.m_pPlayer->Render(false, 255, false); + g_graphicsContext.SetRenderingResolution(m_coordsRes, m_needsScaling); +} + +bool CGameWindowFullScreen::OnAction(const CAction &action) +{ + switch (action.GetID()) + { + case ACTION_SHOW_OSD: + { + ToggleOSD(); + return true; + } + case ACTION_TRIGGER_OSD: + { + TriggerOSD(); + return true; + } + case ACTION_SHOW_GUI: + { + // Switch back to the menu + g_windowManager.PreviousWindow(); + return true; + } + case ACTION_ASPECT_RATIO: + { + // Toggle the aspect ratio mode (only if the info is onscreen) + //g_application.m_pPlayer->SetRenderViewMode(CViewModeSettings::GetNextQuickCycleViewMode(CMediaSettings::GetInstance().GetCurrentVideoSettings().m_ViewMode)); + return true; + } + default: + break; + } + + return CGUIWindow::OnAction(action); +} + +bool CGameWindowFullScreen::OnMessage(CGUIMessage& message) +{ + switch (message.GetMessage()) + { + case GUI_MSG_SETFOCUS: + case GUI_MSG_LOSTFOCUS: + { + if (message.GetSenderId() != WINDOW_FULLSCREEN_GAME) + return true; + break; + } + default: + break; + } + + return CGUIWindow::OnMessage(message); +} + +void CGameWindowFullScreen::FrameMove() +{ + if (!g_application.m_pPlayer->HasPlayer()) + return; + + m_fullscreenText->FrameMove(); + + CGUIWindow::FrameMove(); +} + +void CGameWindowFullScreen::ClearBackground() +{ + if (g_application.m_pPlayer->IsRenderingVideoLayer()) +#ifdef HAS_IMXVPU + g_graphicsContext.Clear((16 << 16) | (8 << 8) | 16); +#else + g_graphicsContext.Clear(0); +#endif +} + +bool CGameWindowFullScreen::HasVisibleControls() +{ + return m_controlStats->nCountVisible > 0; +} + +void CGameWindowFullScreen::OnWindowLoaded() +{ + CGUIWindow::OnWindowLoaded(); + + // Override the clear colour - we must never clear fullscreen + m_clearBackground = 0; + + m_fullscreenText->OnWindowLoaded(); +} + +void CGameWindowFullScreen::OnInitWindow() +{ + g_infoManager.SetShowInfo(false); + g_infoManager.SetDisplayAfterSeek(0); // Make sure display after seek is off + + // Switch resolution + g_graphicsContext.SetFullScreenVideo(true); //! @todo + + CGUIWindow::OnInitWindow(); +} + +void CGameWindowFullScreen::OnDeinitWindow(int nextWindowID) +{ + // Close all active modal dialogs + g_windowManager.CloseInternalModalDialogs(true); + + CGUIWindow::OnDeinitWindow(nextWindowID); + + CSingleLock lock(g_graphicsContext); + + g_graphicsContext.SetFullScreenVideo(false); //! @todo +} + +void CGameWindowFullScreen::ToggleOSD() +{ + CGUIDialog *pOSD = GetOSD(); + if (pOSD != nullptr) + { + if (pOSD->IsDialogRunning()) + pOSD->Close(); + else + pOSD->Open(); + } + + MarkDirtyRegion(); +} + +void CGameWindowFullScreen::TriggerOSD() +{ + CGUIDialog *pOSD = GetOSD(); + if (pOSD != nullptr) + { + if (!pOSD->IsDialogRunning()) + pOSD->Open(); + } +} + +CGUIDialog *CGameWindowFullScreen::GetOSD() +{ + return g_windowManager.GetDialog(WINDOW_DIALOG_GAME_OSD); } diff --git a/xbmc/cores/RetroPlayer/windows/GameWindowFullScreen.h b/xbmc/cores/RetroPlayer/windows/GameWindowFullScreen.h index 95db3ef51ae27..4a0e283d4ebb8 100644 --- a/xbmc/cores/RetroPlayer/windows/GameWindowFullScreen.h +++ b/xbmc/cores/RetroPlayer/windows/GameWindowFullScreen.h @@ -19,17 +19,47 @@ */ #pragma once -#include "video/windows/GUIWindowFullScreen.h" //! @todo +#include "guilib/GUIWindow.h" + +class CGUIDialog; namespace KODI { namespace RETRO { - class CGameWindowFullScreen : public CGUIWindowFullScreen + class CGameWindowFullScreenText; + + class CGameWindowFullScreen : public CGUIWindow { public: CGameWindowFullScreen(); - ~CGameWindowFullScreen() override = default; + ~CGameWindowFullScreen() override; + + // implementation of CGUIControl via CGUIWindow + void Process(unsigned int currentTime, CDirtyRegionList &dirtyregion) override; + void Render() override; + void RenderEx() override; + bool OnAction(const CAction &action) override; + bool OnMessage(CGUIMessage& message) override; + + // implementation of CGUIWindow + void FrameMove() override; + void ClearBackground() override; + bool HasVisibleControls() override; + void OnWindowLoaded() override; + void OnDeinitWindow(int nextWindowID) override; + + protected: + // implementation of CGUIWindow + void OnInitWindow() override; + + private: + void ToggleOSD(); + void TriggerOSD(); + CGUIDialog *GetOSD(); + + // GUI parameters + std::unique_ptr m_fullscreenText; }; } } diff --git a/xbmc/cores/RetroPlayer/windows/GameWindowFullScreenText.cpp b/xbmc/cores/RetroPlayer/windows/GameWindowFullScreenText.cpp new file mode 100644 index 0000000000000..639ac3563cece --- /dev/null +++ b/xbmc/cores/RetroPlayer/windows/GameWindowFullScreenText.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2017 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Program; see the file COPYING. If not, see + * . + * + */ + +#include "GameWindowFullScreenText.h" +#include "video/windows/GUIWindowFullScreenDefines.h" +#include "guilib/GUIDialog.h" +#include "guilib/GUIMessage.h" +#include "guilib/GUIWindow.h" + +using namespace KODI; +using namespace RETRO; + +CGameWindowFullScreenText::CGameWindowFullScreenText(CGUIWindow &fullscreenWindow) : + m_fullscreenWindow(fullscreenWindow) +{ +} + +void CGameWindowFullScreenText::OnWindowLoaded() +{ + m_bShowText = false; + m_bTextChanged = true; + m_bTextVisibilityChanged = true; + m_lines.clear(); +} + +void CGameWindowFullScreenText::FrameMove() +{ + if (m_bTextChanged) + { + m_bTextChanged = false; + UploadText(); + } + + if (m_bTextVisibilityChanged) + { + m_bTextVisibilityChanged = false; + + if (m_bShowText) + Show(); + else + Hide(); + } +} + +const std::string &CGameWindowFullScreenText::GetText(unsigned int lineIndex) const +{ + if (lineIndex < m_lines.size()) + return m_lines[lineIndex]; + + static const std::string empty; + return empty; +} + +void CGameWindowFullScreenText::SetText(unsigned int lineIndex, std::string line) +{ + if (lineIndex >= m_lines.size()) + m_lines.resize(lineIndex + 1); + + m_lines[lineIndex] = std::move(line); +} + +const std::vector &CGameWindowFullScreenText::GetText() const +{ + return m_lines; +} + +void CGameWindowFullScreenText::SetText(std::vector text) +{ + m_lines = std::move(text); +} + +void CGameWindowFullScreenText::UploadText() +{ + for (unsigned int i = 0; i < m_lines.size(); i++) + { + int rowControl = GetControlID(i); + if (rowControl > 0) + SET_CONTROL_LABEL(rowControl, m_lines[i]); + } +} + +void CGameWindowFullScreenText::Show() +{ + SET_CONTROL_VISIBLE(LABEL_ROW1); + SET_CONTROL_VISIBLE(LABEL_ROW2); + SET_CONTROL_VISIBLE(LABEL_ROW3); + SET_CONTROL_VISIBLE(BLUE_BAR); +} + +void CGameWindowFullScreenText::Hide() +{ + SET_CONTROL_HIDDEN(LABEL_ROW1); + SET_CONTROL_HIDDEN(LABEL_ROW2); + SET_CONTROL_HIDDEN(LABEL_ROW3); + SET_CONTROL_HIDDEN(BLUE_BAR); +} + +int CGameWindowFullScreenText::GetID() const +{ + return m_fullscreenWindow.GetID(); +} + +bool CGameWindowFullScreenText::OnMessage(CGUIMessage &message) +{ + return m_fullscreenWindow.OnMessage(message); +} + +int CGameWindowFullScreenText::GetControlID(unsigned int lineIndex) +{ + switch (lineIndex) + { + case 0: return LABEL_ROW1; + case 1: return LABEL_ROW2; + case 2: return LABEL_ROW3; + default: + break; + } + + return -1; +} diff --git a/xbmc/cores/RetroPlayer/windows/GameWindowFullScreenText.h b/xbmc/cores/RetroPlayer/windows/GameWindowFullScreenText.h new file mode 100644 index 0000000000000..29ca192c22c8e --- /dev/null +++ b/xbmc/cores/RetroPlayer/windows/GameWindowFullScreenText.h @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2017 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Program; see the file COPYING. If not, see + * . + * + */ +#pragma once + +#include +#include + +class CGUIDialog; +class CGUIMessage; +class CGUIWindow; + +namespace KODI +{ +namespace RETRO +{ + class CGameWindowFullScreenText + { + public: + CGameWindowFullScreenText(CGUIWindow &fullscreenWindow); + ~CGameWindowFullScreenText() = default; + + // Window functions + void OnWindowLoaded(); + void FrameMove(); + + /*! + * \brief Get a line of text + */ + const std::string &GetText(unsigned int lineIndex) const; + + /*! + * \brief Set a line of text + */ + void SetText(unsigned int lineIndex, std::string line); + + /*! + * \brief Get entire text + */ + const std::vector &GetText() const; + + /*! + * \brief Set entire text + */ + void SetText(std::vector text); + + private: + // Window functions + void UploadText(); + void Show(); + void Hide(); + + /*! + * \brief Translate line index to the control ID in the skin + * + * \param lineIndex The line in the string vector + * + * \return The ID of the line's label control in the skin + */ + static int GetControlID(unsigned int lineIndex); + + // Window functions required by GUIMessage macros + //! @todo Change macros into functions + int GetID() const; + bool OnMessage(CGUIMessage &message); + + // Construction parameters + CGUIWindow &m_fullscreenWindow; + + // Window state + bool m_bShowText = false; + bool m_bTextChanged = true; + bool m_bTextVisibilityChanged = true; + + // Text + std::vector m_lines; + }; +} +} diff --git a/xbmc/games/dialogs/osd/DialogGameVideoSelect.cpp b/xbmc/games/dialogs/osd/DialogGameVideoSelect.cpp index c705edbc74df3..cb09ba71e1f1c 100644 --- a/xbmc/games/dialogs/osd/DialogGameVideoSelect.cpp +++ b/xbmc/games/dialogs/osd/DialogGameVideoSelect.cpp @@ -118,6 +118,8 @@ void CDialogGameVideoSelect::FrameMove() CGUIBaseContainer *thumbs = dynamic_cast(GetControl(CONTROL_THUMBS)); if (thumbs != nullptr) OnItemFocus(thumbs->GetSelectedItem()); + + CGUIDialog::FrameMove(); } void CDialogGameVideoSelect::OnWindowLoaded() diff --git a/xbmc/video/windows/CMakeLists.txt b/xbmc/video/windows/CMakeLists.txt index a9de0e8810745..0695663a603f6 100644 --- a/xbmc/video/windows/CMakeLists.txt +++ b/xbmc/video/windows/CMakeLists.txt @@ -5,6 +5,7 @@ set(SOURCES GUIWindowFullScreen.cpp VideoFileItemListModifier.cpp) set(HEADERS GUIWindowFullScreen.h + GUIWindowFullScreenDefines.h GUIWindowVideoBase.h GUIWindowVideoNav.h GUIWindowVideoPlaylist.h diff --git a/xbmc/video/windows/GUIWindowFullScreen.cpp b/xbmc/video/windows/GUIWindowFullScreen.cpp index dfbbe3c56f584..4390943c1a51b 100644 --- a/xbmc/video/windows/GUIWindowFullScreen.cpp +++ b/xbmc/video/windows/GUIWindowFullScreen.cpp @@ -21,6 +21,7 @@ #include "threads/SystemClock.h" #include "system.h" #include "GUIWindowFullScreen.h" +#include "GUIWindowFullScreenDefines.h" #include "Application.h" #include "ServiceBroker.h" #include "messaging/ApplicationMessenger.h" @@ -57,28 +58,12 @@ using namespace KODI::MESSAGING; -#define BLUE_BAR 0 -#define LABEL_ROW1 10 -#define LABEL_ROW2 11 -#define LABEL_ROW3 12 - -//Displays current position, visible after seek or when forced -//Alt, use conditional visibility Player.DisplayAfterSeek -#define LABEL_CURRENT_TIME 22 - -//Displays when video is rebuffering -//Alt, use conditional visibility Player.IsCaching -#define LABEL_BUFFERING 24 - -//Progressbar used for buffering status and after seeking -#define CONTROL_PROGRESS 23 - #if defined(TARGET_DARWIN) static CLinuxResourceCounter m_resourceCounter; #endif -CGUIWindowFullScreen::CGUIWindowFullScreen(int windowId) - : CGUIWindow(windowId, "VideoFullScreen.xml") +CGUIWindowFullScreen::CGUIWindowFullScreen() + : CGUIWindow(WINDOW_FULLSCREEN_VIDEO, "VideoFullScreen.xml") { m_viewModeChanged = true; m_dwShowViewModeTimeout = 0; @@ -480,8 +465,5 @@ bool CGUIWindowFullScreen::HasVisibleControls() CGUIDialog *CGUIWindowFullScreen::GetOSD() { - if (g_application.m_pPlayer->IsPlayingGame()) - return g_windowManager.GetDialog(WINDOW_DIALOG_GAME_OSD); - else - return g_windowManager.GetDialog(WINDOW_DIALOG_VIDEO_OSD); + return g_windowManager.GetDialog(WINDOW_DIALOG_VIDEO_OSD); } diff --git a/xbmc/video/windows/GUIWindowFullScreen.h b/xbmc/video/windows/GUIWindowFullScreen.h index 89ef6be2e1f7e..c1995be7a1fc3 100644 --- a/xbmc/video/windows/GUIWindowFullScreen.h +++ b/xbmc/video/windows/GUIWindowFullScreen.h @@ -21,14 +21,13 @@ */ #include "guilib/GUIWindow.h" -#include "guilib/WindowIDs.h" //! @todo class CGUIDialog; class CGUIWindowFullScreen : public CGUIWindow { public: - CGUIWindowFullScreen(int windowId = WINDOW_FULLSCREEN_VIDEO); //! @todo + CGUIWindowFullScreen(); ~CGUIWindowFullScreen(void) override; bool OnMessage(CGUIMessage& message) override; bool OnAction(const CAction &action) override; diff --git a/xbmc/video/windows/GUIWindowFullScreenDefines.h b/xbmc/video/windows/GUIWindowFullScreenDefines.h new file mode 100644 index 0000000000000..504346fe18e1c --- /dev/null +++ b/xbmc/video/windows/GUIWindowFullScreenDefines.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2017 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Program; see the file COPYING. If not, see + * . + * + */ +#pragma once + +#define BLUE_BAR 0 +#define LABEL_ROW1 10 +#define LABEL_ROW2 11 +#define LABEL_ROW3 12 + + // Displays current position, visible after seek or when forced + // Alt, use conditional visibility Player.DisplayAfterSeek +#define LABEL_CURRENT_TIME 22 + + // Displays when video is rebuffering + // Alt, use conditional visibility Player.IsCaching +#define LABEL_BUFFERING 24 + + // Progressbar used for buffering status and after seeking +#define CONTROL_PROGRESS 23 From 08fffa11cba6589544ceed3be8a1532c9a1867a3 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Thu, 7 Sep 2017 22:15:00 +0200 Subject: [PATCH 035/113] [PVR] CPVRClient::CloseStream must reset playing flags and playing recording/channel. --- xbmc/addons/PVRClient.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xbmc/addons/PVRClient.cpp b/xbmc/addons/PVRClient.cpp index 1c8229a62963b..8ee3301f73680 100644 --- a/xbmc/addons/PVRClient.cpp +++ b/xbmc/addons/PVRClient.cpp @@ -1597,10 +1597,12 @@ void CPVRClient::CloseStream(void) if (IsPlayingLiveStream()) { m_struct.toAddon.CloseLiveStream(); + ClearPlayingChannel(); } else if (IsPlayingRecording()) { m_struct.toAddon.CloseRecordedStream(); + ClearPlayingRecording(); } } From 966cb275f9ed5ecf0d49ef43ba38133531ca83cb Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Thu, 7 Sep 2017 18:44:26 -0700 Subject: [PATCH 036/113] VideoShaders: rename VideoFilterShader to VideoFilterShaderGL --- xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp | 2 +- .../VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt | 7 +++++-- .../{VideoFilterShader.cpp => VideoFilterShaderGL.cpp} | 5 +---- .../{VideoFilterShader.h => VideoFilterShaderGL.h} | 0 4 files changed, 7 insertions(+), 7 deletions(-) rename xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/{VideoFilterShader.cpp => VideoFilterShaderGL.cpp} (98%) rename xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/{VideoFilterShader.h => VideoFilterShaderGL.h} (100%) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp index 8ecf3a9e07d1d..2c04a27330e24 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp @@ -33,7 +33,7 @@ #include "settings/MediaSettings.h" #include "settings/Settings.h" #include "VideoShaders/YUV2RGBShader.h" -#include "VideoShaders/VideoFilterShader.h" +#include "VideoShaders/VideoFilterShaderGL.h" #include "windowing/WindowingFactory.h" #include "guilib/Texture.h" #include "guilib/LocalizeStrings.h" diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt index bd92ff8de6ccd..cb79eddf6de5d 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt @@ -13,11 +13,14 @@ endif() if(OPENGL_FOUND OR OPENGLES_FOUND) list(APPEND SOURCES GLSLOutput.cpp - VideoFilterShader.cpp YUV2RGBShader.cpp) list(APPEND HEADERS GLSLOutput.h - VideoFilterShader.h YUV2RGBShader.h) endif() +if(OPENGL_FOUND) + list(APPEND SOURCES VideoFilterShaderGL.cpp) + list(APPEND HEADERS VideoFilterShaderGL.h) +endif() + core_add_library(videoshaders) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShader.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShaderGL.cpp similarity index 98% rename from xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShader.cpp rename to xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShaderGL.cpp index aac511a4263d0..8db8e9a1cd4f9 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShader.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShaderGL.cpp @@ -21,11 +21,10 @@ #include "system.h" -#if defined(HAS_GL) || HAS_GLES >= 2 #include #include -#include "VideoFilterShader.h" +#include "VideoFilterShaderGL.h" #include "utils/log.h" #include "utils/GLUtils.h" #include "ConvolutionKernels.h" @@ -272,5 +271,3 @@ bool DefaultFilterShader::OnEnabled() VerifyGLState(); return true; } - -#endif diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShader.h b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShaderGL.h similarity index 100% rename from xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShader.h rename to xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShaderGL.h From e7003b5bef3c64e84b0656abff70be8c1f08729a Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Thu, 7 Sep 2017 18:45:08 -0700 Subject: [PATCH 037/113] LinuxRendererGLES: implement hq scalers --- system/shaders/convolution-4x4.glsl | 13 + system/shaders/convolution-6x6.glsl | 15 +- .../VideoRenderers/LinuxRendererGLES.cpp | 345 +++++++++++++++++- .../VideoRenderers/LinuxRendererGLES.h | 9 +- .../VideoShaders/CMakeLists.txt | 5 + .../VideoShaders/VideoFilterShaderGLES.cpp | 302 +++++++++++++++ .../VideoShaders/VideoFilterShaderGLES.h | 119 ++++++ 7 files changed, 789 insertions(+), 19 deletions(-) create mode 100644 xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShaderGLES.cpp create mode 100644 xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShaderGLES.h diff --git a/system/shaders/convolution-4x4.glsl b/system/shaders/convolution-4x4.glsl index d41b1272944d7..6413cd6819739 100644 --- a/system/shaders/convolution-4x4.glsl +++ b/system/shaders/convolution-4x4.glsl @@ -18,11 +18,19 @@ * */ +#ifdef GL_ES + precision highp float; +#endif + uniform sampler2D img; uniform vec2 stepxy; uniform float m_stretch; varying vec2 cord; +#ifdef GL_ES + uniform float m_alpha; +#endif + #if (USE1DTEXTURE) uniform sampler1D kernelTex; #else @@ -103,7 +111,12 @@ vec4 process() line(xystart.y + stepxy.y * 2.0, xpos, linetaps) * columntaps.b + line(xystart.y + stepxy.y * 3.0, xpos, linetaps) * columntaps.a; +#ifdef GL_ES + rgb.a = m_alpha; +#else rgb.a = gl_Color.a; +#endif + return rgb; } diff --git a/system/shaders/convolution-6x6.glsl b/system/shaders/convolution-6x6.glsl index 7c568c16ec1a0..fed2332801de2 100644 --- a/system/shaders/convolution-6x6.glsl +++ b/system/shaders/convolution-6x6.glsl @@ -18,11 +18,19 @@ * */ +#ifdef GL_ES + precision highp float; +#endif + uniform sampler2D img; uniform vec2 stepxy; uniform float m_stretch; varying vec2 cord; +#ifdef GL_ES + uniform float m_alpha; +#endif + #if (USE1DTEXTURE) uniform sampler1D kernelTex; #else @@ -80,7 +88,7 @@ half3 line (float ypos, vec3 xpos1, vec3 xpos2, half3 linetaps1, half3 linetaps2 pixel(xpos1.b, ypos) * linetaps1.g + pixel(xpos2.r, ypos) * linetaps2.g + pixel(xpos2.g, ypos) * linetaps1.b + - pixel(xpos2.b, ypos) * linetaps2.b; + pixel(xpos2.b, ypos) * linetaps2.b; } vec4 process() @@ -114,7 +122,12 @@ vec4 process() line(xystart.y + stepxy.y * 4.0, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.b + line(xystart.y + stepxy.y * 5.0, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.b; +#ifdef GL_ES + rgb.a = m_alpha; +#else rgb.a = gl_Color.a; +#endif + return rgb; } diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp index 7bfcea6a7d134..a7722cdcc7385 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp @@ -37,7 +37,7 @@ #include "settings/MediaSettings.h" #include "settings/Settings.h" #include "VideoShaders/YUV2RGBShader.h" -#include "VideoShaders/VideoFilterShader.h" +#include "VideoShaders/VideoFilterShaderGLES.h" #include "windowing/WindowingFactory.h" #include "guilib/Texture.h" #include "threads/SingleLock.h" @@ -99,6 +99,9 @@ CLinuxRendererGLES::CLinuxRendererGLES() m_StrictBinding = false; m_clearColour = 0.0f; + m_fbo.width = 0.0; + m_fbo.height = 0.0; + #if defined(EGL_KHR_reusable_sync) && !defined(EGL_EGLEXT_PROTOTYPES) if (!eglCreateSyncKHR) { eglCreateSyncKHR = (PFNEGLCREATESYNCKHRPROC) eglGetProcAddress("eglCreateSyncKHR"); @@ -349,7 +352,7 @@ void CLinuxRendererGLES::Flush() glFinish(); m_bValidated = false; - m_fbo.Cleanup(); + m_fbo.fbo.Cleanup(); m_iYV12RenderBuffer = 0; } @@ -458,7 +461,7 @@ void CLinuxRendererGLES::UpdateVideoFilter() delete m_pVideoFilterShader; m_pVideoFilterShader = NULL; } - m_fbo.Cleanup(); + m_fbo.fbo.Cleanup(); VerifyGLState(); @@ -474,12 +477,40 @@ void CLinuxRendererGLES::UpdateVideoFilter() m_renderQuality = RQ_SINGLEPASS; return; - case VS_SCALINGMETHOD_CUBIC: - CLog::Log(LOGERROR, "GLES: CUBIC not supported!"); - break; - case VS_SCALINGMETHOD_LANCZOS2: + case VS_SCALINGMETHOD_SPLINE36_FAST: + case VS_SCALINGMETHOD_LANCZOS3_FAST: + case VS_SCALINGMETHOD_SPLINE36: case VS_SCALINGMETHOD_LANCZOS3: + case VS_SCALINGMETHOD_CUBIC: + if (m_renderMethod & RENDER_GLSL) + { + if (!m_fbo.fbo.Initialize()) + { + CLog::Log(LOGERROR, "GL: Error initializing FBO"); + break; + } + + if (!m_fbo.fbo.CreateAndBindToTexture(GL_TEXTURE_2D, m_sourceWidth, m_sourceHeight, GL_RGBA)) + { + CLog::Log(LOGERROR, "GL: Error creating texture and binding to FBO"); + break; + } + } + + m_pVideoFilterShader = new ConvolutionFilterShader(m_scalingMethod, false); + if (!m_pVideoFilterShader->CompileAndLink()) + { + CLog::Log(LOGERROR, "GL: Error compiling and linking video filter shader"); + break; + } + SetTextureFilter(GL_LINEAR); + m_renderQuality = RQ_MULTIPASS; + return; + + case VS_SCALINGMETHOD_BICUBIC_SOFTWARE: + case VS_SCALINGMETHOD_LANCZOS_SOFTWARE: + case VS_SCALINGMETHOD_SINC_SOFTWARE: case VS_SCALINGMETHOD_SINC8: case VS_SCALINGMETHOD_NEDI: CLog::Log(LOGERROR, "GL: TODO: This scaler has not yet been implemented"); @@ -496,7 +527,7 @@ void CLinuxRendererGLES::UpdateVideoFilter() delete m_pVideoFilterShader; m_pVideoFilterShader = NULL; } - m_fbo.Cleanup(); + m_fbo.fbo.Cleanup(); SetTextureFilter(GL_LINEAR); m_renderQuality = RQ_SINGLEPASS; @@ -541,6 +572,7 @@ void CLinuxRendererGLES::LoadShaders(int field) break; } } + break; default: { m_renderMethod = -1 ; @@ -595,7 +627,7 @@ void CLinuxRendererGLES::UnInit() DeleteTexture(i); // cleanup framebuffer object if it was in use - m_fbo.Cleanup(); + m_fbo.fbo.Cleanup(); m_bValidated = false; m_bConfigured = false; } @@ -667,7 +699,9 @@ void CLinuxRendererGLES::Render(DWORD flags, int index) // call texture load function if (!UploadTexture(index)) + { return; + } if (RenderHook(index)) ; @@ -683,7 +717,8 @@ void CLinuxRendererGLES::Render(DWORD flags, int index) break; case RQ_MULTIPASS: - RenderMultiPass(index, m_currentField); + RenderToFBO(index, m_currentField); + RenderFromFBO(); VerifyGLState(); break; @@ -691,7 +726,7 @@ void CLinuxRendererGLES::Render(DWORD flags, int index) break; } } - + AfterRenderHook(index); } @@ -803,11 +838,264 @@ void CLinuxRendererGLES::RenderSinglePass(int index, int field) VerifyGLState(); } -void CLinuxRendererGLES::RenderMultiPass(int index, int field) +void CLinuxRendererGLES::RenderToFBO(int index, int field, bool weave /*= false*/) { - //! @todo Multipass rendering does not currently work! FIX! - CLog::Log(LOGERROR, "GLES: MULTIPASS rendering was called! But it doesnt work!!!"); - return; + YUVPLANE (&planes)[YuvImage::MAX_PLANES] = m_buffers[index].fields[field]; + + if (m_reloadShaders) + { + m_reloadShaders = 0; + LoadShaders(m_currentField); + } + + if (!m_fbo.fbo.IsValid()) + { + if (!m_fbo.fbo.Initialize()) + { + CLog::Log(LOGERROR, "GL: Error initializing FBO"); + return; + } + if (!m_fbo.fbo.CreateAndBindToTexture(GL_TEXTURE_2D, m_sourceWidth, m_sourceHeight, GL_RGBA, GL_SHORT)) + { + CLog::Log(LOGERROR, "GL: Error creating texture and binding to FBO"); + return; + } + } + + glDisable(GL_DEPTH_TEST); + + // Y + glEnable(m_textureTarget); + glActiveTexture(GL_TEXTURE0); + glBindTexture(m_textureTarget, planes[0].id); + VerifyGLState(); + + // U + glActiveTexture(GL_TEXTURE1); + glEnable(m_textureTarget); + glBindTexture(m_textureTarget, planes[1].id); + VerifyGLState(); + + // V + glActiveTexture(GL_TEXTURE2); + glEnable(m_textureTarget); + glBindTexture(m_textureTarget, planes[2].id); + VerifyGLState(); + + glActiveTexture(GL_TEXTURE0); + VerifyGLState(); + + Shaders::BaseYUV2RGBShader *pYUVShader = m_pYUVProgShader; + // make sure the yuv shader is loaded and ready to go + if (!pYUVShader || (!pYUVShader->OK())) + { + CLog::Log(LOGERROR, "GL: YUV shader not active, cannot do multipass render"); + return; + } + + m_fbo.fbo.BeginRender(); + VerifyGLState(); + + pYUVShader->SetBlack(CMediaSettings::GetInstance().GetCurrentVideoSettings().m_Brightness * 0.01f - 0.5f); + pYUVShader->SetContrast(CMediaSettings::GetInstance().GetCurrentVideoSettings().m_Contrast * 0.02f); + pYUVShader->SetWidth(planes[0].texwidth); + pYUVShader->SetHeight(planes[0].texheight); + pYUVShader->SetNonLinStretch(1.0); + if (field == FIELD_TOP) + pYUVShader->SetField(1); + else if(field == FIELD_BOT) + pYUVShader->SetField(0); + + pYUVShader->SetConvertFullColorRange(!g_Windowing.UseLimitedColor()); + + VerifyGLState(); + + glMatrixModview.Push(); + glMatrixModview->LoadIdentity(); + glMatrixModview.Load(); + + glMatrixProject.Push(); + glMatrixProject->LoadIdentity(); + glMatrixProject->Ortho2D(0, m_sourceWidth, 0, m_sourceHeight); + glMatrixProject.Load(); + + pYUVShader->SetMatrices(glMatrixProject.Get(), glMatrixModview.Get()); + + CRect viewport; + g_Windowing.GetViewPort(viewport); + glViewport(0, 0, m_sourceWidth, m_sourceHeight); + glScissor (0, 0, m_sourceWidth, m_sourceHeight); + + if (!pYUVShader->Enable()) + { + CLog::Log(LOGERROR, "GL: Error enabling YUV shader"); + } + + m_fbo.width = planes[0].rect.x2 - planes[0].rect.x1; + m_fbo.height = planes[0].rect.y2 - planes[0].rect.y1; + if (m_textureTarget == GL_TEXTURE_2D) + { + m_fbo.width *= planes[0].texwidth; + m_fbo.height *= planes[0].texheight; + } + m_fbo.width *= planes[0].pixpertex_x; + m_fbo.height *= planes[0].pixpertex_y; + if (weave) + m_fbo.height *= 2; + + // 1st Pass to video frame size + GLubyte idx[4] = {0, 1, 3, 2}; //determines order of triangle strip + GLfloat vert[4][3]; + GLfloat tex[3][4][2]; + + GLint vertLoc = pYUVShader->GetVertexLoc(); + GLint Yloc = pYUVShader->GetYcoordLoc(); + GLint Uloc = pYUVShader->GetUcoordLoc(); + GLint Vloc = pYUVShader->GetVcoordLoc(); + + glVertexAttribPointer(vertLoc, 3, GL_FLOAT, 0, 0, vert); + glVertexAttribPointer(Yloc, 2, GL_FLOAT, 0, 0, tex[0]); + glVertexAttribPointer(Uloc, 2, GL_FLOAT, 0, 0, tex[1]); + glVertexAttribPointer(Vloc, 2, GL_FLOAT, 0, 0, tex[2]); + + glEnableVertexAttribArray(vertLoc); + glEnableVertexAttribArray(Yloc); + glEnableVertexAttribArray(Uloc); + glEnableVertexAttribArray(Vloc); + + // Setup vertex position values + // Set vertex coordinates + vert[0][0] = vert[3][0] = 0.0f; + vert[0][1] = vert[1][1] = 0.0f; + vert[1][0] = vert[2][0] = m_fbo.width; + vert[2][1] = vert[3][1] = m_fbo.height; + vert[0][2] = vert[1][2] = vert[2][2] = vert[3][2] = 0.0f; + + + // Setup texture coordinates + for (int i=0; i<3; i++) + { + tex[i][0][0] = tex[i][3][0] = planes[i].rect.x1; + tex[i][0][1] = tex[i][1][1] = planes[i].rect.y1; + tex[i][1][0] = tex[i][2][0] = planes[i].rect.x2; + tex[i][2][1] = tex[i][3][1] = planes[i].rect.y2; + } + + glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, idx); + + VerifyGLState(); + + pYUVShader->Disable(); + + glMatrixModview.PopLoad(); + glMatrixProject.PopLoad(); + + VerifyGLState(); + + glDisableVertexAttribArray(vertLoc); + glDisableVertexAttribArray(Yloc); + glDisableVertexAttribArray(Uloc); + glDisableVertexAttribArray(Vloc); + + g_Windowing.SetViewPort(viewport); + + m_fbo.fbo.EndRender(); + + glActiveTexture(GL_TEXTURE1); + glDisable(m_textureTarget); + + glActiveTexture(GL_TEXTURE2); + glDisable(m_textureTarget); + + glActiveTexture(GL_TEXTURE0); + glDisable(m_textureTarget); + + VerifyGLState(); +} + +void CLinuxRendererGLES::RenderFromFBO() +{ + glEnable(GL_TEXTURE_2D); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, m_fbo.fbo.Texture()); + VerifyGLState(); + + // Use regular normalized texture coordinates + + // 2nd Pass to screen size with optional video filter + + if (m_pVideoFilterShader) + { + GLint filter; + if (!m_pVideoFilterShader->GetTextureFilter(filter)) + filter = m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR; + + m_fbo.fbo.SetFiltering(GL_TEXTURE_2D, filter); + m_pVideoFilterShader->SetSourceTexture(0); + m_pVideoFilterShader->SetWidth(m_sourceWidth); + m_pVideoFilterShader->SetHeight(m_sourceHeight); + m_pVideoFilterShader->SetAlpha(1.0f); + + //disable non-linear stretch when a dvd menu is shown, parts of the menu are rendered through the overlay renderer + //having non-linear stretch on breaks the alignment + if (g_application.m_pPlayer->IsInMenu()) + m_pVideoFilterShader->SetNonLinStretch(1.0); + else + m_pVideoFilterShader->SetNonLinStretch(pow(CDisplaySettings::GetInstance().GetPixelRatio(), g_advancedSettings.m_videoNonLinStretchRatio)); + + m_pVideoFilterShader->SetMatrices(glMatrixProject.Get(), glMatrixModview.Get()); + m_pVideoFilterShader->Enable(); + } + else + { + GLint filter = m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR; + m_fbo.fbo.SetFiltering(GL_TEXTURE_2D, filter); + } + + VerifyGLState(); + + float imgwidth = m_fbo.width / m_sourceWidth; + float imgheight = m_fbo.height / m_sourceHeight; + + GLubyte idx[4] = {0, 1, 3, 2}; //determines order of triangle strip + GLfloat vert[4][3]; + GLfloat tex[4][2]; + + GLint vertLoc = m_pVideoFilterShader->GetVertexLoc(); + GLint loc = m_pVideoFilterShader->GetcoordLoc(); + + glVertexAttribPointer(vertLoc, 3, GL_FLOAT, 0, 0, vert); + glVertexAttribPointer(loc, 2, GL_FLOAT, 0, 0, tex); + + glEnableVertexAttribArray(vertLoc); + glEnableVertexAttribArray(loc); + + // Setup vertex position values + for(int i = 0; i < 4; i++) + { + vert[i][0] = m_rotatedDestCoords[i].x; + vert[i][1] = m_rotatedDestCoords[i].y; + vert[i][2] = 0.0f;// set z to 0 + } + + // Setup texture coordinates + tex[0][0] = tex[3][0] = 0.0f; + tex[0][1] = tex[1][1] = 0.0f; + tex[1][0] = tex[2][0] = imgwidth; + tex[2][1] = tex[3][1] = imgheight; + + glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, idx); + + VerifyGLState(); + + if (m_pVideoFilterShader) + m_pVideoFilterShader->Disable(); + + VerifyGLState(); + + glBindTexture(GL_TEXTURE_2D, 0); + glDisable(GL_TEXTURE_2D); + VerifyGLState(); } bool CLinuxRendererGLES::RenderCapture(CRenderCapture* capture) @@ -1302,7 +1590,7 @@ bool CLinuxRendererGLES::Supports(ERENDERFEATURE feature) bool CLinuxRendererGLES::SupportsMultiPassRendering() { - return false; + return true; } bool CLinuxRendererGLES::Supports(ESCALINGMETHOD method) @@ -1311,6 +1599,31 @@ bool CLinuxRendererGLES::Supports(ESCALINGMETHOD method) || method == VS_SCALINGMETHOD_LINEAR) return true; + if(method == VS_SCALINGMETHOD_CUBIC + || method == VS_SCALINGMETHOD_LANCZOS2 + || method == VS_SCALINGMETHOD_SPLINE36_FAST + || method == VS_SCALINGMETHOD_LANCZOS3_FAST + || method == VS_SCALINGMETHOD_SPLINE36 + || method == VS_SCALINGMETHOD_LANCZOS3) + { + // if scaling is below level, avoid hq scaling + float scaleX = fabs(((float)m_sourceWidth - m_destRect.Width())/m_sourceWidth)*100; + float scaleY = fabs(((float)m_sourceHeight - m_destRect.Height())/m_sourceHeight)*100; + int minScale = CServiceBroker::GetSettings().GetInt(CSettings::SETTING_VIDEOPLAYER_HQSCALERS); + if (scaleX < minScale && scaleY < minScale) + return false; + + if (m_renderMethod & RENDER_GLSL) + { + // spline36 and lanczos3 are only allowed through advancedsettings.xml + if(method != VS_SCALINGMETHOD_SPLINE36 + && method != VS_SCALINGMETHOD_LANCZOS3) + return true; + else + return g_advancedSettings.m_videoEnableHighQualityHwScalers; + } + } + return false; } diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h index a94a822b8a976..9cd8e70f81793 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h @@ -161,7 +161,8 @@ class CLinuxRendererGLES : public CBaseRenderer void CalculateTextureSourceRects(int source, int num_planes); // renderers - void RenderMultiPass(int index, int field); // multi pass glsl renderer + void RenderToFBO(int index, int field, bool weave = false); + void RenderFromFBO(); void RenderSinglePass(int index, int field); // single pass glsl renderer // hooks for HwDec Renderered @@ -169,7 +170,11 @@ class CLinuxRendererGLES : public CBaseRenderer virtual bool RenderHook(int idx) { return false; }; virtual void AfterRenderHook(int idx) {}; - CFrameBufferObject m_fbo; + struct + { + CFrameBufferObject fbo; + float width, height; + } m_fbo; int m_iYV12RenderBuffer; int m_NumYV12Buffers; diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt index cb79eddf6de5d..9d52775b67b9c 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt @@ -23,4 +23,9 @@ if(OPENGL_FOUND) list(APPEND HEADERS VideoFilterShaderGL.h) endif() +if(OPENGLES_FOUND) + list(APPEND SOURCES VideoFilterShaderGLES.cpp) + list(APPEND HEADERS VideoFilterShaderGLES.h) +endif() + core_add_library(videoshaders) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShaderGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShaderGLES.cpp new file mode 100644 index 0000000000000..d289ab131604e --- /dev/null +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShaderGLES.cpp @@ -0,0 +1,302 @@ +/* + * Copyright (c) 2007 d4rk + * Copyright (C) 2007-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include "system.h" + +#include +#include + +#include "VideoFilterShaderGLES.h" +#include "utils/log.h" +#include "utils/GLUtils.h" +#include "ConvolutionKernels.h" +#include "windowing/WindowingFactory.h" + +#define TEXTARGET GL_TEXTURE_2D + +using namespace Shaders; + +////////////////////////////////////////////////////////////////////// +// BaseVideoFilterShader - base class for video filter shaders +////////////////////////////////////////////////////////////////////// + +BaseVideoFilterShader::BaseVideoFilterShader() +{ + m_width = 1; + m_height = 1; + m_hStepXY = 0; + m_stepX = 0; + m_stepY = 0; + m_sourceTexUnit = 0; + m_hSourceTex = 0; + + m_stretch = 0.0f; + + m_hVertex = -1; + m_hcoord = -1; + m_hProj = -1; + m_hModel = -1; + m_hAlpha = -1; + + m_proj = nullptr; + m_model = nullptr; + m_alpha = -1; + + std::string shaderv = + "attribute vec4 m_attrpos;" + "attribute vec2 m_attrcord;" + "varying vec2 cord;" + "uniform mat4 m_proj;" + "uniform mat4 m_model;" + + "void main ()" + "{" + "mat4 mvp = m_proj * m_model;" + "gl_Position = mvp * m_attrpos;" + "cord = m_attrcord.xy;" + "}"; + VertexShader()->SetSource(shaderv); + + std::string shaderp = + "precision mediump float;" + "uniform sampler2D img;" + "varying vec2 cord;" + "void main()" + "{" + "gl_FragColor = texture2D(img, cord);" + "}"; + PixelShader()->SetSource(shaderp); +} + +void BaseVideoFilterShader::OnCompiledAndLinked() +{ + m_hVertex = glGetAttribLocation(ProgramHandle(), "m_attrpos"); + m_hcoord = glGetAttribLocation(ProgramHandle(), "m_attrcord"); + m_hAlpha = glGetUniformLocation(ProgramHandle(), "m_alpha"); + m_hProj = glGetUniformLocation(ProgramHandle(), "m_proj"); + m_hModel = glGetUniformLocation(ProgramHandle(), "m_model"); +} + +bool BaseVideoFilterShader::OnEnabled() +{ + glUniformMatrix4fv(m_hProj, 1, GL_FALSE, m_proj); + glUniformMatrix4fv(m_hModel, 1, GL_FALSE, m_model); + glUniform1f(m_hAlpha, m_alpha); + return true; +} + +ConvolutionFilterShader::ConvolutionFilterShader(ESCALINGMETHOD method, bool stretch, GLSLOutput *output) +{ + m_method = method; + m_kernelTex1 = 0; + m_hKernTex = -1; + + std::string shadername; + std::string defines; + + if (g_Windowing.IsExtSupported("GL_EXT_color_buffer_float")) + { + m_floattex = true; + } + else + { + m_floattex = false; + } + + if (m_method == VS_SCALINGMETHOD_CUBIC || + m_method == VS_SCALINGMETHOD_LANCZOS2 || + m_method == VS_SCALINGMETHOD_SPLINE36_FAST || + m_method == VS_SCALINGMETHOD_LANCZOS3_FAST) + { + shadername = "convolution-4x4.glsl"; + } + else if (m_method == VS_SCALINGMETHOD_SPLINE36 || + m_method == VS_SCALINGMETHOD_LANCZOS3) + { + shadername = "convolution-6x6.glsl"; + } + + if (m_floattex) + { + m_internalformat = GL_RGBA16F_EXT; + defines = "#define HAS_FLOAT_TEXTURE 1\n"; + } + else + { + m_internalformat = GL_RGBA; + defines = "#define HAS_FLOAT_TEXTURE 0\n"; + } + + //don't compile in stretch support when it's not needed + if (stretch) + defines += "#define XBMC_STRETCH 1\n"; + else + defines += "#define XBMC_STRETCH 0\n"; + + // get defines from the output stage if used + m_glslOutput = output; + if (m_glslOutput) { + defines += m_glslOutput->GetDefines(); + } + + //tell shader if we're not using a 1D texture + defines += "#define USE1DTEXTURE 0\n"; + + CLog::Log(LOGDEBUG, "GL: ConvolutionFilterShader: using %s defines:\n%s", shadername.c_str(), defines.c_str()); + PixelShader()->LoadSource(shadername, defines); + PixelShader()->AppendSource("output.glsl"); +} + +ConvolutionFilterShader::~ConvolutionFilterShader() +{ + delete m_glslOutput; +} + +void ConvolutionFilterShader::OnCompiledAndLinked() +{ + BaseVideoFilterShader::OnCompiledAndLinked(); + + // obtain shader attribute handles on successful compilation + m_hSourceTex = glGetUniformLocation(ProgramHandle(), "img"); + m_hStepXY = glGetUniformLocation(ProgramHandle(), "stepxy"); + m_hKernTex = glGetUniformLocation(ProgramHandle(), "kernelTex"); + m_hStretch = glGetUniformLocation(ProgramHandle(), "m_stretch"); + + CConvolutionKernel kernel(m_method, 256); + + if (m_kernelTex1) + { + glDeleteTextures(1, &m_kernelTex1); + m_kernelTex1 = 0; + } + + glGenTextures(1, &m_kernelTex1); + + if ((m_kernelTex1<=0)) + { + CLog::Log(LOGERROR, "GL: ConvolutionFilterShader: Error creating kernel texture"); + return; + } + + //make a kernel texture on GL_TEXTURE2 and set clamping and interpolation + //TEXTARGET is set to GL_TEXTURE_1D or GL_TEXTURE_2D + glActiveTexture(GL_TEXTURE2); + glBindTexture(TEXTARGET, m_kernelTex1); + glTexParameteri(TEXTARGET, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(TEXTARGET, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(TEXTARGET, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(TEXTARGET, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + //if float textures are supported, we can load the kernel as a float texture + //if not we load it as 8 bit unsigned which gets converted back to float in the shader + GLenum format; + GLvoid* data; + if (m_floattex) + { + format = GL_FLOAT; + data = (GLvoid*)kernel.GetFloatPixels(); + } + else + { + format = GL_UNSIGNED_BYTE; + data = (GLvoid*)kernel.GetUint8Pixels(); + } + + //upload as 2D texture with height of 1 + glTexImage2D(TEXTARGET, 0, m_internalformat, kernel.GetSize(), 1, 0, GL_RGBA, format, data); + + glActiveTexture(GL_TEXTURE0); + + VerifyGLState(); + + if (m_glslOutput) m_glslOutput->OnCompiledAndLinked(ProgramHandle()); +} + +bool ConvolutionFilterShader::OnEnabled() +{ + BaseVideoFilterShader::OnEnabled(); + + // set shader attributes once enabled + glActiveTexture(GL_TEXTURE2); + glBindTexture(TEXTARGET, m_kernelTex1); + + glActiveTexture(GL_TEXTURE0); + glUniform1i(m_hSourceTex, m_sourceTexUnit); + glUniform1i(m_hKernTex, 2); + glUniform2f(m_hStepXY, m_stepX, m_stepY); + glUniform1f(m_hStretch, m_stretch); + VerifyGLState(); + if (m_glslOutput) m_glslOutput->OnEnabled(); + return true; +} + +void ConvolutionFilterShader::OnDisabled() +{ + if (m_glslOutput) m_glslOutput->OnDisabled(); +} + +void ConvolutionFilterShader::Free() +{ + if (m_kernelTex1) + glDeleteTextures(1, &m_kernelTex1); + m_kernelTex1 = 0; + if (m_glslOutput) m_glslOutput->Free(); + BaseVideoFilterShader::Free(); +} + +StretchFilterShader::StretchFilterShader() +{ + PixelShader()->LoadSource("stretch.glsl"); +} + +void StretchFilterShader::OnCompiledAndLinked() +{ + BaseVideoFilterShader::OnCompiledAndLinked(); + + m_hSourceTex = glGetUniformLocation(ProgramHandle(), "img"); + m_hStretch = glGetUniformLocation(ProgramHandle(), "m_stretch"); +} + +bool StretchFilterShader::OnEnabled() +{ + BaseVideoFilterShader::OnEnabled(); + + glUniform1i(m_hSourceTex, m_sourceTexUnit); + glUniform1f(m_hStretch, m_stretch); + VerifyGLState(); + return true; +} + +void DefaultFilterShader::OnCompiledAndLinked() +{ + BaseVideoFilterShader::OnCompiledAndLinked(); + + m_hSourceTex = glGetUniformLocation(ProgramHandle(), "img"); +} + +bool DefaultFilterShader::OnEnabled() +{ + BaseVideoFilterShader::OnEnabled(); + + glUniform1i(m_hSourceTex, m_sourceTexUnit); + VerifyGLState(); + return true; +} diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShaderGLES.h b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShaderGLES.h new file mode 100644 index 0000000000000..48520c59c27db --- /dev/null +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/VideoFilterShaderGLES.h @@ -0,0 +1,119 @@ +#pragma once + +/* + * Copyright (C) 2007-2015 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kodi; see the file COPYING. If not, see + * . + * + */ + +#include "system.h" + +#if defined(HAS_GL) || HAS_GLES >= 2 +#include "system_gl.h" + + +#include "guilib/Shader.h" +#include "settings/VideoSettings.h" +#include "GLSLOutput.h" + +namespace Shaders { + + class BaseVideoFilterShader : public CGLSLShaderProgram + { + public: + BaseVideoFilterShader(); + virtual void OnCompiledAndLinked(); + virtual bool OnEnabled(); + virtual void SetSourceTexture(GLint ytex) { m_sourceTexUnit = ytex; } + virtual void SetWidth(int w) { m_width = w; m_stepX = w>0?1.0f/w:0; } + virtual void SetHeight(int h) { m_height = h; m_stepY = h>0?1.0f/h:0; } + virtual void SetNonLinStretch(float stretch) { m_stretch = stretch; } + virtual bool GetTextureFilter(GLint& filter) { return false; } + virtual GLint GetVertexLoc() { return m_hVertex; } + virtual GLint GetcoordLoc() { return m_hcoord; } + virtual void SetMatrices(GLfloat *p, GLfloat *m) { m_proj = p; m_model = m; } + virtual void SetAlpha(GLfloat alpha) { m_alpha = alpha; } + + protected: + int m_width; + int m_height; + float m_stepX; + float m_stepY; + float m_stretch; + GLint m_sourceTexUnit; + + // shader attribute handles + GLint m_hSourceTex; + GLint m_hStepXY; + GLint m_hStretch = 0; + + GLint m_hVertex; + GLint m_hcoord; + GLint m_hProj; + GLint m_hModel; + GLint m_hAlpha; + + GLfloat *m_proj; + GLfloat *m_model; + GLfloat m_alpha; + }; + + class ConvolutionFilterShader : public BaseVideoFilterShader + { + public: + ConvolutionFilterShader(ESCALINGMETHOD method, bool stretch, GLSLOutput *output=NULL); + ~ConvolutionFilterShader() override; + void OnCompiledAndLinked() override; + bool OnEnabled() override; + void OnDisabled() override; + void Free() override; + + bool GetTextureFilter(GLint& filter) override { filter = GL_NEAREST; return true; } + + protected: + // kernel textures + GLuint m_kernelTex1; + + // shader handles to kernel textures + GLint m_hKernTex; + + ESCALINGMETHOD m_method; + bool m_floattex; //if float textures are supported + GLint m_internalformat; + + Shaders::GLSLOutput *m_glslOutput; + }; + + class StretchFilterShader : public BaseVideoFilterShader + { + public: + StretchFilterShader(); + void OnCompiledAndLinked() override; + bool OnEnabled() override; + }; + + class DefaultFilterShader : public BaseVideoFilterShader + { + public: + void OnCompiledAndLinked() override; + bool OnEnabled() override; + }; + +} // end namespace + +#endif + From 300833d8d711f45055cbda8bde61031e4fd1d2ac Mon Sep 17 00:00:00 2001 From: Rechi Date: Fri, 8 Sep 2017 16:28:21 +0200 Subject: [PATCH 038/113] FFmpeg: Bump to 3.3.3-Leia-Alpha-1 --- tools/depends/target/ffmpeg/FFMPEG-VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/depends/target/ffmpeg/FFMPEG-VERSION b/tools/depends/target/ffmpeg/FFMPEG-VERSION index 5e76db735f5a5..fc927b51c3a4f 100644 --- a/tools/depends/target/ffmpeg/FFMPEG-VERSION +++ b/tools/depends/target/ffmpeg/FFMPEG-VERSION @@ -1,5 +1,5 @@ LIBNAME=ffmpeg BASE_URL=https://github.com/xbmc/FFmpeg -VERSION=3.3.2-Leia-Alpha-1 +VERSION=3.3.3-Leia-Alpha-1 ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz GNUTLS_VER=3.4.14 From 074581ebd97bbb91e0c88783bd9d5fa37760bbe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20B=C3=BChlmann?= Date: Fri, 8 Sep 2017 01:22:33 +0200 Subject: [PATCH 039/113] Allow the binary addon to set redirect limit --- xbmc/filesystem/CurlFile.cpp | 9 ++++++--- xbmc/filesystem/CurlFile.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/xbmc/filesystem/CurlFile.cpp b/xbmc/filesystem/CurlFile.cpp index ebebcf689e995..277f6abe7b0fb 100644 --- a/xbmc/filesystem/CurlFile.cpp +++ b/xbmc/filesystem/CurlFile.cpp @@ -427,6 +427,7 @@ CCurlFile::CCurlFile() m_seekable = true; m_useOldHttpVersion = false; m_connecttimeout = 0; + m_redirectlimit = 5; m_lowspeedtime = 0; m_ftpauth = ""; m_ftpport = ""; @@ -503,9 +504,9 @@ void CCurlFile::SetCommonOptions(CReadState* state) g_curlInterface.easy_setopt(h, CURLOPT_FTP_USE_EPSV, 0); // turn off epsv - // Allow us to follow two redirects - g_curlInterface.easy_setopt(h, CURLOPT_FOLLOWLOCATION, TRUE); - g_curlInterface.easy_setopt(h, CURLOPT_MAXREDIRS, 5); + // Allow us to follow redirects + g_curlInterface.easy_setopt(h, CURLOPT_FOLLOWLOCATION, m_redirectlimit != 0); + g_curlInterface.easy_setopt(h, CURLOPT_MAXREDIRS, m_redirectlimit); // Enable cookie engine for current handle g_curlInterface.easy_setopt(h, CURLOPT_COOKIEFILE, ""); @@ -821,6 +822,8 @@ void CCurlFile::ParseAndCorrectUrl(CURL &url2) m_cipherlist = value; else if (name == "connection-timeout") m_connecttimeout = strtol(value.c_str(), NULL, 10); + else if (name == "redirect-limit") + m_redirectlimit = strtol(value.c_str(), NULL, 10); else if (name == "postdata") { m_postdata = Base64::Decode(value); diff --git a/xbmc/filesystem/CurlFile.h b/xbmc/filesystem/CurlFile.h index 8fa218caac8c7..ef0dbaa360aeb 100644 --- a/xbmc/filesystem/CurlFile.h +++ b/xbmc/filesystem/CurlFile.h @@ -184,6 +184,7 @@ namespace XFILE std::string m_cipherlist; bool m_ftppasvip; int m_connecttimeout; + int m_redirectlimit; int m_lowspeedtime; bool m_opened; bool m_forWrite; From 9eb00725944eb12abc096dce3de475af29a65886 Mon Sep 17 00:00:00 2001 From: fritsch Date: Sat, 9 Sep 2017 06:41:52 +0200 Subject: [PATCH 040/113] Language: Add description for SPDIF 352.8 and 384 khz --- .../resource.language.en_gb/resources/strings.po | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po index 0d0a2afbd1e65..eaa22308a95e0 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -16383,8 +16383,20 @@ msgctxt "#34128" msgid "192.0" msgstr "" +#. SPDIF max sampling rate +#: system/settings/settings.xml +msgctxt "#34129" +msgid "352.8" +msgstr "" + +#. SPDIF max sampling rate +#: system/settings/settings.xml +msgctxt "#34130" +msgid "384.0" +msgstr "" + #empty strings from id 34129 to 34200 -#34129-34200 reserved for future use +#34131-34200 reserved for future use #: xbmc/PlayListPlayer.cpp msgctxt "#34201" From 03b4396b466ea7c19e70313619c75577b3dd250a Mon Sep 17 00:00:00 2001 From: fritsch Date: Sat, 9 Sep 2017 06:42:13 +0200 Subject: [PATCH 041/113] Settings: Make 352.8 khz and 384 khz available for SPDIF --- system/settings/settings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/system/settings/settings.xml b/system/settings/settings.xml index 763ab04833bfb..7b011c2211a7f 100755 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -2580,6 +2580,8 @@ + + From c1d3beedb16ba0cda61919361ba69f4c2c1473c5 Mon Sep 17 00:00:00 2001 From: Philipp Kerling Date: Sun, 6 Aug 2017 16:59:36 +0200 Subject: [PATCH 042/113] Remove dependency on (un)zip where unwarranted zip is only used for darwin codesigning. unzip is used both for codesigning and android. All other platforms do not use them, so no need to check for them. --- docs/README.android | 2 +- docs/README.armel | 2 +- docs/README.linux | 3 +-- docs/README.opensuse | 4 ++-- docs/README.ubuntu | 2 +- tools/depends/configure.ac | 24 ++++++++++++++---------- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/docs/README.android b/docs/README.android index f55086d0ec411..daf8b65c137e6 100644 --- a/docs/README.android +++ b/docs/README.android @@ -29,7 +29,7 @@ These are the minimum packages necessary for building Kodi. Non-Ubuntu users will need to get the equivalents. $ sudo apt-get install build-essential default-jdk git curl autoconf \ - unzip zip zlib1g-dev gawk gperf cmake libcurl4-openssl-dev + unzip zlib1g-dev gawk gperf cmake libcurl4-openssl-dev If you run a 64bit operating system you will also need to get ia32-libs diff --git a/docs/README.armel b/docs/README.armel index dce9216b099c2..2a28faaf06212 100644 --- a/docs/README.armel +++ b/docs/README.armel @@ -217,7 +217,7 @@ These are python and liblzo2 For Angstrom: $ opkg update - $ opkg install subversion make g++ gcc gawk pmount libtool automake gperf unzip bison libsdl-1.2-dev libsdl-gfx-dev libfribidi-dev liblzo-dev libfreetype-dev libsqlite3-dev libasound2 python-sqlite3 libcurl4 libxrandr-dev libxrender-dev libmysqlclient-dev libpcre-dev libdbus-glib-1-dev hal-dev libfontconfig-dev libxt-dev libxmu-dev libpng-dev libjpeg-dev + $ opkg install subversion make g++ gcc gawk pmount libtool automake gperf bison libsdl-1.2-dev libsdl-gfx-dev libfribidi-dev liblzo-dev libfreetype-dev libsqlite3-dev libasound2 python-sqlite3 libcurl4 libxrandr-dev libxrender-dev libmysqlclient-dev libpcre-dev libdbus-glib-1-dev hal-dev libfontconfig-dev libxt-dev libxmu-dev libpng-dev libjpeg-dev Unfortunately this will only install the packages that are available through opkg. There will be further packages that need to be installed. Either use the method mentioned below, or selectively find and install packages, mentioned at the bottom of this README. diff --git a/docs/README.linux b/docs/README.linux index 833645098b72f..0c3c411222301 100644 --- a/docs/README.linux +++ b/docs/README.linux @@ -57,8 +57,7 @@ Build-Depends: autoconf, automake, autopoint, autotools-dev, cmake, curl, libtag1-dev (>= 1.8), libtinyxml-dev (>= 2.6.2), libtool, libudev-dev, libusb-dev, libva-dev, libvdpau-dev, libxml2-dev, libxmu-dev, libxrandr-dev, libxslt1-dev, libxt-dev, lsb-release, rapidjson-dev, - nasm [!amd64], python-dev, python-imaging, python-support, swig, unzip, uuid-dev, yasm, - zip, zlib1g-dev + nasm [!amd64], python-dev, python-imaging, python-support, swig, uuid-dev, yasm, zlib1g-dev If you want to build with Wayland instead of X11, you will need: wayland-protocols (>= 1.7), libwaylandpp-dev diff --git a/docs/README.opensuse b/docs/README.opensuse index 1898104f984e8..da7a554709d75 100644 --- a/docs/README.opensuse +++ b/docs/README.opensuse @@ -52,7 +52,7 @@ make cmake autoconf automake gcc gcc-c++ libtool gettext-devel patch boost-devel libmysqlclient-devel libass-devel libmpeg2-devel libmad-devel libjpeg-devel libsamplerate-devel libogg-devel libvorbis-devel libmodplug-devel libcurl-devel flac-devel libbz2-devel libtiff-devel lzo-devel libyajl-devel fribidi-devel sqlite3-devel libpng12-devel pcre-devel libcdio-devel libjasper-devel -libmicrohttpd-devel libsmbclient-devel python-devel gperf zip nasm tinyxml-devel libtag-devel libbluray-devel +libmicrohttpd-devel libsmbclient-devel python-devel gperf nasm tinyxml-devel libtag-devel libbluray-devel libnfs-devel shairplay-devel swig libvdpau-devel libavahi-devel libcec-devel libdvdread-devel libva-devel libplist-devel libxst-devel alsa-devel libpulse-devel libXrandr-devel libXrender-devel randrproto-devel renderproto-devel libssh-devel libudev-devel libpcap-devel libgudev-1_0-devel libcap-ng-devel libcap-devel ccache doxygen capi4linux-devel liblcms2-devel @@ -73,7 +73,7 @@ Build-Depends: autoconf, automake, autopoint, autotools-dev, cmake, curl, libtag1-dev (>= 1.8), libtinyxml-dev (>= 2.6.2), libtool, libudev-dev, libusb-dev, libva-dev, libvdpau-dev, libxml2-dev, libxmu-dev, libxrandr-dev, libxslt1-dev, libxt-dev, libyajl-dev (>=2.0), lsb-release, - nasm [!amd64], python-dev, python-imaging, python-support, swig, unzip, uuid-dev, yasm, + nasm [!amd64], python-dev, python-imaging, python-support, swig, uuid-dev, yasm, zip, zlib1g-dev [NOTICE] crossguid / libcrossguid-dev all Linux distributions. diff --git a/docs/README.ubuntu b/docs/README.ubuntu index e0c1cbdc7b8ed..83c971de27653 100644 --- a/docs/README.ubuntu +++ b/docs/README.ubuntu @@ -91,7 +91,7 @@ For Ubuntu (all versions >= 7.04): libsqlite3-dev libssh-dev libssl-dev libtinyxml-dev libtool libudev-dev libusb-dev \ libva-dev libvdpau-dev libxml2-dev libxmu-dev libxrandr-dev \ libxrender-dev libxslt1-dev libxt-dev mesa-utils nasm pmount python-dev python-imaging \ - python-sqlite rapidjson-dev swig unzip uuid-dev yasm zip zlib1g-dev + python-sqlite rapidjson-dev swig uuid-dev yasm zlib1g-dev For >= 10.10: $ sudo apt-get install autopoint libltdl-dev diff --git a/tools/depends/configure.ac b/tools/depends/configure.ac index 3fb921f8e1673..d9a62f7256a0b 100644 --- a/tools/depends/configure.ac +++ b/tools/depends/configure.ac @@ -107,16 +107,6 @@ if test "$use_ccache" = "yes"; then fi fi -AC_CHECK_PROG(HAVE_UNZIP,unzip,"yes","no",) -if test "x$HAVE_UNZIP" = "xno" ; then - AC_MSG_ERROR("Missing program: unzip") -fi - -AC_CHECK_PROG(HAVE_ZIP,zip,"yes","no",) -if test "x$HAVE_ZIP" = "xno" ; then - AC_MSG_ERROR("Missing program: zip") -fi - AC_PATH_PROG(CURL,curl,"no") if test "x$CURL" = "xno" ; then AC_MSG_ERROR("Missing program: curl") @@ -585,6 +575,20 @@ if test "$platform_os" == "android"; then fi fi +# darwin needs unzip/zip in Codesign.command +if test "$platform_os" = "android" || test "$platform_os" = "osx" || test "$platform_os" = "ios"; then + AC_CHECK_PROG(HAVE_UNZIP,unzip,"yes","no",) + if test "x$HAVE_UNZIP" = "xno"; then + AC_MSG_ERROR("Missing program: unzip") + fi +fi +if test "$platform_os" = "osx" || test "$platform_os" = "ios"; then + AC_CHECK_PROG(HAVE_ZIP,zip,"yes","no",) + if test "x$HAVE_ZIP" = "xno"; then + AC_MSG_ERROR("Missing program: zip") + fi +fi + # Some dumb checks to see if paths might be correct. if [ ! `mkdir -p $prefix/$deps_dir/include` ]; then AC_MSG_ERROR(unable to create $prefix/$deps_dir/include. verify that the path and permissions are correct.) From 7ceba6a322f06bd1bad3d52c3f662e5b8bcda602 Mon Sep 17 00:00:00 2001 From: Philipp Kerling Date: Thu, 17 Aug 2017 08:22:30 +0200 Subject: [PATCH 043/113] Add missing libzip dependency for Android --- cmake/platform/android/android.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/platform/android/android.cmake b/cmake/platform/android/android.cmake index bfa003bb7605b..c857cba310175 100644 --- a/cmake/platform/android/android.cmake +++ b/cmake/platform/android/android.cmake @@ -1 +1 @@ -set(PLATFORM_REQUIRED_DEPS OpenGLES EGL) +set(PLATFORM_REQUIRED_DEPS OpenGLES EGL Zip) From 9cea929993b9e4a75588b12437a79bd9b6035003 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 7 Sep 2017 09:20:21 +0200 Subject: [PATCH 044/113] VideoPlayer: drop FlipPage --- .../VideoPlayer/VideoRenderers/BaseRenderer.h | 3 +- .../VideoRenderers/LinuxRendererGL.cpp | 22 +- .../VideoRenderers/LinuxRendererGL.h | 4 +- .../VideoRenderers/RenderManager.cpp | 190 ++++++++---------- .../VideoRenderers/RenderManager.h | 4 - 5 files changed, 89 insertions(+), 134 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.h b/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.h index 90202624c94ef..10afac83f5492 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.h @@ -68,7 +68,6 @@ class CBaseRenderer virtual bool IsConfigured() = 0; virtual void AddVideoPicture(const VideoPicture &picture, int index, double currentClock) = 0; virtual bool IsPictureHW(const VideoPicture &picture) { return false; }; - virtual void FlipPage(int source) = 0; virtual void UnInit() = 0; virtual void Reset() = 0; virtual void Flush() {}; @@ -79,7 +78,7 @@ class CBaseRenderer // Render info, can be called before configure virtual CRenderInfo GetRenderInfo() { return CRenderInfo(); } virtual void Update() = 0; - virtual void RenderUpdate(bool clear, unsigned int flags = 0, unsigned int alpha = 255) = 0; + virtual void RenderUpdate(int index, bool clear, unsigned int flags, unsigned int alpha) = 0; virtual bool RenderCapture(CRenderCapture* capture) = 0; virtual bool ConfigChanged(const VideoPicture &picture) = 0; diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp index 8ecf3a9e07d1d..7e1e9a0972c8f 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp @@ -311,11 +311,6 @@ bool CLinuxRendererGL::ConfigChanged(const VideoPicture &picture) return false; } -int CLinuxRendererGL::NextYV12Texture() -{ - return (m_iYV12RenderBuffer + 1) % m_NumYV12Buffers; -} - void CLinuxRendererGL::AddVideoPicture(const VideoPicture &picture, int index, double currentClock) { YUVBUFFER &buf = m_buffers[index]; @@ -499,9 +494,10 @@ void CLinuxRendererGL::Update() ValidateRenderTarget(); } -void CLinuxRendererGL::RenderUpdate(bool clear, DWORD flags, DWORD alpha) +void CLinuxRendererGL::RenderUpdate(int index, bool clear, DWORD flags, DWORD alpha) { - int index = m_iYV12RenderBuffer; + m_iLastRenderBuffer = m_iYV12RenderBuffer; + m_iYV12RenderBuffer = index; if (!ValidateRenderer()) { @@ -621,18 +617,6 @@ void CLinuxRendererGL::DrawBlackBars() glEnd(); } -void CLinuxRendererGL::FlipPage(int source) -{ - m_iLastRenderBuffer = m_iYV12RenderBuffer; - - if( source >= 0 && source < m_NumYV12Buffers ) - m_iYV12RenderBuffer = source; - else - m_iYV12RenderBuffer = NextYV12Texture(); - - return; -} - void CLinuxRendererGL::UpdateVideoFilter() { bool pixelRatioChanged = (CDisplaySettings::GetInstance().GetPixelRatio() > 1.001f || CDisplaySettings::GetInstance().GetPixelRatio() < 0.999f) != diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.h b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.h index 51da44158afec..92c183230a5d4 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.h @@ -108,13 +108,12 @@ class CLinuxRendererGL : public CBaseRenderer bool Configure(const VideoPicture &picture, float fps, unsigned flags, unsigned int orientation) override; bool IsConfigured() override { return m_bConfigured; } void AddVideoPicture(const VideoPicture &picture, int index, double currentClock) override; - void FlipPage(int source) override; void UnInit() override; void Reset() override; void Flush() override; void SetBufferSize(int numBuffers) override { m_NumYV12Buffers = numBuffers; } void ReleaseBuffer(int idx) override; - void RenderUpdate(bool clear, DWORD flags = 0, DWORD alpha = 255) override; + void RenderUpdate(int index, bool clear, DWORD flags, DWORD alpha) override; void Update() override; bool RenderCapture(CRenderCapture* capture) override; CRenderInfo GetRenderInfo() override; @@ -131,7 +130,6 @@ class CLinuxRendererGL : public CBaseRenderer void DrawBlackBars(); bool ValidateRenderer(); - int NextYV12Texture(); virtual bool ValidateRenderTarget(); virtual void LoadShaders(int field=FIELD_FULL); void SetTextureFilter(GLenum method); diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp index 585d0a165fe11..be73a0bfe024a 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp @@ -320,7 +320,6 @@ void CRenderManager::FrameMove() if (m_presentstep == PRESENT_FLIP) { - m_pRenderer->FlipPage(m_presentsource); m_presentstep = PRESENT_FRAME; m_presentevent.notifyAll(); } @@ -652,90 +651,6 @@ void CRenderManager::SetViewMode(int iViewMode) m_playerPort->VideoParamsChange(); } -void CRenderManager::FlipPage(volatile std::atomic_bool& bStop, double pts, - EINTERLACEMETHOD deintMethod, EFIELDSYNC sync, bool wait) -{ - { CSingleLock lock(m_statelock); - - if (bStop) - return; - - if (!m_pRenderer) - return; - } - - EPRESENTMETHOD presentmethod; - - EINTERLACEMETHOD interlacemethod = deintMethod; - - if (interlacemethod == VS_INTERLACEMETHOD_NONE) - { - presentmethod = PRESENT_METHOD_SINGLE; - sync = FS_NONE; - } - else - { - if (sync == FS_NONE) - presentmethod = PRESENT_METHOD_SINGLE; - else - { - if (interlacemethod == VS_INTERLACEMETHOD_RENDER_BLEND) - presentmethod = PRESENT_METHOD_BLEND; - else if (interlacemethod == VS_INTERLACEMETHOD_RENDER_WEAVE) - presentmethod = PRESENT_METHOD_WEAVE; - else if (interlacemethod == VS_INTERLACEMETHOD_RENDER_BOB) - presentmethod = PRESENT_METHOD_BOB; - else - { - if (!m_pRenderer->WantsDoublePass()) - presentmethod = PRESENT_METHOD_SINGLE; - else - presentmethod = PRESENT_METHOD_BOB; - } - } - } - - CSingleLock lock(m_presentlock); - - if (m_free.empty()) - return; - - int source = m_free.front(); - - SPresent& m = m_Queue[source]; - m.presentfield = sync; - m.presentmethod = presentmethod; - m.pts = pts; - requeue(m_queued, m_free); - m_playerPort->UpdateRenderBuffers(m_queued.size(), m_discard.size(), m_free.size()); - - // signal to any waiters to check state - if (m_presentstep == PRESENT_IDLE) - { - m_presentstep = PRESENT_READY; - m_presentevent.notifyAll(); - } - - if (wait) - { - m_forceNext = true; - XbmcThreads::EndTime endtime(200); - while (m_presentstep == PRESENT_READY) - { - m_presentevent.wait(lock, 20); - if(endtime.IsTimePast() || bStop) - { - if (!bStop) - { - CLog::Log(LOGWARNING, "CRenderManager::FlipPage - timeout waiting for render"); - } - break; - } - } - m_forceNext = false; - } -} - RESOLUTION CRenderManager::GetResolution() { RESOLUTION res = g_graphicsContext.GetVideoResolution(); @@ -875,11 +790,11 @@ void CRenderManager::PresentSingle(bool clear, DWORD flags, DWORD alpha) SPresent& m = m_Queue[m_presentsource]; if (m.presentfield == FS_BOT) - m_pRenderer->RenderUpdate(clear, flags | RENDER_FLAG_BOT, alpha); + m_pRenderer->RenderUpdate(m_presentsource, clear, flags | RENDER_FLAG_BOT, alpha); else if (m.presentfield == FS_TOP) - m_pRenderer->RenderUpdate(clear, flags | RENDER_FLAG_TOP, alpha); + m_pRenderer->RenderUpdate(m_presentsource, clear, flags | RENDER_FLAG_TOP, alpha); else - m_pRenderer->RenderUpdate(clear, flags, alpha); + m_pRenderer->RenderUpdate(m_presentsource, clear, flags, alpha); } /* new simpler method of handling interlaced material, * @@ -891,16 +806,16 @@ void CRenderManager::PresentFields(bool clear, DWORD flags, DWORD alpha) if(m_presentstep == PRESENT_FRAME) { if( m.presentfield == FS_BOT) - m_pRenderer->RenderUpdate(clear, flags | RENDER_FLAG_BOT | RENDER_FLAG_FIELD0, alpha); + m_pRenderer->RenderUpdate(m_presentsource, clear, flags | RENDER_FLAG_BOT | RENDER_FLAG_FIELD0, alpha); else - m_pRenderer->RenderUpdate(clear, flags | RENDER_FLAG_TOP | RENDER_FLAG_FIELD0, alpha); + m_pRenderer->RenderUpdate(m_presentsource, clear, flags | RENDER_FLAG_TOP | RENDER_FLAG_FIELD0, alpha); } else { if( m.presentfield == FS_TOP) - m_pRenderer->RenderUpdate(clear, flags | RENDER_FLAG_BOT | RENDER_FLAG_FIELD1, alpha); + m_pRenderer->RenderUpdate(m_presentsource, clear, flags | RENDER_FLAG_BOT | RENDER_FLAG_FIELD1, alpha); else - m_pRenderer->RenderUpdate(clear, flags | RENDER_FLAG_TOP | RENDER_FLAG_FIELD1, alpha); + m_pRenderer->RenderUpdate(m_presentsource, clear, flags | RENDER_FLAG_TOP | RENDER_FLAG_FIELD1, alpha); } } @@ -910,13 +825,13 @@ void CRenderManager::PresentBlend(bool clear, DWORD flags, DWORD alpha) if( m.presentfield == FS_BOT ) { - m_pRenderer->RenderUpdate(clear, flags | RENDER_FLAG_BOT | RENDER_FLAG_NOOSD, alpha); - m_pRenderer->RenderUpdate(false, flags | RENDER_FLAG_TOP, alpha / 2); + m_pRenderer->RenderUpdate(m_presentsource, clear, flags | RENDER_FLAG_BOT | RENDER_FLAG_NOOSD, alpha); + m_pRenderer->RenderUpdate(m_presentsource, false, flags | RENDER_FLAG_TOP, alpha / 2); } else { - m_pRenderer->RenderUpdate(clear, flags | RENDER_FLAG_TOP | RENDER_FLAG_NOOSD, alpha); - m_pRenderer->RenderUpdate(false, flags | RENDER_FLAG_BOT, alpha / 2); + m_pRenderer->RenderUpdate(m_presentsource, clear, flags | RENDER_FLAG_TOP | RENDER_FLAG_NOOSD, alpha); + m_pRenderer->RenderUpdate(m_presentsource, false, flags | RENDER_FLAG_BOT, alpha / 2); } } @@ -966,19 +881,21 @@ void CRenderManager::ToggleDebug() bool CRenderManager::AddVideoPicture(const VideoPicture& picture, volatile std::atomic_bool& bStop, EINTERLACEMETHOD deintMethod, bool wait) { - int index; + CSingleLock lock(m_presentlock); + + if (m_free.empty()) + return false; + + int index = m_free.front(); + { - CSingleLock lock(m_presentlock); - if (m_free.empty()) + CSingleLock lock(m_datalock); + if (!m_pRenderer) return false; - index = m_free.front(); - } - CSingleLock lock(m_datalock); - if (!m_pRenderer) - return false; + m_pRenderer->AddVideoPicture(picture, index, m_dvdClock.GetClock()); + } - m_pRenderer->AddVideoPicture(picture, index, m_dvdClock.GetClock()); // set fieldsync if picture is interlaced EFIELDSYNC displayField = FS_NONE; @@ -993,7 +910,68 @@ bool CRenderManager::AddVideoPicture(const VideoPicture& picture, volatile std:: } } - FlipPage(bStop, picture.pts, deintMethod, displayField, wait); + EPRESENTMETHOD presentmethod = PRESENT_METHOD_SINGLE; + if (deintMethod == VS_INTERLACEMETHOD_NONE) + { + presentmethod = PRESENT_METHOD_SINGLE; + displayField = FS_NONE; + } + else + { + if (displayField == FS_NONE) + presentmethod = PRESENT_METHOD_SINGLE; + else + { + if (deintMethod == VS_INTERLACEMETHOD_RENDER_BLEND) + presentmethod = PRESENT_METHOD_BLEND; + else if (deintMethod == VS_INTERLACEMETHOD_RENDER_WEAVE) + presentmethod = PRESENT_METHOD_WEAVE; + else if (deintMethod == VS_INTERLACEMETHOD_RENDER_BOB) + presentmethod = PRESENT_METHOD_BOB; + else + { + if (!m_pRenderer->WantsDoublePass()) + presentmethod = PRESENT_METHOD_SINGLE; + else + presentmethod = PRESENT_METHOD_BOB; + } + } + } + + + SPresent& m = m_Queue[index]; + m.presentfield = displayField; + m.presentmethod = presentmethod; + m.pts = picture.pts; + requeue(m_queued, m_free); + m_playerPort->UpdateRenderBuffers(m_queued.size(), m_discard.size(), m_free.size()); + + // signal to any waiters to check state + if (m_presentstep == PRESENT_IDLE) + { + m_presentstep = PRESENT_READY; + m_presentevent.notifyAll(); + } + + if (wait) + { + m_forceNext = true; + XbmcThreads::EndTime endtime(200); + while (m_presentstep == PRESENT_READY) + { + m_presentevent.wait(lock, 20); + if(endtime.IsTimePast() || bStop) + { + if (!bStop) + { + CLog::Log(LOGWARNING, "CRenderManager::AddVideoPicture - timeout waiting for render"); + } + break; + } + } + m_forceNext = false; + } + return true; } diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h index 8d3c938f0bd08..c240c16b16a4f 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h @@ -116,8 +116,6 @@ class CRenderManager * AddVideoPicture and AddOverlay. It waits for max 50 ms before it returns -1 * in case no buffer is available. Player may call this in a loop and decides * by itself when it wants to drop a frame. - * If no buffering is requested in Configure, player does not need to call this, - * because FlipPage will block. */ int WaitForBuffer(volatile std::atomic_bool& bStop, int timeout = 100); @@ -153,8 +151,6 @@ class CRenderManager void UpdateLatencyTweak(); void CheckEnableClockSync(); - void FlipPage(volatile std::atomic_bool& bStop, double pts, EINTERLACEMETHOD deintMethod, EFIELDSYNC sync, bool wait); - CBaseRenderer *m_pRenderer = nullptr; OVERLAY::CRenderer m_overlays; CDebugRenderer m_debugRenderer; From 3f87106e3449008bfef453b288cc9d0fbd94a09f Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 7 Sep 2017 09:26:53 +0200 Subject: [PATCH 045/113] VideoPlayer: consmetics - white spaces --- .../VideoRenderers/WinRenderer.cpp | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp index 90b46ed3afba9..b0cb0c5cc8db5 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp @@ -39,13 +39,13 @@ #include "VideoShaders/WinVideoFilter.h" #include "windowing/WindowingFactory.h" -typedef struct +typedef struct { RenderMethod method; const char *name; } RenderMethodDetail; -static RenderMethodDetail RenderMethodDetails[] = +static RenderMethodDetail RenderMethodDetails[] = { { RENDER_SW , "Software" }, { RENDER_PS , "Pixel Shaders" }, @@ -290,7 +290,7 @@ void CWinRenderer::Reset() void CWinRenderer::Update() { - if (!m_bConfigured) + if (!m_bConfigured) return; ManageRenderArea(); ManageTextures(); @@ -343,7 +343,7 @@ void CWinRenderer::UnInit() SAFE_DELETE(m_colorShader); SAFE_DELETE(m_scalerShader); - + m_bConfigured = false; m_bFilterInitialized = false; @@ -467,7 +467,7 @@ EBufferFormat CWinRenderer::SelectBufferFormat(AVPixelFormat format, const Rende case DXGI_FORMAT_P016: decoderFormat = AV_PIX_FMT_YUV420P16; break; - default: + default: break; } } @@ -557,7 +557,7 @@ void CWinRenderer::SelectPSVideoFilter() if (m_scalingMethod == VS_SCALINGMETHOD_AUTO) { bool scaleSD = m_sourceHeight < 720 && m_sourceWidth < 1280; - bool scaleUp = static_cast(m_sourceHeight) < g_graphicsContext.GetHeight() + bool scaleUp = static_cast(m_sourceHeight) < g_graphicsContext.GetHeight() && static_cast(m_sourceWidth) < g_graphicsContext.GetWidth(); bool scaleFps = m_fps < (g_advancedSettings.m_videoAutoScaleMaxFps + 0.01f); @@ -741,7 +741,7 @@ void CWinRenderer::RenderSW(CD3DTexture* target) return; // Don't know where this martian comes from but it can happen in the initial frames of a video - if (m_destRect.x1 < 0 && m_destRect.x2 < 0 + if (m_destRect.x1 < 0 && m_destRect.x2 < 0 || m_destRect.y1 < 0 && m_destRect.y2 < 0) return; @@ -778,7 +778,7 @@ void CWinRenderer::RenderSW(CD3DTexture* target) for (unsigned int idx = 0; idx < buf->GetActivePlanes(); idx++) buf->MapPlane(idx, reinterpret_cast(&src[idx]), &srcStride[idx]); - + D3D11_MAPPED_SUBRESOURCE destlr; if (!m_IntermediateTarget.LockRect(0, &destlr, D3D11_MAP_WRITE_DISCARD)) CLog::Log(LOGERROR, "%s: failed to lock swtarget texture into memory.", __FUNCTION__); @@ -814,7 +814,7 @@ void CWinRenderer::RenderPS(CD3DTexture* target) // reset view port g_Windowing.Get3D11Context()->RSSetViewports(1, &viewPort); - // select destination rectangle + // select destination rectangle CPoint destPoints[4]; if (m_renderOrientation) { @@ -854,7 +854,7 @@ void CWinRenderer::RenderHW(DWORD flags, CD3DTexture* target) && image->format != BUFFER_FMT_D3D11_P010 && image->format != BUFFER_FMT_D3D11_P016) return; - + if (!image->loaded) return; @@ -925,7 +925,7 @@ void CWinRenderer::RenderHW(DWORD flags, CD3DTexture* target) CRect src = m_sourceRect, dst = destRect; CRect targetRect = CRect(0.0f, 0.0f, - static_cast(m_IntermediateTarget.GetWidth()), + static_cast(m_IntermediateTarget.GetWidth()), static_cast(m_IntermediateTarget.GetHeight())); if (target != g_Windowing.GetBackBuffer()) @@ -1035,7 +1035,7 @@ bool CWinRenderer::Supports(ESCALINGMETHOD method) { if (m_renderMethod == RENDER_DXVA) { - if (method == VS_SCALINGMETHOD_DXVA_HARDWARE + if (method == VS_SCALINGMETHOD_DXVA_HARDWARE || method == VS_SCALINGMETHOD_AUTO) return true; if (!g_advancedSettings.m_DXVAAllowHqScaling || m_renderOrientation) @@ -1043,7 +1043,7 @@ bool CWinRenderer::Supports(ESCALINGMETHOD method) } if ( method == VS_SCALINGMETHOD_AUTO - || (method == VS_SCALINGMETHOD_LINEAR && m_renderMethod == RENDER_PS)) + || (method == VS_SCALINGMETHOD_LINEAR && m_renderMethod == RENDER_PS)) return true; if (g_Windowing.GetFeatureLevel() >= D3D_FEATURE_LEVEL_9_3 && !m_renderOrientation) @@ -1108,15 +1108,15 @@ bool CWinRenderer::HandlesVideoBuffer(CVideoBuffer* buffer) CRenderInfo CWinRenderer::GetRenderInfo() { CRenderInfo info; - info.formats = - { - AV_PIX_FMT_D3D11VA_VLD, - AV_PIX_FMT_NV12, - AV_PIX_FMT_P010, - AV_PIX_FMT_P016, - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_YUV420P10, - AV_PIX_FMT_YUV420P16 + info.formats = + { + AV_PIX_FMT_D3D11VA_VLD, + AV_PIX_FMT_NV12, + AV_PIX_FMT_P010, + AV_PIX_FMT_P016, + AV_PIX_FMT_YUV420P, + AV_PIX_FMT_YUV420P10, + AV_PIX_FMT_YUV420P16 }; info.max_buffer_size = NUM_BUFFERS; if (m_renderMethod == RENDER_DXVA && m_processor) From 292905a6588b36ffb9a31c2d0a1335c4cbe1ba07 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 7 Sep 2017 09:28:11 +0200 Subject: [PATCH 046/113] windows: VideoPlayer - drop FlipPage --- .../cores/VideoPlayer/VideoRenderers/WinRenderer.cpp | 12 +++--------- xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.h | 3 +-- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp index b0cb0c5cc8db5..379944523ddc9 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp @@ -296,8 +296,10 @@ void CWinRenderer::Update() ManageTextures(); } -void CWinRenderer::RenderUpdate(bool clear, unsigned int flags, unsigned int alpha) +void CWinRenderer::RenderUpdate(int index, bool clear, unsigned int flags, unsigned int alpha) { + m_iYV12RenderBuffer = index; + if (clear) g_graphicsContext.Clear(g_Windowing.UseLimitedColor() ? 0x101010 : 0); @@ -310,14 +312,6 @@ void CWinRenderer::RenderUpdate(bool clear, unsigned int flags, unsigned int alp Render(flags, g_Windowing.GetBackBuffer()); } -void CWinRenderer::FlipPage(int source) -{ - if( source >= 0 && source < m_NumYV12Buffers ) - m_iYV12RenderBuffer = source; - else - m_iYV12RenderBuffer = NextBuffer(); -} - void CWinRenderer::PreInit() { CSingleLock lock(g_graphicsContext); diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.h b/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.h index 59308594df8c0..50e293af55186 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.h @@ -58,13 +58,12 @@ class CWinRenderer : public CBaseRenderer // Player functions bool Configure(const VideoPicture &picture, float fps, unsigned flags, unsigned int orientation) override; void AddVideoPicture(const VideoPicture &picture, int index, double currentClock) override; - void FlipPage(int source) override; void UnInit() override; void Reset() override; /* resets renderer after seek for example */ bool IsConfigured() override { return m_bConfigured; } void Flush() override; CRenderInfo GetRenderInfo() override; - void RenderUpdate(bool clear, unsigned int flags = 0, unsigned int alpha = 255) override; + void RenderUpdate(int index, bool clear, unsigned int flags, unsigned int alpha) override; void SetBufferSize(int numBuffers) override { m_neededBuffers = numBuffers; } void ReleaseBuffer(int idx) override; bool NeedBuffer(int idx) override; From bf1b7921c68754d428cb4d79153adf955801088e Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 7 Sep 2017 09:29:33 +0200 Subject: [PATCH 047/113] VideoPlayer: GLES - drop unused variable in renderer --- .../VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp | 8 +------- xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp index 7bfcea6a7d134..e42f21a1f9cfc 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp @@ -93,7 +93,6 @@ CLinuxRendererGLES::CLinuxRendererGLES() m_scalingMethodGui = (ESCALINGMETHOD)-1; m_NumYV12Buffers = 0; - m_iLastRenderBuffer = 0; m_bConfigured = false; m_bValidated = false; m_StrictBinding = false; @@ -179,8 +178,6 @@ bool CLinuxRendererGLES::Configure(const VideoPicture &picture, float fps, unsig // frame is loaded after every call to Configure(). m_bValidated = false; - m_iLastRenderBuffer = -1; - return true; } @@ -384,8 +381,6 @@ void CLinuxRendererGLES::RenderUpdate(bool clear, DWORD flags, DWORD alpha) ManageRenderArea(); - m_iLastRenderBuffer = index; - if (clear) { glClearColor(m_clearColour, m_clearColour, m_clearColour, 0); @@ -691,7 +686,7 @@ void CLinuxRendererGLES::Render(DWORD flags, int index) break; } } - + AfterRenderHook(index); } @@ -1327,4 +1322,3 @@ bool CLinuxRendererGLES::IsGuiLayer() } #endif - diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h index a94a822b8a976..e8f149de57b4d 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h @@ -173,7 +173,6 @@ class CLinuxRendererGLES : public CBaseRenderer int m_iYV12RenderBuffer; int m_NumYV12Buffers; - int m_iLastRenderBuffer; bool m_bConfigured; bool m_bValidated; From df29f8d7e359e672714895d1372018f121956d7b Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 7 Sep 2017 09:31:43 +0200 Subject: [PATCH 048/113] VideoPlayer: GLES - drop FlipPage --- .../VideoRenderers/LinuxRendererGLES.cpp | 17 ++++------------- .../VideoRenderers/LinuxRendererGLES.h | 3 +-- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp index e42f21a1f9cfc..2975a56f1e4c6 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp @@ -358,8 +358,10 @@ void CLinuxRendererGLES::Update() ValidateRenderTarget(); } -void CLinuxRendererGLES::RenderUpdate(bool clear, DWORD flags, DWORD alpha) +void CLinuxRendererGLES::RenderUpdate(int index, bool clear, DWORD flags, DWORD alpha) { + m_iYV12RenderBuffer = index; + if (!m_bConfigured) return; @@ -373,8 +375,7 @@ void CLinuxRendererGLES::RenderUpdate(bool clear, DWORD flags, DWORD alpha) return; } - int index = m_iYV12RenderBuffer; - YUVBUFFER& buf = m_buffers[index]; + YUVBUFFER& buf = m_buffers[index]; if (!buf.fields[FIELD_FULL][0].id) return; @@ -424,16 +425,6 @@ void CLinuxRendererGLES::RenderUpdateVideo(bool clear, DWORD flags, DWORD alpha) return; } -void CLinuxRendererGLES::FlipPage(int source) -{ - if( source >= 0 && source < m_NumYV12Buffers ) - m_iYV12RenderBuffer = source; - else - m_iYV12RenderBuffer = NextYV12Texture(); - - return; -} - void CLinuxRendererGLES::UpdateVideoFilter() { if (m_scalingMethodGui == CMediaSettings::GetInstance().GetCurrentVideoSettings().m_ScalingMethod) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h index e8f149de57b4d..b6ab87e247339 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h @@ -114,7 +114,6 @@ class CLinuxRendererGLES : public CBaseRenderer virtual bool Configure(const VideoPicture &picture, float fps, unsigned flags, unsigned int orientation) override; virtual bool IsConfigured() override { return m_bConfigured; } virtual void AddVideoPicture(const VideoPicture &picture, int index, double currentClock) override; - virtual void FlipPage(int source) override; virtual void UnInit() override; virtual void Reset() override; virtual void Flush() override; @@ -122,7 +121,7 @@ class CLinuxRendererGLES : public CBaseRenderer virtual void SetBufferSize(int numBuffers) override { m_NumYV12Buffers = numBuffers; } virtual bool IsGuiLayer() override; virtual void ReleaseBuffer(int idx) override; - virtual void RenderUpdate(bool clear, DWORD flags = 0, DWORD alpha = 255) override; + virtual void RenderUpdate(int index, bool clear, DWORD flags, DWORD alpha) override; virtual void Update() override; virtual bool RenderCapture(CRenderCapture* capture) override; virtual CRenderInfo GetRenderInfo() override; From 5ad38cb8cadb62716ee37316dc194e9248169e5c Mon Sep 17 00:00:00 2001 From: peak3d Date: Sat, 9 Sep 2017 19:49:40 +0200 Subject: [PATCH 049/113] [AML] Remove FlipPage --- .../VideoRenderers/HwDecRender/RendererAML.cpp | 17 +++-------------- .../VideoRenderers/HwDecRender/RendererAML.h | 4 +--- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp index 33b79588d059d..00549d9afa852 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp @@ -33,8 +33,7 @@ #include "settings/AdvancedSettings.h" CRendererAML::CRendererAML() - : m_iRenderBuffer(0) - , m_prevVPts(-1) + : m_prevVPts(-1) , m_bConfigured(false) { CLog::Log(LOGINFO, "Constructing CRendererAML"); @@ -125,16 +124,6 @@ void CRendererAML::ReleaseBuffer(int idx) } } -void CRendererAML::FlipPage(int source) -{ - if( source >= 0 && source < m_numRenderBuffers ) - m_iRenderBuffer = source; - else - m_iRenderBuffer = (m_iRenderBuffer + 1) % m_numRenderBuffers; - - return; -} - bool CRendererAML::Supports(ERENDERFEATURE feature) { if (feature == RENDERFEATURE_ZOOM || @@ -161,11 +150,11 @@ void CRendererAML::Reset() } } -void CRendererAML::RenderUpdate(bool clear, DWORD flags, DWORD alpha) +void CRendererAML::RenderUpdate(int index, bool clear, DWORD flags, DWORD alpha) { ManageRenderArea(); - CAMLVideoBuffer *amli = dynamic_cast(m_buffers[m_iRenderBuffer].videoBuffer); + CAMLVideoBuffer *amli = dynamic_cast(m_buffers[index].videoBuffer); if(amli && amli->m_amlCodec) { int pts = amli->m_omxPts; diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h index fa30247584007..b4986853035c3 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h @@ -43,11 +43,10 @@ class CRendererAML : public CBaseRenderer virtual bool IsConfigured() override { return m_bConfigured; }; virtual bool ConfigChanged(const VideoPicture &picture) { return false; }; virtual CRenderInfo GetRenderInfo() override; - virtual void FlipPage(int source) override; virtual void UnInit() override {}; virtual void Reset() override; virtual void Update() override {}; - virtual void RenderUpdate(bool clear, unsigned int flags = 0, unsigned int alpha = 255) override; + virtual void RenderUpdate(int index, bool clear, unsigned int flags, unsigned int alpha) override; virtual bool SupportsMultiPassRendering()override { return false; }; // Player functions @@ -58,7 +57,6 @@ class CRendererAML : public CBaseRenderer virtual bool Supports(ERENDERFEATURE feature) override; private: - int m_iRenderBuffer; static const int m_numRenderBuffers = 4; struct BUFFER From 5f51a15995333b640d050960ae6b70375a4ac707 Mon Sep 17 00:00:00 2001 From: peak3d Date: Sat, 9 Sep 2017 21:30:52 +0200 Subject: [PATCH 050/113] [MediaCodec] Remove FlipPage --- .../HwDecRender/RendererMediaCodecSurface.cpp | 6 +----- .../VideoRenderers/HwDecRender/RendererMediaCodecSurface.h | 3 +-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererMediaCodecSurface.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererMediaCodecSurface.cpp index 4b1eb21331f5a..3c3306f01f862 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererMediaCodecSurface.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererMediaCodecSurface.cpp @@ -104,10 +104,6 @@ void CRendererMediaCodecSurface::ReleaseBuffer(int idx) { } -void CRendererMediaCodecSurface::FlipPage(int source) -{ -} - bool CRendererMediaCodecSurface::Supports(ERENDERFEATURE feature) { if (feature == RENDERFEATURE_ZOOM || @@ -123,7 +119,7 @@ void CRendererMediaCodecSurface::Reset() { } -void CRendererMediaCodecSurface::RenderUpdate(bool clear, DWORD flags, DWORD alpha) +void CRendererMediaCodecSurface::RenderUpdate(int index, bool clear, DWORD flags, DWORD alpha) { CXBMCApp::get()->WaitVSync(100); ManageRenderArea(); diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererMediaCodecSurface.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererMediaCodecSurface.h index f2023342881ac..14ec51e54173a 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererMediaCodecSurface.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererMediaCodecSurface.h @@ -43,11 +43,10 @@ class CRendererMediaCodecSurface : public CBaseRenderer virtual bool IsConfigured() override { return m_bConfigured; }; virtual bool ConfigChanged(const VideoPicture &picture) override { return false; }; virtual CRenderInfo GetRenderInfo() override; - virtual void FlipPage(int source) override; virtual void UnInit() override {}; virtual void Reset() override; virtual void Update() override {}; - virtual void RenderUpdate(bool clear, unsigned int flags = 0, unsigned int alpha = 255) override; + virtual void RenderUpdate(int index, bool clear, unsigned int flags, unsigned int alpha) override; virtual bool SupportsMultiPassRendering() override { return false; }; // Player functions From 928eb08da21e912211c01edf08f3c6a881bda72d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 8 Sep 2017 14:13:46 +0100 Subject: [PATCH 051/113] MMAL: drop FlipPage --- .../HwDecRender/MMALRenderer.cpp | 20 +------------------ .../VideoRenderers/HwDecRender/MMALRenderer.h | 5 +---- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp index e91c483f9d971..9d4e1eb9ab08b 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp @@ -544,7 +544,6 @@ CMMALRenderer::CMMALRenderer() : CThread("MMALRenderer"), m_processThread(this, memset(m_buffers, 0, sizeof m_buffers); m_iFlags = 0; m_bConfigured = false; - m_iYV12RenderBuffer = 0; m_queue_render = nullptr; m_error = 0.0; m_fps = 0.0; @@ -904,7 +903,6 @@ void CMMALRenderer::Flush() if (m_vout_input) mmal_port_flush(m_vout_input); ReleaseBuffers(); - m_iYV12RenderBuffer = 0; } void CMMALRenderer::Update() @@ -914,10 +912,9 @@ void CMMALRenderer::Update() ManageRenderArea(); } -void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) +void CMMALRenderer::RenderUpdate(int source, bool clear, unsigned int flags, unsigned int alpha) { CSingleLock lock(m_sharedSection); - int source = m_iYV12RenderBuffer; CMMALBuffer *omvb = nullptr; if (!m_bConfigured) @@ -978,21 +975,6 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha) m_vsync_count++; } -void CMMALRenderer::FlipPage(int source) -{ - CSingleLock lock(m_sharedSection); - if (!m_bConfigured) - { - CLog::Log(LOGDEBUG, LOGVIDEO, "%s::%s - not configured: source:%d", CLASSNAME, __func__, source); - return; - } - - if (VERBOSE && g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "%s::%s - source:%d", CLASSNAME, __func__, source); - - m_iYV12RenderBuffer = source; -} - void CMMALRenderer::ReleaseBuffers() { if (VERBOSE && g_advancedSettings.CanLogComponent(LOGVIDEO)) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h index 7980b19779282..9eb6f51161abe 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h @@ -151,7 +151,6 @@ class CMMALRenderer : public CBaseRenderer, public CThread, public IRunnable // Player functions virtual bool Configure(const VideoPicture &picture, float fps, unsigned flags, unsigned int orientation) override; virtual void ReleaseBuffer(int idx) override; - virtual void FlipPage(int source) override; virtual void UnInit(); virtual void Reset() override; /* resets renderer after seek for example */ virtual void Flush() override; @@ -164,7 +163,7 @@ class CMMALRenderer : public CBaseRenderer, public CThread, public IRunnable virtual bool Supports(ERENDERFEATURE feature) override; virtual bool Supports(ESCALINGMETHOD method) override; - virtual void RenderUpdate(bool clear, DWORD flags = 0, DWORD alpha = 255) override; + virtual void RenderUpdate(int source, bool clear, unsigned int flags, unsigned int alpha) override; virtual void SetVideoRect(const CRect& SrcRect, const CRect& DestRect); virtual bool IsGuiLayer() override { return false; } @@ -178,8 +177,6 @@ class CMMALRenderer : public CBaseRenderer, public CThread, public IRunnable static bool Register(); protected: - int m_iYV12RenderBuffer; - CMMALBuffer *m_buffers[NUM_BUFFERS]; bool m_bConfigured; unsigned int m_extended_format; From 79f3ab72b415e90bb9bca924e9b64eaa48d63d0a Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sun, 10 Sep 2017 13:06:56 +0200 Subject: [PATCH 052/113] AE: some fixes and limit of max error --- .../AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp index d698cb8de64d7..b5ac47bd513ce 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp @@ -215,7 +215,7 @@ float CEngineStats::GetCacheTime(CActiveAEStream *stream) float CEngineStats::GetCacheTotal(CActiveAEStream *stream) { - return MAX_CACHE_LEVEL + m_sinkCacheTotal; + return MAX_CACHE_LEVEL + MAX_WATER_LEVEL + m_sinkCacheTotal; } float CEngineStats::GetWaterLevel() @@ -1912,6 +1912,16 @@ bool CActiveAE::RunStages() double delay = status.GetDelay() * 1000; double playingPts = pts - delay; double error = playingPts - (*it)->m_pClock->GetClock(); + if (error > 1000) + { + CLog::Log(LOGWARNING, "ActiveAE - large audio sync error: %d", error); + error = 1000; + } + else if (error < -1000) + { + CLog::Log(LOGWARNING, "ActiveAE - large audio sync error: %d", error); + error = -1000; + } (*it)->m_syncError.Add(error); } } @@ -2413,14 +2423,14 @@ CSampleBuffer* CActiveAE::SyncStream(CActiveAEStream *stream) } else { - int bytesToSkip = framesToSkip*buf->pkt->bytes_per_sample; - for(int i=0; ipkt->planes; i++) + int bytesToSkip = framesToSkip * buf->pkt->bytes_per_sample / buf->pkt->planes; + for (int i=0; ipkt->planes; i++) { memmove(buf->pkt->data[i], buf->pkt->data[i]+bytesToSkip, buf->pkt->linesize - bytesToSkip); } buf->pkt->nb_samples -= framesToSkip; - stream->m_syncError.Correction(framesToSkip*1000/buf->pkt->config.sample_rate); - error += framesToSkip*1000/buf->pkt->config.sample_rate; + stream->m_syncError.Correction((double)framesToSkip * 1000 / buf->pkt->config.sample_rate); + error += (double)framesToSkip * 1000 / buf->pkt->config.sample_rate; } } @@ -2460,6 +2470,7 @@ CSampleBuffer* CActiveAE::SyncStream(CActiveAEStream *stream) { stream->m_processingBuffers->SetRR(1.0, m_settings.atempoThreshold); } + stream->m_syncError.SetErrorInterval(stream->GetErrorInterval()); return ret; From afe641fa770d44d6837b175935408ff634cf741c Mon Sep 17 00:00:00 2001 From: peak3d Date: Sun, 10 Sep 2017 13:10:39 +0200 Subject: [PATCH 053/113] [AML] correct PTS-offset calculation --- xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp index 2fe7e5070995f..c4aa547c06f2a 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp @@ -1605,7 +1605,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints) CLog::Log(LOGNOTICE, "CAMLCodec::OpenDecoder - using V4L2 pts format: %s", m_ptsIs64us ? "64Bit":"32Bit"); - m_ptsOverflow = m_ptsIs64us ? 0 : INT64_0; + m_ptsOverflow = (sizeof(long) == 8) ? 0 : INT64_0; m_opened = true; // vcodec is open, update speed if it was @@ -1735,7 +1735,7 @@ void CAMLCodec::Reset() // reset some interal vars m_cur_pts = INT64_0; - m_ptsOverflow = m_ptsIs64us ? 0 : INT64_0; + m_ptsOverflow = (sizeof(long) == 8) ? 0 : INT64_0; m_state = 0; m_frameSizes.clear(); m_frameSizeSum = 0; @@ -1784,7 +1784,7 @@ bool CAMLCodec::AddData(uint8_t *pData, size_t iSize, double dts, double pts) } //Handle PTS overflow - if (!m_ptsIs64us) + if (sizeof(long) < 8) { if (am_private->am_pkt.avpts != INT64_0) { @@ -1976,7 +1976,7 @@ CDVDVideoCodec::VCReturn CAMLCodec::GetPicture(VideoPicture *pVideoPicture) { m_last_pts -= 0x7FFFFFFF; m_ptsOverflow += 0x80000000; - CLog::Log(LOGDEBUG, "CAMLCodec::GetPicture, PTS overflow incremented(%lld)", m_ptsOverflow); + CLog::Log(LOGDEBUG, "CAMLCodec::GetPicture, PTS overflow incremented(%llX)", m_ptsOverflow); } pVideoPicture->iDuration = (double)((m_cur_pts - m_last_pts) * DVD_TIME_BASE) / PTS_FREQ; } From 9e9ddbc0bd653bf496151bcc029826ede704ae3e Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Sat, 9 Sep 2017 18:51:07 +0200 Subject: [PATCH 054/113] [PVR] CPVRClient(s)::OpenStream: Remove unused parameter bIsSwitchingChannels. --- xbmc/addons/PVRClient.cpp | 2 +- xbmc/addons/PVRClient.h | 3 +-- xbmc/pvr/PVRManager.cpp | 2 +- xbmc/pvr/addons/PVRClients.cpp | 4 ++-- xbmc/pvr/addons/PVRClients.h | 3 +-- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/xbmc/addons/PVRClient.cpp b/xbmc/addons/PVRClient.cpp index 8ee3301f73680..68c132ea06f9a 100644 --- a/xbmc/addons/PVRClient.cpp +++ b/xbmc/addons/PVRClient.cpp @@ -1555,7 +1555,7 @@ void CPVRClient::ClearPlayingEpgTag() m_bIsPlayingEpgTag = false; } -bool CPVRClient::OpenStream(const CPVRChannelPtr &channel, bool bIsSwitchingChannel) +bool CPVRClient::OpenStream(const CPVRChannelPtr &channel) { bool bReturn(false); CloseStream(); diff --git a/xbmc/addons/PVRClient.h b/xbmc/addons/PVRClient.h index 1a7c1586081f7..88e11410589e9 100644 --- a/xbmc/addons/PVRClient.h +++ b/xbmc/addons/PVRClient.h @@ -607,10 +607,9 @@ namespace PVR /*! * @brief Open a live stream on the server. * @param channel The channel to stream. - * @param bIsSwitchingChannel True when switching channels, false otherwise. * @return True if the stream opened successfully, false otherwise. */ - bool OpenStream(const CPVRChannelPtr &channel, bool bIsSwitchingChannel); + bool OpenStream(const CPVRChannelPtr &channel); /*! * @brief Close an open live stream. diff --git a/xbmc/pvr/PVRManager.cpp b/xbmc/pvr/PVRManager.cpp index 322e43e6b8698..9d103b4261124 100644 --- a/xbmc/pvr/PVRManager.cpp +++ b/xbmc/pvr/PVRManager.cpp @@ -769,7 +769,7 @@ bool CPVRManager::OpenLiveStream(const CFileItem &fileItem) // check if we're allowed to play this file const CPVRChannelPtr channel = fileItem.GetPVRChannelInfoTag(); if (!IsParentalLocked(channel)) - bReturn = m_addons->OpenStream(channel, false); + bReturn = m_addons->OpenStream(channel); return bReturn; } diff --git a/xbmc/pvr/addons/PVRClients.cpp b/xbmc/pvr/addons/PVRClients.cpp index 7d71cdb9afdfd..5e7c5102479b8 100644 --- a/xbmc/pvr/addons/PVRClients.cpp +++ b/xbmc/pvr/addons/PVRClients.cpp @@ -1142,7 +1142,7 @@ bool CPVRClients::FillRecordingStreamFileItem(CFileItem &fileItem) return false; } -bool CPVRClients::OpenStream(const CPVRChannelPtr &channel, bool bIsSwitchingChannel) +bool CPVRClients::OpenStream(const CPVRChannelPtr &channel) { bool bReturn(false); CloseStream(); @@ -1150,7 +1150,7 @@ bool CPVRClients::OpenStream(const CPVRChannelPtr &channel, bool bIsSwitchingCha /* try to open the stream on the client */ PVR_CLIENT client; if (GetCreatedClient(channel->ClientID(), client)) - bReturn = client->OpenStream(channel, bIsSwitchingChannel); + bReturn = client->OpenStream(channel); if (bReturn) SetPlayingChannel(channel); diff --git a/xbmc/pvr/addons/PVRClients.h b/xbmc/pvr/addons/PVRClients.h index 6b87040006535..33c582b84e7e6 100644 --- a/xbmc/pvr/addons/PVRClients.h +++ b/xbmc/pvr/addons/PVRClients.h @@ -297,10 +297,9 @@ namespace PVR /*! * @brief Open a stream on the given channel. * @param channel The channel to start playing. - * @param bIsSwitchingChannel True when switching channels, false otherwise. * @return True if the stream was opened successfully, false otherwise. */ - bool OpenStream(const CPVRChannelPtr &channel, bool bIsSwitchingChannel); + bool OpenStream(const CPVRChannelPtr &channel); /*! * @brief Set the channel that is currently playing. From 09fec8aef1aecaaa73fa49aadf8eabe2f9d3c4ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20B=C3=BChlmann?= Date: Fri, 8 Sep 2017 01:24:27 +0200 Subject: [PATCH 055/113] Allow binary addon to get multiple values for same property name There might be multiple occurences of a http header (e.g. set-cookie) --- xbmc/addons/binary-addons/AddonDll.cpp | 14 ++++++ xbmc/addons/binary-addons/AddonDll.h | 1 + .../interfaces/Addon/AddonCallbacksAddon.cpp | 46 ++++++++++++++++-- .../interfaces/Addon/AddonCallbacksAddon.h | 4 +- xbmc/addons/interfaces/Filesystem.cpp | 15 ++++-- xbmc/addons/interfaces/Filesystem.h | 2 +- .../include/kodi/AddonBase.h | 1 + .../include/kodi/Filesystem.h | 48 +++++++++++++++---- .../include/kodi/libXBMC_addon.h | 35 ++++++++++++-- .../include/kodi/versions.h | 8 ++-- xbmc/filesystem/CurlFile.cpp | 15 ++++++ xbmc/filesystem/CurlFile.h | 1 + xbmc/filesystem/File.cpp | 9 ++++ xbmc/filesystem/File.h | 2 + xbmc/filesystem/FileCache.h | 5 ++ xbmc/filesystem/IFile.h | 12 +++++ 16 files changed, 191 insertions(+), 27 deletions(-) diff --git a/xbmc/addons/binary-addons/AddonDll.cpp b/xbmc/addons/binary-addons/AddonDll.cpp index 237a3a3e1ddfb..6c07387a69573 100644 --- a/xbmc/addons/binary-addons/AddonDll.cpp +++ b/xbmc/addons/binary-addons/AddonDll.cpp @@ -498,6 +498,7 @@ bool CAddonDll::InitInterface(KODI_HANDLE firstKodiInstance) m_interface.toKodi->set_setting_float = set_setting_float; m_interface.toKodi->set_setting_string = set_setting_string; m_interface.toKodi->free_string = free_string; + m_interface.toKodi->free_string_array = free_string_array; // Create function list from addon to kodi, generated with calloc to have // compatible with other versions and everything with "0" @@ -836,6 +837,19 @@ void CAddonDll::free_string(void* kodiBase, char* str) free(str); } +void CAddonDll::free_string_array(void* kodiBase, char** arr, int numElements) +{ + if (arr) + { + for (int i = 0; i < numElements; ++i) + { + free(arr[i]); + } + free(arr); + } +} + + //@} }; /* namespace ADDON */ diff --git a/xbmc/addons/binary-addons/AddonDll.h b/xbmc/addons/binary-addons/AddonDll.h index 2618aead27094..83f551cfe5d1a 100644 --- a/xbmc/addons/binary-addons/AddonDll.h +++ b/xbmc/addons/binary-addons/AddonDll.h @@ -131,6 +131,7 @@ namespace ADDON static bool set_setting_float(void* kodiBase, const char* id, float value); static bool set_setting_string(void* kodiBase, const char* id, const char* value); static void free_string(void* kodiBase, char* str); + static void free_string_array(void* kodiBase, char** arr, int numElements); //@} }; diff --git a/xbmc/addons/interfaces/Addon/AddonCallbacksAddon.cpp b/xbmc/addons/interfaces/Addon/AddonCallbacksAddon.cpp index 46ea1fa7b6905..671ed5208d567 100644 --- a/xbmc/addons/interfaces/Addon/AddonCallbacksAddon.cpp +++ b/xbmc/addons/interfaces/Addon/AddonCallbacksAddon.cpp @@ -18,7 +18,7 @@ * . * */ - +#include #include "Application.h" #include "addons/Addon.h" #include "addons/settings/AddonSettings.h" @@ -60,6 +60,7 @@ CAddonCallbacksAddon::CAddonCallbacksAddon(CAddon* addon) m_callbacks->GetLocalizedString = GetLocalizedString; m_callbacks->GetDVDMenuLanguage = GetDVDMenuLanguage; m_callbacks->FreeString = FreeString; + m_callbacks->FreeStringArray = FreeStringArray; m_callbacks->OpenFile = OpenFile; m_callbacks->OpenFileForWrite = OpenFileForWrite; @@ -76,7 +77,8 @@ CAddonCallbacksAddon::CAddonCallbacksAddon(CAddon* addon) m_callbacks->GetFileChunkSize = GetFileChunkSize; m_callbacks->FileExists = FileExists; m_callbacks->StatFile = StatFile; - m_callbacks->GetFileProperty = GetFileProperty; + m_callbacks->GetFilePropertyValue = GetFilePropertyValue; + m_callbacks->GetFilePropertyValues = GetFilePropertyValues; m_callbacks->DeleteFile = DeleteFile; m_callbacks->CanOpenDirectory = CanOpenDirectory; @@ -315,6 +317,15 @@ void CAddonCallbacksAddon::FreeString(const void* addonData, char* str) free(str); } +void CAddonCallbacksAddon::FreeStringArray(const void* addonData, char** arr, int numElements) +{ + for (int i = 0; i < numElements; ++i) + { + free(arr[i]); + } + free(arr); +} + void* CAddonCallbacksAddon::OpenFile(const void* addonData, const char* strFileName, unsigned int flags) { CAddonInterfaces* helper = (CAddonInterfaces*) addonData; @@ -505,7 +516,7 @@ int CAddonCallbacksAddon::StatFile(const void* addonData, const char *strFileNam return CFile::Stat(strFileName, buffer); } -char *CAddonCallbacksAddon::GetFileProperty(const void* addonData, void* file, XFILE::FileProperty type, const char *name) +char *CAddonCallbacksAddon::GetFilePropertyValue(const void* addonData, void* file, XFILE::FileProperty type, const char *name) { CAddonInterfaces* helper = (CAddonInterfaces*)addonData; if (!helper) @@ -513,10 +524,37 @@ char *CAddonCallbacksAddon::GetFileProperty(const void* addonData, void* file, X CFile* cfile = (CFile*)file; if (cfile) - return strdup(cfile->GetProperty(type, name).c_str()); + { + std::vector values = cfile->GetPropertyValues(type, name); + if (values.empty()) { + return nullptr; + } + return strdup(values[0].c_str()); + } return nullptr; } +char **CAddonCallbacksAddon::GetFilePropertyValues(const void* addonData, void* file, XFILE::FileProperty type, const char *name, int *numValues) +{ + CAddonInterfaces* helper = (CAddonInterfaces*)addonData; + if (!helper) + return nullptr; + + CFile* cfile = static_cast(file); + if (!cfile) + { + return nullptr; + } + std::vector values = cfile->GetPropertyValues(type, name); + *numValues = values.size(); + char **ret = static_cast(malloc(sizeof(char*)*values.size())); + for (int i = 0; i < *numValues; ++i) + { + ret[i] = strdup(values[i].c_str()); + } + return ret; +} + bool CAddonCallbacksAddon::DeleteFile(const void* addonData, const char *strFileName) { CAddonInterfaces* helper = (CAddonInterfaces*) addonData; diff --git a/xbmc/addons/interfaces/Addon/AddonCallbacksAddon.h b/xbmc/addons/interfaces/Addon/AddonCallbacksAddon.h index 527e582d20044..bb8c5deee64b1 100644 --- a/xbmc/addons/interfaces/Addon/AddonCallbacksAddon.h +++ b/xbmc/addons/interfaces/Addon/AddonCallbacksAddon.h @@ -62,6 +62,7 @@ class CAddonCallbacksAddon static char* GetLocalizedString(const void* addonData, long dwCode); static char* GetDVDMenuLanguage(const void* addonData); static void FreeString(const void* addonData, char* str); + static void FreeStringArray(const void* addonData, char** arr, int numElements); // file operations static void* OpenFile(const void* addonData, const char* strFileName, unsigned int flags); @@ -79,7 +80,8 @@ class CAddonCallbacksAddon static int GetFileChunkSize(const void* addonData, void* file); static bool FileExists(const void* addonData, const char *strFileName, bool bUseCache); static int StatFile(const void* addonData, const char *strFileName, struct __stat64* buffer); - static char *GetFileProperty(const void* addonData, void* file, XFILE::FileProperty type, const char *name); + static char *GetFilePropertyValue(const void* addonData, void* file, XFILE::FileProperty type, const char *name); + static char **GetFilePropertyValues(const void* addonData, void* file, XFILE::FileProperty type, const char *name, int *numValues); static bool DeleteFile(const void* addonData, const char *strFileName); static bool CanOpenDirectory(const void* addonData, const char* strURL); static bool CreateDirectory(const void* addonData, const char *strPath); diff --git a/xbmc/addons/interfaces/Filesystem.cpp b/xbmc/addons/interfaces/Filesystem.cpp index a25f0304a1116..bfe88f7055eb5 100644 --- a/xbmc/addons/interfaces/Filesystem.cpp +++ b/xbmc/addons/interfaces/Filesystem.cpp @@ -18,6 +18,8 @@ * */ +#include + #include "Filesystem.h" #include "addons/kodi-addon-dev-kit/include/kodi/Filesystem.h" @@ -73,7 +75,7 @@ void Interface_Filesystem::Init(AddonGlobalInterface* addonInterface) addonInterface->toKodi->kodi_filesystem->get_file_download_speed = get_file_download_speed; addonInterface->toKodi->kodi_filesystem->close_file = close_file; addonInterface->toKodi->kodi_filesystem->get_file_chunk_size = get_file_chunk_size; - addonInterface->toKodi->kodi_filesystem->get_property = get_property; + addonInterface->toKodi->kodi_filesystem->get_property_values = get_property_values; addonInterface->toKodi->kodi_filesystem->curl_create = curl_create; addonInterface->toKodi->kodi_filesystem->curl_add_option = curl_add_option; @@ -504,7 +506,7 @@ int Interface_Filesystem::get_file_chunk_size(void* kodiBase, void* file) return static_cast(file)->GetChunkSize(); } -char* Interface_Filesystem::get_property(void* kodiBase, void* file, int type, const char *name) +char** Interface_Filesystem::get_property_values(void* kodiBase, void* file, int type, const char *name, int *numValues) { CAddonDll* addon = static_cast(kodiBase); if (addon == nullptr || file == nullptr || name == nullptr) @@ -535,7 +537,14 @@ char* Interface_Filesystem::get_property(void* kodiBase, void* file, int type, c CLog::Log(LOGERROR, "Interface_Filesystem::%s - invalid data (addon='%p', file='%p')", __FUNCTION__, addon, file); return nullptr; }; - return strdup(static_cast(file)->GetProperty(internalType, name).c_str()); + std::vector values = static_cast(file)->GetPropertyValues(internalType, name); + *numValues = values.size(); + char **ret = static_cast(malloc(sizeof(char*)*values.size())); + for (int i = 0; i < *numValues; ++i) + { + ret[i] = strdup(values[i].c_str()); + } + return ret; } void* Interface_Filesystem::curl_create(void* kodiBase, const char* url) diff --git a/xbmc/addons/interfaces/Filesystem.h b/xbmc/addons/interfaces/Filesystem.h index 3f79a594f6ef3..0f78e03fac5e4 100644 --- a/xbmc/addons/interfaces/Filesystem.h +++ b/xbmc/addons/interfaces/Filesystem.h @@ -77,7 +77,7 @@ namespace ADDON static double get_file_download_speed(void* kodiBase, void* file); static void close_file(void* kodiBase, void* file); static int get_file_chunk_size(void* kodiBase, void* file); - static char* get_property(void* kodiBase, void* file, int type, const char *name); + static char** get_property_values(void* kodiBase, void* file, int type, const char *name, int *numValues); static void* curl_create(void* kodiBase, const char* url); static bool curl_add_option(void* kodiBase, void* file, int type, const char* name, const char* value); diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h index 0c5e6175817f3..432a1c3d2753f 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h @@ -160,6 +160,7 @@ typedef struct AddonToKodiFuncTable_Addon // Function addresses used for callbacks from addon to Kodi void (*free_string)(void* kodiBase, char* str); + void (*free_string_array)(void* kodiBase, char** arr, int numElements); char* (*get_addon_path)(void* kodiBase); char* (*get_base_user_path)(void* kodiBase); void (*addon_log_msg)(void* kodiBase, const int loglevel, const char *msg); diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h index b06770c25b0de..37e8e3ea35a41 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h @@ -22,6 +22,7 @@ #include "AddonBase.h" #include +#include #if !defined(_WIN32) #include @@ -110,7 +111,7 @@ extern "C" double (*get_file_download_speed)(void* kodiBase, void* file); void (*close_file)(void* kodiBase, void* file); int (*get_file_chunk_size)(void* kodiBase, void* file); - char* (*get_property)(void* kodiBase, void* file, int type, const char *name); + char** (*get_property_values)(void* kodiBase, void* file, int type, const char *name, int *numValues); void* (*curl_create)(void* kodiBase, const char* url); bool (*curl_add_option)(void* kodiBase, void* file, int type, const char* name, const char* value); @@ -1540,22 +1541,51 @@ namespace vfs /// @param[in] name The name of a named property value (e.g. Header) /// @return value of requested property, empty on failure / non-existance /// - const std::string GetProperty(FilePropertyTypes type, const std::string &name) const + const std::string GetPropertyValue(FilePropertyTypes type, const std::string &name) const { if (!m_file) { - kodi::Log(ADDON_LOG_ERROR, "kodi::vfs::CURLCreate(...) needed to call before GetProperty!"); + kodi::Log(ADDON_LOG_ERROR, "kodi::vfs::CURLCreate(...) needed to call before GetPropertyValue!"); return ""; } - char *res(::kodi::addon::CAddonBase::m_interface->toKodi->kodi_filesystem->get_property( - ::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, m_file, type, name.c_str())); + std::vector values = GetPropertyValues(type, name); + if (values.empty()) { + return ""; + } + return values[0]; + } + //-------------------------------------------------------------------------- + + //========================================================================== + /// + /// @ingroup cpp_kodi_vfs_CFile + /// @brief retrieve file property values + /// + /// @param[in] type The type of the file property values to retrieve the value for + /// @param[in] name The name of the named property (e.g. Header) + /// @return values of requested property, empty vector on failure / non-existance + /// + const std::vector GetPropertyValues(FilePropertyTypes type, const std::string &name) const + { + if (!m_file) + { + kodi::Log(ADDON_LOG_ERROR, "kodi::vfs::CURLCreate(...) needed to call before GetPropertyValues!"); + return std::vector(); + } + int numValues; + char **res(::kodi::addon::CAddonBase::m_interface->toKodi->kodi_filesystem->get_property_values( + ::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, m_file, type, name.c_str(), &numValues)); if (res) { - std::string strReturn(res); - ::kodi::addon::CAddonBase::m_interface->toKodi->free_string(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, res); - return strReturn; + std::vector vecReturn; + for (int i = 0; i < numValues; ++i) + { + vecReturn.emplace_back(res[i]); + } + ::kodi::addon::CAddonBase::m_interface->toKodi->free_string_array(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, res, numValues); + return vecReturn; } - return ""; + return std::vector(); } //-------------------------------------------------------------------------- diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h index c2645781bbe4d..5ef6bdc9df08a 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h @@ -139,6 +139,7 @@ typedef struct CB_AddOn char* (*GetLocalizedString)(const void* addonData, long dwCode); char* (*GetDVDMenuLanguage)(const void* addonData); void (*FreeString)(const void* addonData, char* str); + void (*FreeStringArray)(const void* addonData, char** arr, int numElements); void* (*OpenFile)(const void* addonData, const char* strFileName, unsigned int flags); void* (*OpenFileForWrite)(const void* addonData, const char* strFileName, bool bOverWrite); @@ -155,7 +156,8 @@ typedef struct CB_AddOn int (*GetFileChunkSize)(const void* addonData, void* file); bool (*FileExists)(const void* addonData, const char *strFileName, bool bUseCache); int (*StatFile)(const void* addonData, const char *strFileName, struct __stat64* buffer); - char *(*GetFileProperty)(const void* addonData, void* file, XFILE::FileProperty type, const char *name); + char *(*GetFilePropertyValue)(const void* addonData, void* file, XFILE::FileProperty type, const char *name); + char **(*GetFilePropertyValues)(const void* addonData, void* file, XFILE::FileProperty type, const char *name, int *numPorperties); bool (*DeleteFile)(const void* addonData, const char *strFileName); bool (*CanOpenDirectory)(const void* addonData, const char* strURL); bool (*CreateDirectory)(const void* addonData, const char *strPath); @@ -299,6 +301,16 @@ namespace ADDON { m_Callbacks->FreeString(m_Handle->addonData, str); } + + /*! + * @brief Free the memory used by arr including its elements + * @param arr The string array to free + * @param numElements The length of the array + */ + void FreeStringArray(char** arr, int numElements) + { + m_Callbacks->FreeStringArray(m_Handle->addonData, arr, numElements); + } /*! * @brief Open the file with filename via XBMC's CFile. Needs to be closed by calling CloseFile() when done. @@ -468,13 +480,26 @@ namespace ADDON /*! * @brief Get a property from an open file. * @param file The file to get an property for - * @param type type of the requested property. - * @param name of the requested property / can be null. + * @param type Type of the requested property. + * @param name Name of the requested property / can be null. * @return The value of the requested property, must be FreeString'ed. */ - char *GetFileProperty(void* file, XFILE::FileProperty type, const char *name) + char *GetFilePropertyValue(void* file, XFILE::FileProperty type, const char *name) + { + return m_Callbacks->GetFilePropertyValue(m_Handle->addonData, file, type, name); + } + + /*! + * @brief Get multiple property values from an open file. + * @param file The file to get the property values for + * @param type Type of the requested property. + * @param name Name of the requested property / can be null. + * @param numValues Number of property values returned. + * @return List of values of the requested property, must be FreeStringArray'ed. + */ + char **GetFilePropertyValues(void* file, XFILE::FileProperty type, const char *name, int *numValues) { - return m_Callbacks->GetFileProperty(m_Handle->addonData, file, type, name); + return m_Callbacks->GetFilePropertyValues(m_Handle->addonData, file, type, name, numValues); } /*! diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h index 1852327c4dd1c..d50a990c1f916 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h @@ -41,8 +41,8 @@ * overview. */ -#define ADDON_GLOBAL_VERSION_MAIN "1.0.11" -#define ADDON_GLOBAL_VERSION_MAIN_MIN "1.0.11" +#define ADDON_GLOBAL_VERSION_MAIN "1.0.12" +#define ADDON_GLOBAL_VERSION_MAIN_MIN "1.0.12" #define ADDON_GLOBAL_VERSION_MAIN_XML_ID "kodi.binary.global.main" #define ADDON_GLOBAL_VERSION_MAIN_DEPENDS "AddonBase.h" \ "xbmc_addon_dll.h" \ @@ -66,8 +66,8 @@ #define ADDON_GLOBAL_VERSION_AUDIOENGINE_XML_ID "kodi.binary.global.audioengine" #define ADDON_GLOBAL_VERSION_AUDIOENGINE_DEPENDS "AudioEngine.h" -#define ADDON_GLOBAL_VERSION_FILESYSTEM "1.0.1" -#define ADDON_GLOBAL_VERSION_FILESYSTEM_MIN "1.0.1" +#define ADDON_GLOBAL_VERSION_FILESYSTEM "1.0.2" +#define ADDON_GLOBAL_VERSION_FILESYSTEM_MIN "1.0.2" #define ADDON_GLOBAL_VERSION_FILESYSTEM_XML_ID "kodi.binary.global.filesystem" #define ADDON_GLOBAL_VERSION_FILESYSTEM_DEPENDS "Filesystem.h" diff --git a/xbmc/filesystem/CurlFile.cpp b/xbmc/filesystem/CurlFile.cpp index ebebcf689e995..76510bee4933c 100644 --- a/xbmc/filesystem/CurlFile.cpp +++ b/xbmc/filesystem/CurlFile.cpp @@ -1929,6 +1929,21 @@ const std::string CCurlFile::GetProperty(XFILE::FileProperty type, const std::st } } +const std::vector CCurlFile::GetPropertyValues(XFILE::FileProperty type, const std::string &name) const +{ + if (type == FILE_PROPERTY_RESPONSE_HEADER) + { + return m_state->m_httpheader.GetValues(name); + } + std::vector values; + std::string value = GetProperty(type, name); + if (!value.empty()) + { + values.emplace_back(value); + } + return values; +} + double CCurlFile::GetDownloadSpeed() { double res = 0.0f; diff --git a/xbmc/filesystem/CurlFile.h b/xbmc/filesystem/CurlFile.h index 8fa218caac8c7..157073998b7c7 100644 --- a/xbmc/filesystem/CurlFile.h +++ b/xbmc/filesystem/CurlFile.h @@ -62,6 +62,7 @@ namespace XFILE ssize_t Read(void* lpBuf, size_t uiBufSize) override { return m_state->Read(lpBuf, uiBufSize); } ssize_t Write(const void* lpBuf, size_t uiBufSize) override; const std::string GetProperty(XFILE::FileProperty type, const std::string &name = "") const override; + const std::vector GetPropertyValues(XFILE::FileProperty type, const std::string &name = "") const override; int IoControl(EIoControl request, void* param) override; double GetDownloadSpeed() override; diff --git a/xbmc/filesystem/File.cpp b/xbmc/filesystem/File.cpp index 5f29dd38e49b7..d29076dd5af7f 100644 --- a/xbmc/filesystem/File.cpp +++ b/xbmc/filesystem/File.cpp @@ -957,6 +957,15 @@ const std::string CFile::GetProperty(XFILE::FileProperty type, const std::string return m_pFile->GetProperty(type, name); } +const std::vector CFile::GetPropertyValues(XFILE::FileProperty type, const std::string &name) const +{ + if (!m_pFile) + { + return std::vector(); + } + return m_pFile->GetPropertyValues(type, name); +} + ssize_t CFile::LoadFile(const std::string &filename, auto_buffer& outputBuffer) { const CURL pathToUrl(filename); diff --git a/xbmc/filesystem/File.h b/xbmc/filesystem/File.h index f67db9c5a4104..3ad1b859ebdfb 100644 --- a/xbmc/filesystem/File.h +++ b/xbmc/filesystem/File.h @@ -32,6 +32,7 @@ #include #include #include +#include #include "utils/auto_buffer.h" #include "IFileTypes.h" #include "PlatformDefs.h" @@ -110,6 +111,7 @@ class CFile void Close(); int GetChunkSize(); const std::string GetProperty(XFILE::FileProperty type, const std::string &name = "") const; + const std::vector GetPropertyValues(XFILE::FileProperty type, const std::string &name = "") const; ssize_t LoadFile(const std::string &filename, auto_buffer& outputBuffer); diff --git a/xbmc/filesystem/FileCache.h b/xbmc/filesystem/FileCache.h index 31872b74c89fe..f5525642f9b51 100644 --- a/xbmc/filesystem/FileCache.h +++ b/xbmc/filesystem/FileCache.h @@ -61,6 +61,11 @@ namespace XFILE const std::string GetProperty(XFILE::FileProperty type, const std::string &name = "") const override; + virtual const std::vector GetPropertyValues(XFILE::FileProperty type, const std::string &name = "") const override + { + return std::vector(); + } + private: CCacheStrategy *m_pCache; bool m_bDeleteCache; diff --git a/xbmc/filesystem/IFile.h b/xbmc/filesystem/IFile.h index f41b41d272513..228f68d0c0c97 100644 --- a/xbmc/filesystem/IFile.h +++ b/xbmc/filesystem/IFile.h @@ -35,6 +35,7 @@ #include #include #include +#include #if !defined(SIZE_MAX) || !defined(SSIZE_MAX) #include @@ -133,6 +134,17 @@ class IFile { return type == XFILE::FILE_PROPERTY_CONTENT_TYPE ? "application/octet-stream" : ""; }; + + virtual const std::vector GetPropertyValues(XFILE::FileProperty type, const std::string &name = "") const + { + std::vector values; + std::string value = GetProperty(type, name); + if (!value.empty()) + { + values.emplace_back(value); + } + return values; + } }; class CRedirectException From f92bedcb63bf5d8cf6a1aa55b760aced6c7fc1f1 Mon Sep 17 00:00:00 2001 From: Garrett Brown Date: Sat, 9 Sep 2017 11:47:25 -0700 Subject: [PATCH 056/113] Fix Coverity CIDs 175368 and 175367 This fixes two logic errors in commit acd30c1bf of PR 12761. Coverity CID 175368: ** CID 175368: Integer handling issues (CONSTANT_EXPRESSION_RESULT) GUIWindowSlideShow.cpp: 249 in CGUIWindowSlideShow::OnDeinitWindow(int)() ________________________________________________________________________________________________________ *** CID 175368: Integer handling issues (CONSTANT_EXPRESSION_RESULT) GUIWindowSlideShow.cpp: 249 in CGUIWindowSlideShow::OnDeinitWindow(int)() 243 if (m_Resolution != CDisplaySettings::GetInstance().GetCurrentResolution()) 244 { 245 //FIXME: Use GUI resolution for now 246 //g_graphicsContext.SetVideoResolution(CDisplaySettings::GetInstance().GetCurrentResolution(), TRUE); 247 } 248 >>> CID 175368: Integer handling issues (CONSTANT_EXPRESSION_RESULT) >>> The "or" condition "nextWindowID != 12005 || nextWindowID != 12906" will always be true because "nextWindowID" cannot be equal to two different values at the same time, so it must be not equal to at least one of them. 249 if (nextWindowID != WINDOW_FULLSCREEN_VIDEO || 250 nextWindowID != WINDOW_FULLSCREEN_GAME) 251 { 252 // wait for any outstanding picture loads 253 if (m_pBackgroundLoader) 254 { Coverity CID 175367: ** CID 175367: Integer handling issues (CONSTANT_EXPRESSION_RESULT) InputManager.cpp: 569 in CInputManager::OnKey(const CKey &)() ________________________________________________________________________________________________________ *** CID 175367: Integer handling issues (CONSTANT_EXPRESSION_RESULT) InputManager.cpp: 569 in CInputManager::OnKey(const CKey &)() 563 if (g_application.WakeUpScreenSaverAndDPMS(processKey) && !processKey) 564 { 565 CLog::LogF(LOGDEBUG, "%s pressed, screen saver/dpms woken up", m_Keyboard.GetKeyName((int)key.GetButtonCode()).c_str()); 566 return true; 567 } 568 >>> CID 175367: Integer handling issues (CONSTANT_EXPRESSION_RESULT) >>> The "or" condition "iWin != 12005 || iWin != 12906" will always be true because "iWin" cannot be equal to two different values at the same time, so it must be not equal to at least one of them. 569 if (iWin != WINDOW_FULLSCREEN_VIDEO || 570 iWin != WINDOW_FULLSCREEN_GAME) 571 { 572 // current active window isnt the fullscreen window 573 // just use corresponding section from keymap.xml 574 // to map key->action --- xbmc/input/InputManager.cpp | 2 +- xbmc/pictures/GUIWindowSlideShow.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xbmc/input/InputManager.cpp b/xbmc/input/InputManager.cpp index f24c73f265d92..97fd7ff900d33 100644 --- a/xbmc/input/InputManager.cpp +++ b/xbmc/input/InputManager.cpp @@ -566,7 +566,7 @@ bool CInputManager::OnKey(const CKey& key) return true; } - if (iWin != WINDOW_FULLSCREEN_VIDEO || + if (iWin != WINDOW_FULLSCREEN_VIDEO && iWin != WINDOW_FULLSCREEN_GAME) { // current active window isnt the fullscreen window diff --git a/xbmc/pictures/GUIWindowSlideShow.cpp b/xbmc/pictures/GUIWindowSlideShow.cpp index e5bf1b7a6c111..6d0a0157742c4 100644 --- a/xbmc/pictures/GUIWindowSlideShow.cpp +++ b/xbmc/pictures/GUIWindowSlideShow.cpp @@ -246,7 +246,7 @@ void CGUIWindowSlideShow::OnDeinitWindow(int nextWindowID) //g_graphicsContext.SetVideoResolution(CDisplaySettings::GetInstance().GetCurrentResolution(), TRUE); } - if (nextWindowID != WINDOW_FULLSCREEN_VIDEO || + if (nextWindowID != WINDOW_FULLSCREEN_VIDEO && nextWindowID != WINDOW_FULLSCREEN_GAME) { // wait for any outstanding picture loads From 7186f1233826cb8468d6f0bcae78b13bbb5e89d5 Mon Sep 17 00:00:00 2001 From: tadly Date: Fri, 18 Aug 2017 19:07:29 +0200 Subject: [PATCH 057/113] don't use regex matching If the path within `${PROJECT_SOURCE_DIR}`contains special characters (e.g. `+`), the build will fail as they get interpreted by regex --- cmake/scripts/common/AddonHelpers.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/scripts/common/AddonHelpers.cmake b/cmake/scripts/common/AddonHelpers.cmake index 92cd0b1389574..0a879d6bf14f3 100644 --- a/cmake/scripts/common/AddonHelpers.cmake +++ b/cmake/scripts/common/AddonHelpers.cmake @@ -52,7 +52,8 @@ macro (build_addon target prefix libs) # Read used headers from addon, needed to identitfy used kodi addon interface headers if(${prefix}_HEADERS) # Add the used header files defined with CMakeLists.txt from addon itself - if(${prefix}_HEADERS MATCHES ${PROJECT_SOURCE_DIR}) + string(FIND "${${prefix}_HEADERS}" "${PROJECT_SOURCE_DIR}" position) + if(position GREATER -1) # include path name already complete list(APPEND USED_SOURCES ${${prefix}_HEADERS}) else() @@ -75,7 +76,8 @@ macro (build_addon target prefix libs) endif() # Add the used source files defined with CMakeLists.txt from addon itself - if(${prefix}_SOURCES MATCHES ${PROJECT_SOURCE_DIR}) + string(FIND "${${prefix}_SOURCES}" "${PROJECT_SOURCE_DIR}" position) + if(position GREATER -1) # include path name already complete list(APPEND USED_SOURCES ${${prefix}_SOURCES}) else() From a293c270a8cc133b42aeeca141c17bed12a93c5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20B=C3=BChlmann?= Date: Mon, 11 Sep 2017 22:35:00 +0200 Subject: [PATCH 058/113] Allow setting custom http request from binary addon --- xbmc/filesystem/CurlFile.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xbmc/filesystem/CurlFile.cpp b/xbmc/filesystem/CurlFile.cpp index ebebcf689e995..60c42b14f1dae 100644 --- a/xbmc/filesystem/CurlFile.cpp +++ b/xbmc/filesystem/CurlFile.cpp @@ -830,6 +830,10 @@ void CCurlFile::ParseAndCorrectUrl(CURL &url2) { SetRequestHeader(it->first, value); } + else if (name == "customrequest") + { + SetCustomRequest(value); + } else { if (name.length() > 0 && name[0] == '!') From 07f88993a8b86d1c3a94f3352de3b61f347d4485 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Tue, 12 Sep 2017 17:10:51 +0200 Subject: [PATCH 059/113] VideoPlayer: bring up busy dialog if opening stream blocks too long --- xbmc/cores/VideoPlayer/VideoPlayer.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp index a34f33dc8155e..87cbc620ce0cf 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp @@ -688,7 +688,7 @@ CVideoPlayer::~CVideoPlayer() bool CVideoPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options) { - CLog::Log(LOGNOTICE, "VideoPlayer: Opening: %s", CURL::GetRedacted(file.GetPath()).c_str()); + CLog::Log(LOGNOTICE, "VideoPlayer::OpenFile: %s", CURL::GetRedacted(file.GetPath()).c_str()); // if playing a file close it first // this has to be changed so we won't have to close it. @@ -701,11 +701,15 @@ bool CVideoPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options params.m_item.SetMimeTypeForInternetFile(); m_messenger.Put(new CDVDMsgOpenFile(params), 1); - if (m_openEvent.WaitMSec(2000)) + if (!CGUIDialogBusy::WaitOnEvent(m_openEvent, 2000, true)) { if (!m_bStop && !m_bAbortRequest) return true; } + else + { + CLog::Log(LOGNOTICE, "CVideoPlayer::OpenFile: cancelled"); + } CloseFile(); } @@ -719,7 +723,11 @@ bool CVideoPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options m_openEvent.Reset(); Create(); - CGUIDialogBusy::WaitOnEvent(m_openEvent, g_advancedSettings.m_videoBusyDialogDelay_ms, false); + if (!CGUIDialogBusy::WaitOnEvent(m_openEvent, g_advancedSettings.m_videoBusyDialogDelay_ms, true)) + { + CLog::Log(LOGNOTICE, "CVideoPlayer::OpenFile: cancelled (2)"); + CloseFile(); + } // Playback might have been stopped due to some error if (m_bStop || m_bAbortRequest) @@ -870,7 +878,7 @@ bool CVideoPlayer::OpenDemuxStream() CLog::Log(LOGNOTICE, "Creating Demuxer"); int attempts = 10; - while(!m_bStop && attempts-- > 0) + while (!m_bStop && attempts-- > 0) { m_pDemuxer = CDVDFactoryDemuxer::CreateDemuxer(m_pInputStream); if(!m_pDemuxer && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER)) @@ -885,7 +893,7 @@ bool CVideoPlayer::OpenDemuxStream() break; } - if(!m_pDemuxer) + if (!m_pDemuxer) { CLog::Log(LOGERROR, "%s - Error creating demuxer", __FUNCTION__); return false; @@ -1259,7 +1267,7 @@ void CVideoPlayer::Prepare() CMediaSettings::GetInstance().GetCurrentVideoSettings().m_SubtitleCached = true; } - if(!OpenDemuxStream()) + if (!OpenDemuxStream()) { m_bAbortRequest = true; return; From ba33905cf3d5a996503f0984d836ad4f0084c627 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Tue, 12 Sep 2017 17:13:19 +0200 Subject: [PATCH 060/113] VideoPlayer: drop obsolete SetScanTimeout --- xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h | 1 - .../DVDInputStreams/DVDInputStreamPVRManager.cpp | 6 ------ .../VideoPlayer/DVDInputStreams/DVDInputStreamPVRManager.h | 2 -- xbmc/cores/VideoPlayer/VideoPlayer.cpp | 3 --- 4 files changed, 12 deletions(-) diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h index 03639aa3b1b04..f5f767ab7adb5 100644 --- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h +++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h @@ -167,7 +167,6 @@ class CDVDInputStream virtual ENextStream NextStream() { return NEXTSTREAM_NONE; } virtual void Abort() {} virtual int GetBlockSize() { return 0; } - virtual void ResetScanTimeout(unsigned int iTimeoutMs) { } virtual bool CanSeek() { return true; } virtual bool CanPause() { return true; } diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamPVRManager.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamPVRManager.cpp index 7e1f6d2a38bbb..788217a30d5f5 100644 --- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamPVRManager.cpp +++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamPVRManager.cpp @@ -66,11 +66,6 @@ CDVDInputStreamPVRManager::~CDVDInputStreamPVRManager() delete m_StreamProps; } -void CDVDInputStreamPVRManager::ResetScanTimeout(unsigned int iTimeoutMs) -{ - m_ScanTimeout.Set(iTimeoutMs); -} - bool CDVDInputStreamPVRManager::IsEOF() { // don't mark as eof while within the scan timeout @@ -145,7 +140,6 @@ bool CDVDInputStreamPVRManager::Open() m_demuxActive = true; } - ResetScanTimeout((unsigned int) CServiceBroker::GetSettings().GetInt(CSettings::SETTING_PVRPLAYBACK_SCANTIME) * 1000); CLog::Log(LOGDEBUG, "CDVDInputStreamPVRManager::Open - stream opened: %s", CURL::GetRedacted(m_item.GetDynPath()).c_str()); m_StreamProps->iStreamCount = 0; diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamPVRManager.h b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamPVRManager.h index 5fe98b0e0bd92..c124b1f772499 100644 --- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamPVRManager.h +++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamPVRManager.h @@ -86,8 +86,6 @@ class CDVDInputStreamPVRManager */ std::string GetInputFormat(); - void ResetScanTimeout(unsigned int iTimeoutMs) override; - // Demux interface CDVDInputStream::IDemux* GetIDemux() override; bool OpenDemux() override; diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp index 87cbc620ce0cf..62cff07a9261b 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp @@ -2954,8 +2954,6 @@ void CVideoPlayer::SetCaching(ECacheState state) m_VideoPlayerVideo->SetSpeed(DVD_PLAYSPEED_PAUSE); m_streamPlayerSpeed = DVD_PLAYSPEED_PAUSE; - m_pInputStream->ResetScanTimeout((unsigned int) CServiceBroker::GetSettings().GetInt(CSettings::SETTING_PVRPLAYBACK_SCANTIME) * 1000); - m_cachingTimer.Set(5000); } @@ -2966,7 +2964,6 @@ void CVideoPlayer::SetCaching(ECacheState state) m_VideoPlayerAudio->SetSpeed(m_playSpeed); m_VideoPlayerVideo->SetSpeed(m_playSpeed); m_streamPlayerSpeed = m_playSpeed; - m_pInputStream->ResetScanTimeout(0); } m_caching = state; From 93e96e4e7bb56b07d628178dcaf5e8f52ed21fb1 Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Fri, 8 Sep 2017 10:35:01 -0700 Subject: [PATCH 061/113] [cmake] only build LinuxRendererGLES for specific renderers --- .../VideoPlayer/VideoRenderers/CMakeLists.txt | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/CMakeLists.txt b/xbmc/cores/VideoPlayer/VideoRenderers/CMakeLists.txt index b10b0a4fd77d8..37d565db3044d 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/CMakeLists.txt +++ b/xbmc/cores/VideoPlayer/VideoRenderers/CMakeLists.txt @@ -30,21 +30,27 @@ if(CORE_SYSTEM_NAME STREQUAL windows) OverlayRendererDX.h) endif() +if (OPENGL_FOUND OR OPENGLES_FOUND) + list(APPEND SOURCES OverlayRendererGL.cpp) + list(APPEND HEADERS OverlayRendererGL.h) +endif() + if(OPENGL_FOUND) - list(APPEND SOURCES OverlayRendererGL.cpp - LinuxRendererGL.cpp + list(APPEND SOURCES LinuxRendererGL.cpp FrameBufferObject.cpp) - list(APPEND HEADERS OverlayRendererGL.h - LinuxRendererGL.h + list(APPEND HEADERS LinuxRendererGL.h FrameBufferObject.h) endif() -if(OPENGLES_FOUND) +if(OPENGLES_FOUND AND (CORE_PLATFORM_NAME_LC STREQUAL android OR + CORE_PLATFORM_NAME_LC STREQUAL ios OR + CORE_PLATFORM_NAME_LC STREQUAL gbm OR + CORE_PLATFORM_NAME_LC STREQUAL imx OR + CORE_PLATFORM_NAME_LC STREQUAL mir OR + CORE_PLATFORM_NAME_LC STREQUAL wayland)) list(APPEND SOURCES LinuxRendererGLES.cpp - OverlayRendererGL.cpp FrameBufferObject.cpp) list(APPEND HEADERS LinuxRendererGLES.h - OverlayRendererGL.h FrameBufferObject.cpp) endif() From dc4cfa186cb4c687155a560d52693d702ef614b6 Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Tue, 12 Sep 2017 08:27:08 -0700 Subject: [PATCH 062/113] [cmake] only build videoshaders for specific renderers --- .../VideoShaders/CMakeLists.txt | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt index 9d52775b67b9c..d39a5594b7b1c 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt @@ -11,21 +11,27 @@ if(CORE_SYSTEM_NAME STREQUAL windows) YUV2RGBShader.h) endif() -if(OPENGL_FOUND OR OPENGLES_FOUND) - list(APPEND SOURCES GLSLOutput.cpp +if(OPENGL_FOUND) + list(APPEND SOURCES VideoFilterShaderGL.cpp + GLSLOutput.cpp YUV2RGBShader.cpp) - list(APPEND HEADERS GLSLOutput.h + list(APPEND HEADERS VideoFilterShaderGL.h + GLSLOutput.h YUV2RGBShader.h) endif() -if(OPENGL_FOUND) - list(APPEND SOURCES VideoFilterShaderGL.cpp) - list(APPEND HEADERS VideoFilterShaderGL.h) -endif() - -if(OPENGLES_FOUND) - list(APPEND SOURCES VideoFilterShaderGLES.cpp) - list(APPEND HEADERS VideoFilterShaderGLES.h) +if(OPENGLES_FOUND AND (CORE_PLATFORM_NAME_LC STREQUAL android OR + CORE_PLATFORM_NAME_LC STREQUAL ios OR + CORE_PLATFORM_NAME_LC STREQUAL gbm OR + CORE_PLATFORM_NAME_LC STREQUAL imx OR + CORE_PLATFORM_NAME_LC STREQUAL mir OR + CORE_PLATFORM_NAME_LC STREQUAL wayland)) + list(APPEND SOURCES VideoFilterShaderGLES.cpp + GLSLOutput.cpp + YUV2RGBShader.cpp) + list(APPEND HEADERS VideoFilterShaderGLES.h + GLSLOutput.h + YUV2RGBShader.h) endif() core_add_library(videoshaders) From 62fb833b482dff3da83d28fb0faa6b4dd07da1b8 Mon Sep 17 00:00:00 2001 From: Stefan Saraev Date: Tue, 12 Sep 2017 23:44:11 +0300 Subject: [PATCH 063/113] [fix] aml build after pull/12474 build/windowing/amlogic/windowing_Amlogic.a(WinSystemAmlogic.cpp.o): In function `CWinSystemAmlogic::InitWindowSystem()': WinSystemAmlogic.cpp:(.text._ZN17CWinSystemAmlogic16InitWindowSystemEv+0x18): undefined reference to `CLinuxRendererGLES::Register()' --- xbmc/cores/VideoPlayer/VideoRenderers/CMakeLists.txt | 1 + .../cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/CMakeLists.txt b/xbmc/cores/VideoPlayer/VideoRenderers/CMakeLists.txt index 37d565db3044d..83d106616f5b8 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/CMakeLists.txt +++ b/xbmc/cores/VideoPlayer/VideoRenderers/CMakeLists.txt @@ -44,6 +44,7 @@ endif() if(OPENGLES_FOUND AND (CORE_PLATFORM_NAME_LC STREQUAL android OR CORE_PLATFORM_NAME_LC STREQUAL ios OR + CORE_PLATFORM_NAME_LC STREQUAL aml OR CORE_PLATFORM_NAME_LC STREQUAL gbm OR CORE_PLATFORM_NAME_LC STREQUAL imx OR CORE_PLATFORM_NAME_LC STREQUAL mir OR diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt index d39a5594b7b1c..d4d0a0376ec00 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt @@ -22,6 +22,7 @@ endif() if(OPENGLES_FOUND AND (CORE_PLATFORM_NAME_LC STREQUAL android OR CORE_PLATFORM_NAME_LC STREQUAL ios OR + CORE_PLATFORM_NAME_LC STREQUAL aml OR CORE_PLATFORM_NAME_LC STREQUAL gbm OR CORE_PLATFORM_NAME_LC STREQUAL imx OR CORE_PLATFORM_NAME_LC STREQUAL mir OR From c9264eac67650ac7b9a3e14a87181dd8aa120d66 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Wed, 13 Sep 2017 07:53:01 +0200 Subject: [PATCH 064/113] AE: correct format specifier of log --- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp index b5ac47bd513ce..77092a14e9792 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp @@ -1914,12 +1914,12 @@ bool CActiveAE::RunStages() double error = playingPts - (*it)->m_pClock->GetClock(); if (error > 1000) { - CLog::Log(LOGWARNING, "ActiveAE - large audio sync error: %d", error); + CLog::Log(LOGWARNING, "ActiveAE - large audio sync error: %f", error); error = 1000; } else if (error < -1000) { - CLog::Log(LOGWARNING, "ActiveAE - large audio sync error: %d", error); + CLog::Log(LOGWARNING, "ActiveAE - large audio sync error: %f", error); error = -1000; } (*it)->m_syncError.Add(error); From b34447df55a87c3cb4f3bf22cad89698a084f013 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 7 Sep 2017 11:24:12 +0200 Subject: [PATCH 065/113] VideoPlayer: fix video freeze caused by audio delay --- xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp | 2 +- .../cores/VideoPlayer/VideoRenderers/RenderManager.cpp | 10 +--------- xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h | 1 - 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp index c12890f8fb3fe..9c4d1822b927b 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp @@ -693,7 +693,7 @@ bool CVideoPlayerVideo::ProcessDecoderOutput(double &frametime, double &pts) msg.player = VideoPlayer_VIDEO; msg.cachetime = DVD_MSEC_TO_TIME(50); //! @todo implement msg.cachetotal = DVD_MSEC_TO_TIME(100); //! @todo implement - msg.timestamp = hasTimestamp ? pts : DVD_NOPTS_VALUE; + msg.timestamp = hasTimestamp ? (pts + m_renderManager.GetDelay() * 1000) : DVD_NOPTS_VALUE; m_messageParent.Put(new CDVDMsgType(CDVDMsg::PLAYER_STARTED, msg)); } diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp index be73a0bfe024a..b34010a5d8a57 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp @@ -224,7 +224,6 @@ bool CRenderManager::Configure() m_free.push_back(i); m_bRenderGUI = true; - m_waitForBufferCount = 0; m_bTriggerUpdateResolution = true; m_presentstep = PRESENT_IDLE; m_presentpts = DVD_NOPTS_VALUE; @@ -1037,23 +1036,16 @@ int CRenderManager::WaitForBuffer(volatile std::atomic_bool&bStop, int timeout) while(m_free.empty()) { m_presentevent.wait(lock, std::min(50, timeout)); - if(endtime.IsTimePast() || bStop) + if (endtime.IsTimePast() || bStop) { if (timeout != 0 && !bStop) { CLog::Log(LOGWARNING, "CRenderManager::WaitForBuffer - timeout waiting for buffer"); - m_waitForBufferCount++; - if (m_waitForBufferCount > 2) - { - m_bRenderGUI = false; - } } return -1; } } - m_waitForBufferCount = 0; - // make sure overlay buffer is released, this won't happen on AddOverlay m_overlays.Release(m_free.front()); diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h index c240c16b16a4f..4f2a634faa75e 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h @@ -159,7 +159,6 @@ class CRenderManager CCriticalSection m_datalock; bool m_bTriggerUpdateResolution = false; bool m_bRenderGUI = true; - int m_waitForBufferCount = 0; int m_rendermethod = 0; bool m_renderedOverlay = false; bool m_renderDebug = false; From 4b9c6ce3a73f7e3ebc432dee4cc0671821cc3bb2 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Fri, 8 Sep 2017 14:29:59 +0200 Subject: [PATCH 066/113] VideoPlayer: do not drop pictures after timout on buffer wait --- xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp | 97 ++++++++++++--------- xbmc/cores/VideoPlayer/VideoPlayerVideo.h | 23 +++-- 2 files changed, 69 insertions(+), 51 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp index 9c4d1822b927b..47b5201164871 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp @@ -328,6 +328,7 @@ void CVideoPlayerVideo::Process() m_droppingStats.Reset(); m_iDroppedFrames = 0; m_rewindStalled = false; + m_outputSate = OUTPUT_NORMAL; while (!m_bStop) { @@ -358,10 +359,20 @@ void CVideoPlayerVideo::Process() } else if (ret == MSGQ_TIMEOUT) { + if (m_outputSate == OUTPUT_AGAIN && + m_picture.videoBuffer) + { + m_outputSate = OutputPicture(&m_picture); + if (m_outputSate == OUTPUT_AGAIN) + { + onlyPrioMsgs = true; + continue; + } + } // don't ask for a new frame if we can't deliver it to renderer - if ((m_speed != DVD_PLAYSPEED_PAUSE || - m_syncState != IDVDStreamPlayer::SYNC_INSYNC) && - !m_paused) + else if ((m_speed != DVD_PLAYSPEED_PAUSE || + m_syncState != IDVDStreamPlayer::SYNC_INSYNC) && + !m_paused) { if (ProcessDecoderOutput(frametime, pts)) { @@ -394,7 +405,7 @@ void CVideoPlayerVideo::Process() if (m_picture.videoBuffer) { m_picture.pts = pts; - OutputPicture(&m_picture); + m_outputSate = OutputPicture(&m_picture); pts += frametime; } @@ -528,13 +539,13 @@ void CVideoPlayerVideo::Process() bRequestDrop = false; iDropDirective = CalcDropRequirement(pts); - if ((iDropDirective & EOS_VERYLATE) && + if ((iDropDirective & DROP_VERYLATE) && m_bAllowDrop && !bPacketDrop) { bRequestDrop = true; } - if (iDropDirective & EOS_DROPPED) + if (iDropDirective & DROP_DROPPED) { m_iDroppedFrames++; m_ptsTracker.Flush(); @@ -547,7 +558,7 @@ void CVideoPlayerVideo::Process() } int codecControl = 0; - if (iDropDirective & EOS_BUFFER_LEVEL) + if (iDropDirective & DROP_BUFFER_LEVEL) codecControl |= DVD_CODEC_CTRL_HURRY; if (m_speed > DVD_PLAYSPEED_NORMAL) codecControl |= DVD_CODEC_CTRL_NO_POSTPROC; @@ -680,12 +691,28 @@ bool CVideoPlayerVideo::ProcessDecoderOutput(double &frametime, double &pts) } m_picture.pts = pts + extraDelay; - int iResult = OutputPicture(&m_picture); + // guess next frame pts. iDuration is always valid + if (m_speed != 0) + pts += m_picture.iDuration * m_speed / abs(m_speed); - frametime = (double)DVD_TIME_BASE / m_fFrameRate; + m_outputSate = OutputPicture(&m_picture); + + if (m_outputSate == OUTPUT_AGAIN) + { + return true; + } + else if (m_outputSate == OUTPUT_ABORT) + { + return false; + } + else if ((m_outputSate == OUTPUT_DROPPED) && !(m_picture.iFlags & DVP_FLAG_DROPPED)) + { + m_iDroppedFrames++; + m_ptsTracker.Flush(); + } if (m_syncState == IDVDStreamPlayer::SYNC_STARTING && - !(iResult & EOS_DROPPED) && + m_outputSate != OUTPUT_DROPPED && !(m_picture.iFlags & DVP_FLAG_DROPPED)) { m_syncState = IDVDStreamPlayer::SYNC_WAITSYNC; @@ -697,20 +724,7 @@ bool CVideoPlayerVideo::ProcessDecoderOutput(double &frametime, double &pts) m_messageParent.Put(new CDVDMsgType(CDVDMsg::PLAYER_STARTED, msg)); } - // guess next frame pts. iDuration is always valid - if (m_speed != 0) - pts += m_picture.iDuration * m_speed / abs(m_speed); - - if (iResult & EOS_ABORT) - { - return false; - } - - if ((iResult & EOS_DROPPED) && !(m_picture.iFlags & DVP_FLAG_DROPPED)) - { - m_iDroppedFrames++; - m_ptsTracker.Flush(); - } + frametime = (double)DVD_TIME_BASE / m_fFrameRate; } return true; @@ -801,7 +815,7 @@ std::string CVideoPlayerVideo::GetStereoMode() return stereo_mode; } -int CVideoPlayerVideo::OutputPicture(const VideoPicture* pPicture) +CVideoPlayerVideo::EOutputState CVideoPlayerVideo::OutputPicture(const VideoPicture* pPicture) { m_bAbortOutput = false; @@ -843,11 +857,9 @@ int CVideoPlayerVideo::OutputPicture(const VideoPicture* pPicture) m_pVideoCodec->GetAllowedReferences())) { CLog::Log(LOGERROR, "%s - failed to configure renderer", __FUNCTION__); - return EOS_ABORT; + return OUTPUT_ABORT; } - int result = 0; - //try to calculate the framerate m_ptsTracker.Add(pPicture->pts); if (!m_stalled) @@ -876,11 +888,11 @@ int CVideoPlayerVideo::OutputPicture(const VideoPicture* pPicture) m_rewindStalled = true; Sleep(50); } - return result | EOS_DROPPED; + return OUTPUT_DROPPED; } else if (pPicture->pts < iPlayingClock) { - return result | EOS_DROPPED; + return OUTPUT_DROPPED; } } else if (m_speed > DVD_PLAYSPEED_NORMAL) @@ -898,7 +910,7 @@ int CVideoPlayerVideo::OutputPicture(const VideoPicture* pPicture) if (diff < mindiff) { m_droppingStats.AddOutputDropGain(pPicture->pts, 1); - return result | EOS_DROPPED; + return OUTPUT_DROPPED; } } @@ -906,7 +918,7 @@ int CVideoPlayerVideo::OutputPicture(const VideoPicture* pPicture) { m_droppingStats.AddOutputDropGain(pPicture->pts, 1); CLog::Log(LOGDEBUG,"%s - dropped in output", __FUNCTION__); - return result | EOS_DROPPED; + return OUTPUT_DROPPED; } int timeToDisplay = DVD_TIME_TO_MSEC(pPicture->pts - iPlayingClock); @@ -919,8 +931,7 @@ int CVideoPlayerVideo::OutputPicture(const VideoPicture* pPicture) int buffer = m_renderManager.WaitForBuffer(m_bAbortOutput, maxWaitTime); if (buffer < 0) { - m_droppingStats.AddOutputDropGain(pPicture->pts, 1); - return EOS_DROPPED; + return OUTPUT_AGAIN; } ProcessOverlays(pPicture, pPicture->pts); @@ -933,10 +944,10 @@ int CVideoPlayerVideo::OutputPicture(const VideoPicture* pPicture) if (!m_renderManager.AddVideoPicture(*pPicture, m_bAbortOutput, deintMethod, (m_syncState == ESyncState::SYNC_STARTING))) { m_droppingStats.AddOutputDropGain(pPicture->pts, 1); - return EOS_DROPPED; + return OUTPUT_DROPPED; } - return result; + return OUTPUT_NORMAL; } std::string CVideoPlayerVideo::GetPlayerInfo() @@ -1075,8 +1086,8 @@ int CVideoPlayerVideo::CalcDropRequirement(double pts) double iDecoderPts, iRenderPts; int iSkippedPicture = -1; int iDroppedFrames = -1; - int iBufferLevel; - int queued, discard; + int iBufferLevel; + int queued, discard; m_droppingStats.m_lastPts = pts; @@ -1091,10 +1102,10 @@ int CVideoPlayerVideo::CalcDropRequirement(double pts) iBufferLevel = queued + discard; if (iBufferLevel < 0) - result |= EOS_BUFFER_LEVEL; + result |= DROP_BUFFER_LEVEL; else if (iBufferLevel < 2) { - result |= EOS_BUFFER_LEVEL; + result |= DROP_BUFFER_LEVEL; CLog::Log(LOGDEBUG, LOGVIDEO, "CVideoPlayerVideo::CalcDropRequirement - hurry: %d", iBufferLevel); } @@ -1107,7 +1118,7 @@ int CVideoPlayerVideo::CalcDropRequirement(double pts) gain.pts = iDecoderPts; m_droppingStats.m_gain.push_back(gain); m_droppingStats.m_totalGain += gain.frames; - result |= EOS_DROPPED; + result |= DROP_DROPPED; CLog::Log(LOGDEBUG, LOGVIDEO, "CVideoPlayerVideo::CalcDropRequirement - dropped pictures, lateframes: %d, Bufferlevel: %d, dropped: %d", lateframes, iBufferLevel, iSkippedPicture); } if (iDroppedFrames > 0) @@ -1117,7 +1128,7 @@ int CVideoPlayerVideo::CalcDropRequirement(double pts) gain.pts = iDecoderPts; m_droppingStats.m_gain.push_back(gain); m_droppingStats.m_totalGain += iDroppedFrames; - result |= EOS_DROPPED; + result |= DROP_DROPPED; CLog::Log(LOGDEBUG, LOGVIDEO, "CVideoPlayerVideo::CalcDropRequirement - dropped in decoder, lateframes: %d, Bufferlevel: %d, dropped: %d", lateframes, iBufferLevel, iDroppedFrames); } } @@ -1135,7 +1146,7 @@ int CVideoPlayerVideo::CalcDropRequirement(double pts) if (lateness > 0 && m_speed) { - result |= EOS_VERYLATE; + result |= DROP_VERYLATE; } return result; } diff --git a/xbmc/cores/VideoPlayer/VideoPlayerVideo.h b/xbmc/cores/VideoPlayer/VideoPlayerVideo.h index ae4cf0cc69a85..e0465c4d06602 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayerVideo.h +++ b/xbmc/cores/VideoPlayer/VideoPlayerVideo.h @@ -32,14 +32,11 @@ #include "utils/BitstreamStats.h" #include -class CDemuxStreamVideo; - -#define VIDEO_PICTURE_QUEUE_SIZE 1 +#define DROP_DROPPED 1 +#define DROP_VERYLATE 2 +#define DROP_BUFFER_LEVEL 4 -#define EOS_ABORT 1 -#define EOS_DROPPED 2 -#define EOS_VERYLATE 4 -#define EOS_BUFFER_LEVEL 8 +class CDemuxStreamVideo; class CDroppingStats { @@ -95,6 +92,14 @@ class CVideoPlayerVideo : public CThread, public IDVDStreamPlayerVideo protected: + enum EOutputState + { + OUTPUT_NORMAL, + OUTPUT_ABORT, + OUTPUT_DROPPED, + OUTPUT_AGAIN + }; + void OnExit() override; void Process() override; @@ -102,7 +107,7 @@ class CVideoPlayerVideo : public CThread, public IDVDStreamPlayerVideo void SendMessageBack(CDVDMsg* pMsg, int priority = 0); MsgQueueReturnCode GetMessage(CDVDMsg** pMsg, unsigned int iTimeoutInMilliSeconds, int &priority); - int OutputPicture(const VideoPicture* src); + EOutputState OutputPicture(const VideoPicture* src); void ProcessOverlays(const VideoPicture* pSource, double pts); void OpenStream(CDVDStreamInfo &hint, CDVDVideoCodec* codec); @@ -146,4 +151,6 @@ class CVideoPlayerVideo : public CThread, public IDVDStreamPlayerVideo CDroppingStats m_droppingStats; CRenderManager& m_renderManager; VideoPicture m_picture; + + EOutputState m_outputSate; }; From a9936cfd798f2ecac20755664f7dce3463bbb695 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sun, 3 Sep 2017 14:48:05 +0200 Subject: [PATCH 067/113] VideoPlayer: drop some old avhack --- xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp index 668cf84993c3c..e627335132f90 100644 --- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp +++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp @@ -1384,11 +1384,7 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) if (m_bAVI && pStream->codecpar->codec_id == AV_CODEC_ID_H264) st->bPTSInvalid = true; -#if defined(AVFORMAT_HAS_STREAM_GET_R_FRAME_RATE) AVRational r_frame_rate = av_stream_get_r_frame_rate(pStream); -#else - AVRational r_frame_rate = pStream->r_frame_rate; -#endif //average fps is more accurate for mkv files if (m_bMatroska && pStream->avg_frame_rate.den && pStream->avg_frame_rate.num) From 8d71c40fcb7bab40c8f534495f4de88059ff6141 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sun, 10 Sep 2017 12:05:34 +0200 Subject: [PATCH 068/113] VideoPlayer: drop deprecated side data splitting --- .../DVDCodecs/Audio/DVDAudioCodecPassthrough.cpp | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecPassthrough.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecPassthrough.cpp index 710e30f0dfdc3..4abb0aba86d11 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecPassthrough.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecPassthrough.cpp @@ -117,22 +117,6 @@ bool CDVDAudioCodecPassthrough::AddData(const DemuxPacket &packet) unsigned char *pData(const_cast(packet.pData)); int iSize(packet.iSize); - // get rid of potential side data - if (pData) - { - AVPacket pkt; - av_init_packet(&pkt); - pkt.data = pData; - pkt.size = iSize; - int didSplit = av_packet_split_side_data(&pkt); - if (didSplit) - { - pData = pkt.data; - iSize = pkt.size; - av_packet_free_side_data(&pkt); - } - } - if (pData) { if (m_currentPts == DVD_NOPTS_VALUE) From 32c28df05007b5b78ed74133a7a336f49ce620d7 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 7 Sep 2017 16:00:58 +0200 Subject: [PATCH 069/113] VideoPlayer: fix deprecated variable access in demuxer --- xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp index e627335132f90..25d2b9d9e43aa 100644 --- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp +++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp @@ -543,8 +543,8 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput, bool streaminfo, bool filein { int idx = m_pFormatContext->programs[i]->stream_index[j]; AVStream *st = m_pFormatContext->streams[idx]; - if ((st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->codec_info_nb_frames > 0) || - (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->codec->sample_rate > 0)) + if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st->codec_info_nb_frames > 0) || + (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->sample_rate > 0)) { nProgram = i; break; From 859fc8305e682304323d6a2d489c0e792b29f343 Mon Sep 17 00:00:00 2001 From: Rechi Date: Wed, 13 Sep 2017 15:02:57 +0200 Subject: [PATCH 070/113] [visualization][fix] last parameter of CVisualization::Start is song title --- xbmc/guilib/GUIVisualisationControl.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xbmc/guilib/GUIVisualisationControl.cpp b/xbmc/guilib/GUIVisualisationControl.cpp index 546def8e64a69..75063e8ae4ff7 100644 --- a/xbmc/guilib/GUIVisualisationControl.cpp +++ b/xbmc/guilib/GUIVisualisationControl.cpp @@ -177,8 +177,11 @@ void CGUIVisualisationControl::Process(unsigned int currentTime, CDirtyRegionLis m_alreadyStarted = false; } - std::string strFile = URIUtils::GetFileName(g_application.CurrentFile()); - m_alreadyStarted = m_instance->Start(m_channels, m_samplesPerSec, m_bitsPerSample, strFile); + std::string songTitle = URIUtils::GetFileName(g_application.CurrentFile()); + const MUSIC_INFO::CMusicInfoTag* tag = g_infoManager.GetCurrentSongTag(); + if (tag && !tag->GetTitle().empty()) + songTitle = tag->GetTitle(); + m_alreadyStarted = m_instance->Start(m_channels, m_samplesPerSec, m_bitsPerSample, songTitle); g_graphicsContext.ApplyStateBlock(); m_callStart = false; m_updateTrack = true; From 7a2b7ec0f2f463eb9394d9ee8b76004c1c48c9a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20B=C3=BChlmann?= Date: Wed, 13 Sep 2017 19:36:59 +0200 Subject: [PATCH 071/113] Add documention for OPTION_PROTOCOL values --- .../include/kodi/Filesystem.h | 21 ++++++++++++++++++- xbmc/filesystem/IFileTypes.h | 20 +++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h index b06770c25b0de..460831ff8026a 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h @@ -186,7 +186,7 @@ typedef enum CURLOptiontype { /// Set a general option ADDON_CURL_OPTION_OPTION, - /// Set a protocol option + /// Set a protocol option (see below) ADDON_CURL_OPTION_PROTOCOL, /// Set User and password ADDON_CURL_OPTION_CREDENTIALS, @@ -195,6 +195,25 @@ typedef enum CURLOptiontype } CURLOptiontype; //------------------------------------------------------------------------------ +/// +// The following names for ADDON_CURL_OPTION_PROTOCOL are possible: +// +// accept-charset: Set the "accept-charset" header +// acceptencoding or encoding: Set the "accept-encoding" header +// active-remote: Set the "active-remote" header +// auth: Set the authentication method. Possible values: any, anysafe, digest, ntlm +// connection-timeout: Set the connection timeout in seconds +// cookie: Set the "cookie" header +// customrequest: Set a custom HTTP request like DELETE +// noshout: Set to true if kodi detects a stream as shoutcast by mistake. +// postdata: Set the post body (value needs to be base64 encoded). (Implicitly sets the request to POST) +// referer: Set the "referer" header +// user-agent: Set the "user-agent" header +// seekable: Set the stream seekable. 1: enable, 0: disable +// sslcipherlist: Set list of accepted SSL ciphers. +// +/// + //============================================================================== /// \ingroup cpp_kodi_vfs_Defs /// @brief Used CURL message types diff --git a/xbmc/filesystem/IFileTypes.h b/xbmc/filesystem/IFileTypes.h index d5dd218dda0ea..8e8f12a2a3a36 100644 --- a/xbmc/filesystem/IFileTypes.h +++ b/xbmc/filesystem/IFileTypes.h @@ -78,11 +78,29 @@ typedef enum { enum CURLOPTIONTYPE { CURL_OPTION_OPTION, /**< Set a general option */ - CURL_OPTION_PROTOCOL, /**< Set a protocol option */ + CURL_OPTION_PROTOCOL, /**< Set a protocol option (see below) */ CURL_OPTION_CREDENTIALS,/**< Set User and password */ CURL_OPTION_HEADER /**< Add a Header */ }; +/** + * The following names for CURL_OPTION_PROTOCOL are possible: + * + * accept-charset: Set the "accept-charset" header + * acceptencoding or encoding: Set the "accept-encoding" header + * active-remote: Set the "active-remote" header + * auth: Set the authentication method. Possible values: any, anysafe, digest, ntlm + * connection-timeout: Set the connection timeout in seconds + * cookie: Set the "cookie" header + * customrequest: Set a custom HTTP request like DELETE + * noshout: Set to true if kodi detects a stream as shoutcast by mistake. + * postdata: Set the post body (value needs to be base64 encoded). (Implicitly sets the request to POST) + * referer: Set the "referer" header + * user-agent: Set the "user-agent" header + * seekable: Set the stream seekable. 1: enable, 0: disable + * sslcipherlist: Set list of accepted SSL ciphers. + */ + enum FileProperty { FILE_PROPERTY_RESPONSE_PROTOCOL, /**< Get response protocol line */ From 3463414d6db385dcd7bc0c06926a81901579dd82 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Wed, 13 Sep 2017 15:35:28 +0200 Subject: [PATCH 072/113] VideoPlayer: make OpenFile asynchron --- xbmc/Application.cpp | 8 +++++ xbmc/Application.h | 1 + xbmc/cores/IPlayerCallback.h | 1 + xbmc/cores/VideoPlayer/VideoPlayer.cpp | 41 ++++++-------------------- xbmc/cores/VideoPlayer/VideoPlayer.h | 2 +- xbmc/interfaces/legacy/Player.cpp | 11 +++++++ xbmc/interfaces/legacy/Player.h | 15 ++++++++++ xbmc/interfaces/python/XBPython.cpp | 12 ++++++++ xbmc/interfaces/python/XBPython.h | 1 + xbmc/settings/AdvancedSettings.cpp | 5 ---- xbmc/settings/AdvancedSettings.h | 1 - 11 files changed, 59 insertions(+), 39 deletions(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 33a52e49b0701..2ef16f48b1759 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -3618,6 +3618,14 @@ void CApplication::OnPlayBackStopped() g_windowManager.SendThreadMessage(msg); } +void CApplication::OnPlayBackError() +{ + //@todo Playlists can be continued by calling OnPlaybackEnded instead + // open error dialog + HELPERS::ShowOKDialogText(CVariant{16026}, CVariant{16027}); + OnPlayBackStopped(); +} + void CApplication::OnPlayBackPaused() { #ifdef HAS_PYTHON diff --git a/xbmc/Application.h b/xbmc/Application.h index f06062f73cd3a..104f7872ffad8 100644 --- a/xbmc/Application.h +++ b/xbmc/Application.h @@ -171,6 +171,7 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs void OnPlayBackPaused() override; void OnPlayBackResumed() override; void OnPlayBackStopped() override; + void OnPlayBackError() override; void OnQueueNextItem() override; void OnPlayBackSeek(int64_t iTime, int64_t seekOffset) override; void OnPlayBackSeekChapter(int iChapter) override; diff --git a/xbmc/cores/IPlayerCallback.h b/xbmc/cores/IPlayerCallback.h index 7f871422ef708..95bd98e2a2f21 100644 --- a/xbmc/cores/IPlayerCallback.h +++ b/xbmc/cores/IPlayerCallback.h @@ -29,6 +29,7 @@ class IPlayerCallback virtual void OnPlayBackPaused() {}; virtual void OnPlayBackResumed() {}; virtual void OnPlayBackStopped() = 0; + virtual void OnPlayBackError() = 0; virtual void OnQueueNextItem() = 0; virtual void OnPlayBackSeek(int64_t iTime, int64_t seekOffset) {}; virtual void OnPlayBackSeekChapter(int iChapter) {}; diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp index 62cff07a9261b..c2ab3d029a22a 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp @@ -72,7 +72,6 @@ #include "utils/StreamUtils.h" #include "utils/Variant.h" #include "storage/MediaManager.h" -#include "dialogs/GUIDialogBusy.h" #include "dialogs/GUIDialogKaiToast.h" #include "utils/StringUtils.h" #include "Util.h" @@ -675,6 +674,7 @@ CVideoPlayer::CVideoPlayer(IPlayerCallback& callback) CreatePlayers(); m_displayLost = false; + m_error = false; g_Windowing.Register(this); } @@ -690,27 +690,15 @@ bool CVideoPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options { CLog::Log(LOGNOTICE, "VideoPlayer::OpenFile: %s", CURL::GetRedacted(file.GetPath()).c_str()); - // if playing a file close it first - // this has to be changed so we won't have to close it. if (IsRunning()) { - m_openEvent.Reset(); CDVDMsgOpenFile::FileParams params; params.m_item = file; params.m_options = options; params.m_item.SetMimeTypeForInternetFile(); m_messenger.Put(new CDVDMsgOpenFile(params), 1); - if (!CGUIDialogBusy::WaitOnEvent(m_openEvent, 2000, true)) - { - if (!m_bStop && !m_bAbortRequest) - return true; - } - else - { - CLog::Log(LOGNOTICE, "CVideoPlayer::OpenFile: cancelled"); - } - CloseFile(); + return true; } m_playerOptions = options; @@ -719,19 +707,10 @@ bool CVideoPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options m_item.SetMimeTypeForInternetFile(); m_bAbortRequest = false; + m_error = false; m_renderManager.PreInit(); - m_openEvent.Reset(); Create(); - if (!CGUIDialogBusy::WaitOnEvent(m_openEvent, g_advancedSettings.m_videoBusyDialogDelay_ms, true)) - { - CLog::Log(LOGNOTICE, "CVideoPlayer::OpenFile: cancelled (2)"); - CloseFile(); - } - - // Playback might have been stopped due to some error - if (m_bStop || m_bAbortRequest) - return false; return true; } @@ -1250,6 +1229,7 @@ void CVideoPlayer::Prepare() if (!OpenInputStream()) { m_bAbortRequest = true; + m_error = true; return; } @@ -1270,6 +1250,7 @@ void CVideoPlayer::Prepare() if (!OpenDemuxStream()) { m_bAbortRequest = true; + m_error = true; return; } // give players a chance to reconsider now codecs are known @@ -1366,9 +1347,6 @@ void CVideoPlayer::Prepare() m_callback.OnPlayBackStarted(); - // we are done initializing now, set the readyevent - m_openEvent.Set(); - SetCaching(CACHESTATE_FLUSH); } @@ -2475,15 +2453,14 @@ void CVideoPlayer::OnExit() } m_bStop = true; - // if we didn't stop playing, advance to the next item in xbmc's playlist - if (m_bAbortRequest) + + if (m_error) + m_callback.OnPlayBackError(); + else if (m_bAbortRequest) m_callback.OnPlayBackStopped(); else m_callback.OnPlayBackEnded(); - // set event to inform openfile something went wrong in case openfile is still waiting for this event - m_openEvent.Set(); - CFFmpegLog::ClearLogLevel(); } diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.h b/xbmc/cores/VideoPlayer/VideoPlayer.h index 684a41997320b..7aba70e6a536b 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.h +++ b/xbmc/cores/VideoPlayer/VideoPlayer.h @@ -492,9 +492,9 @@ class CVideoPlayer : public IPlayer, public CThread, public IVideoPlayer, public bool m_players_created; CFileItem m_item; - CEvent m_openEvent; CPlayerOptions m_playerOptions; bool m_bAbortRequest; + bool m_error; ECacheState m_caching; XbmcThreads::EndTime m_cachingTimer; diff --git a/xbmc/interfaces/legacy/Player.cpp b/xbmc/interfaces/legacy/Player.cpp index a1952ca7e9dd3..c1931f2591e41 100644 --- a/xbmc/interfaces/legacy/Player.cpp +++ b/xbmc/interfaces/legacy/Player.cpp @@ -202,6 +202,12 @@ namespace XBMCAddon invokeCallback(new CallbackFunction(this,&Player::onPlayBackStopped)); } + void Player::OnPlayBackError() + { + XBMC_TRACE; + invokeCallback(new CallbackFunction(this,&Player::onPlayBackError)); + } + void Player::OnPlayBackPaused() { XBMC_TRACE; @@ -253,6 +259,11 @@ namespace XBMCAddon XBMC_TRACE; } + void Player::onPlayBackError() + { + XBMC_TRACE; + } + void Player::onPlayBackPaused() { XBMC_TRACE; diff --git a/xbmc/interfaces/legacy/Player.h b/xbmc/interfaces/legacy/Player.h index ad71ee7bb5de6..0aaf0bacd6278 100644 --- a/xbmc/interfaces/legacy/Player.h +++ b/xbmc/interfaces/legacy/Player.h @@ -254,6 +254,20 @@ namespace XBMCAddon virtual void onPlayBackStopped(); #endif +#ifdef DOXYGEN_SHOULD_USE_THIS + /// + /// \ingroup python_PlayerCB + /// @brief \python_func{ onPlayBackError() } + ///----------------------------------------------------------------------- + /// onPlayBackError method. + /// + /// Will be called when playback stops due to an error. + /// + onPlayBackError(); +#else + virtual void onPlayBackError(); +#endif + #ifdef DOXYGEN_SHOULD_USE_THIS /// /// \ingroup python_PlayerCB @@ -715,6 +729,7 @@ namespace XBMCAddon SWIGHIDDENVIRTUAL void OnPlayBackStarted() override; SWIGHIDDENVIRTUAL void OnPlayBackEnded() override; SWIGHIDDENVIRTUAL void OnPlayBackStopped() override; + SWIGHIDDENVIRTUAL void OnPlayBackError() override; SWIGHIDDENVIRTUAL void OnPlayBackPaused() override; SWIGHIDDENVIRTUAL void OnPlayBackResumed() override; SWIGHIDDENVIRTUAL void OnQueueNextItem() override; diff --git a/xbmc/interfaces/python/XBPython.cpp b/xbmc/interfaces/python/XBPython.cpp index a7cf6ec26205f..362e4fec129c7 100644 --- a/xbmc/interfaces/python/XBPython.cpp +++ b/xbmc/interfaces/python/XBPython.cpp @@ -179,6 +179,18 @@ void XBPython::OnPlayBackStopped() } } +// message all registered callbacks that playback stopped due to error +void XBPython::OnPlayBackError() +{ + XBMC_TRACE; + LOCK_AND_COPY(std::vector,tmp,m_vecPlayerCallbackList); + for (PlayerCallbackList::iterator it = tmp.begin(); (it != tmp.end()); ++it) + { + if (CHECK_FOR_ENTRY(m_vecPlayerCallbackList,(*it))) + ((IPlayerCallback*)(*it))->OnPlayBackError(); + } +} + // message all registered callbacks that playback speed changed (FF/RW) void XBPython::OnPlayBackSpeedChanged(int iSpeed) { diff --git a/xbmc/interfaces/python/XBPython.h b/xbmc/interfaces/python/XBPython.h index 85424dc0a5497..1426abd471790 100644 --- a/xbmc/interfaces/python/XBPython.h +++ b/xbmc/interfaces/python/XBPython.h @@ -73,6 +73,7 @@ class XBPython : void OnPlayBackPaused() override; void OnPlayBackResumed() override; void OnPlayBackStopped() override; + void OnPlayBackError() override; void OnPlayBackSpeedChanged(int iSpeed) override; void OnPlayBackSeek(int64_t iTime, int64_t seekOffset) override; void OnPlayBackSeekChapter(int iChapter) override; diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp index 1206f1838c99b..78ed283f271b4 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -161,7 +161,6 @@ void CAdvancedSettings::Initialize() m_DXVAForceProcessorRenderer = true; m_DXVAAllowHqScaling = true; m_videoFpsDetect = 1; - m_videoBusyDialogDelay_ms = 500; m_mediacodecForceSoftwareRendering = false; @@ -686,10 +685,6 @@ void CAdvancedSettings::ParseSettingsFile(const std::string &file) //0 = disable fps detect, 1 = only detect on timestamps with uniform spacing, 2 detect on all timestamps XMLUtils::GetInt(pElement, "fpsdetect", m_videoFpsDetect, 0, 2); - // controls the delay, in milliseconds, until - // the busy dialog is shown when starting video playback. - XMLUtils::GetInt(pElement, "busydialogdelayms", m_videoBusyDialogDelay_ms, 0, 1000); - // Store global display latency settings TiXmlElement* pVideoLatency = pElement->FirstChildElement("latency"); if (pVideoLatency) diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h index bf1c9b8c10b90..2f9910ff58c49 100644 --- a/xbmc/settings/AdvancedSettings.h +++ b/xbmc/settings/AdvancedSettings.h @@ -190,7 +190,6 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler bool m_DXVAForceProcessorRenderer; bool m_DXVAAllowHqScaling; int m_videoFpsDetect; - int m_videoBusyDialogDelay_ms; bool m_mediacodecForceSoftwareRendering; std::string m_videoDefaultPlayer; From 061b24eb27b1ae284144c1514f1fa214fff49578 Mon Sep 17 00:00:00 2001 From: Kolja Lampe Date: Wed, 13 Sep 2017 22:59:57 +0200 Subject: [PATCH 073/113] Make sure we don't overwrite path with an empty value. Fixes out of library bookmark deletion on "Set as watched" --- xbmc/video/jobs/VideoLibraryMarkWatchedJob.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xbmc/video/jobs/VideoLibraryMarkWatchedJob.cpp b/xbmc/video/jobs/VideoLibraryMarkWatchedJob.cpp index 88ad43af4e23f..218decec476fb 100644 --- a/xbmc/video/jobs/VideoLibraryMarkWatchedJob.cpp +++ b/xbmc/video/jobs/VideoLibraryMarkWatchedJob.cpp @@ -93,7 +93,7 @@ bool CVideoLibraryMarkWatchedJob::Work(CVideoDatabase &db) if (m_mark) { std::string path(item->GetPath()); - if (item->HasVideoInfoTag()) + if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->GetPath().empty()) path = item->GetVideoInfoTag()->GetPath(); db.ClearBookMarksOfFile(path, CBookmark::RESUME); From 7c0dca719032b7ebc07b4023b985ec1f10ac946d Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 14 Sep 2017 07:48:32 +0200 Subject: [PATCH 074/113] VideoPlayer: call OnPlaybackStopped before opening new file --- xbmc/cores/VideoPlayer/VideoPlayer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp index c2ab3d029a22a..4025fb6d42240 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp @@ -2482,6 +2482,7 @@ void CVideoPlayer::HandleMessages() SAFE_DELETE(m_pCCDemuxer); SAFE_DELETE(m_pInputStream); + m_callback.OnPlayBackStopped(); m_item = msg.GetItem(); m_playerOptions = msg.GetOptions(); Prepare(); From 6cb5c489d2c7e59b9bdd0ad5987616e1e88ec366 Mon Sep 17 00:00:00 2001 From: pkerling Date: Thu, 14 Sep 2017 10:21:59 +0300 Subject: [PATCH 075/113] Remove autotools files from gitignore (#12514) * Remove autotools files from gitignore * fixup depends * [gitignore] Update for new binary add-on types (#41) * fixup! Remove autotools files from gitignore (#42) --- .gitignore | 176 ++++++++--------------------------------------------- 1 file changed, 27 insertions(+), 149 deletions(-) diff --git a/.gitignore b/.gitignore index d7a41e9ffac88..8bb321edf0a8a 100644 --- a/.gitignore +++ b/.gitignore @@ -18,9 +18,6 @@ testMain .vscode/ # generated files etc -config.cache -config.status -config.log .last_success_revision *.d *.depend @@ -89,32 +86,11 @@ cmake_install.cmake /nbproject # / -/.dummy -/.dummy.in -/Makefile -/Makefile.include -/aclocal.m4 -/autom4te.cache/ -/build-aux/compile -/build-aux/config.guess -/build-aux/config.sub -/build-aux/install-sh -/build-aux/ltmain.sh -/build-aux/missing -/build-aux/ltmain.sh -/autotools -/BUILD/ - /kodi.log /kodi.old.log -/Makefile.depend -/config.status -/configure /kodi.bin /kodi-test /kodi-xrandr -/git_revision.h -/libtool /*.patch /kodi-build/ /gtestresults.xml @@ -133,9 +109,26 @@ cmake_install.cmake /addons/adsp.* /addons/peripheral.* /addons/game.* +/addons/kodi.binary.global.audioengine/addon.xml +/addons/kodi.binary.global.filesystem/addon.xml +/addons/kodi.binary.global.general/addon.xml +/addons/kodi.binary.global.gui/addon.xml +/addons/kodi.binary.global.main/addon.xml +/addons/kodi.binary.global.network/addon.xml +/addons/kodi.binary.instance.adsp/addon.xml +/addons/kodi.binary.instance.audiodecoder/addon.xml +/addons/kodi.binary.instance.audioencoder/addon.xml +/addons/kodi.binary.instance.game/addon.xml +/addons/kodi.binary.instance.imagedecoder/addon.xml +/addons/kodi.binary.instance.inputstream/addon.xml +/addons/kodi.binary.instance.peripheral/addon.xml +/addons/kodi.binary.instance.pvr/addon.xml +/addons/kodi.binary.instance.screensaver/addon.xml +/addons/kodi.binary.instance.vfs/addon.xml +/addons/kodi.binary.instance.videocodec/addon.xml +/addons/kodi.binary.instance.visualization/addon.xml /addons/xbmc.addon/addon.xml /addons/xbmc.json/addon.xml -/addons/kodi.guilib/addon.xml /addons/audiodecoder.* /addons/visualization.* /addons/screensaver.* @@ -157,6 +150,9 @@ cmake_install.cmake /lib/cpluff/config.h.in /lib/cpluff/config.h.in~ /lib/cpluff/configure +/lib/cpluff/config.cache +/lib/cpluff/config.log +/lib/cpluff/config.status /lib/cpluff/Makefile.in /lib/cpluff/*/Makefile.in /lib/cpluff/*/*/Makefile.in @@ -191,6 +187,9 @@ lib/cpluff/stamp-h1 /lib/gtest/build-aux/ltmain.sh /lib/gtest/build-aux/missing /lib/gtest/configure +/lib/gtest/config.cache +/lib/gtest/config.log +/lib/gtest/config.status /lib/gtest/m4/libtool.m4 /lib/gtest/m4/ltoptions.m4 /lib/gtest/m4/ltsugar.m4 @@ -308,6 +307,9 @@ lib/cpluff/stamp-h1 /tools/android/packaging/xbmc/strings.xml #/tools/depends +/tools/depends/**/config.cache +/tools/depends/**/config.log +/tools/depends/**/config.status /tools/depends/native/*/*native/ /tools/depends/target/*/aarch64-linux-gnu/ /tools/depends/native/JsonSchemaBuilder/bin/ @@ -359,7 +361,6 @@ lib/cpluff/stamp-h1 # /tools/TexturePacker /tools/TexturePacker/TexturePacker* /tools/TexturePacker/Makefile -/tools/TexturePacker/*.dll # /userdata/ /userdata/Database @@ -368,126 +369,6 @@ lib/cpluff/stamp-h1 /userdata/cache /userdata/guisettings.xml -# /xbmc/ -/xbmc/.GitRevision -/xbmc/config.h -/xbmc/config.h.in -/xbmc/config.h.in~ -/xbmc/CompileInfo.cpp -/xbmc/DllPaths_generated.h -/xbmc/DllPaths_generated_android.h -/xbmc/Makefile -/xbmc/stamp-h1 - -# /xbmc/addons/ -/xbmc/addons/Makefile -/xbmc/addons/interfaces/Makefile - -# /xbmc/platform/android -/xbmc/platform/android/Makefile -/xbmc/platform/android/activity/Makefile -/xbmc/platform/android/loader/Makefile -/xbmc/platform/android/jni/Makefile - -# /xbmc/cdrip/ -/xbmc/cdrip/Makefile - -# /xbmc/cores/ -/xbmc/cores/AudioEngine/Makefile -/xbmc/cores/DllLoader/exports/build_wrapper.sh -/xbmc/cores/DllLoader/exports/wrapper.def -/xbmc/cores/DllLoader/Makefile -/xbmc/cores/DllLoader/exports/Makefile -/xbmc/cores/VideoPlayer/Makefile -/xbmc/cores/VideoPlayer/DVDCodecs/Audio/Makefile -/xbmc/cores/VideoPlayer/DVDCodecs/Makefile -/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/Makefile -/xbmc/cores/VideoPlayer/DVDCodecs/Video/Makefile -/xbmc/cores/VideoPlayer/DVDDemuxers/Makefile -/xbmc/cores/VideoPlayer/DVDSubtitles/Makefile -/xbmc/cores/VideoPlayer/Process/Makefile -/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/Makefile -/xbmc/cores/omxplayer/Makefile -/xbmc/cores/paplayer/Makefile -/xbmc/cores/playercorefactory/Makefile -/xbmc/cores/Makefile -/xbmc/cores/VideoPlayer/VideoRenderers/Makefile -/xbmc/cores/RetroPlayer/Makefile - -# /xbmc/filesystem/ -/xbmc/filesystem/Makefile - -# /xbmc/freebsd/ -/xbmc/freebsd/Makefile - -# /xbmc/guilib/ -/xbmc/guilib/Makefile -/xbmc/guilib/*.obj -/xbmc/guilib/*.idb -/xbmc/guilib/*.pdb -/xbmc/guilib/*.bak -/xbmc/guilib/Debug (Win32) -/xbmc/guilib/Release (Win32) -/xbmc/guilib/Release -/xbmc/guilib/Release_LTCG -/xbmc/guilib/Debug -/xbmc/guilib/Profile -/xbmc/guilib/Profile_FastCap - -# /xbmc/input -/xbmc/input/linux/Makefile - -# /xbmc/interfaces/ -/xbmc/interfaces/Makefile -/xbmc/interfaces/builtins/Makefile -/xbmc/interfaces/json-rpc/ServiceDescription.h -/xbmc/interfaces/python/Makefile -/xbmc/interfaces/python/generated/ -/xbmc/interfaces/python/test/Makefile - -# /xbmc/linux/ -/xbmc/linux/Makefile -/xbmc/linux/sse4/Makefile - -# /xbmc/platform/posix -/xbmc/platform/posix/Makefile - -# /xbmc/platform -/xbmc/platform/Makefile - -# /xbmc/messaging/ -/xbmc/messaging/Makefile -/xbmc/messaging/helpers/Makefile - -# /xbmc/network/ -/xbmc/network/Makefile -/xbmc/network/httprequesthandler/python/Makefile -/xbmc/network/upnp/Makefile - -# /xbmc/platform/darwin/osx/ -/xbmc/platform/darwin/osx/Info.plist -/xbmc/platform/darwin/osx/Makefile - -# /xbmc/platform/darwin/ios/ -/xbmc/platform/darwin/osx/ios/IOS-Info.plist - -# /xbmc/peripherals/ -/xbmc/peripherals/addons/Makefile -/xbmc/peripherals/bus/Makefile -/xbmc/peripherals/devices/Makefile - -#/xbmc/utils -/xbmc/utils/Makefile - -#/xbmc/platform/win32/ -/xbmc/platform/win32/XBMC_PC.rc -# no longer used -/xbmc/platform/win32/git_rev.h - -# /xbmc/windowing/ -/xbmc/windowing/Makefile -/xbmc/windowing/egl/Makefile - #/lib/win32 /lib/win32/*.tar* /lib/win32/pax_global_header @@ -502,9 +383,6 @@ lib/cpluff/stamp-h1 # Doxygen generated files /docs/html -tools/depends/native/TexturePacker/src/Win32/Debug/ -tools/depends/native/TexturePacker/src/Win32/Release/ -tools/depends/native/TexturePacker/src/Win32/TexturePacker.VC.db exclude_dll.txt #certificates From e54cd63add0648595a73969f89e7dfda484afeb1 Mon Sep 17 00:00:00 2001 From: "h.udo" Date: Thu, 20 Jul 2017 22:13:13 +0100 Subject: [PATCH 076/113] [cmake] Exclude *.xml.include files from install/package generation --- cmake/scripts/common/AddonHelpers.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/scripts/common/AddonHelpers.cmake b/cmake/scripts/common/AddonHelpers.cmake index 13b1946288166..49fdc0d7b7852 100644 --- a/cmake/scripts/common/AddonHelpers.cmake +++ b/cmake/scripts/common/AddonHelpers.cmake @@ -230,7 +230,9 @@ macro (build_addon target prefix libs) set(CPACK_COMPONENTS_IGNORE_GROUPS 1) list(APPEND CPACK_COMPONENTS_ALL ${target}-${${prefix}_VERSION}) # Pack files together to create an archive - install(DIRECTORY ${target} DESTINATION ./ COMPONENT ${target}-${${prefix}_VERSION} PATTERN "*.xml.in" EXCLUDE) + install(DIRECTORY ${target} DESTINATION ./ + COMPONENT ${target}-${${prefix}_VERSION} + REGEX ".+\.xml\.in(clude)?$" EXCLUDE) if(WIN32) if(NOT CPACK_PACKAGE_DIRECTORY) # determine the temporary path @@ -323,7 +325,8 @@ macro (build_addon target prefix libs) if (${prefix}_CUSTOM_BINARY) install(FILES ${LIBRARY_LOCATION} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target} RENAME ${LIBRARY_FILENAME}) endif() - install(DIRECTORY ${target} DESTINATION ${CMAKE_INSTALL_DATADIR}/addons PATTERN "*.xml.in" EXCLUDE) + install(DIRECTORY ${target} DESTINATION ${CMAKE_INSTALL_DATADIR}/addons + REGEX ".+\.xml\.in(clude)?$" EXCLUDE) if(${prefix}_CUSTOM_DATA) install(DIRECTORY ${${prefix}_CUSTOM_DATA} DESTINATION ${CMAKE_INSTALL_DATADIR}/addons/${target}/resources) endif() From 06a6caedfacf94bbd131cb30e5650ede8ada0c1c Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 14 Sep 2017 16:33:11 +0200 Subject: [PATCH 077/113] VideoPlayer: fix OnPlayBack... callbacks --- xbmc/cores/VideoPlayer/VideoPlayer.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp index 4025fb6d42240..460ce1ed30520 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp @@ -701,6 +701,8 @@ bool CVideoPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options return true; } + m_callback.OnPlayBackStarted(); + m_playerOptions = options; m_item = file; // Try to resolve the correct mime type @@ -1345,8 +1347,6 @@ void CVideoPlayer::Prepare() UpdatePlayState(0); - m_callback.OnPlayBackStarted(); - SetCaching(CACHESTATE_FLUSH); } @@ -2475,6 +2475,10 @@ void CVideoPlayer::HandleMessages() { CDVDMsgOpenFile &msg(*static_cast(pMsg)); + CJobManager::GetInstance().Submit([this]() { + m_callback.OnPlayBackStarted(); + }, CJob::PRIORITY_NORMAL); + FlushBuffers(DVD_NOPTS_VALUE, true, true); m_renderManager.Flush(false); CloseDemuxer(); @@ -2482,7 +2486,6 @@ void CVideoPlayer::HandleMessages() SAFE_DELETE(m_pCCDemuxer); SAFE_DELETE(m_pInputStream); - m_callback.OnPlayBackStopped(); m_item = msg.GetItem(); m_playerOptions = msg.GetOptions(); Prepare(); From cc59c9daed45e3a514d380f18d2cc26151185783 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 14 Sep 2017 16:43:42 +0200 Subject: [PATCH 078/113] drop some dirty playstate hacks --- xbmc/Application.cpp | 74 +++++--------------------------------------- xbmc/Application.h | 13 -------- 2 files changed, 8 insertions(+), 79 deletions(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 2ef16f48b1759..5a2612ac2afe4 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -250,8 +250,6 @@ CApplication::CApplication(void) , m_Autorun(new CAutorun()) #endif , m_iScreenSaveLock(0) - , m_bPlaybackStarting(false) - , m_ePlayState(PLAY_STATE_NONE) , m_confirmSkinChange(true) , m_ignoreSkinSettingChanges(false) , m_saveSkinOnUnloading(true) @@ -3377,10 +3375,6 @@ PlayBackRet CApplication::PlayFile(CFileItem item, const std::string& player, bo CMediaSettings::GetInstance().SetVideoStartWindowed(false); { - CSingleLock lock(m_playStateMutex); - // tell system we are starting a file - m_bPlaybackStarting = true; - // for playing a new item, previous playing item's callback may already // pushed some delay message into the threadmessage list, they are not // expected be processed after or during the new item playback starting. @@ -3413,10 +3407,6 @@ PlayBackRet CApplication::PlayFile(CFileItem item, const std::string& player, bo // one of the players that allows gapless playback (paplayer, VideoPlayer) m_pPlayer->ClosePlayerGapless(newPlayer); - // now reset play state to starting, since we already stopped the previous playing item if there is. - // and from now there should be no playback callback from previous playing item be called. - m_ePlayState = PLAY_STATE_STARTING; - m_pPlayer->CreatePlayer(newPlayer, *this); PlayBackRet iResult; @@ -3477,48 +3467,14 @@ PlayBackRet CApplication::PlayFile(CFileItem item, const std::string& player, bo CServiceBroker::GetPlaylistPlayer().SetCurrentPlaylist(PLAYLIST_NONE); } - CSingleLock lock(m_playStateMutex); - m_bPlaybackStarting = false; - - if (iResult == PLAYBACK_OK) - { - // play state: none, starting; playing; stopped; ended. - // last 3 states are set by playback callback, they are all ignored during starting, - // but we recorded the state, here we can make up the callback for the state. - CLog::LogF(LOGDEBUG,"OpenFile succeed, play state %d", m_ePlayState); - switch (m_ePlayState) - { - case PLAY_STATE_PLAYING: - OnPlayBackStarted(); - break; - // FIXME: it seems no meaning to callback started here if there was an started callback - // before this stopped/ended callback we recorded. if we callback started here - // first, it will delay send OnPlay announce, but then we callback stopped/ended - // which will send OnStop announce at once, so currently, just call stopped/ended. - case PLAY_STATE_ENDED: - OnPlayBackEnded(); - break; - case PLAY_STATE_STOPPED: - OnPlayBackStopped(); - break; - case PLAY_STATE_STARTING: - // neither started nor stopped/ended callback be called, that means the item still - // not started, we need not make up any callback, just leave this and - // let the player callback do its work. - break; - default: - break; - } - } - else if (iResult == PLAYBACK_FAIL) + //@todo check PAPlayer and remove this block, Callbacks must not be called by CApplication itself + if (iResult == PLAYBACK_FAIL) { // we send this if it isn't playlistplayer that is doing this int next = CServiceBroker::GetPlaylistPlayer().GetNextSong(); int size = CServiceBroker::GetPlaylistPlayer().GetPlaylist(CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist()).size(); - if(next < 0 - || next >= size) + if (next < 0 || next >= size) OnPlayBackStopped(); - m_ePlayState = PLAY_STATE_NONE; } return iResult; @@ -3526,11 +3482,7 @@ PlayBackRet CApplication::PlayFile(CFileItem item, const std::string& player, bo void CApplication::OnPlayBackEnded() { - CSingleLock lock(m_playStateMutex); - CLog::LogF(LOGDEBUG,"play state was %d, starting %d", m_ePlayState, m_bPlaybackStarting); - m_ePlayState = PLAY_STATE_ENDED; - if(m_bPlaybackStarting) - return; + CLog::LogF(LOGDEBUG ,"CApplication::OnPlayBackEnded"); // informs python script currently running playback has ended // (does nothing if python is not loaded) @@ -3553,11 +3505,7 @@ void CApplication::OnPlayBackEnded() void CApplication::OnPlayBackStarted() { - CSingleLock lock(m_playStateMutex); - CLog::LogF(LOGDEBUG,"play state was %d, starting %d", m_ePlayState, m_bPlaybackStarting); - m_ePlayState = PLAY_STATE_PLAYING; - if(m_bPlaybackStarting) - return; + CLog::LogF(LOGDEBUG,"CApplication::OnPlayBackStarted"); #ifdef HAS_PYTHON // informs python script currently running playback has started @@ -3577,10 +3525,8 @@ void CApplication::OnPlayBackStarted() void CApplication::OnQueueNextItem() { - CSingleLock lock(m_playStateMutex); - CLog::LogF(LOGDEBUG,"play state was %d, starting %d", m_ePlayState, m_bPlaybackStarting); - if(m_bPlaybackStarting) - return; + CLog::LogF(LOGDEBUG,"CApplication::OnQueueNextItem"); + // informs python script currently running that we are requesting the next track // (does nothing if python is not loaded) #ifdef HAS_PYTHON @@ -3593,11 +3539,7 @@ void CApplication::OnQueueNextItem() void CApplication::OnPlayBackStopped() { - CSingleLock lock(m_playStateMutex); - CLog::LogF(LOGDEBUG, "play state was %d, starting %d", m_ePlayState, m_bPlaybackStarting); - m_ePlayState = PLAY_STATE_STOPPED; - if(m_bPlaybackStarting) - return; + CLog::LogF(LOGDEBUG, "CApplication::OnPlayBackStopped"); // informs python script currently running playback has ended // (does nothing if python is not loaded) diff --git a/xbmc/Application.h b/xbmc/Application.h index 104f7872ffad8..736df66a5d4d9 100644 --- a/xbmc/Application.h +++ b/xbmc/Application.h @@ -191,7 +191,6 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs void DelayedPlayerRestart(); void CheckDelayedPlayerRestart(); bool IsPlayingFullScreenVideo() const; - bool IsStartingPlayback() const { return m_bPlaybackStarting; } bool IsFullScreen(); bool OnAppCommand(const CAction &action); bool OnAction(const CAction &action); @@ -309,18 +308,6 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs inline bool IsDPMSActive() { return m_dpmsIsActive; }; int m_iScreenSaveLock; // spiff: are we checking for a lock? if so, ignore the screensaver state, if -1 we have failed to input locks - bool m_bPlaybackStarting; - typedef enum - { - PLAY_STATE_NONE = 0, - PLAY_STATE_STARTING, - PLAY_STATE_PLAYING, - PLAY_STATE_STOPPED, - PLAY_STATE_ENDED, - } PlayState; - PlayState m_ePlayState; - CCriticalSection m_playStateMutex; - std::string m_strPlayListFile; int GlobalIdleTime(); From dcd1f69bb95603daa47399dc7b704f13ebb8022f Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Fri, 8 Sep 2017 12:03:43 -0700 Subject: [PATCH 079/113] YUV2RGBShader: split into GL and GLES files --- system/shaders/yuv2rgb_basic.glsl | 26 +- system/shaders/yuv2rgb_basic_gles.glsl | 50 ---- .../VideoRenderers/LinuxRendererGL.cpp | 2 +- .../VideoRenderers/LinuxRendererGLES.cpp | 6 +- .../VideoShaders/CMakeLists.txt | 34 +-- .../VideoShaders/WinVideoFilter.cpp | 2 +- ...{YUV2RGBShader.cpp => YUV2RGBShaderGL.cpp} | 191 +------------- .../{YUV2RGBShader.h => YUV2RGBShaderGL.h} | 37 +-- .../VideoShaders/YUV2RGBShaderGLES.cpp | 238 ++++++++++++++++++ .../VideoShaders/YUV2RGBShaderGLES.h | 160 ++++++++++++ .../VideoRenderers/VideoShaders/YUVMatrix.cpp | 158 ++++++++++++ .../VideoRenderers/VideoShaders/YUVMatrix.h | 30 +++ 12 files changed, 635 insertions(+), 299 deletions(-) delete mode 100644 system/shaders/yuv2rgb_basic_gles.glsl rename xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/{YUV2RGBShader.cpp => YUV2RGBShaderGL.cpp} (60%) rename xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/{YUV2RGBShader.h => YUV2RGBShaderGL.h} (81%) create mode 100644 xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShaderGLES.cpp create mode 100644 xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShaderGLES.h create mode 100644 xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUVMatrix.cpp create mode 100644 xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUVMatrix.h diff --git a/system/shaders/yuv2rgb_basic.glsl b/system/shaders/yuv2rgb_basic.glsl index 59cac3eaa8b55..7141ffe68d935 100644 --- a/system/shaders/yuv2rgb_basic.glsl +++ b/system/shaders/yuv2rgb_basic.glsl @@ -24,19 +24,24 @@ # define sampler2D sampler2DRect #endif +#ifdef GL_ES + precision mediump float; +#endif + uniform sampler2D m_sampY; uniform sampler2D m_sampU; uniform sampler2D m_sampV; varying vec2 m_cordY; varying vec2 m_cordU; varying vec2 m_cordV; - uniform vec2 m_step; - uniform mat4 m_yuvmat; - uniform float m_stretch; +#ifdef GL_ES + uniform float m_alpha; +#endif + vec2 stretch(vec2 pos) { #if (XBMC_STRETCH) @@ -67,7 +72,12 @@ vec4 process() , 1.0 ); rgb = m_yuvmat * yuv; + +#ifdef GL_ES + rgb.a = m_alpha; +#else rgb.a = gl_Color.a; +#endif #elif defined(XBMC_NV12_RRG) @@ -78,7 +88,12 @@ vec4 process() , 1.0 ); rgb = m_yuvmat * yuv; + +#ifdef GL_ES + rgb.a = m_alpha; +#else rgb.a = gl_Color.a; +#endif #elif defined(XBMC_YUY2) || defined(XBMC_UYVY) @@ -117,7 +132,12 @@ vec4 process() vec4 yuv = vec4(outY, outUV, 1.0); rgb = m_yuvmat * yuv; +#ifdef GL_ES + rgb.a = m_alpha; +#else rgb.a = gl_Color.a; +#endif + #endif return rgb; diff --git a/system/shaders/yuv2rgb_basic_gles.glsl b/system/shaders/yuv2rgb_basic_gles.glsl deleted file mode 100644 index 82fa003b533ad..0000000000000 --- a/system/shaders/yuv2rgb_basic_gles.glsl +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2010-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, 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 - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -precision mediump float; -uniform sampler2D m_sampY; -uniform sampler2D m_sampU; -uniform sampler2D m_sampV; -varying vec2 m_cordY; -varying vec2 m_cordU; -varying vec2 m_cordV; -uniform float m_alpha; -uniform mat4 m_yuvmat; - -// handles both YV12 and NV12 formats -void main() -{ - vec4 yuv, rgb; -#if defined(XBMC_NV12_RRG) - yuv.rgba = vec4( texture2D(m_sampY, m_cordY).r - , texture2D(m_sampU, m_cordU).r - , texture2D(m_sampV, m_cordV).g - , 1.0); -#else - yuv.rgba = vec4( texture2D(m_sampY, m_cordY).r - , texture2D(m_sampU, m_cordU).g - , texture2D(m_sampV, m_cordV).a - , 1.0); -#endif - - rgb = m_yuvmat * yuv; - rgb.a = m_alpha; - gl_FragColor = rgb; -} diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp index ac2f1db709c9b..f2fdff50ce7fc 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp @@ -32,7 +32,7 @@ #include "settings/DisplaySettings.h" #include "settings/MediaSettings.h" #include "settings/Settings.h" -#include "VideoShaders/YUV2RGBShader.h" +#include "VideoShaders/YUV2RGBShaderGL.h" #include "VideoShaders/VideoFilterShaderGL.h" #include "windowing/WindowingFactory.h" #include "guilib/Texture.h" diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp index 38946dd6b1d30..f25883ad7b73c 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp @@ -36,7 +36,7 @@ #include "settings/DisplaySettings.h" #include "settings/MediaSettings.h" #include "settings/Settings.h" -#include "VideoShaders/YUV2RGBShader.h" +#include "VideoShaders/YUV2RGBShaderGLES.h" #include "VideoShaders/VideoFilterShaderGLES.h" #include "windowing/WindowingFactory.h" #include "guilib/Texture.h" @@ -541,8 +541,8 @@ void CLinuxRendererGLES::LoadShaders(int field) CLog::Log(LOGNOTICE, "GL: Selecting Single Pass YUV 2 RGB shader"); EShaderFormat shaderFormat = GetShaderFormat(); - m_pYUVProgShader = new YUV2RGBProgressiveShader(false, m_iFlags, shaderFormat); - m_pYUVBobShader = new YUV2RGBBobShader(false, m_iFlags, shaderFormat); + m_pYUVProgShader = new YUV2RGBProgressiveShader(m_iFlags, shaderFormat); + m_pYUVBobShader = new YUV2RGBBobShader(m_iFlags, shaderFormat); if ((m_pYUVProgShader && m_pYUVProgShader->CompileAndLink()) && (m_pYUVBobShader && m_pYUVBobShader->CompileAndLink())) { diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt index d39a5594b7b1c..3f02baf11243a 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/CMakeLists.txt @@ -1,23 +1,23 @@ -set(SOURCES ConvolutionKernels.cpp) +set(SOURCES ConvolutionKernels.cpp + YUVMatrix.cpp) set(HEADERS ConvolutionKernels.h + YUVMatrix.h dither.h ShaderFormats.h) if(CORE_SYSTEM_NAME STREQUAL windows) - list(APPEND SOURCES WinVideoFilter.cpp - YUV2RGBShader.cpp) - list(APPEND HEADERS WinVideoFilter.h - YUV2RGBShader.h) + list(APPEND SOURCES WinVideoFilter.cpp) + list(APPEND HEADERS WinVideoFilter.h) endif() if(OPENGL_FOUND) - list(APPEND SOURCES VideoFilterShaderGL.cpp - GLSLOutput.cpp - YUV2RGBShader.cpp) - list(APPEND HEADERS VideoFilterShaderGL.h - GLSLOutput.h - YUV2RGBShader.h) + list(APPEND SOURCES GLSLOutput.cpp + VideoFilterShaderGL.cpp + YUV2RGBShaderGL.cpp) + list(APPEND HEADERS GLSLOutput.h + VideoFilterShaderGL.h + YUV2RGBShaderGL.h) endif() if(OPENGLES_FOUND AND (CORE_PLATFORM_NAME_LC STREQUAL android OR @@ -26,12 +26,12 @@ if(OPENGLES_FOUND AND (CORE_PLATFORM_NAME_LC STREQUAL android OR CORE_PLATFORM_NAME_LC STREQUAL imx OR CORE_PLATFORM_NAME_LC STREQUAL mir OR CORE_PLATFORM_NAME_LC STREQUAL wayland)) - list(APPEND SOURCES VideoFilterShaderGLES.cpp - GLSLOutput.cpp - YUV2RGBShader.cpp) - list(APPEND HEADERS VideoFilterShaderGLES.h - GLSLOutput.h - YUV2RGBShader.h) + list(APPEND SOURCES GLSLOutput.cpp + VideoFilterShaderGLES.cpp + YUV2RGBShaderGLES.cpp) + list(APPEND HEADERS GLSLOutput.h + VideoFilterShaderGLES.h + YUV2RGBShaderGLES.h) endif() core_add_library(videoshaders) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/WinVideoFilter.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/WinVideoFilter.cpp index ce79623b62518..3eaa59ac1149e 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/WinVideoFilter.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/WinVideoFilter.cpp @@ -28,7 +28,7 @@ #include "VideoRenderers/WinRenderBuffer.h" #include "windowing/WindowingFactory.h" #include "WinVideoFilter.h" -#include "YUV2RGBShader.h" +#include "YUVMatrix.h" #include #include diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShader.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShaderGL.cpp similarity index 60% rename from xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShader.cpp rename to xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShaderGL.cpp index 70a7a329b7967..5549ff313ff97 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShader.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShaderGL.cpp @@ -21,153 +21,16 @@ #include "system.h" #include "../RenderFlags.h" -#include "YUV2RGBShader.h" +#include "YUV2RGBShaderGL.h" +#include "YUVMatrix.h" #include "settings/AdvancedSettings.h" #include "guilib/TransformMatrix.h" #include "utils/log.h" -#if defined(HAS_GL) || defined(HAS_GLES) #include "utils/GLUtils.h" -#endif #include #include -// http://www.martinreddy.net/gfx/faqs/colorconv.faq - -// -// Transformation matrixes for different colorspaces. -// -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 } -}; - -static float yuv_coef_bt709[4][4] = -{ - { 1.0f, 1.0f, 1.0f, 0.0f }, - { 0.0f, -0.1870f, 1.8556f, 0.0f }, - { 1.5701f, -0.4664f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f, 0.0f } -}; - -static float yuv_coef_bt2020[4][4] = -{ - { 1.0f, 1.0f, 1.0f, 0.0f }, - { 0.0f, -0.1645f, 1.8814f, 0.0f }, - { 1.4745f, -0.5713f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f, 0.0f } -}; - -static float yuv_coef_ebu[4][4] = -{ - { 1.0f, 1.0f, 1.0f, 0.0f }, - { 0.0f, -0.3960f, 2.029f, 0.0f }, - { 1.140f, -0.581f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f, 0.0f } -}; - -static float yuv_coef_smtp240m[4][4] = -{ - { 1.0f, 1.0f, 1.0f, 0.0f }, - { 0.0f, -0.2253f, 1.8270f, 0.0f }, - { 1.5756f, -0.5000f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f, 0.0f } -}; - -static float** PickYUVConversionMatrix(unsigned flags) -{ - // Pick the matrix. - - switch(CONF_FLAGS_YUVCOEF_MASK(flags)) - { - case CONF_FLAGS_YUVCOEF_240M: - return reinterpret_cast(yuv_coef_smtp240m); - case CONF_FLAGS_YUVCOEF_BT2020: - return reinterpret_cast(yuv_coef_bt2020); - case CONF_FLAGS_YUVCOEF_BT709: - return reinterpret_cast(yuv_coef_bt709); - case CONF_FLAGS_YUVCOEF_BT601: - return reinterpret_cast(yuv_coef_bt601); - case CONF_FLAGS_YUVCOEF_EBU: - return reinterpret_cast(yuv_coef_ebu); - } - - return reinterpret_cast(yuv_coef_bt601); -} - -void CalculateYUVMatrix(TransformMatrix &matrix - , unsigned int flags - , EShaderFormat format - , float black - , float contrast - , bool limited) -{ - TransformMatrix coef; - - matrix *= TransformMatrix::CreateScaler(contrast, contrast, contrast); - matrix *= TransformMatrix::CreateTranslation(black, black, black); - - float (*conv)[4] = (float (*)[4])PickYUVConversionMatrix(flags); - for(int row = 0; row < 3; row++) - for(int col = 0; col < 4; col++) - coef.m[row][col] = conv[col][row]; - coef.identity = false; - - if (limited) - { - matrix *= TransformMatrix::CreateTranslation(+ 16.0f / 255 - , + 16.0f / 255 - , + 16.0f / 255); - matrix *= TransformMatrix::CreateScaler((235 - 16) / 255.0f - , (235 - 16) / 255.0f - , (235 - 16) / 255.0f); - } - - matrix *= coef; - matrix *= TransformMatrix::CreateTranslation(0.0, -0.5, -0.5); - - if (!(flags & CONF_FLAGS_YUV_FULLRANGE)) - { - matrix *= TransformMatrix::CreateScaler(255.0f / (235 - 16) - , 255.0f / (240 - 16) - , 255.0f / (240 - 16)); - matrix *= TransformMatrix::CreateTranslation(- 16.0f / 255 - , - 16.0f / 255 - , - 16.0f / 255); - } - - int effectiveBpp; - switch (format) - { - case SHADER_YV12_9: - effectiveBpp = 9; - break; - case SHADER_YV12_10: - effectiveBpp = 10; - break; - case SHADER_YV12_12: - effectiveBpp = 12; - break; - case SHADER_YV12_14: - effectiveBpp = 14; - break; - default: - effectiveBpp = 0; - } - - if (effectiveBpp > 8 && effectiveBpp < 16) - { - // Convert range to 2 bytes - float scale = 65535.0f / ((1 << effectiveBpp) - 1); - matrix *= TransformMatrix::CreateScaler(scale, scale, scale); - } -} - -#if defined(HAS_GL) || HAS_GLES >= 2 - using namespace Shaders; static void CalculateYUVMatrixGL(GLfloat res[4][4] @@ -221,7 +84,6 @@ BaseYUV2RGBGLSLShader::BaseYUV2RGBGLSLShader(bool rect, unsigned flags, EShaderF m_defines += m_glslOutput->GetDefines(); } -#ifdef HAS_GL if(rect) m_defines += "#define XBMC_texture_rectangle 1\n"; else @@ -259,27 +121,6 @@ BaseYUV2RGBGLSLShader::BaseYUV2RGBGLSLShader(bool rect, unsigned flags, EShaderF CLog::Log(LOGERROR, "GL: BaseYUV2RGBGLSLShader - unsupported format %d", m_format); VertexShader()->LoadSource("yuv2rgb_vertex.glsl", m_defines); -#elif HAS_GLES >= 2 - m_hVertex = -1; - m_hYcoord = -1; - m_hUcoord = -1; - m_hVcoord = -1; - m_hProj = -1; - m_hModel = -1; - m_hAlpha = -1; - if (m_format == SHADER_YV12) - m_defines += "#define XBMC_YV12\n"; - else if (m_format == SHADER_NV12) - m_defines += "#define XBMC_NV12\n"; - else if (m_format == SHADER_NV12_RRG) - m_defines += "#define XBMC_NV12_RRG\n"; - else if (m_format == SHADER_YV12) - m_defines += "#define XBMC_YV12\n"; - else - CLog::Log(LOGERROR, "GL: BaseYUV2RGBGLSLShader - unsupported format %d", m_format); - - VertexShader()->LoadSource("yuv2rgb_vertex_gles.glsl", m_defines); -#endif CLog::Log(LOGDEBUG, "GL: BaseYUV2RGBGLSLShader: defines:\n%s", m_defines.c_str()); } @@ -291,15 +132,6 @@ BaseYUV2RGBGLSLShader::~BaseYUV2RGBGLSLShader() void BaseYUV2RGBGLSLShader::OnCompiledAndLinked() { -#if HAS_GLES >= 2 - m_hVertex = glGetAttribLocation(ProgramHandle(), "m_attrpos"); - m_hYcoord = glGetAttribLocation(ProgramHandle(), "m_attrcordY"); - m_hUcoord = glGetAttribLocation(ProgramHandle(), "m_attrcordU"); - m_hVcoord = glGetAttribLocation(ProgramHandle(), "m_attrcordV"); - m_hProj = glGetUniformLocation(ProgramHandle(), "m_proj"); - m_hModel = glGetUniformLocation(ProgramHandle(), "m_model"); - m_hAlpha = glGetUniformLocation(ProgramHandle(), "m_alpha"); -#endif m_hYTex = glGetUniformLocation(ProgramHandle(), "m_sampY"); m_hUTex = glGetUniformLocation(ProgramHandle(), "m_sampU"); m_hVTex = glGetUniformLocation(ProgramHandle(), "m_sampV"); @@ -325,11 +157,7 @@ bool BaseYUV2RGBGLSLShader::OnEnabled() CalculateYUVMatrixGL(matrix, m_flags, m_format, m_black, m_contrast, !m_convertFullRange); glUniformMatrix4fv(m_hMatrix, 1, GL_FALSE, (GLfloat*)matrix); -#if HAS_GLES >= 2 - glUniformMatrix4fv(m_hProj, 1, GL_FALSE, m_proj); - glUniformMatrix4fv(m_hModel, 1, GL_FALSE, m_model); - glUniform1f(m_hAlpha, m_alpha); -#endif + VerifyGLState(); if (m_glslOutput) m_glslOutput->OnEnabled(); return true; @@ -347,7 +175,6 @@ void BaseYUV2RGBGLSLShader::Free() ////////////////////////////////////////////////////////////////////// // BaseYUV2RGBGLSLShader - base class for GLSL YUV2RGB shaders ////////////////////////////////////////////////////////////////////// -#if defined(HAS_GL) // No ARB Shader when using GLES2.0 BaseYUV2RGBARBShader::BaseYUV2RGBARBShader(unsigned flags, EShaderFormat format) { m_width = 1; @@ -361,7 +188,6 @@ BaseYUV2RGBARBShader::BaseYUV2RGBARBShader(unsigned flags, EShaderFormat format) m_hUTex = -1; m_hVTex = -1; } -#endif ////////////////////////////////////////////////////////////////////// // YUV2RGBProgressiveShader - YUV2RGB with no deinterlacing @@ -372,12 +198,8 @@ YUV2RGBProgressiveShader::YUV2RGBProgressiveShader(bool rect, unsigned flags, ES GLSLOutput *output) : BaseYUV2RGBGLSLShader(rect, flags, format, stretch, output) { -#ifdef HAS_GL PixelShader()->LoadSource("yuv2rgb_basic.glsl", m_defines); PixelShader()->AppendSource("output.glsl"); -#elif HAS_GLES >= 2 - PixelShader()->LoadSource("yuv2rgb_basic_gles.glsl", m_defines); -#endif } @@ -391,11 +213,7 @@ YUV2RGBBobShader::YUV2RGBBobShader(bool rect, unsigned flags, EShaderFormat form m_hStepX = -1; m_hStepY = -1; m_hField = -1; -#ifdef HAS_GL PixelShader()->LoadSource("yuv2rgb_bob.glsl", m_defines); -#elif HAS_GLES >= 2 - PixelShader()->LoadSource("yuv2rgb_bob_gles.glsl", m_defines); -#endif } void YUV2RGBBobShader::OnCompiledAndLinked() @@ -422,7 +240,6 @@ bool YUV2RGBBobShader::OnEnabled() ////////////////////////////////////////////////////////////////////// // YUV2RGBProgressiveShaderARB - YUV2RGB with no deinterlacing ////////////////////////////////////////////////////////////////////// -#if defined(HAS_GL) // No ARB Shader when using GLES2.0 YUV2RGBProgressiveShaderARB::YUV2RGBProgressiveShaderARB(bool rect, unsigned flags, EShaderFormat format) : BaseYUV2RGBARBShader(flags, format) { @@ -479,5 +296,3 @@ bool YUV2RGBProgressiveShaderARB::OnEnabled() m_width, m_height); return true; } -#endif -#endif // HAS_GL diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShader.h b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShaderGL.h similarity index 81% rename from xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShader.h rename to xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShaderGL.h index 4e0b4817eaaa2..e8220f2c0581a 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShader.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShaderGL.h @@ -29,8 +29,6 @@ void CalculateYUVMatrix(TransformMatrix &matrix , float contrast , bool limited); -#if defined(HAS_GL) || HAS_GLES >= 2 - #include "GLSLOutput.h" #ifndef __GNUC__ @@ -54,15 +52,7 @@ namespace Shaders { virtual void SetBlack(float black) {}; virtual void SetContrast(float contrast) {}; virtual void SetNonLinStretch(float stretch) {}; -#if HAS_GLES >= 2 - virtual GLint GetVertexLoc() { return 0; }; - virtual GLint GetYcoordLoc() { return 0; }; - virtual GLint GetUcoordLoc() { return 0; }; - virtual GLint GetVcoordLoc() { return 0; }; - - virtual void SetMatrices(GLfloat *p, GLfloat *m) {}; - virtual void SetAlpha(GLfloat alpha) {}; -#endif + void SetConvertFullColorRange(bool convertFullRange) { m_convertFullRange = convertFullRange; } protected: @@ -84,15 +74,6 @@ namespace Shaders { void SetBlack(float black) override { m_black = black; } void SetContrast(float contrast) override { m_contrast = contrast; } void SetNonLinStretch(float stretch) override { m_stretch = stretch; } -#if HAS_GLES >= 2 - GLint GetVertexLoc() override { return m_hVertex; } - GLint GetYcoordLoc() override { return m_hYcoord; } - GLint GetUcoordLoc() override { return m_hUcoord; } - GLint GetVcoordLoc() override { return m_hVcoord; } - - void SetMatrices(GLfloat *p, GLfloat *m) override { m_proj = p; m_model = m; } - void SetAlpha(GLfloat alpha) override { m_alpha = alpha; } -#endif protected: void OnCompiledAndLinked() override; @@ -121,22 +102,8 @@ namespace Shaders { GLint m_hMatrix; GLint m_hStretch; GLint m_hStep; -#if HAS_GLES >= 2 - GLint m_hVertex; - GLint m_hYcoord; - GLint m_hUcoord; - GLint m_hVcoord; - GLint m_hProj; - GLint m_hModel; - GLint m_hAlpha; - - GLfloat *m_proj; - GLfloat *m_model; - GLfloat m_alpha; -#endif }; -#if defined(HAS_GL) // No ARB Shader when using GLES2.0 class BaseYUV2RGBARBShader : public BaseYUV2RGBShader , public CARBShaderProgram @@ -174,7 +141,6 @@ namespace Shaders { void OnCompiledAndLinked() override; bool OnEnabled() override; }; -#endif class YUV2RGBProgressiveShader : public BaseYUV2RGBGLSLShader { @@ -203,4 +169,3 @@ namespace Shaders { #ifndef __GNUC__ #pragma warning( pop ) #endif -#endif diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShaderGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShaderGLES.cpp new file mode 100644 index 0000000000000..69dd780c58bd1 --- /dev/null +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShaderGLES.cpp @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2007 d4rk + * Copyright (C) 2007-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include "system.h" +#include "../RenderFlags.h" +#include "YUV2RGBShaderGLES.h" +#include "YUVMatrix.h" +#include "settings/AdvancedSettings.h" +#include "guilib/TransformMatrix.h" +#include "utils/log.h" +#include "utils/GLUtils.h" + +#include +#include + +using namespace Shaders; + +static void CalculateYUVMatrixGL(GLfloat res[4][4] + , unsigned int flags + , EShaderFormat format + , float black + , float contrast + , bool limited) +{ + TransformMatrix matrix; + CalculateYUVMatrix(matrix, flags, format, black, contrast, limited); + + for(int row = 0; row < 3; row++) + for(int col = 0; col < 4; col++) + res[col][row] = matrix.m[row][col]; + + res[0][3] = 0.0f; + res[1][3] = 0.0f; + res[2][3] = 0.0f; + res[3][3] = 1.0f; +} + +////////////////////////////////////////////////////////////////////// +// BaseYUV2RGBGLSLShader - base class for GLSL YUV2RGB shaders +////////////////////////////////////////////////////////////////////// + +BaseYUV2RGBGLSLShader::BaseYUV2RGBGLSLShader(unsigned flags, EShaderFormat format, bool stretch, + GLSLOutput *output) +{ + m_width = 1; + m_height = 1; + m_field = 0; + m_flags = flags; + m_format = format; + + m_black = 0.0f; + m_contrast = 1.0f; + + m_stretch = 0.0f; + + // shader attribute handles + m_hYTex = -1; + m_hUTex = -1; + m_hVTex = -1; + m_hMatrix = -1; + m_hStretch = -1; + m_hStep = -1; + + m_hVertex = -1; + m_hYcoord = -1; + m_hUcoord = -1; + m_hVcoord = -1; + m_hProj = -1; + m_hModel = -1; + m_hAlpha = -1; + + m_proj = nullptr; + m_model = nullptr; + m_alpha = 1.0; + + // get defines from the output stage if used + m_glslOutput = output; + if (m_glslOutput) + m_defines += m_glslOutput->GetDefines(); + + // not supported on GLES 2.0 + m_defines += "#define XBMC_texture_rectangle 0\n"; + m_defines += "#define XBMC_texture_rectangle_hack 0\n"; + + //don't compile in stretch support when it's not needed + if (stretch) + m_defines += "#define XBMC_STRETCH 1\n"; + else + m_defines += "#define XBMC_STRETCH 0\n"; + + if (m_format == SHADER_YV12 || + m_format == SHADER_YV12_9 || + m_format == SHADER_YV12_10 || + m_format == SHADER_YV12_12 || + m_format == SHADER_YV12_14 || + m_format == SHADER_YV12_16) + m_defines += "#define XBMC_YV12\n"; + else if (m_format == SHADER_NV12) + m_defines += "#define XBMC_NV12\n"; + else if (m_format == SHADER_YUY2) + m_defines += "#define XBMC_YUY2\n"; + else if (m_format == SHADER_UYVY) + m_defines += "#define XBMC_UYVY\n"; + else if (m_format == SHADER_NV12_RRG) + m_defines += "#define XBMC_NV12_RRG\n"; + else if (m_format == SHADER_YV12) + m_defines += "#define XBMC_YV12\n"; + else + CLog::Log(LOGERROR, "GL: BaseYUV2RGBGLSLShader - unsupported format %d", m_format); + + VertexShader()->LoadSource("yuv2rgb_vertex_gles.glsl", m_defines); + + CLog::Log(LOGDEBUG, "GL: BaseYUV2RGBGLSLShader: defines:\n%s", m_defines.c_str()); +} + +BaseYUV2RGBGLSLShader::~BaseYUV2RGBGLSLShader() +{ + delete m_glslOutput; +} + +void BaseYUV2RGBGLSLShader::OnCompiledAndLinked() +{ + m_hVertex = glGetAttribLocation(ProgramHandle(), "m_attrpos"); + m_hYcoord = glGetAttribLocation(ProgramHandle(), "m_attrcordY"); + m_hUcoord = glGetAttribLocation(ProgramHandle(), "m_attrcordU"); + m_hVcoord = glGetAttribLocation(ProgramHandle(), "m_attrcordV"); + m_hProj = glGetUniformLocation(ProgramHandle(), "m_proj"); + m_hModel = glGetUniformLocation(ProgramHandle(), "m_model"); + m_hAlpha = glGetUniformLocation(ProgramHandle(), "m_alpha"); + m_hYTex = glGetUniformLocation(ProgramHandle(), "m_sampY"); + m_hUTex = glGetUniformLocation(ProgramHandle(), "m_sampU"); + m_hVTex = glGetUniformLocation(ProgramHandle(), "m_sampV"); + m_hMatrix = glGetUniformLocation(ProgramHandle(), "m_yuvmat"); + m_hStretch = glGetUniformLocation(ProgramHandle(), "m_stretch"); + m_hStep = glGetUniformLocation(ProgramHandle(), "m_step"); + VerifyGLState(); + + if (m_glslOutput) m_glslOutput->OnCompiledAndLinked(ProgramHandle()); +} + +bool BaseYUV2RGBGLSLShader::OnEnabled() +{ + // set shader attributes once enabled + glUniform1i(m_hYTex, 0); + glUniform1i(m_hUTex, 1); + glUniform1i(m_hVTex, 2); + glUniform1f(m_hStretch, m_stretch); + glUniform2f(m_hStep, 1.0 / m_width, 1.0 / m_height); + + GLfloat matrix[4][4]; + // keep video levels + CalculateYUVMatrixGL(matrix, m_flags, m_format, m_black, m_contrast, !m_convertFullRange); + + glUniformMatrix4fv(m_hMatrix, 1, GL_FALSE, (GLfloat*)matrix); + glUniformMatrix4fv(m_hProj, 1, GL_FALSE, m_proj); + glUniformMatrix4fv(m_hModel, 1, GL_FALSE, m_model); + glUniform1f(m_hAlpha, m_alpha); + VerifyGLState(); + if (m_glslOutput) m_glslOutput->OnEnabled(); + return true; +} + +void BaseYUV2RGBGLSLShader::OnDisabled() +{ + if (m_glslOutput) m_glslOutput->OnDisabled(); +} + +void BaseYUV2RGBGLSLShader::Free() +{ + if (m_glslOutput) m_glslOutput->Free(); +} + +////////////////////////////////////////////////////////////////////// +// YUV2RGBProgressiveShader - YUV2RGB with no deinterlacing +// Use for weave deinterlacing / progressive +////////////////////////////////////////////////////////////////////// + +YUV2RGBProgressiveShader::YUV2RGBProgressiveShader(unsigned flags, EShaderFormat format, bool stretch, + GLSLOutput *output) + : BaseYUV2RGBGLSLShader(flags, format, stretch, output) +{ + PixelShader()->LoadSource("yuv2rgb_basic.glsl", m_defines); + PixelShader()->AppendSource("output.glsl"); +} + + +////////////////////////////////////////////////////////////////////// +// YUV2RGBBobShader - YUV2RGB with Bob deinterlacing +////////////////////////////////////////////////////////////////////// + +YUV2RGBBobShader::YUV2RGBBobShader(unsigned flags, EShaderFormat format) + : BaseYUV2RGBGLSLShader(flags, format, false) +{ + m_hStepX = -1; + m_hStepY = -1; + m_hField = -1; + + PixelShader()->LoadSource("yuv2rgb_bob_gles.glsl", m_defines); +} + +void YUV2RGBBobShader::OnCompiledAndLinked() +{ + BaseYUV2RGBGLSLShader::OnCompiledAndLinked(); + m_hStepX = glGetUniformLocation(ProgramHandle(), "m_stepX"); + m_hStepY = glGetUniformLocation(ProgramHandle(), "m_stepY"); + m_hField = glGetUniformLocation(ProgramHandle(), "m_field"); + VerifyGLState(); +} + +bool YUV2RGBBobShader::OnEnabled() +{ + if(!BaseYUV2RGBGLSLShader::OnEnabled()) + return false; + + glUniform1i(m_hField, m_field); + glUniform1f(m_hStepX, 1.0f / (float)m_width); + glUniform1f(m_hStepY, 1.0f / (float)m_height); + VerifyGLState(); + return true; +} diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShaderGLES.h b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShaderGLES.h new file mode 100644 index 0000000000000..ff36c3c533303 --- /dev/null +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUV2RGBShaderGLES.h @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2007-2015 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ +#pragma once + +#include "guilib/TransformMatrix.h" +#include "ShaderFormats.h" + +void CalculateYUVMatrix(TransformMatrix &matrix + , unsigned int flags + , EShaderFormat format + , float black + , float contrast + , bool limited); + +#include "GLSLOutput.h" + +#ifndef __GNUC__ +#pragma warning( push ) +#pragma warning( disable : 4250 ) +#endif + +#include "guilib/Shader.h" + +namespace Shaders { + + class BaseYUV2RGBShader : virtual public CShaderProgram + { + public: + BaseYUV2RGBShader() : m_convertFullRange(false) {}; + ~BaseYUV2RGBShader() override = default; + virtual void SetField(int field) {}; + virtual void SetWidth(int width) {}; + virtual void SetHeight(int width) {}; + + virtual void SetBlack(float black) {}; + virtual void SetContrast(float contrast) {}; + virtual void SetNonLinStretch(float stretch) {}; + + virtual GLint GetVertexLoc() { return 0; }; + virtual GLint GetYcoordLoc() { return 0; }; + virtual GLint GetUcoordLoc() { return 0; }; + virtual GLint GetVcoordLoc() { return 0; }; + + virtual void SetMatrices(GLfloat *p, GLfloat *m) {}; + virtual void SetAlpha(GLfloat alpha) {}; + + void SetConvertFullColorRange(bool convertFullRange) { m_convertFullRange = convertFullRange; } + + protected: + bool m_convertFullRange; + }; + + + class BaseYUV2RGBGLSLShader + : public BaseYUV2RGBShader + , public CGLSLShaderProgram + { + public: + BaseYUV2RGBGLSLShader(unsigned flags, EShaderFormat format, bool stretch, GLSLOutput *output=NULL); + ~BaseYUV2RGBGLSLShader() override; + void SetField(int field) override { m_field = field; } + void SetWidth(int w) override { m_width = w; } + void SetHeight(int h) override { m_height = h; } + + void SetBlack(float black) override { m_black = black; } + void SetContrast(float contrast) override { m_contrast = contrast; } + void SetNonLinStretch(float stretch) override { m_stretch = stretch; } + + GLint GetVertexLoc() override { return m_hVertex; } + GLint GetYcoordLoc() override { return m_hYcoord; } + GLint GetUcoordLoc() override { return m_hUcoord; } + GLint GetVcoordLoc() override { return m_hVcoord; } + + void SetMatrices(GLfloat *p, GLfloat *m) override { m_proj = p; m_model = m; } + void SetAlpha(GLfloat alpha) override { m_alpha = alpha; } + + protected: + void OnCompiledAndLinked() override; + bool OnEnabled() override; + void OnDisabled() override; + void Free() override; + + unsigned m_flags; + EShaderFormat m_format; + int m_width; + int m_height; + int m_field; + + float m_black; + float m_contrast; + float m_stretch; + + std::string m_defines; + + Shaders::GLSLOutput *m_glslOutput; + + // shader attribute handles + GLint m_hYTex; + GLint m_hUTex; + GLint m_hVTex; + GLint m_hMatrix; + GLint m_hStretch; + GLint m_hStep; + + GLint m_hVertex; + GLint m_hYcoord; + GLint m_hUcoord; + GLint m_hVcoord; + GLint m_hProj; + GLint m_hModel; + GLint m_hAlpha; + + GLfloat *m_proj; + GLfloat *m_model; + GLfloat m_alpha; + }; + + class YUV2RGBProgressiveShader : public BaseYUV2RGBGLSLShader + { + public: + YUV2RGBProgressiveShader(unsigned flags=0, + EShaderFormat format=SHADER_NONE, + bool stretch = false, + GLSLOutput *output=NULL); + }; + + class YUV2RGBBobShader : public BaseYUV2RGBGLSLShader + { + public: + YUV2RGBBobShader(unsigned flags=0, EShaderFormat format=SHADER_NONE); + void OnCompiledAndLinked() override; + bool OnEnabled() override; + + GLint m_hStepX; + GLint m_hStepY; + GLint m_hField; + }; + +} // end namespace + +#ifndef __GNUC__ +#pragma warning( pop ) +#endif diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUVMatrix.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUVMatrix.cpp new file mode 100644 index 0000000000000..fd3e61c147ca6 --- /dev/null +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUVMatrix.cpp @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2007 d4rk + * Copyright (C) 2007-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include "system.h" +#include "../RenderFlags.h" +#include "YUVMatrix.h" + +// http://www.martinreddy.net/gfx/faqs/colorconv.faq + +// +// Transformation matrixes for different colorspaces. +// +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 } +}; + +static float yuv_coef_bt709[4][4] = +{ + { 1.0f, 1.0f, 1.0f, 0.0f }, + { 0.0f, -0.1870f, 1.8556f, 0.0f }, + { 1.5701f, -0.4664f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f, 0.0f } +}; + +static float yuv_coef_bt2020[4][4] = +{ + { 1.0f, 1.0f, 1.0f, 0.0f }, + { 0.0f, -0.1645f, 1.8814f, 0.0f }, + { 1.4745f, -0.5713f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f, 0.0f } +}; + +static float yuv_coef_ebu[4][4] = +{ + { 1.0f, 1.0f, 1.0f, 0.0f }, + { 0.0f, -0.3960f, 2.029f, 0.0f }, + { 1.140f, -0.581f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f, 0.0f } +}; + +static float yuv_coef_smtp240m[4][4] = +{ + { 1.0f, 1.0f, 1.0f, 0.0f }, + { 0.0f, -0.2253f, 1.8270f, 0.0f }, + { 1.5756f, -0.5000f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f, 0.0f } +}; + +static float** PickYUVConversionMatrix(unsigned flags) +{ + // Pick the matrix. + + switch(CONF_FLAGS_YUVCOEF_MASK(flags)) + { + case CONF_FLAGS_YUVCOEF_240M: + return reinterpret_cast(yuv_coef_smtp240m); + case CONF_FLAGS_YUVCOEF_BT2020: + return reinterpret_cast(yuv_coef_bt2020); + case CONF_FLAGS_YUVCOEF_BT709: + return reinterpret_cast(yuv_coef_bt709); + case CONF_FLAGS_YUVCOEF_BT601: + return reinterpret_cast(yuv_coef_bt601); + case CONF_FLAGS_YUVCOEF_EBU: + return reinterpret_cast(yuv_coef_ebu); + } + + return reinterpret_cast(yuv_coef_bt601); +} + +void CalculateYUVMatrix(TransformMatrix &matrix + , unsigned int flags + , EShaderFormat format + , float black + , float contrast + , bool limited) +{ + TransformMatrix coef; + + matrix *= TransformMatrix::CreateScaler(contrast, contrast, contrast); + matrix *= TransformMatrix::CreateTranslation(black, black, black); + + float (*conv)[4] = (float (*)[4])PickYUVConversionMatrix(flags); + for(int row = 0; row < 3; row++) + for(int col = 0; col < 4; col++) + coef.m[row][col] = conv[col][row]; + coef.identity = false; + + if (limited) + { + matrix *= TransformMatrix::CreateTranslation(+ 16.0f / 255 + , + 16.0f / 255 + , + 16.0f / 255); + matrix *= TransformMatrix::CreateScaler((235 - 16) / 255.0f + , (235 - 16) / 255.0f + , (235 - 16) / 255.0f); + } + + matrix *= coef; + matrix *= TransformMatrix::CreateTranslation(0.0, -0.5, -0.5); + + if (!(flags & CONF_FLAGS_YUV_FULLRANGE)) + { + matrix *= TransformMatrix::CreateScaler(255.0f / (235 - 16) + , 255.0f / (240 - 16) + , 255.0f / (240 - 16)); + matrix *= TransformMatrix::CreateTranslation(- 16.0f / 255 + , - 16.0f / 255 + , - 16.0f / 255); + } + + int effectiveBpp; + switch (format) + { + case SHADER_YV12_9: + effectiveBpp = 9; + break; + case SHADER_YV12_10: + effectiveBpp = 10; + break; + case SHADER_YV12_12: + effectiveBpp = 12; + break; + case SHADER_YV12_14: + effectiveBpp = 14; + break; + default: + effectiveBpp = 0; + } + + if (effectiveBpp > 8 && effectiveBpp < 16) + { + // Convert range to 2 bytes + float scale = 65535.0f / ((1 << effectiveBpp) - 1); + matrix *= TransformMatrix::CreateScaler(scale, scale, scale); + } +} diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUVMatrix.h b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUVMatrix.h new file mode 100644 index 0000000000000..5ecffd753981b --- /dev/null +++ b/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/YUVMatrix.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2007-2015 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ +#pragma once + +#include "guilib/TransformMatrix.h" +#include "ShaderFormats.h" + +void CalculateYUVMatrix(TransformMatrix &matrix + , unsigned int flags + , EShaderFormat format + , float black + , float contrast + , bool limited); From d145d7976486065c01f268bec23ab5a823a703b8 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Thu, 14 Sep 2017 22:39:21 +0200 Subject: [PATCH 080/113] [PVR] Cleanup: Remove obsolete and unused setting pvrplayback.scantime. --- addons/resource.language.en_gb/resources/strings.po | 11 ++--------- system/settings/settings.xml | 12 ------------ xbmc/settings/Settings.cpp | 1 - xbmc/settings/Settings.h | 1 - 4 files changed, 2 insertions(+), 23 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po index eaa22308a95e0..3d506247b9ccb 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -9990,11 +9990,7 @@ msgctxt "#19169" msgid "Hide video information box" msgstr "" -#. pvr settings "playback timeout" setting label -#: system/settings/settings.xml -msgctxt "#19170" -msgid "Timeout when starting playback" -msgstr "" +#empty string with id 19170 #. pvr settings "start playback full screen" setting label #: system/settings/settings.xml @@ -18158,10 +18154,7 @@ msgctxt "#36229" msgid "Display signal quality information in the codec information window (if supported by the add-on and backend)." msgstr "" -#: system/settings/settings.xml -msgctxt "#36230" -msgid "Time to wait for a channel to be received after a channel change. Useful for over-the-air channels that occasionally lose signal strength." -msgstr "" +#empty string with id 36230 #: system/settings/settings.xml msgctxt "#36231" diff --git a/system/settings/settings.xml b/system/settings/settings.xml index 7b011c2211a7f..cd12dfdc56b80 100755 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -1393,18 +1393,6 @@ true - - 3 - 10 - - 1 - 1 - 60 - - - 14045 - - 1 true diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp index f09e5ceffca61..6e11e9cfd4380 100644 --- a/xbmc/settings/Settings.cpp +++ b/xbmc/settings/Settings.cpp @@ -237,7 +237,6 @@ const std::string CSettings::SETTING_EPG_IGNOREDBFORCLIENT = "epg.ignoredbforcli const std::string CSettings::SETTING_EPG_RESETEPG = "epg.resetepg"; const std::string CSettings::SETTING_PVRPLAYBACK_SWITCHTOFULLSCREEN = "pvrplayback.switchtofullscreen"; const std::string CSettings::SETTING_PVRPLAYBACK_SIGNALQUALITY = "pvrplayback.signalquality"; -const std::string CSettings::SETTING_PVRPLAYBACK_SCANTIME = "pvrplayback.scantime"; const std::string CSettings::SETTING_PVRPLAYBACK_CONFIRMCHANNELSWITCH = "pvrplayback.confirmchannelswitch"; const std::string CSettings::SETTING_PVRPLAYBACK_CHANNELENTRYTIMEOUT = "pvrplayback.channelentrytimeout"; const std::string CSettings::SETTING_PVRPLAYBACK_FPS = "pvrplayback.fps"; diff --git a/xbmc/settings/Settings.h b/xbmc/settings/Settings.h index 9140fa39f0866..2fd05077d1211 100644 --- a/xbmc/settings/Settings.h +++ b/xbmc/settings/Settings.h @@ -183,7 +183,6 @@ class CSettings : public CSettingsBase, public CSettingCreator, public CSettingC static const std::string SETTING_EPG_RESETEPG; static const std::string SETTING_PVRPLAYBACK_SWITCHTOFULLSCREEN; static const std::string SETTING_PVRPLAYBACK_SIGNALQUALITY; - static const std::string SETTING_PVRPLAYBACK_SCANTIME; static const std::string SETTING_PVRPLAYBACK_CONFIRMCHANNELSWITCH; static const std::string SETTING_PVRPLAYBACK_CHANNELENTRYTIMEOUT; static const std::string SETTING_PVRPLAYBACK_FPS; From 8bbe35ed7767914067c38c9623eda9299a7d5e39 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Fri, 15 Sep 2017 11:13:17 +0200 Subject: [PATCH 081/113] threads: fix deadlock in StopThread --- xbmc/threads/Thread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xbmc/threads/Thread.cpp b/xbmc/threads/Thread.cpp index 8c1861c5dd344..1d00576a9fcbd 100644 --- a/xbmc/threads/Thread.cpp +++ b/xbmc/threads/Thread.cpp @@ -161,7 +161,7 @@ void CThread::StopThread(bool bWait /*= true*/) m_bStop = true; m_StopEvent.Set(); CSingleLock lock(m_CriticalSection); - if (m_ThreadId && bWait) + if (m_ThreadId && bWait && !IsCurrentThread(m_ThreadId)) { lock.Leave(); WaitForThreadExit(0xFFFFFFFF); From 752c59a6c7d6442ee0d55da91d46cffe99e31fba Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Fri, 15 Sep 2017 14:04:10 +0200 Subject: [PATCH 082/113] player state fixes --- xbmc/Application.cpp | 34 ++++------- xbmc/Application.h | 2 +- xbmc/PlayListPlayer.cpp | 12 ++-- xbmc/cores/ExternalPlayer/ExternalPlayer.cpp | 3 +- xbmc/cores/ExternalPlayer/ExternalPlayer.h | 2 + xbmc/cores/IPlayerCallback.h | 4 +- xbmc/cores/RetroPlayer/RetroPlayer.cpp | 2 +- xbmc/cores/VideoPlayer/VideoPlayer.cpp | 14 ++--- xbmc/cores/paplayer/PAPlayer.cpp | 63 +++++++------------- xbmc/cores/paplayer/PAPlayer.h | 2 +- xbmc/interfaces/legacy/Player.cpp | 2 +- xbmc/interfaces/legacy/Player.h | 2 +- xbmc/interfaces/python/XBPython.cpp | 4 +- xbmc/interfaces/python/XBPython.h | 2 +- xbmc/network/upnp/UPnPPlayer.cpp | 2 +- xbmc/utils/JobManager.h | 9 +++ 16 files changed, 72 insertions(+), 87 deletions(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 5a2612ac2afe4..4b4af2ca5576d 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -3467,16 +3467,6 @@ PlayBackRet CApplication::PlayFile(CFileItem item, const std::string& player, bo CServiceBroker::GetPlaylistPlayer().SetCurrentPlaylist(PLAYLIST_NONE); } - //@todo check PAPlayer and remove this block, Callbacks must not be called by CApplication itself - if (iResult == PLAYBACK_FAIL) - { - // we send this if it isn't playlistplayer that is doing this - int next = CServiceBroker::GetPlaylistPlayer().GetNextSong(); - int size = CServiceBroker::GetPlaylistPlayer().GetPlaylist(CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist()).size(); - if (next < 0 || next >= size) - OnPlayBackStopped(); - } - return iResult; } @@ -3503,20 +3493,21 @@ void CApplication::OnPlayBackEnded() g_windowManager.SendThreadMessage(msg); } -void CApplication::OnPlayBackStarted() +void CApplication::OnPlayBackStarted(const CFileItem &file) { CLog::LogF(LOGDEBUG,"CApplication::OnPlayBackStarted"); #ifdef HAS_PYTHON // informs python script currently running playback has started // (does nothing if python is not loaded) - g_pythonParser.OnPlayBackStarted(); + g_pythonParser.OnPlayBackStarted(file); #endif #if defined(TARGET_DARWIN_IOS) if (m_pPlayer->IsPlayingVideo()) CDarwinUtils::EnableOSScreenSaver(false); #endif + m_itemCurrentFile.reset(new CFileItem(file)); CServiceBroker::GetPVRManager().OnPlaybackStarted(m_itemCurrentFile); CGUIMessage msg(GUI_MSG_PLAYBACK_STARTED, 0, 0); @@ -3764,15 +3755,15 @@ void CApplication::LoadVideoSettings(const CFileItem& item) void CApplication::StopPlaying() { int iWin = g_windowManager.GetActiveWindow(); - if ( m_pPlayer->IsPlaying() ) + if (m_pPlayer->IsPlaying()) { - m_pPlayer->CloseFile(); + m_pPlayer->ClosePlayer(); // turn off visualisation window when stopping - if ((iWin == WINDOW_VISUALISATION - || iWin == WINDOW_FULLSCREEN_VIDEO - || iWin == WINDOW_FULLSCREEN_GAME) - && !m_bStop) + if ((iWin == WINDOW_VISUALISATION || + iWin == WINDOW_FULLSCREEN_VIDEO || + iWin == WINDOW_FULLSCREEN_GAME) && + !m_bStop) g_windowManager.PreviousWindow(); g_partyModeManager.Disable(); @@ -4275,11 +4266,8 @@ bool CApplication::OnMessage(CGUIMessage& message) if (message.GetMessage() == GUI_MSG_PLAYBACK_ENDED) { - CServiceBroker::GetPlaylistPlayer().PlayNext(1, true); - } - else - { - m_pPlayer->ClosePlayer(); + if (!CServiceBroker::GetPlaylistPlayer().PlayNext(1, true)) + m_pPlayer->ClosePlayer(); } if (!m_pPlayer->IsPlaying()) diff --git a/xbmc/Application.h b/xbmc/Application.h index 736df66a5d4d9..e286606b0215f 100644 --- a/xbmc/Application.h +++ b/xbmc/Application.h @@ -167,7 +167,7 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs bool OnMessage(CGUIMessage& message) override; std::string GetCurrentPlayer(); void OnPlayBackEnded() override; - void OnPlayBackStarted() override; + void OnPlayBackStarted(const CFileItem &file) override; void OnPlayBackPaused() override; void OnPlayBackResumed() override; void OnPlayBackStopped() override; diff --git a/xbmc/PlayListPlayer.cpp b/xbmc/PlayListPlayer.cpp index 254081f3fe3ee..a0cfecf81cea8 100644 --- a/xbmc/PlayListPlayer.cpp +++ b/xbmc/PlayListPlayer.cpp @@ -109,6 +109,11 @@ bool CPlayListPlayer::OnMessage(CGUIMessage &message) } } break; + case GUI_MSG_PLAYBACK_STARTED: + { + m_bPlaybackStarted = true; + } + break; } return false; @@ -293,10 +298,10 @@ bool CPlayListPlayer::Play(int iSong, std::string player, bool bAutoPlay /* = fa // check if the item itself is a playlist, and can be expanded // only allow a few levels, this could end up in a loop // if they refer to each other in a loop - for(int i=0;i<5;i++) + for (int i=0;i<5;i++) { - if(!playlist.Expand(iSong)) - break; + if(!playlist.Expand(iSong)) + break; } m_iCurrentSong = iSong; @@ -367,7 +372,6 @@ bool CPlayListPlayer::Play(int iSong, std::string player, bool bAutoPlay /* = fa // consecutive error counter so reset if the current item is playing m_iFailedSongs = 0; m_failedSongsStart = 0; - m_bPlaybackStarted = true; m_bPlayedFirstFile = true; return true; } diff --git a/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp b/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp index 586d318b7fce9..278e3ffd52931 100644 --- a/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp +++ b/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp @@ -101,6 +101,7 @@ bool CExternalPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &opti { try { + m_file = file; m_bIsPlaying = true; m_time = 0; m_playbackStartTime = XbmcThreads::SystemClockMillis(); @@ -318,7 +319,7 @@ void CExternalPlayer::Process() CLog::Log(LOGERROR,"%s: AudioEngine did not suspend before launching external player", __FUNCTION__); } - m_callback.OnPlayBackStarted(); + m_callback.OnPlayBackStarted(m_file); bool ret = true; #if defined(TARGET_WINDOWS) diff --git a/xbmc/cores/ExternalPlayer/ExternalPlayer.h b/xbmc/cores/ExternalPlayer/ExternalPlayer.h index 42b438b576ca0..5fd4a6170cfa3 100644 --- a/xbmc/cores/ExternalPlayer/ExternalPlayer.h +++ b/xbmc/cores/ExternalPlayer/ExternalPlayer.h @@ -20,6 +20,7 @@ * */ +#include "FileItem.h" #include "cores/IPlayer.h" #include "threads/Thread.h" #include @@ -101,4 +102,5 @@ class CExternalPlayer : public IPlayer, public CThread WARP_CURSOR m_warpcursor; int m_playCountMinTime; std::vector m_filenameReplacers; + CFileItem m_file; }; diff --git a/xbmc/cores/IPlayerCallback.h b/xbmc/cores/IPlayerCallback.h index 95bd98e2a2f21..480df31267258 100644 --- a/xbmc/cores/IPlayerCallback.h +++ b/xbmc/cores/IPlayerCallback.h @@ -20,12 +20,14 @@ #pragma once +class CFileItem; + class IPlayerCallback { public: virtual ~IPlayerCallback() = default; virtual void OnPlayBackEnded() = 0; - virtual void OnPlayBackStarted() = 0; + virtual void OnPlayBackStarted(const CFileItem &file) = 0; virtual void OnPlayBackPaused() {}; virtual void OnPlayBackResumed() {}; virtual void OnPlayBackStopped() = 0; diff --git a/xbmc/cores/RetroPlayer/RetroPlayer.cpp b/xbmc/cores/RetroPlayer/RetroPlayer.cpp index 39ddaa494b2ac..d5a8e7b1e04d1 100644 --- a/xbmc/cores/RetroPlayer/RetroPlayer.cpp +++ b/xbmc/cores/RetroPlayer/RetroPlayer.cpp @@ -175,7 +175,7 @@ bool CRetroPlayer::OpenFile(const CFileItem& file, const CPlayerOptions& options { RegisterWindowCallbacks(); SetSpeed(1); - m_callback.OnPlayBackStarted(); + m_callback.OnPlayBackStarted(fileCopy); m_autoSave.reset(new CRetroPlayerAutoSave(*m_gameClient)); } else diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp index 460ce1ed30520..8e9253b2667ef 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp @@ -701,10 +701,10 @@ bool CVideoPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options return true; } - m_callback.OnPlayBackStarted(); + m_item = file; + m_callback.OnPlayBackStarted(m_item); m_playerOptions = options; - m_item = file; // Try to resolve the correct mime type m_item.SetMimeTypeForInternetFile(); @@ -2452,6 +2452,7 @@ void CVideoPlayer::OnExit() m_OmxPlayerState.av_clock.OMXDeinitialize(); } + CFFmpegLog::ClearLogLevel(); m_bStop = true; if (m_error) @@ -2460,8 +2461,6 @@ void CVideoPlayer::OnExit() m_callback.OnPlayBackStopped(); else m_callback.OnPlayBackEnded(); - - CFFmpegLog::ClearLogLevel(); } void CVideoPlayer::HandleMessages() @@ -2475,8 +2474,11 @@ void CVideoPlayer::HandleMessages() { CDVDMsgOpenFile &msg(*static_cast(pMsg)); + m_item = msg.GetItem(); + m_playerOptions = msg.GetOptions(); + CJobManager::GetInstance().Submit([this]() { - m_callback.OnPlayBackStarted(); + m_callback.OnPlayBackStarted(m_item); }, CJob::PRIORITY_NORMAL); FlushBuffers(DVD_NOPTS_VALUE, true, true); @@ -2486,8 +2488,6 @@ void CVideoPlayer::HandleMessages() SAFE_DELETE(m_pCCDemuxer); SAFE_DELETE(m_pInputStream); - m_item = msg.GetItem(); - m_playerOptions = msg.GetOptions(); Prepare(); } else if (pMsg->IsType(CDVDMsg::PLAYER_SEEK) && diff --git a/xbmc/cores/paplayer/PAPlayer.cpp b/xbmc/cores/paplayer/PAPlayer.cpp index 85d75808fd4c9..026136340d846 100644 --- a/xbmc/cores/paplayer/PAPlayer.cpp +++ b/xbmc/cores/paplayer/PAPlayer.cpp @@ -38,20 +38,6 @@ #define FAST_XFADE_TIME 80 /* 80 milliseconds */ #define MAX_SKIP_XFADE_TIME 2000 /* max 2 seconds crossfade on track skip */ -class CQueueNextFileJob : public CJob -{ - CFileItem m_item; - PAPlayer &m_player; - -public: CQueueNextFileJob(const CFileItem& item, PAPlayer &player) - : m_item(item), m_player(player) {} - ~CQueueNextFileJob() override = default; - bool DoWork() override - { - return m_player.QueueNextFileEx(m_item, true, true); - } -}; - // PAP: Psycho-acoustic Audio Player // Supporting all open audio codec standards. // First one being nullsoft's nsv audio decoder format @@ -251,19 +237,13 @@ bool PAPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options) m_isPaused = false; // Make sure to reset the pause state } - // if audio engine is suspended i.e. by a DisplayLost event (HDMI), MakeStream - // waits until the engine is resumed. if we block the main thread here, it can't - // resume the engine after a DisplayReset event - if (CServiceBroker::GetActiveAE().IsSuspended()) { - if (!QueueNextFile(file)) - return false; - } - else - { - if (!QueueNextFileEx(file, false)) - return false; + CSingleLock lock(m_streamsLock); + m_jobCounter++; } + CJobManager::GetInstance().Submit([this, file]() { + QueueNextFileEx(file, false); + }, this, CJob::PRIORITY_NORMAL); CSingleLock lock(m_streamsLock); if (m_streams.size() == 2) @@ -326,11 +306,14 @@ bool PAPlayer::QueueNextFile(const CFileItem &file) CSingleLock lock(m_streamsLock); m_jobCounter++; } - CJobManager::GetInstance().AddJob(new CQueueNextFileJob(file, *this), this, CJob::PRIORITY_NORMAL); + CJobManager::GetInstance().Submit([this, file]() { + QueueNextFileEx(file, true); + }, this, CJob::PRIORITY_NORMAL); + return true; } -bool PAPlayer::QueueNextFileEx(const CFileItem &file, bool fadeIn/* = true */, bool job /* = false */) +bool PAPlayer::QueueNextFileEx(const CFileItem &file, bool fadeIn) { // check if we advance a track of a CUE sheet // if this is the case we don't need to open a new stream @@ -358,15 +341,14 @@ bool PAPlayer::QueueNextFileEx(const CFileItem &file, bool fadeIn/* = true */, b delete si; // advance playlist - if (job) - m_callback.OnPlayBackStarted(); + m_callback.OnPlayBackStarted(*m_FileItem); m_callback.OnQueueNextItem(); return false; } /* decode until there is data-available */ si->m_decoder.Start(); - while(si->m_decoder.GetDataSize(true) == 0) + while (si->m_decoder.GetDataSize(true) == 0) { int status = si->m_decoder.GetStatus(); if (status == STATUS_ENDED || @@ -378,8 +360,7 @@ bool PAPlayer::QueueNextFileEx(const CFileItem &file, bool fadeIn/* = true */, b si->m_decoder.Destroy(); delete si; // advance playlist - if (job) - m_callback.OnPlayBackStarted(); + m_callback.OnPlayBackStarted(*m_FileItem); m_callback.OnQueueNextItem(); return false; } @@ -441,8 +422,7 @@ bool PAPlayer::QueueNextFileEx(const CFileItem &file, bool fadeIn/* = true */, b si->m_decoder.Destroy(); delete si; // advance playlist - if (job) - m_callback.OnPlayBackStarted(); + m_callback.OnPlayBackStarted(file); m_callback.OnQueueNextItem(); return false; } @@ -604,11 +584,6 @@ void PAPlayer::Process() GetTimeInternal(); //update for GUI } - - if(m_isFinished && !m_bStop) - m_callback.OnPlayBackEnded(); - else - m_callback.OnPlayBackStopped(); } inline void PAPlayer::ProcessStreams(double &freeBufferTime) @@ -744,7 +719,7 @@ inline bool PAPlayer::ProcessStream(StreamInfo *si, double &freeBufferTime) if (!si->m_isSlaved) si->m_stream->Resume(); si->m_stream->FadeVolume(0.0f, 1.0f, m_upcomingCrossfadeMS); - m_callback.OnPlayBackStarted(); + m_callback.OnPlayBackStarted(*m_FileItem); } /* if we have not started yet and the stream has been primed */ @@ -820,7 +795,7 @@ inline bool PAPlayer::ProcessStream(StreamInfo *si, double &freeBufferTime) UpdateStreamInfoPlayNextAtFrame(m_currentStream, m_upcomingCrossfadeMS); UpdateGUIData(si); - m_callback.OnPlayBackStarted(); + m_callback.OnPlayBackStarted(*m_FileItem); m_continueStream = false; } else @@ -904,7 +879,11 @@ bool PAPlayer::QueueData(StreamInfo *si) void PAPlayer::OnExit() { - + //@todo signal OnPlayBackError if there was an error on last stream + if (m_isFinished && !m_bStop) + m_callback.OnPlayBackEnded(); + else + m_callback.OnPlayBackStopped(); } void PAPlayer::OnNothingToQueueNotify() diff --git a/xbmc/cores/paplayer/PAPlayer.h b/xbmc/cores/paplayer/PAPlayer.h index 2c2e2567ee5a8..0ab6af273a097 100644 --- a/xbmc/cores/paplayer/PAPlayer.h +++ b/xbmc/cores/paplayer/PAPlayer.h @@ -143,7 +143,7 @@ friend class CQueueNextFileJob; int64_t m_newForcedTotalTime; std::unique_ptr m_processInfo; - bool QueueNextFileEx(const CFileItem &file, bool fadeIn = true, bool job = false); + bool QueueNextFileEx(const CFileItem &file, bool fadeIn); void SoftStart(bool wait = false); void SoftStop(bool wait = false, bool close = true); void CloseAllStreams(bool fade = true); diff --git a/xbmc/interfaces/legacy/Player.cpp b/xbmc/interfaces/legacy/Player.cpp index c1931f2591e41..8ac17a5464262 100644 --- a/xbmc/interfaces/legacy/Player.cpp +++ b/xbmc/interfaces/legacy/Player.cpp @@ -184,7 +184,7 @@ namespace XBMCAddon //CLog::Log(LOGNOTICE, "Current Song After Play: %i", CServiceBroker::GetPlaylistPlayer().GetCurrentSong()); } - void Player::OnPlayBackStarted() + void Player::OnPlayBackStarted(const CFileItem &file) { XBMC_TRACE; invokeCallback(new CallbackFunction(this,&Player::onPlayBackStarted)); diff --git a/xbmc/interfaces/legacy/Player.h b/xbmc/interfaces/legacy/Player.h index 0aaf0bacd6278..6d67f150bc4bc 100644 --- a/xbmc/interfaces/legacy/Player.h +++ b/xbmc/interfaces/legacy/Player.h @@ -726,7 +726,7 @@ namespace XBMCAddon #endif #if !defined SWIG && !defined DOXYGEN_SHOULD_SKIP_THIS - SWIGHIDDENVIRTUAL void OnPlayBackStarted() override; + SWIGHIDDENVIRTUAL void OnPlayBackStarted(const CFileItem &file) override; SWIGHIDDENVIRTUAL void OnPlayBackEnded() override; SWIGHIDDENVIRTUAL void OnPlayBackStopped() override; SWIGHIDDENVIRTUAL void OnPlayBackError() override; diff --git a/xbmc/interfaces/python/XBPython.cpp b/xbmc/interfaces/python/XBPython.cpp index 362e4fec129c7..2bb584b40fd43 100644 --- a/xbmc/interfaces/python/XBPython.cpp +++ b/xbmc/interfaces/python/XBPython.cpp @@ -120,14 +120,14 @@ void XBPython::Announce(AnnouncementFlag flag, const char *sender, const char *m } // message all registered callbacks that we started playing -void XBPython::OnPlayBackStarted() +void XBPython::OnPlayBackStarted(const CFileItem &file) { XBMC_TRACE; LOCK_AND_COPY(std::vector,tmp,m_vecPlayerCallbackList); for (PlayerCallbackList::iterator it = tmp.begin(); (it != tmp.end()); ++it) { if (CHECK_FOR_ENTRY(m_vecPlayerCallbackList,(*it))) - ((IPlayerCallback*)(*it))->OnPlayBackStarted(); + ((IPlayerCallback*)(*it))->OnPlayBackStarted(file); } } diff --git a/xbmc/interfaces/python/XBPython.h b/xbmc/interfaces/python/XBPython.h index 1426abd471790..eaebdddc31fb7 100644 --- a/xbmc/interfaces/python/XBPython.h +++ b/xbmc/interfaces/python/XBPython.h @@ -69,7 +69,7 @@ class XBPython : XBPython(); ~XBPython() override; void OnPlayBackEnded() override; - void OnPlayBackStarted() override; + void OnPlayBackStarted(const CFileItem &file) override; void OnPlayBackPaused() override; void OnPlayBackResumed() override; void OnPlayBackStopped() override; diff --git a/xbmc/network/upnp/UPnPPlayer.cpp b/xbmc/network/upnp/UPnPPlayer.cpp index fe165a9322735..bc28963f7129c 100644 --- a/xbmc/network/upnp/UPnPPlayer.cpp +++ b/xbmc/network/upnp/UPnPPlayer.cpp @@ -368,7 +368,7 @@ bool CUPnPPlayer::OpenFile(const CFileItem& file, const CPlayerOptions& options) m_stopremote = true; m_started = true; - m_callback.OnPlayBackStarted(); + m_callback.OnPlayBackStarted(file); NPT_CHECK_LABEL_SEVERE(m_control->GetPositionInfo(m_delegate->m_device , m_delegate->m_instance , m_delegate), failed); diff --git a/xbmc/utils/JobManager.h b/xbmc/utils/JobManager.h index 8816473e40cfd..2a1ed89f65a94 100644 --- a/xbmc/utils/JobManager.h +++ b/xbmc/utils/JobManager.h @@ -247,6 +247,15 @@ class CJobManager AddJob(new CLambdaJob(std::forward(f)), nullptr, priority); } + /*! + \brief Add a function f to this job manager for asynchronously execution. + */ + template + void Submit(F&& f, IJobCallback *callback, CJob::PRIORITY priority = CJob::PRIORITY_LOW) + { + AddJob(new CLambdaJob(std::forward(f)), callback, priority); + } + /*! \brief Cancel a job with the given id. \param jobID the id of the job to cancel, retrieved previously from AddJob() From 0f1440bc43e4dc286bcba874423df4780f5a8509 Mon Sep 17 00:00:00 2001 From: Rechi Date: Fri, 15 Sep 2017 23:17:12 +0200 Subject: [PATCH 083/113] [cmake] correctly escape install regex syntax introduced at e54cd63add --- cmake/scripts/common/AddonHelpers.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/scripts/common/AddonHelpers.cmake b/cmake/scripts/common/AddonHelpers.cmake index 49fdc0d7b7852..3dbb6c3d1a25e 100644 --- a/cmake/scripts/common/AddonHelpers.cmake +++ b/cmake/scripts/common/AddonHelpers.cmake @@ -232,7 +232,7 @@ macro (build_addon target prefix libs) # Pack files together to create an archive install(DIRECTORY ${target} DESTINATION ./ COMPONENT ${target}-${${prefix}_VERSION} - REGEX ".+\.xml\.in(clude)?$" EXCLUDE) + REGEX ".+\\.xml\\.in(clude)?$" EXCLUDE) if(WIN32) if(NOT CPACK_PACKAGE_DIRECTORY) # determine the temporary path @@ -326,7 +326,7 @@ macro (build_addon target prefix libs) install(FILES ${LIBRARY_LOCATION} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target} RENAME ${LIBRARY_FILENAME}) endif() install(DIRECTORY ${target} DESTINATION ${CMAKE_INSTALL_DATADIR}/addons - REGEX ".+\.xml\.in(clude)?$" EXCLUDE) + REGEX ".+\\.xml\\.in(clude)?$" EXCLUDE) if(${prefix}_CUSTOM_DATA) install(DIRECTORY ${${prefix}_CUSTOM_DATA} DESTINATION ${CMAKE_INSTALL_DATADIR}/addons/${target}/resources) endif() From 9dd1ac497232101d368255169bc4897b2ff0c279 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sat, 16 Sep 2017 14:21:02 +0200 Subject: [PATCH 084/113] AE: allow bigger maxError when not in sync --- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp index 77092a14e9792..e06b582ca9e1d 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp @@ -1911,16 +1911,17 @@ bool CActiveAE::RunStages() double pts = buf->timestamp - (buf->pkt_start_offset * 1000 / buf->pkt->config.sample_rate); double delay = status.GetDelay() * 1000; double playingPts = pts - delay; + double maxError = ((*it)->m_syncState == CAESyncInfo::SYNC_INSYNC) ? 1000 : 5000; double error = playingPts - (*it)->m_pClock->GetClock(); - if (error > 1000) + if (error > maxError) { CLog::Log(LOGWARNING, "ActiveAE - large audio sync error: %f", error); - error = 1000; + error = maxError; } - else if (error < -1000) + else if (error < -maxError) { CLog::Log(LOGWARNING, "ActiveAE - large audio sync error: %f", error); - error = -1000; + error = -maxError; } (*it)->m_syncError.Add(error); } From b6250900a9760216ea39c35e58483aecb9fb58c3 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sun, 17 Sep 2017 14:03:04 +0200 Subject: [PATCH 085/113] VideoPlayer: implement smooth motion --- .../VideoPlayer/VideoRenderers/BaseRenderer.h | 2 +- .../HwDecRender/MMALRenderer.cpp | 14 ++-- .../VideoRenderers/HwDecRender/MMALRenderer.h | 2 +- .../HwDecRender/RendererAML.cpp | 2 +- .../VideoRenderers/HwDecRender/RendererAML.h | 2 +- .../HwDecRender/RendererMediaCodecSurface.cpp | 2 +- .../HwDecRender/RendererMediaCodecSurface.h | 2 +- .../VideoRenderers/LinuxRendererGL.cpp | 44 ++++-------- .../VideoRenderers/LinuxRendererGL.h | 3 +- .../VideoRenderers/LinuxRendererGLES.cpp | 2 +- .../VideoRenderers/LinuxRendererGLES.h | 2 +- .../VideoPlayer/VideoRenderers/RenderFlags.h | 1 - .../VideoRenderers/RenderManager.cpp | 70 ++++++++++++------- .../VideoRenderers/RenderManager.h | 2 +- .../VideoRenderers/WinRenderer.cpp | 2 +- .../VideoPlayer/VideoRenderers/WinRenderer.h | 2 +- 16 files changed, 76 insertions(+), 78 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.h b/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.h index 10afac83f5492..949092cb51101 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/BaseRenderer.h @@ -78,7 +78,7 @@ class CBaseRenderer // Render info, can be called before configure virtual CRenderInfo GetRenderInfo() { return CRenderInfo(); } virtual void Update() = 0; - virtual void RenderUpdate(int index, bool clear, unsigned int flags, unsigned int alpha) = 0; + virtual void RenderUpdate(int index, int index2, bool clear, unsigned int flags, unsigned int alpha) = 0; virtual bool RenderCapture(CRenderCapture* capture) = 0; virtual bool ConfigChanged(const VideoPicture &picture) = 0; diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp index 9d4e1eb9ab08b..ef89e2bbc7252 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp @@ -912,18 +912,18 @@ void CMMALRenderer::Update() ManageRenderArea(); } -void CMMALRenderer::RenderUpdate(int source, bool clear, unsigned int flags, unsigned int alpha) +void CMMALRenderer::RenderUpdate(int index, int index2, bool clear, unsigned int flags, unsigned int alpha) { CSingleLock lock(m_sharedSection); CMMALBuffer *omvb = nullptr; if (!m_bConfigured) { - CLog::Log(LOGDEBUG, LOGVIDEO, "%s::%s - not configured: clear:%d flags:%x alpha:%d source:%d", CLASSNAME, __func__, clear, flags, alpha, source); + CLog::Log(LOGDEBUG, LOGVIDEO, "%s::%s - not configured: clear:%d flags:%x alpha:%d source:%d", CLASSNAME, __func__, clear, flags, alpha, index); goto exit; } - omvb = m_buffers[source]; + omvb = m_buffers[index]; if (g_graphicsContext.GetStereoView() != RENDER_STEREO_VIEW_RIGHT) { @@ -935,7 +935,7 @@ void CMMALRenderer::RenderUpdate(int source, bool clear, unsigned int flags, uns // we only want to upload frames once if (omvb && omvb->m_rendered) { - CLog::Log(LOGDEBUG, LOGVIDEO, "%s::%s - MMAL: clear:%d flags:%x alpha:%d source:%d omvb:%p mmal:%p mflags:%x skipping", CLASSNAME, __func__, clear, flags, alpha, source, omvb, omvb->mmal_buffer, omvb->mmal_buffer->flags); + CLog::Log(LOGDEBUG, LOGVIDEO, "%s::%s - MMAL: clear:%d flags:%x alpha:%d source:%d omvb:%p mmal:%p mflags:%x skipping", CLASSNAME, __func__, clear, flags, alpha, index, omvb, omvb->mmal_buffer, omvb->mmal_buffer->flags); SetVideoRect(m_cachedSourceRect, m_cachedDestRect); goto exit; } @@ -944,7 +944,7 @@ void CMMALRenderer::RenderUpdate(int source, bool clear, unsigned int flags, uns { // dummy buffer from omxplayer if (VERBOSE && g_advancedSettings.CanLogComponent(LOGVIDEO)) - CLog::Log(LOGDEBUG, "%s::%s - OMX: clear:%d flags:%x alpha:%d source:%d omvb:%p", CLASSNAME, __func__, clear, flags, alpha, source, omvb); + CLog::Log(LOGDEBUG, "%s::%s - OMX: clear:%d flags:%x alpha:%d source:%d omvb:%p", CLASSNAME, __func__, clear, flags, alpha, index, omvb); } else if (omvb && omvb->mmal_buffer) { @@ -952,7 +952,7 @@ void CMMALRenderer::RenderUpdate(int source, bool clear, unsigned int flags, uns omvb->mmal_buffer->flags |= MMAL_BUFFER_HEADER_VIDEO_FLAG_INTERLACED | MMAL_BUFFER_HEADER_VIDEO_FLAG_TOP_FIELD_FIRST; else if (flags & RENDER_FLAG_BOT) omvb->mmal_buffer->flags |= MMAL_BUFFER_HEADER_VIDEO_FLAG_INTERLACED; - CLog::Log(LOGDEBUG, LOGVIDEO, "%s::%s - MMAL: clear:%d flags:%x alpha:%d source:%d omvb:%p mmal:%p mflags:%x len:%d data:%p enc:%.4s", CLASSNAME, __func__, clear, flags, alpha, source, omvb, omvb->mmal_buffer, omvb->mmal_buffer->flags, omvb->mmal_buffer->length, omvb->mmal_buffer->data, (char *)&omvb->Encoding()); + CLog::Log(LOGDEBUG, LOGVIDEO, "%s::%s - MMAL: clear:%d flags:%x alpha:%d source:%d omvb:%p mmal:%p mflags:%x len:%d data:%p enc:%.4s", CLASSNAME, __func__, clear, flags, alpha, index, omvb, omvb->mmal_buffer, omvb->mmal_buffer->flags, omvb->mmal_buffer->length, omvb->mmal_buffer->data, (char *)&omvb->Encoding()); assert(omvb->mmal_buffer && omvb->mmal_buffer->data && omvb->mmal_buffer->length); omvb->Acquire(); omvb->m_rendered = true; @@ -960,7 +960,7 @@ void CMMALRenderer::RenderUpdate(int source, bool clear, unsigned int flags, uns mmal_queue_put(m_queue_process, omvb->mmal_buffer); } else - CLog::Log(LOGDEBUG, "%s::%s - MMAL: No buffer to update clear:%d flags:%x alpha:%d source:%d omvb:%p mmal:%p", CLASSNAME, __func__, clear, flags, alpha, source, omvb, omvb ? omvb->mmal_buffer : nullptr); + CLog::Log(LOGDEBUG, "%s::%s - MMAL: No buffer to update clear:%d flags:%x alpha:%d source:%d omvb:%p mmal:%p", CLASSNAME, __func__, clear, flags, alpha, index, omvb, omvb ? omvb->mmal_buffer : nullptr); exit: lock.Leave(); diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h index 9eb6f51161abe..b00a5626b79a3 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.h @@ -163,7 +163,7 @@ class CMMALRenderer : public CBaseRenderer, public CThread, public IRunnable virtual bool Supports(ERENDERFEATURE feature) override; virtual bool Supports(ESCALINGMETHOD method) override; - virtual void RenderUpdate(int source, bool clear, unsigned int flags, unsigned int alpha) override; + virtual void RenderUpdate(int index, int index2, bool clear, unsigned int flags, unsigned int alpha) override; virtual void SetVideoRect(const CRect& SrcRect, const CRect& DestRect); virtual bool IsGuiLayer() override { return false; } diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp index 00549d9afa852..f5a6bc20f7046 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.cpp @@ -150,7 +150,7 @@ void CRendererAML::Reset() } } -void CRendererAML::RenderUpdate(int index, bool clear, DWORD flags, DWORD alpha) +void CRendererAML::RenderUpdate(int index, int index2, bool clear, unsigned int flags, unsigned int alpha) { ManageRenderArea(); diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h index b4986853035c3..d58e2ee13c83d 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererAML.h @@ -46,7 +46,7 @@ class CRendererAML : public CBaseRenderer virtual void UnInit() override {}; virtual void Reset() override; virtual void Update() override {}; - virtual void RenderUpdate(int index, bool clear, unsigned int flags, unsigned int alpha) override; + virtual void RenderUpdate(int index, int index2, bool clear, unsigned int flags, unsigned int alpha) override; virtual bool SupportsMultiPassRendering()override { return false; }; // Player functions diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererMediaCodecSurface.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererMediaCodecSurface.cpp index 3c3306f01f862..bd24d71db3cd8 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererMediaCodecSurface.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererMediaCodecSurface.cpp @@ -119,7 +119,7 @@ void CRendererMediaCodecSurface::Reset() { } -void CRendererMediaCodecSurface::RenderUpdate(int index, bool clear, DWORD flags, DWORD alpha) +void CRendererMediaCodecSurface::RenderUpdate(int index, int index2, bool clear, unsigned int flags, unsigned int alpha) { CXBMCApp::get()->WaitVSync(100); ManageRenderArea(); diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererMediaCodecSurface.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererMediaCodecSurface.h index 14ec51e54173a..201b04cb24d7c 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererMediaCodecSurface.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererMediaCodecSurface.h @@ -46,7 +46,7 @@ class CRendererMediaCodecSurface : public CBaseRenderer virtual void UnInit() override {}; virtual void Reset() override; virtual void Update() override {}; - virtual void RenderUpdate(int index, bool clear, unsigned int flags, unsigned int alpha) override; + virtual void RenderUpdate(int index, int index2, bool clear, unsigned int flags, unsigned int alpha) override; virtual bool SupportsMultiPassRendering() override { return false; }; // Player functions diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp index f2fdff50ce7fc..7b70d43207126 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp @@ -143,7 +143,6 @@ CLinuxRendererGL::CLinuxRendererGL() m_fbo.width = 0.0; m_fbo.height = 0.0; m_NumYV12Buffers = 0; - m_iLastRenderBuffer = 0; m_bConfigured = false; m_bValidated = false; m_clearColour = 0.0f; @@ -260,8 +259,6 @@ bool CLinuxRendererGL::Configure(const VideoPicture &picture, float fps, unsigne // frame is loaded after every call to Configure(). m_bValidated = false; - m_iLastRenderBuffer = -1; - m_nonLinStretch = false; m_nonLinStretchGui = false; m_pixelRatio = 1.0; @@ -494,10 +491,12 @@ void CLinuxRendererGL::Update() ValidateRenderTarget(); } -void CLinuxRendererGL::RenderUpdate(int index, bool clear, DWORD flags, DWORD alpha) +void CLinuxRendererGL::RenderUpdate(int index, int index2, bool clear, unsigned int flags, unsigned int alpha) { - m_iLastRenderBuffer = m_iYV12RenderBuffer; - m_iYV12RenderBuffer = index; + if (index2 >= 0) + m_iYV12RenderBuffer = index2; + else + m_iYV12RenderBuffer = index; if (!ValidateRenderer()) { @@ -518,7 +517,7 @@ void CLinuxRendererGL::RenderUpdate(int index, bool clear, DWORD flags, DWORD al ClearBackBuffer(); } - if (alpha<255) + if (alpha < 255) { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -530,31 +529,16 @@ void CLinuxRendererGL::RenderUpdate(int index, bool clear, DWORD flags, DWORD al glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } - if(flags & RENDER_FLAG_WEAVE) - { - int top_index = index; - int bot_index = index; + if (!Render(flags, m_iYV12RenderBuffer) && clear) + ClearBackBuffer(); - if((flags & RENDER_FLAG_FIELD0) && m_iLastRenderBuffer > -1) - { - if(flags & RENDER_FLAG_TOP) - bot_index = m_iLastRenderBuffer; - else - top_index = m_iLastRenderBuffer; - } - - glEnable(GL_POLYGON_STIPPLE); - glPolygonStipple(stipple_weave); - Render((flags & ~RENDER_FLAG_FIELDMASK) | RENDER_FLAG_TOP, top_index); - glPolygonStipple(stipple_weave+4); - Render((flags & ~RENDER_FLAG_FIELDMASK) | RENDER_FLAG_BOT, bot_index); - glDisable(GL_POLYGON_STIPPLE); - - } - else + if (index2 >= 0) { - if (!Render(flags, index) && clear) - ClearBackBuffer(); + m_iYV12RenderBuffer = index; + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4f(1.0f, 1.0f, 1.0f, 0.5f); + Render(flags, m_iYV12RenderBuffer); } VerifyGLState(); diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.h b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.h index 92c183230a5d4..8a6a0684d66e5 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.h @@ -113,7 +113,7 @@ class CLinuxRendererGL : public CBaseRenderer void Flush() override; void SetBufferSize(int numBuffers) override { m_NumYV12Buffers = numBuffers; } void ReleaseBuffer(int idx) override; - void RenderUpdate(int index, bool clear, DWORD flags, DWORD alpha) override; + void RenderUpdate(int index, int index2, bool clear, unsigned int flags, unsigned int alpha) override; void Update() override; bool RenderCapture(CRenderCapture* capture) override; CRenderInfo GetRenderInfo() override; @@ -175,7 +175,6 @@ class CLinuxRendererGL : public CBaseRenderer int m_iYV12RenderBuffer; int m_NumYV12Buffers; - int m_iLastRenderBuffer; bool m_bConfigured; bool m_bValidated; diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp index f25883ad7b73c..5df3993267e8e 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp @@ -361,7 +361,7 @@ void CLinuxRendererGLES::Update() ValidateRenderTarget(); } -void CLinuxRendererGLES::RenderUpdate(int index, bool clear, DWORD flags, DWORD alpha) +void CLinuxRendererGLES::RenderUpdate(int index, int index2, bool clear, unsigned int flags, unsigned int alpha) { m_iYV12RenderBuffer = index; diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h index 063d2f4d5deb0..a8a7b856b0c35 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h @@ -121,7 +121,7 @@ class CLinuxRendererGLES : public CBaseRenderer virtual void SetBufferSize(int numBuffers) override { m_NumYV12Buffers = numBuffers; } virtual bool IsGuiLayer() override; virtual void ReleaseBuffer(int idx) override; - virtual void RenderUpdate(int index, bool clear, DWORD flags, DWORD alpha) override; + virtual void RenderUpdate(int index, int index2, bool clear, unsigned int flags, unsigned int alpha) override; virtual void Update() override; virtual bool RenderCapture(CRenderCapture* capture) override; virtual CRenderInfo GetRenderInfo() override; diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderFlags.h b/xbmc/cores/VideoPlayer/VideoRenderers/RenderFlags.h index b261cdaa6b2f2..c3ae1b08d3848 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderFlags.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderFlags.h @@ -29,7 +29,6 @@ #define RENDER_FLAG_FIELD0 0x80 #define RENDER_FLAG_FIELD1 0x100 -#define RENDER_FLAG_WEAVE 0x200 // #define RENDER_FLAG_LAST 0x40 diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp index b34010a5d8a57..25ba4391d1d39 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp @@ -51,12 +51,6 @@ using namespace KODI::MESSAGING; -static void requeue(std::deque &trg, std::deque &src) -{ - trg.push_back(src.front()); - src.pop_front(); -} - void CRenderManager::CClockSync::Reset() { m_error = 0; @@ -220,6 +214,7 @@ bool CRenderManager::Configure() m_discard.clear(); m_free.clear(); m_presentsource = 0; + m_presentsourcePast = -1; for (int i=1; i < m_QueueSize; i++) m_free.push_back(i); @@ -415,6 +410,7 @@ bool CRenderManager::Flush(bool wait) m_discard.clear(); m_free.clear(); m_presentsource = 0; + m_presentsourcePast = -1; m_presentstep = PRESENT_IDLE; for (int i = 1; i < m_QueueSize; i++) m_free.push_back(i); @@ -683,8 +679,6 @@ void CRenderManager::Render(bool clear, DWORD flags, DWORD alpha, bool gui) if( m.presentmethod == PRESENT_METHOD_BOB ) PresentFields(clear, flags, alpha); - else if( m.presentmethod == PRESENT_METHOD_WEAVE ) - PresentFields(clear, flags | RENDER_FLAG_WEAVE, alpha); else if( m.presentmethod == PRESENT_METHOD_BLEND ) PresentBlend(clear, flags, alpha); else @@ -734,8 +728,7 @@ void CRenderManager::Render(bool clear, DWORD flags, DWORD alpha, bool gui) if (m_presentstep == PRESENT_FRAME) { - if (m.presentmethod == PRESENT_METHOD_BOB || - m.presentmethod == PRESENT_METHOD_WEAVE) + if (m.presentmethod == PRESENT_METHOD_BOB) m_presentstep = PRESENT_FRAME2; else m_presentstep = PRESENT_IDLE; @@ -789,11 +782,11 @@ void CRenderManager::PresentSingle(bool clear, DWORD flags, DWORD alpha) SPresent& m = m_Queue[m_presentsource]; if (m.presentfield == FS_BOT) - m_pRenderer->RenderUpdate(m_presentsource, clear, flags | RENDER_FLAG_BOT, alpha); + m_pRenderer->RenderUpdate(m_presentsource, m_presentsourcePast, clear, flags | RENDER_FLAG_BOT, alpha); else if (m.presentfield == FS_TOP) - m_pRenderer->RenderUpdate(m_presentsource, clear, flags | RENDER_FLAG_TOP, alpha); + m_pRenderer->RenderUpdate(m_presentsource, m_presentsourcePast, clear, flags | RENDER_FLAG_TOP, alpha); else - m_pRenderer->RenderUpdate(m_presentsource, clear, flags, alpha); + m_pRenderer->RenderUpdate(m_presentsource, m_presentsourcePast, clear, flags, alpha); } /* new simpler method of handling interlaced material, * @@ -805,16 +798,16 @@ void CRenderManager::PresentFields(bool clear, DWORD flags, DWORD alpha) if(m_presentstep == PRESENT_FRAME) { if( m.presentfield == FS_BOT) - m_pRenderer->RenderUpdate(m_presentsource, clear, flags | RENDER_FLAG_BOT | RENDER_FLAG_FIELD0, alpha); + m_pRenderer->RenderUpdate(m_presentsource, m_presentsourcePast, clear, flags | RENDER_FLAG_BOT | RENDER_FLAG_FIELD0, alpha); else - m_pRenderer->RenderUpdate(m_presentsource, clear, flags | RENDER_FLAG_TOP | RENDER_FLAG_FIELD0, alpha); + m_pRenderer->RenderUpdate(m_presentsource, m_presentsourcePast, clear, flags | RENDER_FLAG_TOP | RENDER_FLAG_FIELD0, alpha); } else { if( m.presentfield == FS_TOP) - m_pRenderer->RenderUpdate(m_presentsource, clear, flags | RENDER_FLAG_BOT | RENDER_FLAG_FIELD1, alpha); + m_pRenderer->RenderUpdate(m_presentsource, m_presentsourcePast, clear, flags | RENDER_FLAG_BOT | RENDER_FLAG_FIELD1, alpha); else - m_pRenderer->RenderUpdate(m_presentsource, clear, flags | RENDER_FLAG_TOP | RENDER_FLAG_FIELD1, alpha); + m_pRenderer->RenderUpdate(m_presentsource, m_presentsourcePast, clear, flags | RENDER_FLAG_TOP | RENDER_FLAG_FIELD1, alpha); } } @@ -824,13 +817,13 @@ void CRenderManager::PresentBlend(bool clear, DWORD flags, DWORD alpha) if( m.presentfield == FS_BOT ) { - m_pRenderer->RenderUpdate(m_presentsource, clear, flags | RENDER_FLAG_BOT | RENDER_FLAG_NOOSD, alpha); - m_pRenderer->RenderUpdate(m_presentsource, false, flags | RENDER_FLAG_TOP, alpha / 2); + m_pRenderer->RenderUpdate(m_presentsource, m_presentsourcePast, clear, flags | RENDER_FLAG_BOT | RENDER_FLAG_NOOSD, alpha); + m_pRenderer->RenderUpdate(m_presentsource, m_presentsourcePast, false, flags | RENDER_FLAG_TOP, alpha / 2); } else { - m_pRenderer->RenderUpdate(m_presentsource, clear, flags | RENDER_FLAG_TOP | RENDER_FLAG_NOOSD, alpha); - m_pRenderer->RenderUpdate(m_presentsource, false, flags | RENDER_FLAG_BOT, alpha / 2); + m_pRenderer->RenderUpdate(m_presentsource, m_presentsourcePast, clear, flags | RENDER_FLAG_TOP | RENDER_FLAG_NOOSD, alpha); + m_pRenderer->RenderUpdate(m_presentsource, m_presentsourcePast, false, flags | RENDER_FLAG_BOT, alpha / 2); } } @@ -923,8 +916,6 @@ bool CRenderManager::AddVideoPicture(const VideoPicture& picture, volatile std:: { if (deintMethod == VS_INTERLACEMETHOD_RENDER_BLEND) presentmethod = PRESENT_METHOD_BLEND; - else if (deintMethod == VS_INTERLACEMETHOD_RENDER_WEAVE) - presentmethod = PRESENT_METHOD_WEAVE; else if (deintMethod == VS_INTERLACEMETHOD_RENDER_BOB) presentmethod = PRESENT_METHOD_BOB; else @@ -942,7 +933,8 @@ bool CRenderManager::AddVideoPicture(const VideoPicture& picture, volatile std:: m.presentfield = displayField; m.presentmethod = presentmethod; m.pts = picture.pts; - requeue(m_queued, m_free); + m_queued.push_back(m_free.front()); + m_free.pop_front(); m_playerPort->UpdateRenderBuffers(m_queued.size(), m_discard.size(), m_free.size()); // signal to any waiters to check state @@ -1097,6 +1089,12 @@ void CRenderManager::PrepareNextRender() CLog::LogF(LOGDEBUG, LOGAVTIMING, "frameOnScreen: %f renderPts: %f nextFramePts: %f -> diff: %f render: %u forceNext: %u", frameOnScreen, renderPts, nextFramePts, (renderPts - nextFramePts), renderPts >= nextFramePts, m_forceNext); + if (m_presentsourcePast >= 0) + { + m_discard.push_back(m_presentsourcePast); + m_presentsourcePast = -1; + } + if (renderPts >= nextFramePts || m_forceNext) { // see if any future queued frames are already due @@ -1119,8 +1117,13 @@ void CRenderManager::PrepareNextRender() // skip late frames while (m_queued.front() != idx) { - requeue(m_discard, m_queued); - m_QueueSkip++; + if (m_presentsourcePast >= 0) + { + m_discard.push_back(m_presentsourcePast); + m_QueueSkip++; + } + m_presentsourcePast = m_queued.front(); + m_queued.pop_front(); } int lateframes = static_cast((renderPts - m_Queue[idx].pts) * m_fps / DVD_TIME_BASE); @@ -1138,6 +1141,16 @@ void CRenderManager::PrepareNextRender() m_playerPort->UpdateRenderBuffers(m_queued.size(), m_discard.size(), m_free.size()); } + else if (renderPts >= nextFramePts - frametime) + { + m_lateframes = 0; + m_presentstep = PRESENT_FLIP; + m_presentsourcePast = m_presentsource; + m_presentsource = m_queued.front(); + m_queued.pop_front(); + m_presentpts = m_Queue[m_presentsource].pts - m_displayLatency - frametime / 2; + m_presentevent.notifyAll(); + } } void CRenderManager::DiscardBuffer() @@ -1145,7 +1158,10 @@ void CRenderManager::DiscardBuffer() CSingleLock lock2(m_presentlock); while(!m_queued.empty()) - requeue(m_discard, m_queued); + { + m_discard.push_back(m_queued.front()); + m_queued.pop_front(); + } if(m_presentstep == PRESENT_READY) m_presentstep = PRESENT_IDLE; diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h index 4f2a634faa75e..55f1d1a278a5a 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h @@ -178,7 +178,6 @@ class CRenderManager { PRESENT_METHOD_SINGLE = 0, PRESENT_METHOD_BLEND, - PRESENT_METHOD_WEAVE, PRESENT_METHOD_BOB, }; @@ -228,6 +227,7 @@ class CRenderManager XbmcThreads::EndTime m_presentTimer; bool m_forceNext = false; int m_presentsource = 0; + int m_presentsourcePast = -1; XbmcThreads::ConditionVariable m_presentevent; CEvent m_flushEvent; CDVDClock &m_dvdClock; diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp index 379944523ddc9..d748c24e5911e 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp @@ -296,7 +296,7 @@ void CWinRenderer::Update() ManageTextures(); } -void CWinRenderer::RenderUpdate(int index, bool clear, unsigned int flags, unsigned int alpha) +void CWinRenderer::RenderUpdate(int index, int index2, bool clear, unsigned int flags, unsigned int alpha) { m_iYV12RenderBuffer = index; diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.h b/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.h index 50e293af55186..cd8f4eb0b8484 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.h @@ -63,7 +63,7 @@ class CWinRenderer : public CBaseRenderer bool IsConfigured() override { return m_bConfigured; } void Flush() override; CRenderInfo GetRenderInfo() override; - void RenderUpdate(int index, bool clear, unsigned int flags, unsigned int alpha) override; + void RenderUpdate(int index, int index2, bool clear, unsigned int flags, unsigned int alpha) override; void SetBufferSize(int numBuffers) override { m_neededBuffers = numBuffers; } void ReleaseBuffer(int idx) override; bool NeedBuffer(int idx) override; From ddcd9d2dc1e580b2005931b42576dbf16da81c8a Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Mon, 18 Sep 2017 16:55:10 +0200 Subject: [PATCH 086/113] VideoPlayer: frame advance --- xbmc/ApplicationPlayer.cpp | 7 +++++++ xbmc/ApplicationPlayer.h | 1 + xbmc/cores/IPlayer.h | 1 + xbmc/cores/VideoPlayer/DVDClock.cpp | 10 ++++++++++ xbmc/cores/VideoPlayer/DVDClock.h | 1 + xbmc/cores/VideoPlayer/DVDMessage.h | 1 + xbmc/cores/VideoPlayer/VideoPlayer.cpp | 15 +++++++++++++++ xbmc/cores/VideoPlayer/VideoPlayer.h | 1 + xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp | 2 +- xbmc/interfaces/builtins/PlayerBuiltins.cpp | 14 ++++++++++++++ 10 files changed, 52 insertions(+), 1 deletion(-) diff --git a/xbmc/ApplicationPlayer.cpp b/xbmc/ApplicationPlayer.cpp index 17dd190ca11b0..38dcd645064fb 100644 --- a/xbmc/ApplicationPlayer.cpp +++ b/xbmc/ApplicationPlayer.cpp @@ -523,6 +523,13 @@ void CApplicationPlayer::SetTempo(float tempo) player->SetTempo(tempo); } +void CApplicationPlayer::FrameAdvance(int frames) +{ + std::shared_ptr player = GetInternal(); + if (player) + player->FrameAdvance(frames); +} + void CApplicationPlayer::DoAudioWork() { std::shared_ptr player = GetInternal(); diff --git a/xbmc/ApplicationPlayer.h b/xbmc/ApplicationPlayer.h index 740adfae9e619..92115a00687ea 100644 --- a/xbmc/ApplicationPlayer.h +++ b/xbmc/ApplicationPlayer.h @@ -75,6 +75,7 @@ class CApplicationPlayer PlayBackRet OpenFile(const CFileItem& item, const CPlayerOptions& options); void SetPlaySpeed(float speed); void SetTempo(float tempo); + void FrameAdvance(int frames); void FrameMove(); void Render(bool clear, uint32_t alpha = 255, bool gui = true); diff --git a/xbmc/cores/IPlayer.h b/xbmc/cores/IPlayer.h index 8455ea4d64408..7940b1b8935ec 100644 --- a/xbmc/cores/IPlayer.h +++ b/xbmc/cores/IPlayer.h @@ -317,6 +317,7 @@ class IPlayer virtual void SetSpeed(float speed) = 0; virtual void SetTempo(float tempo) { }; virtual bool SupportsTempo() { return false; } + virtual void FrameAdvance(int frames) { }; //Returns true if not playback (paused or stopped being filled) virtual bool IsCaching() const {return false;}; diff --git a/xbmc/cores/VideoPlayer/DVDClock.cpp b/xbmc/cores/VideoPlayer/DVDClock.cpp index d4b06878f63de..9086df5f03223 100644 --- a/xbmc/cores/VideoPlayer/DVDClock.cpp +++ b/xbmc/cores/VideoPlayer/DVDClock.cpp @@ -122,6 +122,16 @@ void CDVDClock::Pause(bool pause) } } +void CDVDClock::Advance(double time) +{ + CSingleLock lock(m_critSection); + + if (m_pauseClock) + { + m_pauseClock += time / DVD_TIME_BASE * m_systemFrequency; + } +} + void CDVDClock::SetSpeed(int iSpeed) { // this will sometimes be a little bit of due to rounding errors, ie clock might jump a bit when changing speed diff --git a/xbmc/cores/VideoPlayer/DVDClock.h b/xbmc/cores/VideoPlayer/DVDClock.h index 76bd255d6d145..e528e9b48f5a3 100644 --- a/xbmc/cores/VideoPlayer/DVDClock.h +++ b/xbmc/cores/VideoPlayer/DVDClock.h @@ -65,6 +65,7 @@ class CDVDClock double GetVsyncAdjust(); void Pause(bool pause); + void Advance(double time); protected: double SystemToAbsolute(int64_t system); diff --git a/xbmc/cores/VideoPlayer/DVDMessage.h b/xbmc/cores/VideoPlayer/DVDMessage.h index ae32aea3aec61..82baacfc4936e 100644 --- a/xbmc/cores/VideoPlayer/DVDMessage.h +++ b/xbmc/cores/VideoPlayer/DVDMessage.h @@ -63,6 +63,7 @@ class CDVDMsg : public IDVDResourceCounted PLAYER_AVCHANGE, // signal a change in audio or video parameters PLAYER_ABORT, PLAYER_REPORT_STATE, + PLAYER_FRAME_ADVANCE, // demuxer related messages DEMUXER_PACKET, // data packet diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp index 8e9253b2667ef..6822f81d77903 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp @@ -2845,6 +2845,12 @@ void CVideoPlayer::HandleMessages() if (m_pDemuxer) m_pDemuxer->SetSpeed(speed); } + else if (pMsg->IsType(CDVDMsg::PLAYER_FRAME_ADVANCE)) + { + int frames = static_cast(pMsg)->m_value; + double time = DVD_TIME_BASE / m_processInfo->GetVideoFps() * frames; + m_clock.Advance(time); + } else if (pMsg->IsType(CDVDMsg::GENERAL_GUI_ACTION)) OnAction(static_cast*>(pMsg)->m_value); else if (pMsg->IsType(CDVDMsg::PLAYER_STARTED)) @@ -3427,6 +3433,15 @@ void CVideoPlayer::SetTempo(float tempo) } } +void CVideoPlayer::FrameAdvance(int frames) +{ + float currentSpeed = m_processInfo->GetNewSpeed(); + if (currentSpeed != DVD_PLAYSPEED_PAUSE) + return; + + m_messenger.Put(new CDVDMsgInt(CDVDMsg::PLAYER_FRAME_ADVANCE, frames)); +} + bool CVideoPlayer::SupportsTempo() { return m_canTempo; diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.h b/xbmc/cores/VideoPlayer/VideoPlayer.h index 7aba70e6a536b..50bd221c3e6a4 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.h +++ b/xbmc/cores/VideoPlayer/VideoPlayer.h @@ -359,6 +359,7 @@ class CVideoPlayer : public IPlayer, public CThread, public IVideoPlayer, public void SetSpeed(float speed) override; void SetTempo(float tempo) override; bool SupportsTempo() override; + void FrameAdvance(int frames) override; bool OnAction(const CAction &action) override; int GetSourceBitrate() override; diff --git a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp index 47b5201164871..beb12aef585e3 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp @@ -333,7 +333,7 @@ void CVideoPlayerVideo::Process() while (!m_bStop) { int iQueueTimeOut = (int)(m_stalled ? frametime : frametime * 10) / 1000; - int iPriority = (m_speed == DVD_PLAYSPEED_PAUSE && m_syncState == IDVDStreamPlayer::SYNC_INSYNC) ? 1 : 0; + int iPriority = 0; if (m_syncState == IDVDStreamPlayer::SYNC_WAITSYNC) iPriority = 1; diff --git a/xbmc/interfaces/builtins/PlayerBuiltins.cpp b/xbmc/interfaces/builtins/PlayerBuiltins.cpp index 08d5d1c5b6934..faa533e1cfc4b 100644 --- a/xbmc/interfaces/builtins/PlayerBuiltins.cpp +++ b/xbmc/interfaces/builtins/PlayerBuiltins.cpp @@ -137,6 +137,20 @@ static int PlayerControl(const std::vector& params) { g_application.StopPlaying(); } + else if (StringUtils::StartsWithNoCase(params[0], "frameadvance")) + { + std::string strFrames; + if (params[0].size() == 12) + CLog::Log(LOGERROR, "PlayerControl(frameadvance(n)) called with no argument"); + else if (params[0].size() < 15) // arg must be at least "(N)" + CLog::Log(LOGERROR, "PlayerControl(frameadvance(n)) called with invalid argument: \"%s\"", params[0].substr(13).c_str()); + else + + strFrames = params[0].substr(13); + StringUtils::TrimRight(strFrames, ")"); + float frames = (float) atof(strFrames.c_str()); + g_application.m_pPlayer->FrameAdvance(frames); + } else if (paramlow =="rewind" || paramlow == "forward") { if (g_application.m_pPlayer->IsPlaying() && !g_application.m_pPlayer->IsPaused()) From 2b28d14528cccb21556627a0f263d41bd9ae191c Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Mon, 18 Sep 2017 13:29:00 +0200 Subject: [PATCH 087/113] AE: fix sync of free buffers --- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 1 + xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp index e06b582ca9e1d..2857a8577db63 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp @@ -1478,6 +1478,7 @@ void CActiveAE::SFlushStream(CActiveAEStream *stream) stream->m_paused = false; stream->m_syncState = CAESyncInfo::AESyncState::SYNC_START; stream->m_syncError.Flush(); + stream->ResetFreeBuffers(); // flush the engine if we only have a single stream if (m_streams.size() == 1) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp index 84f54cebbc9a8..30e4fb267a59e 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp @@ -463,7 +463,6 @@ void CActiveAEStream::Flush() m_currentBuffer = NULL; m_leftoverBytes = 0; m_activeAE->FlushStream(this); - ResetFreeBuffers(); m_streamIsFlushed = true; } } From d97adad4179da885fcd6549079871a5cc0d88a46 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Mon, 18 Sep 2017 13:49:38 +0200 Subject: [PATCH 088/113] VideoPlayer: initialize renderState --- xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h index 55f1d1a278a5a..c977b9ddfab03 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.h @@ -187,7 +187,7 @@ class CRenderManager STATE_CONFIGURING, STATE_CONFIGURED, }; - ERENDERSTATE m_renderState; + ERENDERSTATE m_renderState = STATE_UNCONFIGURED; CEvent m_stateEvent; /// Display latency tweak value from AdvancedSettings for the current refresh rate From f9d338a2793a9c940c363f4dc34e488ae1cf8156 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Mon, 18 Sep 2017 19:46:10 +0200 Subject: [PATCH 089/113] VideoPlayer: do not combine 2 frames in a row --- xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp index 25ba4391d1d39..56ddb613c12ef 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp @@ -1089,10 +1089,12 @@ void CRenderManager::PrepareNextRender() CLog::LogF(LOGDEBUG, LOGAVTIMING, "frameOnScreen: %f renderPts: %f nextFramePts: %f -> diff: %f render: %u forceNext: %u", frameOnScreen, renderPts, nextFramePts, (renderPts - nextFramePts), renderPts >= nextFramePts, m_forceNext); + bool combined = false; if (m_presentsourcePast >= 0) { m_discard.push_back(m_presentsourcePast); m_presentsourcePast = -1; + combined = true; } if (renderPts >= nextFramePts || m_forceNext) @@ -1141,7 +1143,7 @@ void CRenderManager::PrepareNextRender() m_playerPort->UpdateRenderBuffers(m_queued.size(), m_discard.size(), m_free.size()); } - else if (renderPts >= nextFramePts - frametime) + else if (!combined && renderPts > (nextFramePts - frametime)) { m_lateframes = 0; m_presentstep = PRESENT_FLIP; From 56a260206a2c6abca0972fba8e43d779366cebcf Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Fri, 15 Sep 2017 13:05:32 -0700 Subject: [PATCH 090/113] X11: remove unused GetVisual functions --- xbmc/windowing/X11/GLContextEGL.cpp | 47 ----------------------------- xbmc/windowing/X11/GLContextEGL.h | 1 - 2 files changed, 48 deletions(-) diff --git a/xbmc/windowing/X11/GLContextEGL.cpp b/xbmc/windowing/X11/GLContextEGL.cpp index 68045f952cbd3..db4f30d312b69 100644 --- a/xbmc/windowing/X11/GLContextEGL.cpp +++ b/xbmc/windowing/X11/GLContextEGL.cpp @@ -363,50 +363,3 @@ void CGLContextEGL::QueryExtensions() CLog::Log(LOGDEBUG, "EGL_EXTENSIONS:%s", m_extensions.c_str()); } - -XVisualInfo* CGLContextEGL::GetVisual() -{ - GLint att[] = - { - EGL_RED_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_BLUE_SIZE, 8, - EGL_ALPHA_SIZE, 8, - EGL_BUFFER_SIZE, 32, - EGL_DEPTH_SIZE, 24, - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, - EGL_NONE - }; - - if (m_eglDisplay == EGL_NO_DISPLAY) - { - m_eglDisplay = eglGetDisplay((EGLNativeDisplayType)m_dpy); - if (m_eglDisplay == EGL_NO_DISPLAY) - { - CLog::Log(LOGERROR, "failed to get egl display\n"); - return NULL; - } - if (!eglInitialize(m_eglDisplay, NULL, NULL)) - { - CLog::Log(LOGERROR, "failed to initialize egl display\n"); - return NULL; - } - } - - EGLint numConfigs; - EGLConfig eglConfig = 0; - if (!eglChooseConfig(m_eglDisplay, att, &eglConfig, 1, &numConfigs) || numConfigs == 0) { - CLog::Log(LOGERROR, "Failed to choose a config %d\n", eglGetError()); - } - m_eglConfig=eglConfig; - - XVisualInfo x11_visual_info_template; - if (!eglGetConfigAttrib(m_eglDisplay, m_eglConfig, EGL_NATIVE_VISUAL_ID, (EGLint*)&x11_visual_info_template.visualid)) { - CLog::Log(LOGERROR, "Failed to query native visual id\n"); - } - int num_visuals; - return XGetVisualInfo(m_dpy, - VisualIDMask, - &x11_visual_info_template, - &num_visuals); -} diff --git a/xbmc/windowing/X11/GLContextEGL.h b/xbmc/windowing/X11/GLContextEGL.h index c0dbcfdb373b1..ae2ea88c67b06 100644 --- a/xbmc/windowing/X11/GLContextEGL.h +++ b/xbmc/windowing/X11/GLContextEGL.h @@ -35,7 +35,6 @@ class CGLContextEGL : public CGLContext void SetVSync(bool enable) override; void SwapBuffers() override; void QueryExtensions() override; - XVisualInfo* GetVisual(); EGLDisplay m_eglDisplay; EGLSurface m_eglSurface; EGLContext m_eglContext; From 53b30b8a9dbb89573171c5827fbceb92ea255221 Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Thu, 7 Sep 2017 22:16:01 -0700 Subject: [PATCH 091/113] x11: factor out glx support --- xbmc/windowing/X11/CMakeLists.txt | 11 +++-- xbmc/windowing/X11/WinSystemX11GLContext.cpp | 43 +++++++++++++------- xbmc/windowing/X11/WinSystemX11GLContext.h | 6 +++ 3 files changed, 41 insertions(+), 19 deletions(-) diff --git a/xbmc/windowing/X11/CMakeLists.txt b/xbmc/windowing/X11/CMakeLists.txt index ab138178396d0..965a06d580be8 100644 --- a/xbmc/windowing/X11/CMakeLists.txt +++ b/xbmc/windowing/X11/CMakeLists.txt @@ -1,23 +1,26 @@ set(SOURCES GLContextEGL.cpp - GLContextGLX.cpp GLContext.cpp OSScreenSaverX11.cpp WinEventsX11.cpp WinSystemX11.cpp WinSystemX11GLContext.cpp XRandR.cpp - VideoSyncGLX.cpp VideoSyncDRM.cpp) set(HEADERS GLContext.h GLContextEGL.h - GLContextGLX.h OSScreenSaverX11.h WinEventsX11.h WinSystemX11.h WinSystemX11GLContext.h XRandR.h - VideoSyncGLX.h VideoSyncDRM.h) +if(GLX_FOUND) + list(APPEND SOURCES GLContextGLX.cpp + VideoSyncGLX.cpp) + list(APPEND HEADERS GLContextGLX.h + VideoSyncGLX.h) +endif() + core_add_library(windowing_X11) diff --git a/xbmc/windowing/X11/WinSystemX11GLContext.cpp b/xbmc/windowing/X11/WinSystemX11GLContext.cpp index 3936f423a0943..bddfbd2ce749e 100644 --- a/xbmc/windowing/X11/WinSystemX11GLContext.cpp +++ b/xbmc/windowing/X11/WinSystemX11GLContext.cpp @@ -23,7 +23,6 @@ #include #include "WinSystemX11GLContext.h" -#include "GLContextGLX.h" #include "GLContextEGL.h" #include "utils/log.h" #include "utils/StringUtils.h" @@ -33,7 +32,12 @@ #include #include "Application.h" #include "VideoSyncDRM.h" + +#ifdef HAS_GLX #include "VideoSyncGLX.h" +#include "GLContextGLX.h" +#endif // HAS_GLX + #include "cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.h" #include "cores/VideoPlayer/Process/X11/ProcessInfoX11.h" #include "cores/VideoPlayer/VideoRenderers/LinuxRendererGL.h" @@ -50,7 +54,7 @@ void CWinSystemX11GLContext::PresentRenderImpl(bool rendered) { if (rendered) m_pGLContext->SwapBuffers(); - + if (m_delayDispReset && m_dispResetTimer.IsTimePast()) { m_delayDispReset = false; @@ -74,6 +78,7 @@ bool CWinSystemX11GLContext::IsExtSupported(const char* extension) return m_pGLContext->IsExtSupported(extension); } +#ifdef HAS_GLX GLXWindow CWinSystemX11GLContext::GetWindow() const { return static_cast(m_pGLContext)->m_glxWindow; @@ -83,6 +88,7 @@ GLXContext CWinSystemX11GLContext::GetGlxContext() const { return static_cast(m_pGLContext)->m_glxContext; } +#endif // HAS_GLX EGLDisplay CWinSystemX11GLContext::GetEGLDisplay() const { @@ -177,18 +183,20 @@ bool CWinSystemX11GLContext::DestroyWindow() XVisualInfo* CWinSystemX11GLContext::GetVisual() { - GLint att[] = - { - GLX_RGBA, - GLX_RED_SIZE, 8, - GLX_GREEN_SIZE, 8, - GLX_BLUE_SIZE, 8, - GLX_ALPHA_SIZE, 8, - GLX_DEPTH_SIZE, 24, - GLX_DOUBLEBUFFER, - None - }; - return glXChooseVisual(m_dpy, m_nScreen, att); + int count = 0; + XVisualInfo vTemplate; + XVisualInfo *visual = nullptr; + + int vMask = VisualScreenMask | VisualDepthMask | VisualClassMask | VisualBitsPerRGBMask; + + vTemplate.screen = m_nScreen; + vTemplate.depth = 24; + vTemplate.c_class = TrueColor; + vTemplate.bits_per_rgb = 8; + + visual = XGetVisualInfo(m_dpy, vMask, &vTemplate, &count); + + return visual; } #if defined (HAVE_LIBVA) @@ -236,9 +244,11 @@ bool CWinSystemX11GLContext::RefreshGLContext(bool force) #endif return success; } - delete m_pGLContext; } +#ifdef HAS_GLX + delete m_pGLContext; + // fallback for vdpau m_pGLContext = new CGLContextGLX(m_dpy); success = m_pGLContext->Refresh(force, m_nScreen, m_glWindow, m_newGlContext); @@ -249,6 +259,7 @@ bool CWinSystemX11GLContext::RefreshGLContext(bool force) CRendererVDPAU::Register(); #endif } +#endif // HAS_GLX return success; } @@ -260,10 +271,12 @@ std::unique_ptr CWinSystemX11GLContext::GetVideoSync(void *clock) { pVSync.reset(new CVideoSyncDRM(clock)); } +#ifdef HAS_GLX else if (dynamic_cast(m_pGLContext)) { pVSync.reset(new CVideoSyncGLX(clock)); } +#endif // HAS_GLX return pVSync; } diff --git a/xbmc/windowing/X11/WinSystemX11GLContext.h b/xbmc/windowing/X11/WinSystemX11GLContext.h index 4debaff3faadb..405ac09771ccd 100644 --- a/xbmc/windowing/X11/WinSystemX11GLContext.h +++ b/xbmc/windowing/X11/WinSystemX11GLContext.h @@ -21,7 +21,11 @@ #pragma once #include "WinSystemX11.h" + +#ifdef HAS_GLX #include "GL/glx.h" +#endif // HAS_GLX + #include "EGL/egl.h" #include "rendering/gl/RenderSystemGL.h" #include "utils/GlobalsHandling.h" @@ -44,8 +48,10 @@ class CWinSystemX11GLContext : public CWinSystemX11, public CRenderSystemGL // videosync std::unique_ptr GetVideoSync(void *clock) override; +#ifdef HAS_GLX GLXWindow GetWindow() const; GLXContext GetGlxContext() const; +#endif // HAS_GLX EGLDisplay GetEGLDisplay() const; EGLSurface GetEGLSurface() const; EGLContext GetEGLContext() const; From 6d18ff7cfdf93af8cf2f9f3c8f02be2ac5ede91a Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Fri, 8 Sep 2017 00:03:19 -0700 Subject: [PATCH 092/113] [cmake] require glx when using vdpau --- cmake/platform/linux/x11.cmake | 4 ++-- cmake/scripts/linux/ArchSetup.cmake | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/platform/linux/x11.cmake b/cmake/platform/linux/x11.cmake index edea24de483c7..656fd665726fc 100644 --- a/cmake/platform/linux/x11.cmake +++ b/cmake/platform/linux/x11.cmake @@ -1,2 +1,2 @@ -set(PLATFORM_REQUIRED_DEPS OpenGl EGL X XRandR LibDRM GLX) -set(PLATFORM_OPTIONAL_DEPS VAAPI VDPAU) +set(PLATFORM_REQUIRED_DEPS OpenGl EGL X XRandR LibDRM) +set(PLATFORM_OPTIONAL_DEPS VAAPI VDPAU GLX) diff --git a/cmake/scripts/linux/ArchSetup.cmake b/cmake/scripts/linux/ArchSetup.cmake index 74018d0e76e53..fb350f88f9b7b 100644 --- a/cmake/scripts/linux/ArchSetup.cmake +++ b/cmake/scripts/linux/ArchSetup.cmake @@ -80,3 +80,7 @@ if(ENABLE_GBM) set(ENABLE_VDPAU OFF CACHE BOOL "Disabling VDPAU" FORCE) set(ENABLE_VAAPI OFF CACHE BOOL "Disabling VAAPI" FORCE) endif() + +if(ENABLE_VDPAU) + set(ENABLE_GLX ON CACHE BOOL "Enabling GLX" FORCE) +endif() From f2ca8d0d9fecfbedcab60519d0bed2975081d793 Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Fri, 8 Sep 2017 10:53:10 -0700 Subject: [PATCH 093/113] [cleanup] exchange HAS_GLX for HAVE_X11 --- system/settings/settings.xml | 2 +- xbmc/Application.cpp | 2 +- xbmc/settings/DisplaySettings.cpp | 6 +++--- xbmc/settings/SettingConditions.cpp | 3 --- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/system/settings/settings.xml b/system/settings/settings.xml index cd12dfdc56b80..6d10a4d632339 100755 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -2117,7 +2117,7 @@ - HAS_GLX + HAVE_X11 HAVE_WAYLAND diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 4b4af2ca5576d..424c0f30b7d1f 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -285,7 +285,7 @@ CApplication::CApplication(void) { TiXmlBase::SetCondenseWhiteSpace(false); -#ifdef HAS_GLX +#ifdef HAVE_X11 XInitThreads(); #endif } diff --git a/xbmc/settings/DisplaySettings.cpp b/xbmc/settings/DisplaySettings.cpp index 1abc964535345..c14e1febc9e04 100644 --- a/xbmc/settings/DisplaySettings.cpp +++ b/xbmc/settings/DisplaySettings.cpp @@ -326,7 +326,7 @@ bool CDisplaySettings::OnSettingChanging(std::shared_ptr setting return true; } -#if defined(HAS_GLX) +#if defined(HAVE_X11) else if (settingId == CSettings::SETTING_VIDEOSCREEN_BLANKDISPLAYS) { g_Windowing.UpdateResolutions(); @@ -727,7 +727,7 @@ void CDisplaySettings::SettingOptionsScreensFiller(SettingConstPtr setting, std: if (g_advancedSettings.m_canWindowed && g_Windowing.CanDoWindowed()) list.push_back(std::make_pair(g_localizeStrings.Get(242), DM_WINDOWED)); -#if defined(HAS_GLX) || defined(HAVE_WAYLAND) +#if defined(HAVE_X11) || defined(HAVE_WAYLAND) list.push_back(std::make_pair(g_localizeStrings.Get(244), 0)); #else @@ -778,7 +778,7 @@ void CDisplaySettings::SettingOptionsPreferredStereoscopicViewModesFiller(Settin void CDisplaySettings::SettingOptionsMonitorsFiller(SettingConstPtr setting, std::vector< std::pair > &list, std::string ¤t, void *data) { -#if defined(HAS_GLX) +#if defined(HAVE_X11) std::vector monitors; g_Windowing.GetConnectedOutputs(&monitors); std::string currentMonitor = CServiceBroker::GetSettings().GetString(CSettings::SETTING_VIDEOSCREEN_MONITOR); diff --git a/xbmc/settings/SettingConditions.cpp b/xbmc/settings/SettingConditions.cpp index 456d37a4cb4ab..d7cb995e63a42 100644 --- a/xbmc/settings/SettingConditions.cpp +++ b/xbmc/settings/SettingConditions.cpp @@ -294,9 +294,6 @@ void CSettingConditions::Initialize() #ifdef HAS_GL m_simpleConditions.insert("has_gl"); #endif -#ifdef HAS_GLX - m_simpleConditions.insert("has_glx"); -#endif #ifdef HAS_GLES m_simpleConditions.insert("has_gles"); #endif From efa8204873884c5654ea0828467d7d5ac866dcc5 Mon Sep 17 00:00:00 2001 From: Rechi Date: Tue, 19 Sep 2017 09:24:09 +0200 Subject: [PATCH 094/113] [cleanup][osx] remove Is(Lion|SnowLeopard) check functions minimum required OS X version is already higher (10.8 - Mountain Lion) --- system/settings/darwin_osx.xml | 7 ----- xbmc/platform/darwin/DarwinUtils.h | 2 -- xbmc/platform/darwin/DarwinUtils.mm | 35 ---------------------- xbmc/settings/SettingConditions.cpp | 4 --- xbmc/storage/osx/DarwinStorageProvider.cpp | 6 ---- 5 files changed, 54 deletions(-) diff --git a/system/settings/darwin_osx.xml b/system/settings/darwin_osx.xml index 852f524618d0f..b48031c2aa294 100644 --- a/system/settings/darwin_osx.xml +++ b/system/settings/darwin_osx.xml @@ -1,13 +1,6 @@
- - - - OsxIsSnowLeopard - - - diff --git a/xbmc/platform/darwin/DarwinUtils.h b/xbmc/platform/darwin/DarwinUtils.h index 19c7ee713e925..6a11b125d679a 100644 --- a/xbmc/platform/darwin/DarwinUtils.h +++ b/xbmc/platform/darwin/DarwinUtils.h @@ -32,8 +32,6 @@ class CDarwinUtils public: static const char *getIosPlatformString(void); static bool IsMavericks(void); - static bool IsLion(void); - static bool IsSnowLeopard(void); static bool DeviceHasRetina(double &scale); static bool DeviceHasLeakyVDA(void); static const char *GetOSReleaseString(void); diff --git a/xbmc/platform/darwin/DarwinUtils.mm b/xbmc/platform/darwin/DarwinUtils.mm index 63f75f8ca8b5e..7c5a94a35081e 100644 --- a/xbmc/platform/darwin/DarwinUtils.mm +++ b/xbmc/platform/darwin/DarwinUtils.mm @@ -43,14 +43,6 @@ #import "AutoPool.h" #import "DarwinUtils.h" -#ifndef NSAppKitVersionNumber10_5 -#define NSAppKitVersionNumber10_5 949 -#endif - -#ifndef NSAppKitVersionNumber10_6 -#define NSAppKitVersionNumber10_6 1038 -#endif - #ifndef NSAppKitVersionNumber10_9 #define NSAppKitVersionNumber10_9 1265 #endif @@ -232,33 +224,6 @@ enum iosPlatform getIosPlatform() return isMavericks == 1; } -bool CDarwinUtils::IsLion(void) -{ - static int isLion = -1; -#if defined(TARGET_DARWIN_OSX) - if (isLion == -1) - { - double appKitVersion = floor(NSAppKitVersionNumber); - // everything lower 10.8 is 10.7.x because 10.7 is deployment target... - isLion = (appKitVersion < NSAppKitVersionNumber10_8) ? 1 : 0; - } -#endif - return isLion == 1; -} - -bool CDarwinUtils::IsSnowLeopard(void) -{ - static int isSnowLeopard = -1; -#if defined(TARGET_DARWIN_OSX) - if (isSnowLeopard == -1) - { - double appKitVersion = floor(NSAppKitVersionNumber); - isSnowLeopard = (appKitVersion <= NSAppKitVersionNumber10_6 && appKitVersion > NSAppKitVersionNumber10_5) ? 1 : 0; - } -#endif - return isSnowLeopard == 1; -} - bool CDarwinUtils::DeviceHasRetina(double &scale) { static enum iosPlatform platform = iDeviceUnknown; diff --git a/xbmc/settings/SettingConditions.cpp b/xbmc/settings/SettingConditions.cpp index d7cb995e63a42..237b2540e21d7 100644 --- a/xbmc/settings/SettingConditions.cpp +++ b/xbmc/settings/SettingConditions.cpp @@ -331,10 +331,6 @@ void CSettingConditions::Initialize() if (aml_present()) m_simpleConditions.insert("have_amcodec"); #endif -#ifdef TARGET_DARWIN_OSX - if (CDarwinUtils::IsSnowLeopard()) - m_simpleConditions.insert("osxissnowleopard"); -#endif #if defined(TARGET_WINDOWS) m_simpleConditions.insert("has_dx"); m_simpleConditions.insert("hasdxva2"); diff --git a/xbmc/storage/osx/DarwinStorageProvider.cpp b/xbmc/storage/osx/DarwinStorageProvider.cpp index 6d3020f75cfd3..6d43f1e0cc1cd 100644 --- a/xbmc/storage/osx/DarwinStorageProvider.cpp +++ b/xbmc/storage/osx/DarwinStorageProvider.cpp @@ -76,9 +76,6 @@ void CDarwinStorageProvider::GetLocalDrives(VECSOURCES &localDrives) share.m_ignore = true; localDrives.push_back(share); - if (CDarwinUtils::IsLion()) - return; //temp workaround for crash in Cocoa_GetVolumeNameFromMountPoint on 10.7.x - // This will pick up all local non-removable disks including the Root Disk. DASessionRef session = DASessionCreate(kCFAllocatorDefault); if (session) @@ -123,9 +120,6 @@ void CDarwinStorageProvider::GetRemovableDrives(VECSOURCES &removableDrives) { #if defined(TARGET_DARWIN_OSX) - if (CDarwinUtils::IsLion()) - return; //temp workaround for crash in Cocoa_GetVolumeNameFromMountPoint on 10.7.x - DASessionRef session = DASessionCreate(kCFAllocatorDefault); if (session) { From d0621d685619485567a00455ebd6cf73a1b73d45 Mon Sep 17 00:00:00 2001 From: Rechi Date: Tue, 19 Sep 2017 09:24:09 +0200 Subject: [PATCH 095/113] [cleanup][osx] remove unused DeviceHasLeakyVDA function unused since the switch to VideoToolbox --- xbmc/platform/darwin/DarwinUtils.h | 1 - xbmc/platform/darwin/DarwinUtils.mm | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/xbmc/platform/darwin/DarwinUtils.h b/xbmc/platform/darwin/DarwinUtils.h index 6a11b125d679a..3de594f8966ef 100644 --- a/xbmc/platform/darwin/DarwinUtils.h +++ b/xbmc/platform/darwin/DarwinUtils.h @@ -33,7 +33,6 @@ class CDarwinUtils static const char *getIosPlatformString(void); static bool IsMavericks(void); static bool DeviceHasRetina(double &scale); - static bool DeviceHasLeakyVDA(void); static const char *GetOSReleaseString(void); static const char *GetOSVersionString(void); static float GetIOSVersion(void); diff --git a/xbmc/platform/darwin/DarwinUtils.mm b/xbmc/platform/darwin/DarwinUtils.mm index 7c5a94a35081e..573bc8da07d8b 100644 --- a/xbmc/platform/darwin/DarwinUtils.mm +++ b/xbmc/platform/darwin/DarwinUtils.mm @@ -250,16 +250,6 @@ enum iosPlatform getIosPlatform() return (platform >= iPhone4); } -bool CDarwinUtils::DeviceHasLeakyVDA(void) -{ - static int hasLeakyVDA = -1; -#if defined(TARGET_DARWIN_OSX) - if (hasLeakyVDA == -1) - hasLeakyVDA = NSAppKitVersionNumber <= NSAppKitVersionNumber10_9 ? 1 : 0; -#endif - return hasLeakyVDA == 1; -} - const char *CDarwinUtils::GetOSReleaseString(void) { static std::string osreleaseStr; From 0899da1aceca99250d8476d73a43fc8f73834afe Mon Sep 17 00:00:00 2001 From: Rechi Date: Tue, 19 Sep 2017 09:24:09 +0200 Subject: [PATCH 096/113] [osx] rename IsMavericks function to IsMavericksOrHigher --- .../VideoPlayer/VideoRenderers/LinuxRendererGL.cpp | 2 +- xbmc/platform/darwin/DarwinUtils.h | 2 +- xbmc/platform/darwin/DarwinUtils.mm | 5 +++-- xbmc/platform/darwin/osx/SDLMain.mm | 2 +- xbmc/windowing/osx/WinSystemOSX.mm | 10 +++++----- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp index 7b70d43207126..0c25e9e1a7d03 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGL.cpp @@ -272,7 +272,7 @@ bool CLinuxRendererGL::Configure(const VideoPicture &picture, float fps, unsigne // on osx 10.9 mavericks we get a strange ripple // effect when rendering with pbo // when used on intel gpu - we have to quirk it here - if (CDarwinUtils::IsMavericks()) + if (CDarwinUtils::IsMavericksOrHigher()) { std::string rendervendor = g_Windowing.GetRenderVendor(); StringUtils::ToLower(rendervendor); diff --git a/xbmc/platform/darwin/DarwinUtils.h b/xbmc/platform/darwin/DarwinUtils.h index 3de594f8966ef..fee6d60291527 100644 --- a/xbmc/platform/darwin/DarwinUtils.h +++ b/xbmc/platform/darwin/DarwinUtils.h @@ -31,7 +31,7 @@ class CDarwinUtils { public: static const char *getIosPlatformString(void); - static bool IsMavericks(void); + static bool IsMavericksOrHigher(void); static bool DeviceHasRetina(double &scale); static const char *GetOSReleaseString(void); static const char *GetOSVersionString(void); diff --git a/xbmc/platform/darwin/DarwinUtils.mm b/xbmc/platform/darwin/DarwinUtils.mm index 573bc8da07d8b..e2d6aa55f53ec 100644 --- a/xbmc/platform/darwin/DarwinUtils.mm +++ b/xbmc/platform/darwin/DarwinUtils.mm @@ -207,7 +207,7 @@ enum iosPlatform getIosPlatform() return eDev; } -bool CDarwinUtils::IsMavericks(void) +bool CDarwinUtils::IsMavericksOrHigher(void) { static int isMavericks = -1; #if defined(TARGET_DARWIN_OSX) @@ -217,8 +217,9 @@ enum iosPlatform getIosPlatform() // us when mavericks came out if (isMavericks == -1) { - CLog::Log(LOGDEBUG, "Detected Mavericks..."); isMavericks = [NSProcessInfo instancesRespondToSelector:@selector(beginActivityWithOptions:reason:)] == TRUE ? 1 : 0; + if (isMavericks == 1) + CLog::Log(LOGDEBUG, "Detected Mavericks or higher ..."); } #endif return isMavericks == 1; diff --git a/xbmc/platform/darwin/osx/SDLMain.mm b/xbmc/platform/darwin/osx/SDLMain.mm index 407090e5b1c98..f7aa09a81b5ca 100644 --- a/xbmc/platform/darwin/osx/SDLMain.mm +++ b/xbmc/platform/darwin/osx/SDLMain.mm @@ -536,7 +536,7 @@ int main(int argc, char *argv[]) // as the whole ProcessSerialNumber approach is deprecated // in that case assume finder launch - else // we wouldn't handle documents/movies someone dragged on the app icon - if (CDarwinUtils::IsMavericks()) + if (CDarwinUtils::IsMavericksOrHigher()) gFinderLaunch = TRUE; // Ensure the application object is initialised diff --git a/xbmc/windowing/osx/WinSystemOSX.mm b/xbmc/windowing/osx/WinSystemOSX.mm index 7d2e99b89dc95..d4fc9ac0106f7 100644 --- a/xbmc/windowing/osx/WinSystemOSX.mm +++ b/xbmc/windowing/osx/WinSystemOSX.mm @@ -801,7 +801,7 @@ static void DisplayReconfigured(CGDirectDisplayID display, { bool ret = ResizeWindow(newWidth, newHeight, newLeft, newTop); - if( CDarwinUtils::IsMavericks() ) + if( CDarwinUtils::IsMavericksOrHigher() ) { NSView * last_view = (NSView *)additional; if (last_view && [last_view window]) @@ -978,7 +978,7 @@ static void DisplayReconfigured(CGDirectDisplayID display, [newContext setView:blankView]; // Hide the menu bar. - if (GetDisplayID(res.iScreen) == kCGDirectMainDisplay || CDarwinUtils::IsMavericks() ) + if (GetDisplayID(res.iScreen) == kCGDirectMainDisplay || CDarwinUtils::IsMavericksOrHigher() ) SetMenuBarVisible(false); // Blank other displays if requested. @@ -1012,7 +1012,7 @@ static void DisplayReconfigured(CGDirectDisplayID display, CGDisplayCapture(GetDisplayID(res.iScreen)); // If we don't hide menu bar, it will get events and interrupt the program. - if (GetDisplayID(res.iScreen) == kCGDirectMainDisplay || CDarwinUtils::IsMavericks() ) + if (GetDisplayID(res.iScreen) == kCGDirectMainDisplay || CDarwinUtils::IsMavericksOrHigher() ) SetMenuBarVisible(false); } @@ -1040,7 +1040,7 @@ static void DisplayReconfigured(CGDirectDisplayID display, [NSCursor unhide]; // Show menubar. - if (GetDisplayID(res.iScreen) == kCGDirectMainDisplay || CDarwinUtils::IsMavericks() ) + if (GetDisplayID(res.iScreen) == kCGDirectMainDisplay || CDarwinUtils::IsMavericksOrHigher() ) SetMenuBarVisible(true); if (CServiceBroker::GetSettings().GetBool(CSettings::SETTING_VIDEOSCREEN_FAKEFULLSCREEN)) @@ -1614,7 +1614,7 @@ static void DisplayReconfigured(CGDirectDisplayID display, // find the screenID NSDictionary* screenInfo = [[window screen] deviceDescription]; NSNumber* screenID = [screenInfo objectForKey:@"NSScreenNumber"]; - if ((CGDirectDisplayID)[screenID longValue] == kCGDirectMainDisplay || CDarwinUtils::IsMavericks() ) + if ((CGDirectDisplayID)[screenID longValue] == kCGDirectMainDisplay || CDarwinUtils::IsMavericksOrHigher() ) { SetMenuBarVisible(false); } From f2b1d2c492ad785d6adc6dcfffacc75adb3b16c5 Mon Sep 17 00:00:00 2001 From: fritsch Date: Tue, 19 Sep 2017 12:52:55 +0200 Subject: [PATCH 097/113] GLContextGLX: Do not verify ALPHA size --- xbmc/windowing/X11/GLContextGLX.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/xbmc/windowing/X11/GLContextGLX.cpp b/xbmc/windowing/X11/GLContextGLX.cpp index 033b825d9c450..c50020d22ba1c 100644 --- a/xbmc/windowing/X11/GLContextGLX.cpp +++ b/xbmc/windowing/X11/GLContextGLX.cpp @@ -153,9 +153,7 @@ bool CGLContextGLX::IsSuitableVisual(XVisualInfo *vInfo) return false; if (glXGetConfig(m_dpy, vInfo, GLX_BLUE_SIZE, &value) || value < 8) return false; - if (glXGetConfig(m_dpy, vInfo, GLX_ALPHA_SIZE, &value) || value < 8) - return false; - if (glXGetConfig(m_dpy, vInfo, GLX_DEPTH_SIZE, &value) || value < 8) + if (glXGetConfig(m_dpy, vInfo, GLX_DEPTH_SIZE, &value) || value < 24) return false; return true; From 87ce7cccb31a5df4e946a8b9fc878a2e985d6625 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Tue, 19 Sep 2017 23:08:50 +0200 Subject: [PATCH 098/113] CSetCurrentItemJob: CFileItem instances need to by copied before they can be used safely in another thread (here, the job worker thread). --- xbmc/Application.cpp | 2 +- xbmc/GUIInfoManager.cpp | 8 ++++---- xbmc/GUIInfoManager.h | 2 +- xbmc/cores/VideoPlayer/VideoPlayerRadioRDS.cpp | 6 ++---- xbmc/pvr/PVRGUIChannelNavigator.cpp | 6 +++--- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 424c0f30b7d1f..3e224726cb0ea 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -4171,7 +4171,7 @@ bool CApplication::OnMessage(CGUIMessage& message) CServiceBroker::GetPlaylistPlayer().SetCurrentSong(m_nextPlaylistItem); m_itemCurrentFile.reset(new CFileItem(*item)); } - g_infoManager.SetCurrentItem(m_itemCurrentFile); + g_infoManager.SetCurrentItem(*m_itemCurrentFile); g_partyModeManager.OnSongChange(true); CVariant param; diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index 6200374858acb..43a8bc7d4a402 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -127,7 +127,8 @@ class CSetCurrentItemJob : public CJob { CFileItemPtr m_itemCurrentFile; public: - explicit CSetCurrentItemJob(const CFileItemPtr& item) : m_itemCurrentFile(item) { } + explicit CSetCurrentItemJob(const CFileItem& item) : m_itemCurrentFile(std::make_shared(item)) { } + ~CSetCurrentItemJob(void) override = default; bool DoWork(void) override @@ -8990,7 +8991,7 @@ void CGUIInfoManager::ResetCurrentItem() m_currentMovieDuration = ""; } -void CGUIInfoManager::SetCurrentItem(const CFileItemPtr item) +void CGUIInfoManager::SetCurrentItem(const CFileItem &item) { CSetCurrentItemJob *job = new CSetCurrentItemJob(item); CJobManager::GetInstance().AddJob(job, NULL); @@ -11030,13 +11031,12 @@ void CGUIInfoManager::OnApplicationMessage(KODI::MESSAGING::ThreadMessage* pMsg) if (!item) return; - CFileItemPtr itemptr(item); if (pMsg->param1 == 1 && item->HasMusicInfoTag()) // only grab music tag SetCurrentSongTag(*item->GetMusicInfoTag()); else if (pMsg->param1 == 2 && item->HasVideoInfoTag()) // only grab video tag SetCurrentVideoTag(*item->GetVideoInfoTag()); else - SetCurrentItem(itemptr); + SetCurrentItem(*item); } break; diff --git a/xbmc/GUIInfoManager.h b/xbmc/GUIInfoManager.h index 4199df9885a56..8b434e7d572bc 100644 --- a/xbmc/GUIInfoManager.h +++ b/xbmc/GUIInfoManager.h @@ -151,7 +151,7 @@ friend CSetCurrentItemJob; /*! \brief Set currently playing file item \param blocking whether to run in current thread (true) or background thread (false) */ - void SetCurrentItem(const CFileItemPtr item); + void SetCurrentItem(const CFileItem &item); void ResetCurrentItem(); // Current song stuff /// \brief Retrieves tag info (if necessary) and fills in our current song path. diff --git a/xbmc/cores/VideoPlayer/VideoPlayerRadioRDS.cpp b/xbmc/cores/VideoPlayer/VideoPlayerRadioRDS.cpp index af729d83e82c2..4855f83a0d1b8 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayerRadioRDS.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayerRadioRDS.cpp @@ -629,8 +629,7 @@ void CDVDRadioRDSData::ResetRDSCache() m_currentInfoTag = CPVRRadioRDSInfoTag::CreateDefaultTag(); m_currentChannel = g_application.CurrentFileItem().GetPVRChannelInfoTag(); g_application.CurrentFileItem().SetPVRRadioRDSInfoTag(m_currentInfoTag); - CFileItemPtr itemptr(new CFileItem(g_application.CurrentFileItem())); - g_infoManager.SetCurrentItem(itemptr); + g_infoManager.SetCurrentItem(g_application.CurrentFileItem()); // send a message to all windows to tell them to update the radiotext CGUIMessage msg(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_UPDATE_RADIOTEXT); @@ -857,8 +856,7 @@ void CDVDRadioRDSData::ProcessUECP(const unsigned char *data, unsigned int len) if (m_currentFileUpdate && !m_bStop) { - CFileItemPtr itemptr(new CFileItem(g_application.CurrentFileItem())); - g_infoManager.SetCurrentItem(itemptr); + g_infoManager.SetCurrentItem(g_application.CurrentFileItem()); m_currentFileUpdate = false; } } diff --git a/xbmc/pvr/PVRGUIChannelNavigator.cpp b/xbmc/pvr/PVRGUIChannelNavigator.cpp index 221ff53f61d00..6c4132e38e642 100644 --- a/xbmc/pvr/PVRGUIChannelNavigator.cpp +++ b/xbmc/pvr/PVRGUIChannelNavigator.cpp @@ -83,7 +83,7 @@ namespace PVR void CPVRGUIChannelNavigator::SelectChannel(const CPVRChannelPtr channel, ChannelSwitchMode eSwitchMode) { - g_infoManager.SetCurrentItem(CFileItemPtr(new CFileItem(channel))); + g_infoManager.SetCurrentItem(CFileItem(channel)); CSingleLock lock(m_critSection); m_currentChannel = channel; @@ -183,7 +183,7 @@ namespace PVR } if (item) - g_infoManager.SetCurrentItem(item); + g_infoManager.SetCurrentItem(*item); } void CPVRGUIChannelNavigator::ToggleInfo() @@ -209,7 +209,7 @@ namespace PVR } if (item) - g_infoManager.SetCurrentItem(item); + g_infoManager.SetCurrentItem(*item); ShowInfo(false); } From d30557642976d9c7c782a9cff845d5bc07832eeb Mon Sep 17 00:00:00 2001 From: rbuehlma Date: Wed, 20 Sep 2017 12:43:21 +0200 Subject: [PATCH 099/113] Open EPG instead of channel window (#12812) --- system/keymaps/remote.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/keymaps/remote.xml b/system/keymaps/remote.xml index 4367ff1034980..7b1dfba844902 100644 --- a/system/keymaps/remote.xml +++ b/system/keymaps/remote.xml @@ -196,7 +196,7 @@ PlayerProcessInfo Info - ActivateWindow(PVRChannelGuide) + ActivateWindow(TVGuide) ActivateWindow(Teletext) NextSubtitle NextSubtitle @@ -259,7 +259,7 @@ OSD OSD Info - ActivateWindow(PVRChannelGuide) + ActivateWindow(TVGuide) ActivateWindow(PVROSDChannels) Number0 Number1 From e2042c59bfbccc9a03b025e7006f524632feed49 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Tue, 19 Sep 2017 20:03:34 +0200 Subject: [PATCH 100/113] VideoPlayer: flush audio on resync if clock is far ahead --- xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp index 78ab1f79ab11d..935ca947ab824 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp @@ -315,7 +315,12 @@ void CVideoPlayerAudio::Process() CLog::Log(LOGDEBUG, "CVideoPlayerAudio - CDVDMsg::GENERAL_RESYNC(%f), level: %d, cache: %f", pts, m_messageQueue.GetLevel(), m_audioSink.GetDelay()); - m_audioClock = pts + m_audioSink.GetDelay(); + double delay = m_audioSink.GetDelay(); + if (pts > m_audioClock - delay + 0.5 * DVD_TIME_BASE) + { + m_audioSink.Flush(); + } + m_audioClock = pts + delay; if (m_speed != DVD_PLAYSPEED_PAUSE) m_audioSink.Resume(); m_syncState = IDVDStreamPlayer::SYNC_INSYNC; @@ -501,7 +506,7 @@ bool CVideoPlayerAudio::ProcessDecoderOutput(DVDAudioFrame &audioframe) audioframe.framesOut += framesOutput; // signal to our parent that we have initialized - if(m_syncState == IDVDStreamPlayer::SYNC_STARTING) + if (m_syncState == IDVDStreamPlayer::SYNC_STARTING) { double cachetotal = DVD_SEC_TO_TIME(m_audioSink.GetCacheTotal()); double cachetime = m_audioSink.GetDelay(); From bf0740e700d29bce952884323ae493a88f9bbff3 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Wed, 20 Sep 2017 20:01:15 +0200 Subject: [PATCH 101/113] VideoPlayer: fix audio cache times --- .../AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 7 ++++++- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h | 6 ++++-- .../Engines/ActiveAE/ActiveAEStream.cpp | 7 ++++++- .../AudioEngine/Engines/ActiveAE/ActiveAEStream.h | 1 + xbmc/cores/AudioEngine/Interfaces/AEStream.h | 6 ++++++ xbmc/cores/VideoPlayer/AudioSinkAE.cpp | 14 +++++++++++--- xbmc/cores/VideoPlayer/AudioSinkAE.h | 3 ++- xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp | 10 +++++----- 8 files changed, 41 insertions(+), 13 deletions(-) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp index 2857a8577db63..d55620fa930b9 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp @@ -213,7 +213,12 @@ float CEngineStats::GetCacheTime(CActiveAEStream *stream) return delay; } -float CEngineStats::GetCacheTotal(CActiveAEStream *stream) +float CEngineStats::GetCacheTotal() +{ + return MAX_CACHE_LEVEL; +} + +float CEngineStats::GetMaxDelay() { return MAX_CACHE_LEVEL + MAX_WATER_LEVEL + m_sinkCacheTotal; } diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h index 1e4f8174cbc0a..43a5b57d48834 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h @@ -190,7 +190,8 @@ class CEngineStats void GetDelay(AEDelayStatus& status, CActiveAEStream *stream); void GetSyncInfo(CAESyncInfo& info, CActiveAEStream *stream); float GetCacheTime(CActiveAEStream *stream); - float GetCacheTotal(CActiveAEStream *stream); + float GetCacheTotal(); + float GetMaxDelay(); float GetWaterLevel(); void SetSuspended(bool state); void SetDSP(bool state); @@ -285,7 +286,8 @@ class CActiveAE : public IAE, public IDispResource, private CThread void GetDelay(AEDelayStatus& status, CActiveAEStream *stream) { m_stats.GetDelay(status, stream); } void GetSyncInfo(CAESyncInfo& info, CActiveAEStream *stream) { m_stats.GetSyncInfo(info, stream); } float GetCacheTime(CActiveAEStream *stream) { return m_stats.GetCacheTime(stream); } - float GetCacheTotal(CActiveAEStream *stream) { return m_stats.GetCacheTotal(stream); } + float GetCacheTotal() { return m_stats.GetCacheTotal(); } + float GetMaxDelay() { return m_stats.GetMaxDelay(); } void FlushStream(CActiveAEStream *stream); void PauseStream(CActiveAEStream *stream, bool pause); void StopSound(CActiveAESound *sound); diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp index 30e4fb267a59e..c3b77b4b23b00 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp @@ -372,7 +372,12 @@ double CActiveAEStream::GetCacheTime() double CActiveAEStream::GetCacheTotal() { - return m_activeAE->GetCacheTotal(this); + return m_activeAE->GetCacheTotal(); +} + +double CActiveAEStream::GetMaxDelay() +{ + return m_activeAE->GetMaxDelay(); } void CActiveAEStream::Pause() diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h index d58e8d5b4aa74..48a003e1f3425 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.h @@ -158,6 +158,7 @@ class CActiveAEStream : public IAEStream bool IsBuffering() override; double GetCacheTime() override; double GetCacheTotal() override; + double GetMaxDelay() override; void Pause() override; void Resume() override; diff --git a/xbmc/cores/AudioEngine/Interfaces/AEStream.h b/xbmc/cores/AudioEngine/Interfaces/AEStream.h index 5ec7410732c54..a3f5cfb4ca492 100644 --- a/xbmc/cores/AudioEngine/Interfaces/AEStream.h +++ b/xbmc/cores/AudioEngine/Interfaces/AEStream.h @@ -116,6 +116,12 @@ class IAEStream */ virtual double GetCacheTotal() = 0; + /** + * Returns the total time in seconds of maximum delay + * @return seconds + */ + virtual double GetMaxDelay() = 0; + /** * Pauses the stream playback */ diff --git a/xbmc/cores/VideoPlayer/AudioSinkAE.cpp b/xbmc/cores/VideoPlayer/AudioSinkAE.cpp index 752d84b8c1fd0..200e757707695 100644 --- a/xbmc/cores/VideoPlayer/AudioSinkAE.cpp +++ b/xbmc/cores/VideoPlayer/AudioSinkAE.cpp @@ -109,7 +109,7 @@ unsigned int CAudioSinkAE::AddPackets(const DVDAudioFrame &audioframe) CSingleLock lock (m_critSection); - if(!m_pAudioStream) + if (!m_pAudioStream) return 0; CAESyncInfo info = m_pAudioStream->GetSyncInfo(); @@ -252,7 +252,7 @@ bool CAudioSinkAE::IsValidFormat(const DVDAudioFrame &audioframe) double CAudioSinkAE::GetCacheTime() { CSingleLock lock (m_critSection); - if(!m_pAudioStream) + if (!m_pAudioStream) return 0.0; double delay = 0.0; @@ -265,11 +265,19 @@ double CAudioSinkAE::GetCacheTime() double CAudioSinkAE::GetCacheTotal() { CSingleLock lock (m_critSection); - if(!m_pAudioStream) + if (!m_pAudioStream) return 0.0; return m_pAudioStream->GetCacheTotal(); } +double CAudioSinkAE::GetMaxDelay() +{ + CSingleLock lock (m_critSection); + if (!m_pAudioStream) + return 0.0; + return m_pAudioStream->GetMaxDelay(); +} + double CAudioSinkAE::GetPlayingPts() { if (m_playingPts == DVD_NOPTS_VALUE) diff --git a/xbmc/cores/VideoPlayer/AudioSinkAE.h b/xbmc/cores/VideoPlayer/AudioSinkAE.h index 84de2f96df569..e78b57ad66503 100644 --- a/xbmc/cores/VideoPlayer/AudioSinkAE.h +++ b/xbmc/cores/VideoPlayer/AudioSinkAE.h @@ -52,7 +52,8 @@ class CAudioSinkAE : IAEClockCallback unsigned int AddPackets(const DVDAudioFrame &audioframe); double GetPlayingPts(); double GetCacheTime(); - double GetCacheTotal(); // returns total amount the audio device can buffer + double GetCacheTotal(); // returns total time a stream can buffer + double GetMaxDelay(); // returns total time of audio in AE for the stream double GetDelay(); // returns the time it takes to play a packet if we add one at this time double GetSyncError(); void SetSyncErrorCorrection(double correction); diff --git a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp index 935ca947ab824..20b535f8ed7ab 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp @@ -508,16 +508,16 @@ bool CVideoPlayerAudio::ProcessDecoderOutput(DVDAudioFrame &audioframe) // signal to our parent that we have initialized if (m_syncState == IDVDStreamPlayer::SYNC_STARTING) { - double cachetotal = DVD_SEC_TO_TIME(m_audioSink.GetCacheTotal()); - double cachetime = m_audioSink.GetDelay(); - if (cachetime >= cachetotal * 0.5) + double cachetotal = m_audioSink.GetCacheTotal(); + double cachetime = m_audioSink.GetCacheTime(); + if (cachetime >= cachetotal * 0.75) { m_syncState = IDVDStreamPlayer::SYNC_WAITSYNC; m_stalled = false; SStartMsg msg; msg.player = VideoPlayer_AUDIO; - msg.cachetotal = cachetotal; - msg.cachetime = cachetime; + msg.cachetotal = m_audioSink.GetMaxDelay() * DVD_TIME_BASE; + msg.cachetime = m_audioSink.GetDelay(); msg.timestamp = audioframe.hasTimestamp ? audioframe.pts : DVD_NOPTS_VALUE; m_messageParent.Put(new CDVDMsgType(CDVDMsg::PLAYER_STARTED, msg)); From 87298b467143ff84ced5f88694f883388c3fb89a Mon Sep 17 00:00:00 2001 From: ronie Date: Wed, 20 Sep 2017 23:13:15 +0200 Subject: [PATCH 102/113] PVR Guide fix --- addons/skin.estouchy/addon.xml | 2 +- addons/skin.estouchy/changelog.txt | 3 ++- addons/skin.estouchy/xml/ViewsPVR.xml | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/skin.estouchy/addon.xml b/addons/skin.estouchy/addon.xml index 5d6e6958ee856..864e0a9630351 100644 --- a/addons/skin.estouchy/addon.xml +++ b/addons/skin.estouchy/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/addons/skin.estouchy/changelog.txt b/addons/skin.estouchy/changelog.txt index 034bfb67d4b0a..17636e74ee2df 100644 --- a/addons/skin.estouchy/changelog.txt +++ b/addons/skin.estouchy/changelog.txt @@ -1,5 +1,6 @@ + V2.0.0 -- Kodi v18 LittlePony +- Kodi v18 Leia V1.1.0 - Redesign diff --git a/addons/skin.estouchy/xml/ViewsPVR.xml b/addons/skin.estouchy/xml/ViewsPVR.xml index 7a89c279a9be5..a9290088c5a74 100644 --- a/addons/skin.estouchy/xml/ViewsPVR.xml +++ b/addons/skin.estouchy/xml/ViewsPVR.xml @@ -191,7 +191,6 @@ 40 6 epg_marker.png - 4 10 From 4cb74424a9f89a41022fab33079dd7f86ac79c0f Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Wed, 20 Sep 2017 23:16:56 +0200 Subject: [PATCH 103/113] [video] Fix CVideoInfoTag::SetYear not to except years <= 0. --- xbmc/video/VideoInfoTag.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xbmc/video/VideoInfoTag.cpp b/xbmc/video/VideoInfoTag.cpp index b06f265e01976..806d03819217a 100644 --- a/xbmc/video/VideoInfoTag.cpp +++ b/xbmc/video/VideoInfoTag.cpp @@ -1388,6 +1388,9 @@ void CVideoInfoTag::SetPremieredFromDBDate(std::string premieredString) void CVideoInfoTag::SetYear(int year) { + if (year <= 0) + return; + if (m_bHasPremiered) m_premiered.SetDate(year, m_premiered.GetMonth(), m_premiered.GetDay()); else From 09e2f09207c5e8e7c8735bf8a77bfb4d8b949935 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Wed, 20 Sep 2017 23:24:10 +0200 Subject: [PATCH 104/113] [video] CVideoInfoTag cleanup: use std:move in combination with 'by value' parameters. --- xbmc/video/VideoInfoTag.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xbmc/video/VideoInfoTag.cpp b/xbmc/video/VideoInfoTag.cpp index 806d03819217a..1ed66e8aa4b1c 100644 --- a/xbmc/video/VideoInfoTag.cpp +++ b/xbmc/video/VideoInfoTag.cpp @@ -1375,14 +1375,14 @@ void CVideoInfoTag::SetVotes(int votes, const std::string& type /* = "" */) void CVideoInfoTag::SetPremiered(CDateTime premiered) { - m_premiered = premiered; + m_premiered = std::move(premiered); m_bHasPremiered = premiered.IsValid(); } void CVideoInfoTag::SetPremieredFromDBDate(std::string premieredString) { CDateTime premiered; - premiered.SetFromDBDate(premieredString); + premiered.SetFromDBDate(std::move(premieredString)); SetPremiered(premiered); } From dab74f4a2be4a33bda3eeff9bec1f7fe137dbf58 Mon Sep 17 00:00:00 2001 From: Thomas Amland Date: Sun, 3 Sep 2017 13:23:35 +0200 Subject: [PATCH 105/113] add blocking event stream implementation --- xbmc/utils/EventStream.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/xbmc/utils/EventStream.h b/xbmc/utils/EventStream.h index 279a00494294a..4adc4ac9a134a 100644 --- a/xbmc/utils/EventStream.h +++ b/xbmc/utils/EventStream.h @@ -88,3 +88,18 @@ class CEventSource : public CEventStream CJobManager::GetInstance().Submit(std::move(task)); } }; + +template +class CBlockingEventSource : public CEventStream +{ +public: + template + void HandleEvent(A event) + { + CSingleLock lock(this->m_criticalSection); + for (const auto& subscription : this->m_subscriptions) + { + subscription->HandleEvent(event); + } + } +}; From 4c5eb8b9a07507915fe21ab19fc56042d14aa87a Mon Sep 17 00:00:00 2001 From: Thomas Amland Date: Sun, 3 Sep 2017 13:31:09 +0200 Subject: [PATCH 106/113] split CAddonMgr::Reload into Unload/Load --- xbmc/addons/AddonInstaller.cpp | 8 +++++++- xbmc/addons/AddonManager.cpp | 32 +++++++++++++++----------------- xbmc/addons/AddonManager.h | 2 +- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/xbmc/addons/AddonInstaller.cpp b/xbmc/addons/AddonInstaller.cpp index 1e9862fe37816..9885b7096150a 100644 --- a/xbmc/addons/AddonInstaller.cpp +++ b/xbmc/addons/AddonInstaller.cpp @@ -604,11 +604,17 @@ bool CAddonInstallJob::DoWork() // run any pre-install functions ADDON::OnPreInstall(m_addon); + if (!CAddonMgr::GetInstance().UnloadAddon(m_addon)) + { + CLog::Log(LOGERROR, "CAddonInstallJob[%s]: failed to unload addon.", m_addon->ID().c_str()); + return false; + } + // perform install if (!Install(installFrom, m_repo)) return false; - if (!CAddonMgr::GetInstance().ReloadAddon(m_addon)) + if (!CAddonMgr::GetInstance().LoadAddon(m_addon->ID())) { CLog::Log(LOGERROR, "CAddonInstallJob[%s]: failed to reload addon", m_addon->ID().c_str()); return false; diff --git a/xbmc/addons/AddonManager.cpp b/xbmc/addons/AddonManager.cpp index f893c001fb17d..b68c4ab96fc4e 100644 --- a/xbmc/addons/AddonManager.cpp +++ b/xbmc/addons/AddonManager.cpp @@ -706,8 +706,6 @@ bool CAddonMgr::UnloadAddon(const AddonPtr& addon) if (m_cpluff->uninstall_plugin(m_cp_context, addon->ID().c_str()) == CP_OK) { CLog::Log(LOGDEBUG, "CAddonMgr: %s unloaded", addon->ID().c_str()); - m_events.Publish(AddonEvents::InstalledChanged()); - m_events.Publish(AddonEvents::UnInstalled(addon->ID())); return true; } } @@ -715,17 +713,16 @@ bool CAddonMgr::UnloadAddon(const AddonPtr& addon) return false; } -bool CAddonMgr::ReloadAddon(AddonPtr& addon) +bool CAddonMgr::LoadAddon(const std::string& addonId) { CSingleLock lock(m_critSection); - if (!addon ||!m_cpluff || !m_cp_context) + if (!m_cpluff || !m_cp_context) return false; - AddonPtr tmp; - bool isReinstall = GetAddon(addon->ID(), tmp, ADDON_UNKNOWN, false); - if (isReinstall) + AddonPtr addon; + if (GetAddon(addonId, addon, ADDON_UNKNOWN, false)) { - m_cpluff->uninstall_plugin(m_cp_context, addon->ID().c_str()); + return true; } if (!FindAddons()) @@ -734,22 +731,21 @@ bool CAddonMgr::ReloadAddon(AddonPtr& addon) return false; } - if (!GetAddon(addon->ID(), addon, ADDON_UNKNOWN, false)) + if (!GetAddon(addonId, addon, ADDON_UNKNOWN, false)) { - CLog::Log(LOGERROR, "CAddonMgr: could not reload add-on %s. No add-on with that ID is installed.", addon->ID().c_str()); + CLog::Log(LOGERROR, "CAddonMgr: could not load add-on %s. No add-on with that ID is installed.", addon->ID().c_str()); return false; } - if (isReinstall) - m_events.Publish(AddonEvents::ReInstalled(addon->ID())); - - if (!EnableAddon(addon->ID())) + if (IsAddonDisabled(addon->ID())) { - CLog::Log(LOGERROR, "CAddonMgr: '%s' was installed but could not be enabled", addon->ID().c_str()); - return false; + EnableAddon(addon->ID()); + return true; } - CLog::Log(LOGDEBUG, "CAddonMgr: %s reloaded", addon->ID().c_str()); + m_events.Publish(AddonEvents::ReInstalled(addon->ID())); + m_events.Publish(AddonEvents::InstalledChanged()); + CLog::Log(LOGDEBUG, "CAddonMgr: %s successfully loaded", addon->ID().c_str()); return true; } @@ -758,6 +754,8 @@ void CAddonMgr::OnPostUnInstall(const std::string& id) CSingleLock lock(m_critSection); m_disabled.erase(id); m_updateBlacklist.erase(id); + m_events.Publish(AddonEvents::InstalledChanged()); + m_events.Publish(AddonEvents::UnInstalled(id)); } bool CAddonMgr::RemoveFromUpdateBlacklist(const std::string& id) diff --git a/xbmc/addons/AddonManager.h b/xbmc/addons/AddonManager.h index b69fe3b9afec2..7ea9ad808695b 100644 --- a/xbmc/addons/AddonManager.h +++ b/xbmc/addons/AddonManager.h @@ -178,7 +178,7 @@ namespace ADDON * * Returns true if the addon was successfully loaded and enabled; otherwise false. */ - bool ReloadAddon(AddonPtr& addon); + bool LoadAddon(const std::string& addonId); /*! @note: should only be called by AddonInstaller * From be263f11c36302e494286446f502c2cb777bed49 Mon Sep 17 00:00:00 2001 From: Thomas Amland Date: Sun, 3 Sep 2017 14:06:15 +0200 Subject: [PATCH 107/113] add blocking unload/load callbacks to addon manager --- xbmc/addons/AddonEvents.h | 12 ++++++++++++ xbmc/addons/AddonManager.cpp | 9 +++++++++ xbmc/addons/AddonManager.h | 2 ++ 3 files changed, 23 insertions(+) diff --git a/xbmc/addons/AddonEvents.h b/xbmc/addons/AddonEvents.h index 9ac00ab49b78f..6ada929c7b5a1 100644 --- a/xbmc/addons/AddonEvents.h +++ b/xbmc/addons/AddonEvents.h @@ -71,5 +71,17 @@ namespace ADDON * @deprecated Use Enabled, ReInstalled and UnInstalled instead. */ struct InstalledChanged : AddonEvent {}; + + struct Load : AddonEvent + { + std::string id; + explicit Load(std::string id) : id(std::move(id)) {} + }; + + struct Unload : AddonEvent + { + std::string id; + explicit Unload(std::string id) : id(std::move(id)) {} + }; }; }; diff --git a/xbmc/addons/AddonManager.cpp b/xbmc/addons/AddonManager.cpp index b68c4ab96fc4e..1620ff09b47f0 100644 --- a/xbmc/addons/AddonManager.cpp +++ b/xbmc/addons/AddonManager.cpp @@ -706,6 +706,10 @@ bool CAddonMgr::UnloadAddon(const AddonPtr& addon) if (m_cpluff->uninstall_plugin(m_cp_context, addon->ID().c_str()) == CP_OK) { CLog::Log(LOGDEBUG, "CAddonMgr: %s unloaded", addon->ID().c_str()); + + lock.Leave(); + AddonEvents::Unload event(addon->ID()); + m_unloadEvents.HandleEvent(event); return true; } } @@ -737,6 +741,11 @@ bool CAddonMgr::LoadAddon(const std::string& addonId) return false; } + lock.Leave(); + + AddonEvents::Load event(addon->ID()); + m_unloadEvents.HandleEvent(event); + if (IsAddonDisabled(addon->ID())) { EnableAddon(addon->ID()); diff --git a/xbmc/addons/AddonManager.h b/xbmc/addons/AddonManager.h index 7ea9ad808695b..c7715aa7817f3 100644 --- a/xbmc/addons/AddonManager.h +++ b/xbmc/addons/AddonManager.h @@ -82,6 +82,7 @@ namespace ADDON virtual ~CAddonMgr(); CEventStream& Events() { return m_events; } + CEventStream& UnloadEvents() { return m_unloadEvents; } IAddonMgrCallback* GetCallbackForType(TYPE type); bool RegisterAddonMgrCallback(TYPE type, IAddonMgrCallback* cb); @@ -312,6 +313,7 @@ namespace ADDON CCriticalSection m_critSection; CAddonDatabase m_database; CEventSource m_events; + CBlockingEventSource m_unloadEvents; std::set m_systemAddons; std::set m_optionalAddons; }; From 8bd7213d2ec081717f3c3f4fc0ed43eea843e019 Mon Sep 17 00:00:00 2001 From: Thomas Amland Date: Sun, 3 Sep 2017 15:49:48 +0200 Subject: [PATCH 108/113] prevent 'unloaded' service addons from being started --- xbmc/addons/Service.cpp | 27 ++++++++++++++++++++++++++- xbmc/addons/Service.h | 2 ++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/xbmc/addons/Service.cpp b/xbmc/addons/Service.cpp index e3814e10e6348..fc5d1a24ddcc2 100644 --- a/xbmc/addons/Service.cpp +++ b/xbmc/addons/Service.cpp @@ -50,6 +50,7 @@ CServiceAddonManager::CServiceAddonManager(CAddonMgr& addonMgr) : CServiceAddonManager::~CServiceAddonManager() { m_addonMgr.Events().Unsubscribe(this); + m_addonMgr.UnloadEvents().Unsubscribe(this); } void CServiceAddonManager::OnEvent(const ADDON::AddonEvent& event) @@ -68,9 +69,26 @@ void CServiceAddonManager::OnEvent(const ADDON::AddonEvent& event) } else if (auto reinstallEvent = dynamic_cast(&event)) { - Stop(reinstallEvent->id); Start(reinstallEvent->id); } + + else if (auto e = dynamic_cast(&event)) + { + CLog::Log(LOGINFO, "CServiceAddonManager: Unloading %s", e->id.c_str()); + CSingleLock lock(m_criticalSection); + Stop(e->id); + m_blacklistedAddons.push_back(e->id); + } + else if (auto e = dynamic_cast(&event)) + { + CLog::Log(LOGINFO, "CServiceAddonManager: Removing %s from blacklist", e->id.c_str()); + CSingleLock lock(m_criticalSection); + auto it = std::find(m_blacklistedAddons.begin(), m_blacklistedAddons.end(), e->id); + if (it != m_blacklistedAddons.end()) + { + m_blacklistedAddons.erase(it); + } + } } void CServiceAddonManager::StartBeforeLogin() @@ -92,6 +110,7 @@ void CServiceAddonManager::StartBeforeLogin() void CServiceAddonManager::Start() { m_addonMgr.Events().Subscribe(this, &CServiceAddonManager::OnEvent); + m_addonMgr.UnloadEvents().Subscribe(this, &CServiceAddonManager::OnEvent); VECADDONS addons; if (m_addonMgr.GetAddons(addons, ADDON_SERVICE)) { @@ -120,6 +139,12 @@ void CServiceAddonManager::Start(const AddonPtr& addon) return; } + if (std::find(m_blacklistedAddons.begin(), m_blacklistedAddons.end(), addon->ID()) != m_blacklistedAddons.end()) + { + CLog::Log(LOGINFO, "CServiceAddonManager: Not executing blacklisted addon %s", addon->ID().c_str()); + return; + } + if (StringUtils::EndsWith(addon->LibPath(), ".py")) { CLog::Log(LOGDEBUG, "CServiceAddonManager: starting %s", addon->ID().c_str()); diff --git a/xbmc/addons/Service.h b/xbmc/addons/Service.h index 77186f4f9af4f..277cf4f59bccf 100644 --- a/xbmc/addons/Service.h +++ b/xbmc/addons/Service.h @@ -89,5 +89,7 @@ namespace ADDON CCriticalSection m_criticalSection; /** add-on id -> script id */ std::map m_services; + + std::vector m_blacklistedAddons; }; } From f91e344b82a6109a39e1a58d205c907889b54606 Mon Sep 17 00:00:00 2001 From: "Chris \"Koying\" Browet" Date: Sat, 19 Aug 2017 17:48:33 +0200 Subject: [PATCH 109/113] FIX: [droid] mediasession activation fixes --- xbmc/platform/android/activity/XBMCApp.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xbmc/platform/android/activity/XBMCApp.cpp b/xbmc/platform/android/activity/XBMCApp.cpp index cc3b57c6c9cd8..1bf12ac218976 100644 --- a/xbmc/platform/android/activity/XBMCApp.cpp +++ b/xbmc/platform/android/activity/XBMCApp.cpp @@ -695,6 +695,7 @@ void CXBMCApp::OnPlayBackStarted() m_playback_state |= PLAYBACK_STATE_AUDIO; m_mediaSession->activate(true); + UpdateSessionState(); CJNIIntent intent(ACTION_XBMC_RESUME, CJNIURI::EMPTY, *this, get_class(CJNIContext::get_raw())); m_mediaSession->updateIntent(intent); @@ -710,6 +711,7 @@ void CXBMCApp::OnPlayBackPaused() CLog::Log(LOGDEBUG, "%s", __PRETTY_FUNCTION__); m_playback_state &= ~PLAYBACK_STATE_PLAYING; + UpdateSessionState(); RequestVisibleBehind(false); m_xbmcappinstance->ReleaseAudioFocus(); From 7281262a272cfc57a48645ff065c982503af976b Mon Sep 17 00:00:00 2001 From: "Chris \"Koying\" Browet" Date: Tue, 29 Aug 2017 21:32:10 +0200 Subject: [PATCH 110/113] FIX: [mediasession] update state on seek and speed changes --- xbmc/platform/android/activity/XBMCApp.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xbmc/platform/android/activity/XBMCApp.cpp b/xbmc/platform/android/activity/XBMCApp.cpp index 1bf12ac218976..b2a1b93a481de 100644 --- a/xbmc/platform/android/activity/XBMCApp.cpp +++ b/xbmc/platform/android/activity/XBMCApp.cpp @@ -175,6 +175,10 @@ void CXBMCApp::Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, OnPlayBackPaused(); else if (strcmp(message, "OnStop") == 0) OnPlayBackStopped(); + else if (strcmp(message, "OnSeek") == 0) + UpdateSessionState(); + else if (strcmp(message, "OnSpeedChanged") == 0) + UpdateSessionState(); } else if (flag & Info) { From 47511c2569fcacfe61bb9000aa5f0095286334b1 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Wed, 10 May 2017 19:10:22 +0200 Subject: [PATCH 111/113] AE: fix pause bursts --- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp | 7 +++++-- xbmc/cores/AudioEngine/Utils/AEBitstreamPacker.cpp | 6 ++++-- xbmc/cores/AudioEngine/Utils/AEBitstreamPacker.h | 2 +- xbmc/cores/AudioEngine/Utils/AEPackIEC61937.cpp | 7 ++++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp index cebeebe57b0f6..0d1e83c94524e 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp @@ -929,6 +929,7 @@ unsigned int CActiveAESink::OutputSamples(CSampleBuffer* samples) if (m_requestedFormat.m_dataFormat == AE_FMT_RAW) { + bool skipSwap = false; if (m_needIecPack) { if (frames > 0) @@ -962,7 +963,8 @@ unsigned int CActiveAESink::OutputSamples(CSampleBuffer* samples) { // construct a pause burst if we have already output valid audio bool burst = m_extStreaming && (m_packer->GetBuffer()[0] != 0); - m_packer->PackPause(m_sinkFormat.m_streamInfo, samples->pkt->pause_burst_ms, burst); + if (!m_packer->PackPause(m_sinkFormat.m_streamInfo, samples->pkt->pause_burst_ms, burst)) + skipSwap = true; } else m_packer->Reset(); @@ -978,7 +980,8 @@ unsigned int CActiveAESink::OutputSamples(CSampleBuffer* samples) case SKIP_SWAP: break; case NEED_BYTESWAP: - Endian_Swap16_buf((uint16_t *)buffer[0], (uint16_t *)buffer[0], size / 2); + if (!skipSwap) + Endian_Swap16_buf((uint16_t *)buffer[0], (uint16_t *)buffer[0], size / 2); break; case CHECK_SWAP: SwapInit(samples); diff --git a/xbmc/cores/AudioEngine/Utils/AEBitstreamPacker.cpp b/xbmc/cores/AudioEngine/Utils/AEBitstreamPacker.cpp index 3a6ede137dc26..4a2912bfe20d7 100644 --- a/xbmc/cores/AudioEngine/Utils/AEBitstreamPacker.cpp +++ b/xbmc/cores/AudioEngine/Utils/AEBitstreamPacker.cpp @@ -93,11 +93,11 @@ void CAEBitstreamPacker::Pack(CAEStreamInfo &info, uint8_t* data, int size) } } -void CAEBitstreamPacker::PackPause(CAEStreamInfo &info, unsigned int millis, bool iecBursts) +bool CAEBitstreamPacker::PackPause(CAEStreamInfo &info, unsigned int millis, bool iecBursts) { // re-use last buffer if (m_pauseDuration == millis) - return; + return false; switch (info.m_type) { @@ -125,6 +125,8 @@ void CAEBitstreamPacker::PackPause(CAEStreamInfo &info, unsigned int millis, boo { memset(m_packedBuffer, 0, m_dataSize); } + + return true; } unsigned int CAEBitstreamPacker::GetSize() diff --git a/xbmc/cores/AudioEngine/Utils/AEBitstreamPacker.h b/xbmc/cores/AudioEngine/Utils/AEBitstreamPacker.h index 7394df8fc32ab..71a1930d64008 100644 --- a/xbmc/cores/AudioEngine/Utils/AEBitstreamPacker.h +++ b/xbmc/cores/AudioEngine/Utils/AEBitstreamPacker.h @@ -33,7 +33,7 @@ class CAEBitstreamPacker ~CAEBitstreamPacker(); void Pack(CAEStreamInfo &info, uint8_t* data, int size); - void PackPause(CAEStreamInfo &info, unsigned int millis, bool iecBursts); + bool PackPause(CAEStreamInfo &info, unsigned int millis, bool iecBursts); void Reset(); uint8_t* GetBuffer(); unsigned int GetSize(); diff --git a/xbmc/cores/AudioEngine/Utils/AEPackIEC61937.cpp b/xbmc/cores/AudioEngine/Utils/AEPackIEC61937.cpp index f23faad74b9a7..fb09f6f4c883f 100644 --- a/xbmc/cores/AudioEngine/Utils/AEPackIEC61937.cpp +++ b/xbmc/cores/AudioEngine/Utils/AEPackIEC61937.cpp @@ -239,7 +239,8 @@ int CAEPackIEC61937::PackPause(uint8_t *dest, unsigned int millis, unsigned int memcpy(dest+i*periodInBytes, dest, periodInBytes); } - packet->m_data[1] = (gap & 0x00FF) << 8; - packet->m_data[0] = (gap & 0xFF00) >> 8; + uint16_t *gapPtr = reinterpret_cast(packet->m_data); + *gapPtr = gap; + return periodsNeeded * periodInBytes; -} \ No newline at end of file +} From a895cc6cd35c594e28f0f521ddedada260bb830e Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Wed, 20 Sep 2017 08:16:18 +0200 Subject: [PATCH 112/113] VideoPlayer: send cb notifications on exit via a job --- xbmc/cores/VideoPlayer/VideoPlayer.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp index 6822f81d77903..1ba51c096d047 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp @@ -2455,12 +2455,17 @@ void CVideoPlayer::OnExit() CFFmpegLog::ClearLogLevel(); m_bStop = true; - if (m_error) - m_callback.OnPlayBackError(); - else if (m_bAbortRequest) - m_callback.OnPlayBackStopped(); - else - m_callback.OnPlayBackEnded(); + IPlayerCallback *cb = &m_callback; + bool error = m_error; + bool abort = m_bAbortRequest; + CJobManager::GetInstance().Submit([=]() { + if (error) + cb->OnPlayBackError(); + else if (abort) + cb->OnPlayBackStopped(); + else + cb->OnPlayBackEnded(); + }, CJob::PRIORITY_NORMAL); } void CVideoPlayer::HandleMessages() From 47c522e54ad4c9329d7c49aa0b7acab3d1ed71d8 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 22 Sep 2017 12:21:22 +0100 Subject: [PATCH 113/113] ActiveAE: Fix up bytes skipped in SyncStream PR12785 introduced an issue where noise occurs after seeks and unpausing This fixes the issue. --- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp index d55620fa930b9..9f8d787519faf 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp @@ -2430,7 +2430,8 @@ CSampleBuffer* CActiveAE::SyncStream(CActiveAEStream *stream) } else { - int bytesToSkip = framesToSkip * buf->pkt->bytes_per_sample / buf->pkt->planes; + int bytesToSkip = framesToSkip * buf->pkt->bytes_per_sample * + buf->pkt->config.channels / buf->pkt->planes; for (int i=0; ipkt->planes; i++) { memmove(buf->pkt->data[i], buf->pkt->data[i]+bytesToSkip, buf->pkt->linesize - bytesToSkip);