ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
toolx::streams::FrameOverlay Class Reference

Burns the session name (bottom centre) and the date/time (top right) into frames. More...

#include <frame_overlay.h>

Collaboration diagram for toolx::streams::FrameOverlay:
Collaboration graph

Data Structures

struct  Saved
 The frame pixels hidden by one overlay. More...

Public Member Functions

void setSessionNameOverlay (bool enabled)
 Enable or disable the session name overlay.
void setTimeOverlay (bool enabled)
 Enable or disable the date/time overlay.
void restore (uint8_t *buffer, uint32_t width, uint32_t height, mediax::rtp::ColourspaceType encoding)
 Undo the overlays painted by the previous apply().
void apply (uint8_t *buffer, uint32_t width, uint32_t height, mediax::rtp::ColourspaceType encoding, const std::string &session_name)
 Paint the enabled overlays into a frame.

Private Member Functions

void blit (const QImage &overlay, int start_x, int start_y, uint8_t *buffer, uint32_t width, uint32_t height, mediax::rtp::ColourspaceType encoding, Saved &saved)
 Save the pixels under an overlay, then composite the overlay over them.
void updateFont (uint32_t height)
 Resize the font to the frame height.

Static Private Member Functions

static void restoreRegion (Saved &saved, uint8_t *buffer, uint32_t width, uint32_t height, uint32_t bytes_per_pixel)
 Put the saved pixels of an overlay back.

Private Attributes

std::atomic< bool > m_session_name_enabled { false }
 Whether to paint the session name.
std::atomic< bool > m_time_enabled { false }
 Whether to paint the date/time.
QFont m_font
 The overlay font, sized to the frame height.
QFontMetrics m_metrics { QFont() }
 Metrics of the overlay font.
uint32_t m_font_height = 0
 The frame height the font was sized for.
QImage m_session_image
 The rendered session name, only redrawn when the name or the font changes.
std::string m_session_text
 The name that was rendered.
Saved m_saved_session
 Pixels hidden by the session name overlay.
Saved m_saved_time
 Pixels hidden by the date/time overlay.

Detailed Description

Burns the session name (bottom centre) and the date/time (top right) into frames.

The overlays are painted straight into the frame the generator hands to the encoder, so they are embedded in the transmitted video. Test patterns that are only drawn when they change must not accumulate overlays, so each apply() saves the pixels it covers and restore() puts them back at the start of the next frame.

The enable flags may be changed from another thread. apply() and restore() belong to the generator thread.

Member Function Documentation

◆ apply()

void toolx::streams::FrameOverlay::apply ( uint8_t * buffer,
uint32_t width,
uint32_t height,
mediax::rtp::ColourspaceType encoding,
const std::string & session_name )

Paint the enabled overlays into a frame.

Parameters
bufferthe frame buffer
widthframe width in pixels
heightframe height in pixels
encodingthe colourspace of the frame
session_namethe text of the session name overlay

◆ restore()

void toolx::streams::FrameOverlay::restore ( uint8_t * buffer,
uint32_t width,
uint32_t height,
mediax::rtp::ColourspaceType encoding )

Undo the overlays painted by the previous apply().

Call before the frame is regenerated.

Parameters
bufferthe frame buffer
widthframe width in pixels
heightframe height in pixels
encodingthe colourspace of the frame

◆ setSessionNameOverlay()

void toolx::streams::FrameOverlay::setSessionNameOverlay ( bool enabled)
inline

Enable or disable the session name overlay.

Parameters
enabledtrue to paint the session name at the bottom centre of the frame

◆ setTimeOverlay()

void toolx::streams::FrameOverlay::setTimeOverlay ( bool enabled)
inline

Enable or disable the date/time overlay.

Parameters
enabledtrue to paint the date and time at the top right of the frame

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