Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CApplication Class Reference

#include <Application.h>

Inheritance diagram for CApplication:
IWindowManagerCallback IMsgTargetCallback KODI::MESSAGING::IMessageTarget CComponentContainer< BaseType > CApplicationPlayerCallback CApplicationSettingsHandling IPlayerCallback ISettingCallback ISettingsHandler ISubSettings

Public Member Functions

 CApplication (void)
 
 ~CApplication (void) override
 
bool Create ()
 
bool Initialize ()
 
int Run ()
 
bool Cleanup ()
 
void FrameMove (bool processEvents, bool processGUI=true) override
 
void Render () override
 
bool IsInitialized () const
 
bool IsStopping () const
 
bool CreateGUI ()
 
bool InitWindow (RESOLUTION res=RES_INVALID)
 
bool Stop (int exitCode)
 
const std::string & CurrentFile ()
 
CFileItemCurrentFileItem ()
 
std::shared_ptr< CFileItemCurrentFileItemPtr ()
 
const CFileItemCurrentUnstackedItem ()
 
bool OnMessage (CGUIMessage &message) override
 
std::string GetCurrentPlayer ()
 
int GetMessageMask () override
 Should return the message mask that it wishes to receive messages for.
 
void OnApplicationMessage (KODI::MESSAGING::ThreadMessage *pMsg) override
 This gets called whenever a message matching the registered message mask is processed.
 
bool PlayMedia (CFileItem &item, const std::string &player, KODI::PLAYLIST::Id playlistId)
 
bool ProcessAndStartPlaylist (const std::string &strPlayList, KODI::PLAYLIST::CPlayList &playlist, KODI::PLAYLIST::Id playlistId, int track=0)
 
bool PlayFile (CFileItem item, const std::string &player, bool bRestart=false, bool forceSelection=false)
 
void StopPlaying ()
 
void Restart (bool bSamePosition=true)
 
void DelayedPlayerRestart ()
 
void CheckDelayedPlayerRestart ()
 
bool IsPlayingFullScreenVideo () const
 
bool IsFullScreen ()
 
bool OnAction (const CAction &action)
 
void CloseNetworkShares ()
 
void ConfigureAndEnableAddons ()
 
void ShowAppMigrationMessage ()
 
void Process () override
 
void ProcessSlow ()
 
double GetTotalTime () const
 Returns the total time in fractional seconds of the currently playing media.
 
double GetTime () const
 Returns the current time in fractional seconds of the currently playing media.
 
float GetPercentage () const
 
float GetCachePercentage () const
 
void SeekPercentage (float percent)
 
void SeekTime (double dTime=0.0)
 
void UpdateLibraries ()
 
void UpdateCurrentPlayArt ()
 
bool ExecuteXBMCAction (std::string action, const std::shared_ptr< CGUIListItem > &item=NULL)
 
bool IsAppFocused () const
 
bool GetRenderGUI () const override
 
bool SetLanguage (const std::string &strLanguage)
 
bool LoadLanguage (bool reload)
 
void SetLoggingIn (bool switchingProfiles)
 
void LockFrameMoveGuard ()
 Locks calls from outside kodi (e.g. python) until framemove is processed.
 
void UnlockFrameMoveGuard ()
 Unlocks calls from outside kodi (e.g. python).
 
- Public Member Functions inherited from IWindowManagerCallback
 IWindowManagerCallback (void)
 
virtual ~IWindowManagerCallback (void)
 
- Public Member Functions inherited from IMsgTargetCallback
virtual ~IMsgTargetCallback ()=default
 
- Public Member Functions inherited from KODI::MESSAGING::IMessageTarget
virtual ~IMessageTarget ()=default
 
- Public Member Functions inherited from CComponentContainer< BaseType >
template<class T >
std::shared_ptr< T > GetComponent ()
 Obtain a component.
 
template<class T >
std::shared_ptr< const T > GetComponent () const
 Obtain a component.
 
std::size_t size () const
 Returns number of registered components.
 
- Public Member Functions inherited from CApplicationPlayerCallback
 CApplicationPlayerCallback ()
 
void OnPlayBackEnded () override
 
void OnPlayBackStarted (const CFileItem &file) override
 
void OnPlayerCloseFile (const CFileItem &file, const CBookmark &bookmark) override
 
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
 
void OnPlayBackSpeedChanged (int iSpeed) override
 
void OnAVChange () override
 
void OnAVStarted (const CFileItem &file) override
 
void RequestVideoSettings (const CFileItem &fileItem) override
 
void StoreVideoSettings (const CFileItem &fileItem, const CVideoSettings &vs) override
 
