Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
XBMCAddon::Python::PythonLanguageHook Class Reference

#include <LanguageHook.h>

Inheritance diagram for XBMCAddon::Python::PythonLanguageHook:
XBMCAddon::LanguageHook XBMCAddon::AddonClass

Public Member Functions

 PythonLanguageHook (PyInterpreterState *interp)
 
 ~PythonLanguageHook () override
 
void DelayedCallOpen () override
 
void DelayedCallClose () override
 
void MakePendingCalls () override
 
XBMCAddon::CallbackHandlerGetCallbackHandler () override
 
String GetAddonId () override
 
String GetAddonVersion () override
 
long GetInvokerId () override
 
void RegisterPlayerCallback (IPlayerCallback *player) override
 
void UnregisterPlayerCallback (IPlayerCallback *player) override
 
void RegisterMonitorCallback (XBMCAddon::xbmc::Monitor *monitor) override
 
void UnregisterMonitorCallback (XBMCAddon::xbmc::Monitor *monitor) override
 
bool WaitForEvent (CEvent &hEvent, unsigned int milliseconds) override
 
void RegisterAddonClassInstance (AddonClass *obj)
 
void UnregisterAddonClassInstance (AddonClass *obj)
 
bool HasRegisteredAddonClassInstance (AddonClass *obj)
 
bool HasRegisteredAddonClasses ()
 
std::set< AddonClass * > & GetRegisteredAddonClasses ()
 
void UnregisterMe ()
 
void RegisterMe ()
 
- Public Member Functions inherited from XBMCAddon::LanguageHook
 ~LanguageHook () override
 
virtual void Constructing (AddonClass *beingConstructed)
 
virtual void Destructing (AddonClass *beingDestructed)
 
- Public Member Functions inherited from XBMCAddon::AddonClass
 AddonClass ()
 
virtual ~AddonClass ()
 
const char * GetClassname () const
 
LanguageHookGetLanguageHook ()
 
bool isDeallocating ()
 
void Release () const
 
void Acquire () const
 

Static Public Member Functions

static AddonClass::Ref< PythonLanguageHookGetIfExists (PyInterpreterState *interp)
 
static bool IsAddonClassInstanceRegistered (AddonClass *obj)
 
- Static Public Member Functions inherited from XBMCAddon::LanguageHook
static void SetLanguageHook (LanguageHook *languageHook)
 
static LanguageHookGetLanguageHook ()
 
static void ClearLanguageHook ()
 
- Static Public Member Functions inherited from XBMCAddon::AddonClass
static short getNumAddonClasses ()
 

Additional Inherited Members

- Protected Member Functions inherited from XBMCAddon::LanguageHook
 LanguageHook ()=default
 
- Protected Member Functions inherited from XBMCAddon::AddonClass
virtual void deallocating ()
 
- Static Protected Member Functions inherited from XBMCAddon::AddonClass
static short getNextClassIndex ()
 
- Protected Attributes inherited from XBMCAddon::AddonClass
LanguageHooklanguageHook
 

Detailed Description

This class supplies the python specific functionality for plugging into the API. It's got a static only implementation and uses the singleton pattern for access.

Constructor & Destructor Documentation

◆ PythonLanguageHook()

XBMCAddon::Python::PythonLanguageHook::PythonLanguageHook ( PyInterpreterState * interp)
inlineexplicit

◆ ~PythonLanguageHook()

XBMCAddon::Python::PythonLanguageHook::~PythonLanguageHook ( )
override

Member Function Documentation

◆ DelayedCallClose()

void XBMCAddon::Python::PythonLanguageHook::DelayedCallClose ( )
overridevirtual

If the scripting language needs special handling for calls that block or are delayed in any other means, this should be overloaded.

In Python when control is passed to a native method that blocks, you need to allow other threads in Python to run by using Py_BEGIN_ALLOW_THREADS. When that delayed method ends you need to restore the Python thread state using Py_END_ALLOW_THREADS. This is the place to put that functionality

Reimplemented from XBMCAddon::LanguageHook.

◆ DelayedCallOpen()

void XBMCAddon::Python::PythonLanguageHook::DelayedCallOpen ( )
overridevirtual

If the scripting language needs special handling for calls that block or are delayed in any other means, this should be overloaded.

