WPILibC++  2019.3.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
cs::MjpegServer Class Reference

A sink that acts as a MJPEG-over-HTTP network server. More...

#include <cscore_oo.h>

Inheritance diagram for cs::MjpegServer:
cs::VideoSink

Public Member Functions

 MjpegServer (const wpi::Twine &name, const wpi::Twine &listenAddress, int port)
 Create a MJPEG-over-HTTP server sink. More...
 
 MjpegServer (const wpi::Twine &name, int port)
 Create a MJPEG-over-HTTP server sink. More...
 
std::string GetListenAddress () const
 Get the listen address of the server.
 
int GetPort () const
 Get the port number of the server.
 
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 (const VideoSink &sink)
 
 VideoSink (VideoSink &&sink) noexcept
 
VideoSinkoperator= (VideoSink other) noexcept
 
 operator bool () const
 
int GetHandle () const
 
bool operator== (const VideoSink &other) const
 
bool operator!= (const VideoSink &other) const
 
Kind GetKind () const
 Get the kind of the sink.
 
std::string GetName () const
 Get the name of the sink. More...
 
std::string GetDescription () const
 Get the sink description. More...
 
VideoProperty GetProperty (const wpi::Twine &name)
 Get a property of the sink. More...
 
std::vector< VideoPropertyEnumerateProperties () const
 Enumerate all properties of this sink.
 
bool SetConfigJson (wpi::StringRef 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 (const wpi::Twine &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< VideoSinkEnumerateSinks ()
 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
 

Detailed Description

A sink that acts as a MJPEG-over-HTTP network server.

Constructor & Destructor Documentation

cs::MjpegServer::MjpegServer ( const wpi::Twine name,
const wpi::Twine listenAddress,
int  port 
)
inline

Create a MJPEG-over-HTTP server sink.

Parameters
nameSink name (arbitrary unique identifier)
listenAddressTCP listen address (empty string for all addresses)
portTCP port number
cs::MjpegServer::MjpegServer ( const wpi::Twine name,
int  port 
)
inline

Create a MJPEG-over-HTTP server sink.

Parameters
nameSink name (arbitrary unique identifier)
portTCP port number

Member Function Documentation

void cs::MjpegServer::SetCompression ( int  quality)
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.

Parameters
qualityJPEG compression quality (0-100), -1 for unspecified
void cs::MjpegServer::SetDefaultCompression ( int  quality)
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.

Parameters
qualityJPEG compression quality (0-100)
void cs::MjpegServer::SetFPS ( int  fps)
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.

Parameters
fpsFPS, 0 for unspecified
void cs::MjpegServer::SetResolution ( int  width,
int  height 
)
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.

Parameters
widthwidth, 0 for unspecified
heightheight, 0 for unspecified

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