- Public Member Functions inherited from IPlayerCallback
virtual ~IPlayerCallback ()=default
 
- Public Member Functions inherited from ISettingCallback
virtual ~ISettingCallback ()=default
 
virtual bool OnSettingChanging (const std::shared_ptr< const CSetting > &setting)
 The value of the given setting is being changed.
 
virtual void OnSettingPropertyChanged (const std::shared_ptr< const CSetting > &setting, const char *propertyName)
 The given property of the given setting has changed.
 
- Public Member Functions inherited from ISettingsHandler
virtual ~ISettingsHandler ()=default
 
virtual bool OnSettingsLoading ()
 Settings loading has been initiated.
 
virtual void OnSettingsLoaded ()
 Settings have been loaded.
 
virtual void OnSettingsSaved () const
 Settings have been saved.
 
virtual void OnSettingsUnloaded ()
 Setting values have been unloaded.
 
virtual void OnSettingsCleared ()
 Settings have been cleared.
 
- Public Member Functions inherited from ISubSettings
virtual ~ISubSettings ()=default
 
virtual void Clear ()
 Clear any loaded setting values.
 

Public Attributes

std::string m_strPlayListFile
 
std::unique_ptr< CServiceManagerm_ServiceManager
 
bool m_bStop {false}
 
bool m_AppFocused {true}
 

Static Public Attributes

static const unsigned int ACTION_PREV_ITEM_THRESHOLD = 3
 

Protected Member Functions

bool OnSettingsSaving () const override
 Settings saving has been initiated.
 
void PlaybackCleanup ()
 
bool PlayStack (CFileItem &item, bool bRestart)
 
- Protected Member Functions inherited from CComponentContainer< BaseType >
void RegisterComponent (const std::shared_ptr< BaseType > &component)
 Register a new component instance.
 
void DeregisterComponent (const std::type_info &typeInfo)
 Deregister a component.
 
- Protected Member Functions inherited from CApplicationSettingsHandling
void RegisterSettings ()
 
void UnregisterSettings ()
 
bool Load (const TiXmlNode *settings) override
 Load settings from the given XML node.
 
bool Save (TiXmlNode *settings) const override
 Save settings to the given XML node.
 
void OnSettingChanged (const std::shared_ptr< const CSetting > &setting) override
 The value of the given setting has changed.
 
void OnSettingAction (const std::shared_ptr< const CSetting > &setting) override
 The given setting has been activated.
 
bool OnSettingUpdate (const std::shared_ptr< CSetting > &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode) override
 The given setting needs to be updated.
 

Protected Attributes

std::shared_ptr< ANNOUNCEMENT::CAnnouncementManagerm_pAnnouncementManager
 
std::unique_ptr< CGUIComponentm_pGUI
 
std::unique_ptr< CWinSystemBasem_pWinSystem
 
std::unique_ptr< ActiveAE::CActiveAEm_pActiveAE
 
std::shared_ptr< CAppInboundProtocolm_pAppPort
 
CStopWatch m_restartPlayerTimer
 
CStopWatch m_frameTime
 
CStopWatch m_slowTimer
 
XbmcThreads::EndTime m_guiRefreshTimer
 
std::string m_prevMedia
 
bool m_bInitializing = true
 
int m_nextPlaylistItem = -1
 
std::chrono::time_point< std::chrono::steady_clock > m_lastRenderTime
 
bool m_skipGuiRender = false
 
std::unique_ptr< MUSIC_INFO::CMusicInfoScannerm_musicInfoScanner
 
std::unique_ptr< CInertialScrollingHandlerm_pInertialScrollingHandler
 
std::vector< std::shared_ptr< ADDON::CAddonInfo > > m_incompatibleAddons
 

Constructor & Destructor Documentation

◆ CApplication()

CApplication::CApplication ( void )

◆ ~CApplication()

CApplication::~CApplication ( void )
override

Member Function Documentation

◆ CheckDelayedPlayerRestart()

void CApplication::CheckDelayedPlayerRestart ( )

◆ Cleanup()

bool CApplication::Cleanup ( )

◆ CloseNetworkShares()

void CApplication::CloseNetworkShares ( )

◆ ConfigureAndEnableAddons()

void CApplication::ConfigureAndEnableAddons ( )

< Installed addons, but not auto-enabled via manifest

◆ Create()

bool CApplication::Create ( )
Todo
Win32 has no special://home/ mapping by default, so we

◆ CreateGUI()

bool CApplication::CreateGUI ( )

◆ CurrentFile()

const std::string & CApplication::CurrentFile ( )

◆ CurrentFileItem()

CFileItem & CApplication::CurrentFileItem ( )

◆ CurrentFileItemPtr()

