Widget that displays an UncompressedVideoPayload via SDL texture rendering. More...
#include <sdlvideowidget.h>


Public Types | |
| enum | ScaleMode { ScaleNone , ScaleFit , ScaleStretch } |
| Scaling mode for displayed images. More... | |
Public Member Functions | |
| 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. | |
Static Public Member Functions | |
| 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. | |
Protected Member Functions | |
| void | paintEvent (PaintEvent *e) override |
Widget that displays an UncompressedVideoPayload via SDL texture rendering.
SDLVideoWidget manages an SDL_Texture and renders an UncompressedVideoPayload within its widget geometry. It handles aspect-ratio-preserving scaling with letterbox/pillarbox bars.
The widget obtains the SDL_Renderer from its ancestor SDLWindow. It must be a child (direct or indirect) of an SDLWindow to render.
Every uncompressed PixelFormat the library supports can be displayed. Formats with a direct SDL equivalent (8-bit RGB/BGR/ RGBA/BGRA/ARGB/ABGR and the host-endian 16-bit variants of those) are uploaded to an SDL texture as-is. Everything else — DPX packings, v210, 10/12-bit words, YUV, float, linear, non-host endian — must be converted upstream (e.g. by a planner-inserted CSC stage) to an SDL-native PixelFormat before it reaches the widget; the widget itself does not perform CSC. isDirectlyMappable() reports which formats skip the planner's CSC stage.
Compressed pixel descriptions (e.g. JPEG_RGB8_sRGB) are not supported — the caller must decode them first.
setPayload() is thread-affine; use ObjectBase signal/slot dispatch (or EventLoop::postCallable) to deliver payloads from a producer thread. | promeki::SDLVideoWidget::SDLVideoWidget | ( | ObjectBase * | parent = nullptr | ) |
Constructs an SDLVideoWidget.
| parent | Parent widget (typically an SDLWindow). |
|
static |
Returns whether a format can skip CSC conversion on upload.
This is the fast-path predicate — it does NOT tell you whether the widget can display the format (it can display every uncompressed format via the fallback path).
| pd | The promeki pixel description. |
|
static |
Maps a promeki PixelFormat to an SDL_Colorspace.
Used for YUV formats that mapPixelFormat() returns a direct SDL YUV format for. The colorspace property tells SDL which YCbCr→RGB matrix and which range (limited / full) to use when rendering the texture.
Returns 0 for RGB and for unsupported YUV formats — in the RGB case the caller should just let SDL use its default (sRGB).
| pd | The promeki pixel description. |
|
static |
Maps a promeki PixelFormat to an SDL pixel format.
Returns a direct SDL format for:
YUV formats are uploaded via SDL's direct YUV path — SDL performs the YCbCr→RGB conversion on the GPU when the texture is rendered, with the color matrix and range taken from the texture's colorspace property (see mapColorspace()).
Returns 0 for formats without a direct SDL equivalent (DPX, v210, linear-light float, non-host-endian 16-bit, 10/12-bit-in-16-bit-word, 422 planar, 422 NV16, compressed, etc). Formats that return 0 are still displayable — the widget falls back to CSC conversion to RGBA8_sRGB.
| pd | The promeki pixel description. |
| void promeki::SDLVideoWidget::setPayload | ( | const UncompressedVideoPayload::Ptr & | payload | ) |
Sets the payload to display.
The payload is uploaded to an SDL texture on the next paint. If the pixel format is not directly supported by SDL, the upload fails and the frame is dropped — callers must deliver an SDL-native PixelFormat (see isDirectlyMappable).
| payload | The payload to display. |
|
inline |
Sets the scaling mode.
| mode | The scaling mode. |