In Python when control is passed to a native method that blocks, you need to allow other threads in Python to run by using Py_BEGIN_ALLOW_THREADS. This is the place to put that functionality

Reimplemented from XBMCAddon::LanguageHook.

◆ GetAddonId()

String XBMCAddon::Python::PythonLanguageHook::GetAddonId ( )
overridevirtual

This method should be done a different way but since the only other way I can think to do it requires an InheritableThreadLocal C++ equivalent, I'm going to defer to this technique for now.

Currently (for python) the scripting language has the Addon id injected into it as a global variable. Therefore the only way to retrieve it is to use scripting language specific calls. So until I figure out a better way to do this, this is how I need to retrieve it.

Reimplemented from XBMCAddon::LanguageHook.

◆ GetAddonVersion()

String XBMCAddon::Python::PythonLanguageHook::GetAddonVersion ( )
overridevirtual

Reimplemented from XBMCAddon::LanguageHook.

◆ GetCallbackHandler()

XBMCAddon::CallbackHandler * XBMCAddon::Python::PythonLanguageHook::GetCallbackHandler ( )
overridevirtual

PythonCallbackHandler expects to be instantiated PER AddonClass instance that is to be used as a callback. This is why this cannot be instantiated once.

There is an expectation that this method is called from the Python thread that instantiated an AddonClass that has the potential for a callback.

See RetardedAsyncCallbackHandler for more details. See PythonCallbackHandler for more details See PythonCallbackHandler::PythonCallbackHandler for more details

Reimplemented from XBMCAddon::LanguageHook.

◆ GetIfExists()

AddonClass::Ref< PythonLanguageHook > XBMCAddon::Python::PythonLanguageHook::GetIfExists ( PyInterpreterState * interp)
static

◆ GetInvokerId()

long XBMCAddon::Python::PythonLanguageHook::GetInvokerId ( )
overridevirtual

Reimplemented from XBMCAddon::LanguageHook.

◆ GetRegisteredAddonClasses()

std::set< AddonClass * > & XBMCAddon::Python::PythonLanguageHook::GetRegisteredAddonClasses ( )
inline

◆ HasRegisteredAddonClasses()

bool XBMCAddon::Python::PythonLanguageHook::HasRegisteredAddonClasses ( )
inline

◆ HasRegisteredAddonClassInstance()

bool XBMCAddon::Python::PythonLanguageHook::HasRegisteredAddonClassInstance ( AddonClass * obj)

◆ IsAddonClassInstanceRegistered()

bool XBMCAddon::Python::PythonLanguageHook::IsAddonClassInstanceRegistered ( AddonClass * obj)
static

◆ MakePendingCalls()

void XBMCAddon::Python::PythonLanguageHook::MakePendingCalls ( )
overridevirtual

Reimplemented from XBMCAddon::LanguageHook.

◆ RegisterAddonClassInstance()

void XBMCAddon::Python::PythonLanguageHook::RegisterAddonClassInstance ( AddonClass * obj)

◆ RegisterMe()

void XBMCAddon::Python::PythonLanguageHook::RegisterMe ( )

◆ RegisterMonitorCallback()

void XBMCAddon::Python::PythonLanguageHook::RegisterMonitorCallback ( XBMCAddon::xbmc::Monitor * monitor)
overridevirtual

◆ RegisterPlayerCallback()

void XBMCAddon::Python::PythonLanguageHook::RegisterPlayerCallback ( IPlayerCallback * player)
overridevirtual

◆ UnregisterAddonClassInstance()

void XBMCAddon::Python::PythonLanguageHook::UnregisterAddonClassInstance ( AddonClass * obj)

◆ UnregisterMe()

void XBMCAddon::Python::PythonLanguageHook::UnregisterMe ( )

◆ UnregisterMonitorCallback()

void XBMCAddon::Python::PythonLanguageHook::UnregisterMonitorCallback ( XBMCAddon::xbmc::Monitor * monitor)
overridevirtual

◆ UnregisterPlayerCallback()

void XBMCAddon::Python::PythonLanguageHook::UnregisterPlayerCallback ( IPlayerCallback * player)
overridevirtual

◆ WaitForEvent()

bool XBMCAddon::Python::PythonLanguageHook::WaitForEvent ( CEvent & hEvent,
unsigned int milliseconds )
overridevirtual

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