std::shared_ptr< CFileItem > CApplication::CurrentFileItemPtr ( )

◆ CurrentUnstackedItem()

const CFileItem & CApplication::CurrentUnstackedItem ( )

◆ DelayedPlayerRestart()

void CApplication::DelayedPlayerRestart ( )

◆ ExecuteXBMCAction()

bool CApplication::ExecuteXBMCAction ( std::string action,
const std::shared_ptr< CGUIListItem > & item = NULL )

◆ FrameMove()

void CApplication::FrameMove ( bool processEvents,
bool processGUI = true )
overridevirtual
Todo
look into the possibility to use this for GBM int fps = 0;

This code reduces rendering fps of the GUI layer when playing videos in fullscreen mode it makes only sense on architectures with multiple layers if (CServiceBroker::GetWinSystem()->GetGfxContext().IsFullScreenVideo() && !m_appPlayer.IsPausedPlayback() && m_appPlayer.IsRenderingVideoLayer()) fps = CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(CSettings::SETTING_VIDEOPLAYER_LIMITGUIUPDATE);

auto now = std::chrono::steady_clock::now();

auto frameTime = std::chrono::duration_cast<std::chrono::milliseconds>(now - m_lastRenderTime).count(); if (fps > 0 && frameTime * fps < 1000) m_skipGuiRender = true;

Implements IWindowManagerCallback.

◆ GetCachePercentage()

float CApplication::GetCachePercentage ( ) const

◆ GetCurrentPlayer()

std::string CApplication::GetCurrentPlayer ( )

◆ GetMessageMask()

int CApplication::GetMessageMask ( )
overridevirtual

Should return the message mask that it wishes to receive messages for.

The message mask is defined in "messaging/ApplicationMessenger.h" pick the next one available when creating a new

Implements KODI::MESSAGING::IMessageTarget.

◆ GetPercentage()

float CApplication::GetPercentage ( ) const

◆ GetRenderGUI()

bool CApplication::GetRenderGUI ( ) const
overridevirtual

Reimplemented from IWindowManagerCallback.

◆ GetTime()

double CApplication::GetTime ( ) const

Returns the current time in fractional seconds of the currently playing media.

Beware that this method returns fractional seconds whereas IPlayer::GetTime() returns milliseconds.

◆ GetTotalTime()

double CApplication::GetTotalTime ( ) const

Returns the total time in fractional seconds of the currently playing media.

Beware that this method returns fractional seconds whereas IPlayer::GetTotalTime() returns milliseconds.

◆ Initialize()

bool CApplication::Initialize ( )
Todo
Move GUIFontManager into service broker and drop the global reference

◆ InitWindow()

bool CApplication::InitWindow ( RESOLUTION res = RES_INVALID)

◆ IsAppFocused()

bool CApplication::IsAppFocused ( ) const
inline

◆ IsFullScreen()

bool CApplication::IsFullScreen ( )

◆ IsInitialized()

bool CApplication::IsInitialized ( ) const
inline

◆ IsPlayingFullScreenVideo()

bool CApplication::IsPlayingFullScreenVideo ( ) const

◆ IsStopping()

bool CApplication::IsStopping ( ) const
inline

◆ LoadLanguage()

bool CApplication::LoadLanguage ( bool reload)

◆ LockFrameMoveGuard()

void CApplication::LockFrameMoveGuard ( )

Locks calls from outside kodi (e.g. python) until framemove is processed.

◆ OnAction()

bool CApplication::OnAction ( const CAction & action)

◆ OnApplicationMessage()

void CApplication::OnApplicationMessage ( KODI::MESSAGING::ThreadMessage * msg)
overridevirtual

This gets called whenever a message matching the registered message mask is processed.

There are no ordering guarantees here so implementations should never rely on a certain ordering of messages.

Cleaning up any pointers stored in the message payload is not specified and is decided by the implementer of the message. In general prefer to delete any data in this method to keep the callsites cleaner and simpler but if data is to be passed back it's perfectly valid to handle it any way that fits the situation as long as it's documented along with the message.

To return a simple value the result parameter of

See also
ThreadMessage can be used as it will be used as the return value for
CApplicationMessenger::SendMsg. It is up to the implementer to decide if this is to be used and it should be documented along with any new message implemented.

Implements KODI::MESSAGING::IMessageTarget.

◆ OnMessage()

bool CApplication::OnMessage ( CGUIMessage & message)
overridevirtual

Implements IMsgTargetCallback.

◆ OnSettingsSaving()

bool CApplication::OnSettingsSaving ( ) const
overrideprotectedvirtual

Settings saving has been initiated.

