WPILibC++ 2023.4.3
|
A sink that acts as a MJPEG-over-HTTP network server. More...
#include <cscore_oo.h>
Public Member Functions | |
MjpegServer ()=default | |
MjpegServer (std::string_view name, std::string_view listenAddress, int port) | |
Create a MJPEG-over-HTTP server sink. More... | |
MjpegServer (std::string_view name, int port) | |
Create a MJPEG-over-HTTP server sink. More... | |
std::string | GetListenAddress () const |
Get the listen address of the server. More... | |
int | GetPort () const |
Get the port number of the server. More... | |
void | SetResolution (int width, int height) |
Set the stream resolution for clients that don't specify it. More... | |
void | SetFPS (int fps) |
Set the stream frames per second (FPS) for clients that don't specify it. More... | |
void | SetCompression (int quality) |
Set the compression for clients that don't specify it. More... | |
void | SetDefaultCompression (int quality) |
Set the default compression used for non-MJPEG sources. More... | |
Public Member Functions inherited from cs::VideoSink | |
VideoSink () noexcept=default | |
VideoSink (const VideoSink &sink) | |
VideoSink (VideoSink &&sink) noexcept | |
VideoSink & | operator= (VideoSink other) noexcept |
~VideoSink () | |
operator bool () const | |
int | GetHandle () const |
bool | operator== (const VideoSink &other) const |
Kind | GetKind () const |
Get the kind of the sink. More... | |
std::string | GetName () const |
Get the name of the sink. More... | |
std::string | GetDescription () const |
Get the sink description. More... | |
VideoProperty | GetProperty (std::string_view name) |
Get a property of the sink. More... | |
std::vector< VideoProperty > | EnumerateProperties () const |
Enumerate all properties of this sink. More... | |
bool | SetConfigJson (std::string_view config) |
Set properties from a JSON configuration string. More... | |
bool | SetConfigJson (const wpi::json &config) |
Set properties from a JSON configuration object. More... | |
std::string | GetConfigJson () const |
Get a JSON configuration string. More... | |
wpi::json | GetConfigJsonObject () const |
Get a JSON configuration object. More... | |
void | SetSource (VideoSource source) |
Configure which source should provide frames to this sink. More... | |
VideoSource | GetSource () const |
Get the connected source. More... | |
VideoProperty | GetSourceProperty (std::string_view name) |
Get a property of the associated source. More... | |
CS_Status | GetLastStatus () const |
Additional Inherited Members | |
Public Types inherited from cs::VideoSink | |
enum | Kind { kUnknown = CS_SINK_UNKNOWN , kMjpeg = CS_SINK_MJPEG , kCv = CS_SINK_CV } |
Static Public Member Functions inherited from cs::VideoSink | |
static std::vector< VideoSink > | EnumerateSinks () |
Enumerate all existing sinks. More... | |
Protected Member Functions inherited from cs::VideoSink | |
VideoSink (CS_Sink handle) | |
Protected Attributes inherited from cs::VideoSink | |
CS_Status | m_status = 0 |
CS_Sink | m_handle {0} |
A sink that acts as a MJPEG-over-HTTP network server.
|
default |
|
inline |
Create a MJPEG-over-HTTP server sink.
name | Sink name (arbitrary unique identifier) |
listenAddress | TCP listen address (empty string for all addresses) |
port | TCP port number |
|
inline |
Create a MJPEG-over-HTTP server sink.
name | Sink name (arbitrary unique identifier) |
port | TCP port number |
|
inline |
Get the listen address of the server.
|
inline |
Get the port number of the server.
|
inline |
Set the compression for clients that don't specify it.
Setting this will result in increased CPU usage for MJPEG source cameras as it will decompress and recompress the image instead of using the camera's MJPEG image directly.
quality | JPEG compression quality (0-100), -1 for unspecified |
|
inline |
Set the default compression used for non-MJPEG sources.
If not set, 80 is used. This function has no effect on MJPEG source cameras; use SetCompression() instead to force recompression of MJPEG source images.
quality | JPEG compression quality (0-100) |
|
inline |
Set the stream frames per second (FPS) for clients that don't specify it.
It is not necessary to set this if it is the same as the source FPS.
fps | FPS, 0 for unspecified |
|
inline |
Set the stream resolution for clients that don't specify it.
It is not necessary to set this if it is the same as the source resolution.
Setting this different than the source resolution will result in increased CPU usage, particularly for MJPEG source cameras, as it will decompress, resize, and recompress the image, instead of using the camera's MJPEG image directly.
width | width, 0 for unspecified |
height | height, 0 for unspecified |