WPILibC++ 2023.4.3
cs::HttpCamera Class Reference

A source that represents a MJPEG-over-HTTP (IP) camera. More...

#include <cscore_oo.h>

Inheritance diagram for cs::HttpCamera:
cs::VideoCamera cs::VideoSource cs::AxisCamera

Public Types

enum  HttpCameraKind { kUnknown = CS_HTTP_UNKNOWN , kMJPGStreamer = CS_HTTP_MJPGSTREAMER , kCSCore = CS_HTTP_CSCORE , kAxis = CS_HTTP_AXIS }
 
- Public Types inherited from cs::VideoCamera
enum  WhiteBalance {
  kFixedIndoor = 3000 , kFixedOutdoor1 = 4000 , kFixedOutdoor2 = 5000 , kFixedFluorescent1 = 5100 ,
  kFixedFlourescent2 = 5200
}
 
- Public Types inherited from cs::VideoSource
enum  Kind { kUnknown = CS_SOURCE_UNKNOWN , kUsb = CS_SOURCE_USB , kHttp = CS_SOURCE_HTTP , kCv = CS_SOURCE_CV }
 
enum  ConnectionStrategy { kConnectionAutoManage = CS_CONNECTION_AUTO_MANAGE , kConnectionKeepOpen = CS_CONNECTION_KEEP_OPEN , kConnectionForceClose = CS_CONNECTION_FORCE_CLOSE }
 Connection strategy. More...
 

Public Member Functions

 HttpCamera (std::string_view name, std::string_view url, HttpCameraKind kind=kUnknown)
 Create a source for a MJPEG-over-HTTP (IP) camera. More...
 
 HttpCamera (std::string_view name, const char *url, HttpCameraKind kind=kUnknown)
 Create a source for a MJPEG-over-HTTP (IP) camera. More...
 
 HttpCamera (std::string_view name, const std::string &url, HttpCameraKind kind=kUnknown)
 Create a source for a MJPEG-over-HTTP (IP) camera. More...
 
 HttpCamera (std::string_view name, std::span< const std::string > urls, HttpCameraKind kind=kUnknown)
 Create a source for a MJPEG-over-HTTP (IP) camera. More...
 
template<typename T >
 HttpCamera (std::string_view name, std::initializer_list< T > urls, HttpCameraKind kind=kUnknown)
 Create a source for a MJPEG-over-HTTP (IP) camera. More...
 
HttpCameraKind GetHttpCameraKind () const
 Get the kind of HTTP camera. More...
 
void SetUrls (std::span< const std::string > urls)
 Change the URLs used to connect to the camera. More...
 
template<typename T >
void SetUrls (std::initializer_list< T > urls)
 Change the URLs used to connect to the camera. More...
 
std::vector< std::string > GetUrls () const
 Get the URLs used to connect to the camera. More...
 
- Public Member Functions inherited from cs::VideoCamera
 VideoCamera ()=default
 
void SetBrightness (int brightness)
 Set the brightness, as a percentage (0-100). More...
 
int GetBrightness ()
 Get the brightness, as a percentage (0-100). More...
 
void SetWhiteBalanceAuto ()
 Set the white balance to auto. More...
 
void SetWhiteBalanceHoldCurrent ()
 Set the white balance to hold current. More...
 
void SetWhiteBalanceManual (int value)
 Set the white balance to manual, with specified color temperature. More...
 
void SetExposureAuto ()
 Set the exposure to auto aperature. More...
 
void SetExposureHoldCurrent ()
 Set the exposure to hold current. More...
 
void SetExposureManual (int value)
 Set the exposure to manual, as a percentage (0-100). More...
 
- Public Member Functions inherited from cs::VideoSource
 VideoSource () noexcept=default
 
 VideoSource (const VideoSource &source)
 
 VideoSource (VideoSource &&other) noexcept
 
VideoSourceoperator= (VideoSource other) noexcept
 
 ~VideoSource ()
 
 operator bool () const
 
int GetHandle () const
 
bool operator== (const VideoSource &other) const
 
Kind GetKind () const
 Get the kind of the source. More...
 
std::string GetName () const
 Get the name of the source. More...
 
std::string GetDescription () const
 Get the source description. More...
 
uint64_t GetLastFrameTime () const
 Get the last time a frame was captured. More...
 
void SetConnectionStrategy (ConnectionStrategy strategy)
 Sets the connection strategy. More...
 
bool IsConnected () const
 Is the source currently connected to whatever is providing the images? More...
 
bool IsEnabled () const
 Gets source enable status. More...
 
VideoProperty GetProperty (std::string_view name)
 Get a property. More...
 
std::vector< VideoPropertyEnumerateProperties () const
 Enumerate all properties of this source. More...
 
