Captures this machine's desktop and publishes it as an H.264 RTSP stream (the sending counterpart to ScreenReceiver). More...
#include <Malena/Screen/ScreenSender.h>
Public Member Functions | |
| ScreenSenderBase (const char *name, const char *rtspUrl) | |
| ScreenSenderBase (const ScreenSenderBase &)=delete | |
| virtual | ~ScreenSenderBase () |
| bool | isPublishing () const |
| ScreenSenderBase & | operator= (const ScreenSenderBase &)=delete |
| const std::string & | senderName () const |
| void | setCaptureIndex (int index) |
| void | setCaptureWindow (unsigned int windowId) |
| void | setUrl (const std::string &rtspUrl) |
| void | setWindowHelperPath (const std::string &path) |
| void | start () |
| void | stop () |
| const std::string & | url () const |
Captures this machine's desktop and publishes it as an H.264 RTSP stream (the sending counterpart to ScreenReceiver).
Headless (no UI): it captures the screen with a platform-native GStreamer source, encodes with a platform-native non-GPL H.264 encoder, and pushes the stream to an RTSP server (e.g. MediaMTX on the Pi) via rtspclientsink. A Malena admin app constructs one of these to share its own desktop; the stream is then displayed by any ScreenReceiver pulling the same path.
capture → videoconvert → H.264 encode → h264parse → rtspclientsink(URL)
Encoders are chosen to keep the product distributable (no GPL/x264):
The pipeline runs on its own GStreamer threads with a background watcher that auto-reconnects (with backoff) if the RTSP server is not yet up or drops.
Definition at line 36 of file ScreenSender.h.
| ml::ScreenSenderBase::ScreenSenderBase | ( | const char * | name, |
| const char * | rtspUrl ) |
| name | Human-readable label for logs/status. |
| rtspUrl | Publish target, e.g. "rtsp://192.168.4.1:8554/admin". |
|
virtual |
|
delete |
| bool ml::ScreenSenderBase::isPublishing | ( | ) | const |
True while the pipeline is live (PLAYING with no recent error).
|
delete |
| const std::string & ml::ScreenSenderBase::senderName | ( | ) | const |
| void ml::ScreenSenderBase::setCaptureIndex | ( | int | index | ) |
Choose which display (monitor) to capture. macOS: avfvideosrc device-index; Windows: d3d11screencapturesrc monitor-index; Linux currently ignores it (whole primary screen). Restarts if running. Default 0 (primary display). Also selects whole-display capture mode (the default).
| void ml::ScreenSenderBase::setCaptureWindow | ( | unsigned int | windowId | ) |
Capture a single window instead of a whole display (macOS only). Streams via an external helper (set with setWindowHelperPath) that uses ScreenCaptureKit, since the built-in GStreamer screen sources can only grab a full display. If no helper is configured, falls back to whole-display capture. Restarts if running.
| windowId | Native window id (macOS CGWindowID / SCWindow.windowID). |
| void ml::ScreenSenderBase::setUrl | ( | const std::string & | rtspUrl | ) |
Change the publish destination. Restarts the pipeline if running, so the caller can derive the URL at runtime (e.g. from a configured media host) rather than fixing it at construction. No-op if unchanged.
| void ml::ScreenSenderBase::setWindowHelperPath | ( | const std::string & | path | ) |
| void ml::ScreenSenderBase::start | ( | ) |
Start (or restart) capturing + publishing. Non-blocking.
| void ml::ScreenSenderBase::stop | ( | ) |
Stop publishing and release the pipeline.
| const std::string & ml::ScreenSenderBase::url | ( | ) | const |