|
vdr-plugin-softhddevice-drm-gles 1.6.8-daba64b
|
State Machine Implementation. More...
#include <statemachine.h>
Public Member Functions | |
| cStateMachine (cSoftHdDevice *) | |
| Create the state machine. | |
| void | OnEventReceived (const Event &) |
| Event handler for playback state transitions. | |
| State | GetState (void) const |
| void | SetState (State state) |
| void | ChangeState (State) |
| Sets the new state and triggers actions, which are necessary when leaving the old and entering the new state. | |
Private Attributes | |
| cSoftHdDevice * | m_pDevice |
| pointer to the device | |
| std::mutex | m_mutex |
| state machine mutex | |
| std::atomic< State > | m_state = DETACHED |
| current state | |
State Machine Implementation.
Events can be pushed directly to the state machine (OnEventReceived()) or can be pushed through the event handler queue. Pushing directly may block the calling thread until OnEventReceiced() returns. Pushing the event to the event handler queue avoids this locking but does not guarantee, that the event is processed immediately.
The user may choose, which solution fits best for the present use case.
Definition at line 141 of file statemachine.h.
| cStateMachine::cStateMachine | ( | cSoftHdDevice * | device | ) |
Create the state machine.
| device | pointer to cSoftHdDevice object |
Definition at line 32 of file statemachine.cpp.
Sets the new state and triggers actions, which are necessary when leaving the old and entering the new state.
| newState | target state |
Definition at line 43 of file statemachine.cpp.
References cSoftHdDevice::EnterState(), cSoftHdDevice::LeaveState(), LOGDEBUG, m_pDevice, m_state, and StateToString().
Referenced by OnEventReceived().
Definition at line 146 of file statemachine.h.
References m_state.
Event handler for playback state transitions.
Processes events (Play, Pause, Stop, TrickSpeed, StillPicture) and performs the appropriate state transitions based on the current state. The method halts both display and decoding threads before processing the event and resumes them afterwards to ensure thread-safe state transitions.
| event | The event to process (variant type containing specific event data) |
Definition at line 66 of file statemachine.cpp.
References BUFFERING, ChangeState(), DETACHED, EventToString(), cSoftHdDevice::HaltOpenGlThread(), cSoftHdDevice::HaltVideoThreads(), cSoftHdDevice::HandleDisplayModeChange(), cSoftHdDevice::HandleStillPicture(), cSoftHdDevice::InitAudio(), cSoftHdDevice::IsDetachForced(), LOGDEBUG, LOGERROR, LOGWARNING, m_mutex, m_pDevice, m_state, cSoftHdDevice::PausePlayback(), PLAY, cSoftHdDevice::ResetVideoFilter(), cSoftHdDevice::ResumeFromPause(), cSoftHdDevice::ResumeOpenGlThread(), cSoftHdDevice::ResumePlayback(), cSoftHdDevice::ResumeVideoThreads(), cSoftHdDevice::SchedulePlaybackStart(), cSoftHdDevice::ScheduleResyncAtPtsMs(), cSoftHdDevice::SetDetachForced(), cSoftHdDevice::SetTrickSpeed(), StateToString(), STOP, and TRICK_SPEED.
Referenced by cEventHandler::Action().
Definition at line 147 of file statemachine.h.
References m_state.
|
private |
|
private |
pointer to the device
Definition at line 151 of file statemachine.h.
Referenced by ChangeState(), and OnEventReceived().
current state
Definition at line 153 of file statemachine.h.
Referenced by ChangeState(), GetState(), OnEventReceived(), and SetState().