VideoMode GetVideoMode () const
 Get the current video mode. More...
 
bool SetVideoMode (const VideoMode &mode)
 Set the video mode. More...
 
bool SetVideoMode (VideoMode::PixelFormat pixelFormat, int width, int height, int fps)
 Set the video mode. More...
 
bool SetPixelFormat (VideoMode::PixelFormat pixelFormat)
 Set the pixel format. More...
 
bool SetResolution (int width, int height)
 Set the resolution. More...
 
bool SetFPS (int fps)
 Set the frames per second (FPS). More...
 
bool SetConfigJson (std::string_view config)
 Set video mode and properties from a JSON configuration string. More...
 
bool SetConfigJson (const wpi::json &config)
 Set video mode and 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...
 
double GetActualFPS () const
 Get the actual FPS. More...
 
double GetActualDataRate () const
 Get the data rate (in bytes per second). More...
 
std::vector< VideoModeEnumerateVideoModes () const
 Enumerate all known video modes for this source. More...
 
CS_Status GetLastStatus () const
 
std::vector< VideoSinkEnumerateSinks ()
 Enumerate all sinks connected to this source. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from cs::VideoSource
static std::vector< VideoSourceEnumerateSources ()
 Enumerate all existing sources. More...
 
- Protected Member Functions inherited from cs::VideoCamera
 VideoCamera (CS_Source handle)
 
- Protected Member Functions inherited from cs::VideoSource
 VideoSource (CS_Source handle)
 
- Protected Attributes inherited from cs::VideoSource
CS_Status m_status = 0
 
CS_Source m_handle {0}
 

Detailed Description

A source that represents a MJPEG-over-HTTP (IP) camera.

Member Enumeration Documentation

◆ HttpCameraKind

Enumerator
kUnknown 
kMJPGStreamer 
kCSCore 
kAxis 

Constructor & Destructor Documentation

◆ HttpCamera() [1/5]

cs::HttpCamera::HttpCamera ( std::string_view  name,
std::string_view  url,
HttpCameraKind  kind = kUnknown 
)
inline

Create a source for a MJPEG-over-HTTP (IP) camera.

Parameters
nameSource name (arbitrary unique identifier)
urlCamera URL (e.g. "http://10.x.y.11/video/stream.mjpg")
kindCamera kind (e.g. kAxis)

◆ HttpCamera() [2/5]

cs::HttpCamera::HttpCamera ( std::string_view  name,
const char *  url,
HttpCameraKind  kind = kUnknown 
)
inline

Create a source for a MJPEG-over-HTTP (IP) camera.

Parameters
nameSource name (arbitrary unique identifier)
urlCamera URL (e.g. "http://10.x.y.11/video/stream.mjpg")
kindCamera kind (e.g. kAxis)

◆ HttpCamera() [3/5]

cs::HttpCamera::HttpCamera ( std::string_view  name,
const std::string &  url,
HttpCameraKind  kind = kUnknown 
)
inline

Create a source for a MJPEG-over-HTTP (IP) camera.

Parameters
nameSource name (arbitrary unique identifier)
urlCamera URL (e.g. "http://10.x.y.11/video/stream.mjpg")
kindCamera kind (e.g. kAxis)

◆ HttpCamera() [4/5]

cs::HttpCamera::HttpCamera ( std::string_view  name,
std::span< const std::string >  urls,
HttpCameraKind  kind = kUnknown 
)
inline

Create a source for a MJPEG-over-HTTP (IP) camera.

Parameters
nameSource name (arbitrary unique identifier)
urlsArray of Camera URLs
kindCamera kind (e.g. kAxis)

◆ HttpCamera() [5/5]

template<typename T >
cs::HttpCamera::HttpCamera ( std::string_view  name,
std::initializer_list< T >  urls,
HttpCameraKind  kind = kUnknown 
)
inline

Create a source for a MJPEG-over-HTTP (IP) camera.

Parameters
nameSource name (arbitrary unique identifier)
urlsArray of Camera URLs
kindCamera kind (e.g. kAxis)

Member Function Documentation

◆ GetHttpCameraKind()

HttpCamera::HttpCameraKind cs::HttpCamera::GetHttpCameraKind ( ) const
inline

Get the kind of HTTP camera.

Autodetection can result in returning a different value than the camera was created with.

◆ GetUrls()

std::vector< std::string > cs::HttpCamera::GetUrls ( ) const
inline

Get the URLs used to connect to the camera.

◆ SetUrls() [1/2]

template<typename T >
void cs::HttpCamera::SetUrls ( std::initializer_list< T >  urls)
inline

Change the URLs used to connect to the camera.

◆ SetUrls() [2/2]

void cs::HttpCamera::SetUrls ( std::span< const std::string >  urls)
inline

Change the URLs used to connect to the camera.


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