A source for video that provides a sequence of frames.
More...
#include <wpi/cs/VideoSource.hpp>
A source for video that provides a sequence of frames.
◆ ConnectionStrategy
Connection strategy.
Used for SetConnectionStrategy().
| Enumerator |
|---|
| kConnectionAutoManage | Automatically connect or disconnect based on whether any sinks are connected to this source.
This is the default behavior.
|
| kConnectionKeepOpen | Try to keep the connection open regardless of whether any sinks are connected.
|
| kConnectionForceClose | Never open the connection.
If this is set when the connection is open, close the connection.
|
◆ Kind
Video source kind.
| Enumerator |
|---|
| kUnknown | Unknown video source.
|
| kUsb | USB video source.
|
| kHttp | HTTP video source.
|
| kCv | CV video source.
|
| kRaw | Raw video source.
|
◆ VideoSource() [1/4]
| wpi::cs::VideoSource::VideoSource |
( |
| ) |
|
|
defaultnoexcept |
◆ VideoSource() [2/4]
| wpi::cs::VideoSource::VideoSource |
( |
const VideoSource & | source | ) |
|
|
inline |
◆ VideoSource() [3/4]
| wpi::cs::VideoSource::VideoSource |
( |
VideoSource && | other | ) |
|
|
inlinenoexcept |
◆ ~VideoSource()
| wpi::cs::VideoSource::~VideoSource |
( |
| ) |
|
|
inline |
◆ VideoSource() [4/4]
| wpi::cs::VideoSource::VideoSource |
( |
CS_Source | handle | ) |
|
|
inlineexplicitprotected |
◆ EnumerateProperties()
| std::vector< VideoProperty > wpi::cs::VideoSource::EnumerateProperties |
( |
| ) |
const |
Enumerate all properties of this source.
◆ EnumerateSinks()
| std::vector< VideoSink > wpi::cs::VideoSource::EnumerateSinks |
( |
| ) |
|
Enumerate all sinks connected to this source.
- Returns
- Vector of sinks.
◆ EnumerateSources()
| std::vector< VideoSource > wpi::cs::VideoSource::EnumerateSources |
( |
| ) |
|
|
static |
Enumerate all existing sources.
- Returns
- Vector of sources.
◆ EnumerateVideoModes()
| std::vector< VideoMode > wpi::cs::VideoSource::EnumerateVideoModes |
( |
| ) |
const |
|
inline |
Enumerate all known video modes for this source.
◆ GetActualDataRate()
| double wpi::cs::VideoSource::GetActualDataRate |
( |
| ) |
const |
|
inline |
Get the data rate (in bytes per second).
SetTelemetryPeriod() must be called for this to be valid.
- Returns
- Data rate averaged over the telemetry period.
◆ GetActualFPS()
| double wpi::cs::VideoSource::GetActualFPS |
( |
| ) |
const |
|
inline |
Get the actual FPS.
SetTelemetryPeriod() must be called for this to be valid.
- Returns
- Actual FPS averaged over the telemetry period.
◆ GetConfigJson()
| std::string wpi::cs::VideoSource::GetConfigJson |
( |
| ) |
const |
|
inline |
Get a JSON configuration string.
- Returns
- JSON configuration string
◆ GetConfigJsonObject()
| wpi::util::json wpi::cs::VideoSource::GetConfigJsonObject |
( |
| ) |
const |
Get a JSON configuration object.
- Returns
- JSON configuration object
◆ GetDescription()
| std::string wpi::cs::VideoSource::GetDescription |
( |
| ) |
const |
|
inline |
Get the source description.
This is source-kind specific.
◆ GetHandle()
| int wpi::cs::VideoSource::GetHandle |
( |
| ) |
const |
|
inline |
◆ GetKind()
| Kind wpi::cs::VideoSource::GetKind |
( |
| ) |
const |
|
inline |
Get the kind of the source.
◆ GetLastFrameTime()
| uint64_t wpi::cs::VideoSource::GetLastFrameTime |
( |
| ) |
const |
|
inline |
Get the last time a frame was captured.
This uses the same time base as wpi::util::Now().
- Returns
- Time in 1 us increments.
◆ GetLastStatus()
| CS_Status wpi::cs::VideoSource::GetLastStatus |
( |
| ) |
const |
|
inline |
◆ GetName()
| std::string wpi::cs::VideoSource::GetName |
( |
| ) |
const |
|
inline |
Get the name of the source.
The name is an arbitrary identifier provided when the source is created, and should be unique.
◆ GetProperty()
| VideoProperty wpi::cs::VideoSource::GetProperty |
( |
std::string_view | name | ) |
|
|
inline |
Get a property.
- Parameters
-
- Returns
- Property contents (of kind Property::kNone if no property with the given name exists)
◆ GetVideoMode()
| VideoMode wpi::cs::VideoSource::GetVideoMode |
( |
| ) |
const |
|
inline |
Get the current video mode.
◆ IsConnected()
| bool wpi::cs::VideoSource::IsConnected |
( |
| ) |
const |
|
inline |
Is the source currently connected to whatever is providing the images?
◆ IsEnabled()
| bool wpi::cs::VideoSource::IsEnabled |
( |
| ) |
const |
|
inline |
Gets source enable status.
This is determined with a combination of connection strategy and the number of sinks connected.
- Returns
- True if enabled, false otherwise.
◆ operator bool()
| wpi::cs::VideoSource::operator bool |
( |
| ) |
const |
|
inlineexplicit |
◆ operator=()
◆ operator==()
| bool wpi::cs::VideoSource::operator== |
( |
const VideoSource & | other | ) |
const |
|
inline |
◆ SetConfigJson() [1/2]
| bool wpi::cs::VideoSource::SetConfigJson |
( |
const wpi::util::json & | config | ) |
|
|
inline |
Set video mode and properties from a JSON configuration object.
- Parameters
-
- Returns
- True if set successfully
◆ SetConfigJson() [2/2]
| bool wpi::cs::VideoSource::SetConfigJson |
( |
std::string_view | config | ) |
|
|
inline |
Set video mode and properties from a JSON configuration string.
The format of the JSON input is:
{
"pixel format": "MJPEG", "YUYV", etc
"width": video mode width
"height": video mode height
"fps": video mode fps
"brightness": percentage brightness
"white balance": "auto", "hold", or value
"exposure": "auto", "hold", or value
"properties": [
{
"name": property name
"value": property value
}
]
}
- Parameters
-
- Returns
- True if set successfully
◆ SetConnectionStrategy()
Sets the connection strategy.
By default, the source will automatically connect or disconnect based on whether any sinks are connected.
This function is non-blocking; look for either a connection open or close event or call IsConnected() to determine the connection state.
- Parameters
-
| strategy | connection strategy (auto, keep open, or force close) |
◆ SetFPS()
| bool wpi::cs::VideoSource::SetFPS |
( |
int | fps | ) |
|
|
inline |
Set the frames per second (FPS).
- Parameters
-
- Returns
- True if set successfully
◆ SetPixelFormat()
Set the pixel format.
- Parameters
-
| pixelFormat | desired pixel format |
- Returns
- True if set successfully
◆ SetResolution()
| bool wpi::cs::VideoSource::SetResolution |
( |
int | width, |
|
|
int | height ) |
|
inline |
Set the resolution.
- Parameters
-
| width | desired width |
| height | desired height |
- Returns
- True if set successfully
◆ SetVideoMode() [1/2]
| bool wpi::cs::VideoSource::SetVideoMode |
( |
const VideoMode & | mode | ) |
|
|
inline |
Set the video mode.
- Parameters
-
◆ SetVideoMode() [2/2]
| bool wpi::cs::VideoSource::SetVideoMode |
( |
wpi::util::PixelFormat | pixelFormat, |
|
|
int | width, |
|
|
int | height, |
|
|
int | fps ) |
|
inline |
Set the video mode.
- Parameters
-
| pixelFormat | desired pixel format |
| width | desired width |
| height | desired height |
| fps | desired FPS |
- Returns
- True if set successfully
◆ swap
◆ VideoEvent
◆ VideoSink
◆ m_handle
◆ m_status
The documentation for this class was generated from the following file: