Generates test card frames, encodes them with OpenH264 and casts them with a mediax::qt6::QtCastSender.
More...
#include <cast_generator.h>
|
| | CastGenerator (QObject *parent=nullptr) |
| | Construct a new cast generator.
|
|
| ~CastGenerator () final |
| | Stop casting.
|
|
| CastGenerator (const CastGenerator &)=delete |
|
CastGenerator & | operator= (const CastGenerator &)=delete |
|
| CastGenerator (CastGenerator &&)=delete |
|
CastGenerator & | operator= (CastGenerator &&)=delete |
| bool | start (const CastStreamConfig &config, QString &error) |
| | Open the encoder, start connecting to the device and start generating frames.
|
|
void | stop () |
| | Stop generating frames and stop the application on the device.
|
| bool | isRunning () const |
| | Check if the generator is running.
|
| mediax::qt6::QtCastSender::State | state () const |
| | The state of the connection to the device.
|
| QString | lastError () const |
| | The description of the last error reported by the sender.
|
| void | setPattern (int pattern) |
| | Change the test card while running.
|
| void | setSessionNameOverlay (bool enabled) |
| | Burn the session name into the video while running.
|
| void | setTimeOverlay (bool enabled) |
| | Burn the date and time into the video while running.
|
|
|
void | generateThread () |
| | The frame generation thread.
|
|
|
CastStreamConfig | m_config |
| | The cast configuration.
|
|
std::shared_ptr< mediax::rtp::h264::openh264::RtpH264OpenH264Payloader > | m_encoder |
| | The encoder, outlives the sender's use of it.
|
|
mediax::qt6::QtCastSender * | m_sender = nullptr |
| | The sender, owned by this object.
|
|
std::thread | m_thread |
| | The frame generation thread.
|
|
std::atomic< bool > | m_running { false } |
| | True while the thread should run.
|
|
std::atomic< int > | m_pattern { 0 } |
| | The current test pattern.
|
|
FrameOverlay | m_overlay |
| | Paints the session name and date/time overlays into the frames.
|
|
QString | m_last_error |
| | The last error reported by the sender.
|
Generates test card frames, encodes them with OpenH264 and casts them with a mediax::qt6::QtCastSender.
The connection to the device is made, and re-made if it drops, in the background by the sender. Frames are generated at the configured rate regardless. Like the sender this object belongs to the GUI thread, start() and stop() must be called from it.
◆ CastGenerator()
| toolx::streams::CastGenerator::CastGenerator |
( |
QObject * | parent = nullptr | ) |
|
|
explicit |
Construct a new cast generator.
- Parameters
-
◆ isRunning()
| bool toolx::streams::CastGenerator::isRunning |
( |
| ) |
const |
Check if the generator is running.
- Returns
- true between a successful start() and stop()
◆ lastError()
| QString toolx::streams::CastGenerator::lastError |
( |
| ) |
const |
The description of the last error reported by the sender.
- Returns
- QString the error, empty if there was none
◆ setPattern()
| void toolx::streams::CastGenerator::setPattern |
( |
int | pattern | ) |
|
Change the test card while running.
- Parameters
-
◆ setSessionNameOverlay()
| void toolx::streams::CastGenerator::setSessionNameOverlay |
( |
bool | enabled | ) |
|
Burn the session name into the video while running.
- Parameters
-
| enabled | true to paint the session name at the bottom centre of the frame |
◆ setTimeOverlay()
| void toolx::streams::CastGenerator::setTimeOverlay |
( |
bool | enabled | ) |
|
Burn the date and time into the video while running.
- Parameters
-
| enabled | true to paint the date and time at the top right of the frame |
◆ start()
| bool toolx::streams::CastGenerator::start |
( |
const CastStreamConfig & | config, |
|
|
QString & | error ) |
Open the encoder, start connecting to the device and start generating frames.
Returns at once. The device connects in the background, see state().
- Parameters
-
| config | the cast configuration |
| error | set to the reason when false is returned |
- Returns
- true if casting was started
◆ state()
| mediax::qt6::QtCastSender::State toolx::streams::CastGenerator::state |
( |
| ) |
const |
The state of the connection to the device.
- Returns
- the state, Idle when not running
The documentation for this class was generated from the following files: