Burns the session name (bottom centre) and the date/time (top right) into frames.
More...
#include <frame_overlay.h>
|
| struct | Saved |
| | The frame pixels hidden by one overlay. More...
|
|
| 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.
|
|
|
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 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.
|
|
|
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.
|
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.
◆ 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
-
| buffer | the frame buffer |
| width | frame width in pixels |
| height | frame height in pixels |
| encoding | the colourspace of the frame |
| session_name | the 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
-
| buffer | the frame buffer |
| width | frame width in pixels |
| height | frame height in pixels |
| encoding | the colourspace of the frame |
◆ setSessionNameOverlay()
| void toolx::streams::FrameOverlay::setSessionNameOverlay |
( |
bool | enabled | ) |
|
|
inline |
Enable or disable the session name overlay.
- Parameters
-
| enabled | true 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
-
| enabled | true to paint the date and time at the top right of the frame |
The documentation for this class was generated from the following files: