Isle
Loading...
Searching...
No Matches
MxMediaManager Class Reference

[AI] Central class for managing the lifecycle and thread-safety of MxPresenter objects for audio/video playback. More...

#include <mxmediamanager.h>

Inheritance diagram for MxMediaManager:
Collaboration diagram for MxMediaManager:

Public Member Functions

 MxMediaManager ()
 [AI] Constructor. More...
 
 ~MxMediaManager () override
 [AI] Destructor. More...
 
MxResult Tickle () override
 [AI] Called by the tickle manager to step through and update all presenters, and process their output data. More...
 
virtual MxResult Create ()
 [AI] Allocates and initializes the internal presenter list for this manager, ensuring thread safety. More...
 
virtual void Destroy ()
 [AI] Destroys all registered presenters and resets the internal state, ensuring safe resource disposal. More...
 
virtual void RegisterPresenter (MxPresenter &p_presenter)
 [AI] Register a new presenter for tickle management and playback coordination. More...
 
virtual void UnregisterPresenter (MxPresenter &p_presenter)
 [AI] Remove a presenter from tickle and managed output lists. More...
 
virtual void StopPresenters ()
 [AI] Stops/ends the action on all registered presenters, typically halting all playback and output. More...
 
MxResult Init ()
 [AI] Initializes all internal members to their default values. More...
 
- Public Member Functions inherited from MxCore
 MxCore ()
 [AI] Constructs a new MxCore object and assigns it a unique id. More...
 
virtual ~MxCore ()
 [AI] Virtual destructor. Required for correct polymorphic cleanup in derived classes. More...
 
virtual MxLong Notify (MxParam &p_param)
 [AI] Virtual callback notification mechanism. More...
 
virtual MxResult Tickle ()
 [AI] Called by tickle managers to allow the object to update itself. More...
 
virtual const char * ClassName () const
 [AI] Returns the runtime class name of this object. More...
 
virtual MxBool IsA (const char *p_name) const
 [AI] Checks whether this object's class type or parents match the given name. More...
 
MxU32 GetId ()
 [AI] Gets the unique (per-process) id assigned to this object instance. More...
 

Protected Attributes

MxPresenterListm_presenters
 [AI] Pointer to list of currently registered (active) presenters. More...
 
MxThreadm_thread
 [AI] Optional pointer to a worker thread used for media dispatch/IO (if multi-threaded operation is used, otherwise NULL). More...
 
MxCriticalSection m_criticalSection
 [AI] Critical section object used for guarding access to the presenter list and internal members for thread safety. More...
 

Detailed Description

[AI] Central class for managing the lifecycle and thread-safety of MxPresenter objects for audio/video playback.

[AI] The MxMediaManager is responsible for keeping track of all currently active MxPresenter objects, providing registration/unregistration, and ticking each presenter as necessary. It ensures thread-safe access to its collections via an internal MxCriticalSection. This class is typically instantiated and owned by the engine singleton (MxOmni), and provides high-level media dispatching/coordination for cutscenes, sound and possibly video output.

Definition at line 22 of file mxmediamanager.h.

Constructor & Destructor Documentation

◆ MxMediaManager()

MxMediaManager::MxMediaManager ( )

[AI] Constructor.

Initializes the manager to default values.

Definition at line 14 of file mxmediamanager.cpp.

◆ ~MxMediaManager()

MxMediaManager::~MxMediaManager ( )
override

[AI] Destructor.

Ensures destruction of all managed presenters and cleanup.

Definition at line 20 of file mxmediamanager.cpp.

Member Function Documentation

◆ Create()

MxResult MxMediaManager::Create ( )
virtual

[AI] Allocates and initializes the internal presenter list for this manager, ensuring thread safety.

[AI] This must be called before the manager is used. Returns FAILURE if allocation fails, destroying internal state accordingly. Called internally by the constructor.

Returns
[AI] SUCCESS on allocation, FAILURE on memory error.

Reimplemented in MxAudioManager.

Definition at line 34 of file mxmediamanager.cpp.

◆ Destroy()

void MxMediaManager::Destroy ( )
virtual

[AI] Destroys all registered presenters and resets the internal state, ensuring safe resource disposal.

[AI] Safe to call multiple times. This method deletes the internal presenter list and re-initializes all pointer members, releasing any system resource.

Reimplemented in LegoSoundManager, LegoVideoManager, MxAudioManager, MxEventManager, MxMusicManager, MxSoundManager, and MxVideoManager.

Definition at line 49 of file mxmediamanager.cpp.

◆ Init()

MxResult MxMediaManager::Init ( )

[AI] Initializes all internal members to their default values.

[AI] Called from the constructor and Destroy(). Zeros out pointers.

Returns
[AI] Always returns SUCCESS.

Definition at line 26 of file mxmediamanager.cpp.

◆ RegisterPresenter()

void MxMediaManager::RegisterPresenter ( MxPresenter p_presenter)
virtual

[AI] Register a new presenter for tickle management and playback coordination.

Parameters
p_presenter[AI] Presenter to register. Must be non-null and remain valid until unregistered or destroyed.

[AI] Adds the presenter to the internal list so that it will participate in tickling (update/output). This should be called when a presenter becomes active.

Definition at line 81 of file mxmediamanager.cpp.

◆ StopPresenters()

void MxMediaManager::StopPresenters ( )
virtual

[AI] Stops/ends the action on all registered presenters, typically halting all playback and output.

[AI] Calls EndAction() on each presenter, signaling them to stop playback or transition to an idle state.

Definition at line 100 of file mxmediamanager.cpp.

◆ Tickle()

MxResult MxMediaManager::Tickle ( )
overridevirtual

[AI] Called by the tickle manager to step through and update all presenters, and process their output data.

[AI] First, Tickle() calls the Tickle() method of each registered presenter to advance their playback or state. Then, in a separate pass, it calls PutData() on each presenter to request media data to be rendered/output. Both passes are performed under thread synchronization.

Returns
[AI] Returns SUCCESS after all presenters have been processed, or FAILURE on internal error.

Reimplemented from MxCore.

Reimplemented in MxVideoManager.

Definition at line 61 of file mxmediamanager.cpp.

◆ UnregisterPresenter()

void MxMediaManager::UnregisterPresenter ( MxPresenter p_presenter)
virtual

[AI] Remove a presenter from tickle and managed output lists.

Parameters
p_presenter[AI] Presenter to unregister. Will be located and safely removed (if present).

[AI] This should be called by presenters that are being destroyed or no longer need to participate in media output.

Definition at line 89 of file mxmediamanager.cpp.

Member Data Documentation

◆ m_criticalSection

MxCriticalSection MxMediaManager::m_criticalSection
protected

[AI] Critical section object used for guarding access to the presenter list and internal members for thread safety.

Definition at line 98 of file mxmediamanager.h.

◆ m_presenters

MxPresenterList* MxMediaManager::m_presenters
protected

[AI] Pointer to list of currently registered (active) presenters.

List is thread-safe.

Definition at line 88 of file mxmediamanager.h.

◆ m_thread

MxThread* MxMediaManager::m_thread
protected

[AI] Optional pointer to a worker thread used for media dispatch/IO (if multi-threaded operation is used, otherwise NULL).

Definition at line 93 of file mxmediamanager.h.


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