Widget that plays frames through an SDLPlayerMediaIO. More...
#include <sdlplayerwidget.h>


Public Member Functions | |
| SDLPlayerWidget (SDLAudioOutput *audio=nullptr, bool useAudioClock=true, ObjectBase *parent=nullptr) | |
| Constructs an SDLPlayerWidget. | |
| MediaIO * | mediaIO () const |
| Returns the MediaIO the widget consumes frames through. | |
| SDLPlayerMediaIO * | task () const |
| Returns the underlying task (may be useful for tests). | |
| FrameCount | framesPresented () const |
| Total frames the widget has presented since construction. | |
| void | togglePause () |
| Toggles the playback clock's pause state. | |
| bool | isPaused () const |
| Returns true when the playback clock is paused. | |
Public Member Functions inherited from promeki::SDLVideoWidget | |
| SDLVideoWidget (ObjectBase *parent=nullptr) | |
| Constructs an SDLVideoWidget. | |
| ~SDLVideoWidget () | |
| Destructor. Frees the SDL texture. | |
| void | setPayload (const UncompressedVideoPayload::Ptr &payload) |
| Sets the payload to display. | |
| void | setScaleMode (ScaleMode mode) |
| Sets the scaling mode. | |
| ScaleMode | scaleMode () const |
| Returns the current scaling mode. | |
Protected Member Functions | |
| void | keyPressEvent (KeyEvent *e) override |
Handles Key_Space by toggling pause. | |
Protected Member Functions inherited from promeki::SDLVideoWidget | |
| void | paintEvent (PaintEvent *e) override |
Friends | |
| class | SDLPlayerMediaIO |
Additional Inherited Members | |
Public Types inherited from promeki::SDLVideoWidget | |
| enum | ScaleMode { ScaleNone , ScaleFit , ScaleStretch } |
| Scaling mode for displayed images. More... | |
Static Public Member Functions inherited from promeki::SDLVideoWidget | |
| static uint32_t | mapPixelFormat (const PixelFormat &pd) |
| Maps a promeki PixelFormat to an SDL pixel format. | |
| static uint32_t | mapColorspace (const PixelFormat &pd) |
| Maps a promeki PixelFormat to an SDL_Colorspace. | |
| static bool | isDirectlyMappable (const PixelFormat &pd) |
| Returns whether a format can skip CSC conversion on upload. | |
Widget that plays frames through an SDLPlayerMediaIO.
SDLPlayerWidget subclasses SDLVideoWidget so it paints frames directly, and owns the MediaIO / SDLPlayerMediaIO pair that consumes frames. Clients retrieve the sink via mediaIO and write frames as they would with any MediaIO backend.
The widget is the player's keyboard surface. With FocusPolicy::StrongFocus set at construction, the SDL subsystem routes key events here when the app gives it focus (setFocus or explicit SdlSubsystem::setFocusedWidget). The space key toggles the playback clock's pause state; other keys are left unaccepted so the SdlSubsystem walk propagates them up the parent chain.
The widget owns the MediaIO, which owns the task. The task holds a back-pointer to this widget so its pull thread can call back into presentImage — safe because the destruction order guarantees the MediaIO (and therefore the task + its threads) is torn down before the widget's bases.
|
explicit |
Constructs an SDLPlayerWidget.
Creates the owned SDLPlayerMediaIO / MediaIO pair and sets FocusPolicy::StrongFocus on the widget so the app can setFocus on it to receive key events.
| audio | Audio output (may be nullptr). |
| useAudioClock | Prefer the audio device as the timing source (default true). |
| parent | Optional parent widget / window. |
|
overrideprotected |
Handles Key_Space by toggling pause.
All other key codes are left unaccepted so the SDL subsystem's parent-chain walk propagates them upward.
| void promeki::SDLPlayerWidget::togglePause | ( | ) |
Toggles the playback clock's pause state.
No-op when no MediaIO is currently open (i.e. no pause-capable clock exists yet).