Returns
True if the settings should be saved, false if the saving should be aborted.

Reimplemented from ISettingsHandler.

◆ PlaybackCleanup()

void CApplication::PlaybackCleanup ( )
protected

◆ PlayFile()

bool CApplication::PlayFile ( CFileItem item,
const std::string & player,
bool bRestart = false,
bool forceSelection = false )
Todo
  • this will fail if user seeks back to first file in stack

◆ PlayMedia()

bool CApplication::PlayMedia ( CFileItem & item,
const std::string & player,
KODI::PLAYLIST::Id playlistId )

◆ PlayStack()

bool CApplication::PlayStack ( CFileItem & item,
bool bRestart )
protected

◆ Process()

void CApplication::Process ( )
overridevirtual

◆ ProcessAndStartPlaylist()

bool CApplication::ProcessAndStartPlaylist ( const std::string & strPlayList,
KODI::PLAYLIST::CPlayList & playlist,
KODI::PLAYLIST::Id playlistId,
int track = 0 )

◆ ProcessSlow()

void CApplication::ProcessSlow ( )

◆ Render()

void CApplication::Render ( )
overridevirtual

◆ Restart()

void CApplication::Restart ( bool bSamePosition = true)

◆ Run()

int CApplication::Run ( )

◆ SeekPercentage()

void CApplication::SeekPercentage ( float percent)

◆ SeekTime()

void CApplication::SeekTime ( double dTime = 0.0)

◆ SetLanguage()

bool CApplication::SetLanguage ( const std::string & strLanguage)

◆ SetLoggingIn()

void CApplication::SetLoggingIn ( bool switchingProfiles)

◆ ShowAppMigrationMessage()

void CApplication::ShowAppMigrationMessage ( )

◆ Stop()

bool CApplication::Stop ( int exitCode)

◆ StopPlaying()

void CApplication::StopPlaying ( )

◆ UnlockFrameMoveGuard()

void CApplication::UnlockFrameMoveGuard ( )

Unlocks calls from outside kodi (e.g. python).

◆ UpdateCurrentPlayArt()

void CApplication::UpdateCurrentPlayArt ( )

◆ UpdateLibraries()

void CApplication::UpdateLibraries ( )

Member Data Documentation

◆ ACTION_PREV_ITEM_THRESHOLD

const unsigned int CApplication::ACTION_PREV_ITEM_THRESHOLD = 3
static

◆ m_AppFocused

bool CApplication::m_AppFocused {true}

◆ m_bInitializing

bool CApplication::m_bInitializing = true
protected

◆ m_bStop

bool CApplication::m_bStop {false}

◆ m_frameTime

CStopWatch CApplication::m_frameTime
protected

◆ m_guiRefreshTimer

XbmcThreads::EndTime CApplication::m_guiRefreshTimer
protected

◆ m_incompatibleAddons

std::vector<std::shared_ptr<ADDON::CAddonInfo> > CApplication::m_incompatibleAddons
protected

Result of addon migration (incompatible addon infos)

◆ m_lastRenderTime

std::chrono::time_point<std::chrono::steady_clock> CApplication::m_lastRenderTime
protected

◆ m_musicInfoScanner

std::unique_ptr<MUSIC_INFO::CMusicInfoScanner> CApplication::m_musicInfoScanner
protected

◆ m_nextPlaylistItem

int CApplication::m_nextPlaylistItem = -1
protected

◆ m_pActiveAE

std::unique_ptr<ActiveAE::CActiveAE> CApplication::m_pActiveAE
protected

◆ m_pAnnouncementManager

std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> CApplication::m_pAnnouncementManager
protected

◆ m_pAppPort

std::shared_ptr<CAppInboundProtocol> CApplication::m_pAppPort
protected

◆ m_pGUI

std::unique_ptr<CGUIComponent> CApplication::m_pGUI
protected

◆ m_pInertialScrollingHandler

std::unique_ptr<CInertialScrollingHandler> CApplication::m_pInertialScrollingHandler
protected

◆ m_prevMedia

std::string CApplication::m_prevMedia
protected

◆ m_pWinSystem

std::unique_ptr<CWinSystemBase> CApplication::m_pWinSystem
protected

◆ m_restartPlayerTimer

CStopWatch CApplication::m_restartPlayerTimer
protected

◆ m_ServiceManager

std::unique_ptr<CServiceManager> CApplication::m_ServiceManager

◆ m_skipGuiRender

bool CApplication::m_skipGuiRender = false
protected

◆ m_slowTimer

CStopWatch CApplication::m_slowTimer
protected

◆ m_strPlayListFile

std::string CApplication::m_strPlayListFile

The documentation for this class was generated from the following files: