WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::cs::VideoSink Class Reference

A sink for video that accepts a sequence of frames. More...

#include <wpi/cs/VideoSink.hpp>

Inheritance diagram for wpi::cs::VideoSink:
wpi::cs::ImageSink wpi::cs::MjpegServer wpi::cs::CvSink wpi::cs::RawSink

Public Types

enum  Kind { kUnknown = CS_SINK_UNKNOWN , kMjpeg = CS_SINK_MJPEG , kCv = CS_SINK_CV , kRaw = CS_SINK_RAW }

Public Member Functions

 VideoSink () noexcept=default
 VideoSink (const VideoSink &sink)
 VideoSink (VideoSink &&other) noexcept
VideoSinkoperator= (VideoSink other) noexcept
 ~VideoSink ()
 operator bool () const
 Returns true if the VideoSink is valid.
int GetHandle () const
 Returns the VideoSink handle.
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.
std::string GetDescription () const
 Get the sink description.
VideoProperty GetProperty (std::string_view name)
 Get a property of the sink.
std::vector< VideoPropertyEnumerateProperties () const
 Enumerate all properties of this sink.
bool SetConfigJson (std::string_view config)
 Set properties from a JSON configuration string.
bool SetConfigJson (const wpi::util::json &config)
 Set properties from a JSON configuration object.
std::string GetConfigJson () const
 Get a JSON configuration string.
wpi::util::json GetConfigJsonObject () const
 Get a JSON configuration object.
void SetSource (VideoSource source)
 Configure which source should provide frames to this sink.
VideoSource GetSource () const
 Get the connected source.
VideoProperty GetSourceProperty (std::string_view name)
 Get a property of the associated source.
CS_Status GetLastStatus () const

Static Public Member Functions

static std::vector< VideoSinkEnumerateSinks ()
 Enumerate all existing sinks.

Protected Member Functions

 VideoSink (CS_Sink handle)

Protected Attributes

CS_Status m_status = 0
CS_Sink m_handle {0}

Friends

class VideoEvent
class VideoSource
void swap (VideoSink &first, VideoSink &second) noexcept

Detailed Description

A sink for video that accepts a sequence of frames.

Member Enumeration Documentation

◆ Kind

Enumerator
kUnknown 

Unknown sink type.

kMjpeg 

MJPEG video sink.

kCv 

CV video sink.

kRaw 

Raw video sink.

Constructor & Destructor Documentation

◆ VideoSink() [1/4]

wpi::cs::VideoSink::VideoSink ( )
defaultnoexcept

◆ VideoSink() [2/4]

wpi::cs::VideoSink::VideoSink ( const VideoSink & sink)
inline

◆ VideoSink() [3/4]

wpi::cs::VideoSink::VideoSink ( VideoSink && other)
inlinenoexcept

◆ ~VideoSink()

wpi::cs::VideoSink::~VideoSink ( )
inline

◆ VideoSink() [4/4]

wpi::cs::VideoSink::VideoSink ( CS_Sink handle)
inlineexplicitprotected

Member Function Documentation

◆ EnumerateProperties()

std::vector< VideoProperty > wpi::cs::VideoSink::EnumerateProperties ( ) const

Enumerate all properties of this sink.

◆ EnumerateSinks()

std::vector< VideoSink > wpi::cs::VideoSink::EnumerateSinks ( )
static

Enumerate all existing sinks.

Returns
Vector of sinks.

◆ GetConfigJson()

std::string wpi::cs::VideoSink::GetConfigJson ( ) const
inline

Get a JSON configuration string.

Returns
JSON configuration string

◆ GetConfigJsonObject()

wpi::util::json wpi::cs::VideoSink::GetConfigJsonObject ( ) const

Get a JSON configuration object.

Returns
JSON configuration object

◆ GetDescription()

std::string wpi::cs::VideoSink::GetDescription ( ) const
inline

Get the sink description.

This is sink-kind specific.

◆ GetHandle()

int wpi::cs::VideoSink::GetHandle ( ) const
inline

Returns the VideoSink handle.

Returns
The VideoSink handle.

◆ GetKind()

Kind wpi::cs::VideoSink::GetKind ( ) const
inline

Get the kind of the sink.

◆ GetLastStatus()

CS_Status wpi::cs::VideoSink::GetLastStatus ( ) const
inline

◆ GetName()

std::string wpi::cs::VideoSink::GetName ( ) const
inline

Get the name of the sink.

The name is an arbitrary identifier provided when the sink is created, and should be unique.

◆ GetProperty()

VideoProperty wpi::cs::VideoSink::GetProperty ( std::string_view name)
inline

Get a property of the sink.

Parameters
nameProperty name
Returns
Property (kind Property::kNone if no property with the given name exists)

◆ GetSource()

VideoSource wpi::cs::VideoSink::GetSource ( ) const
inline

Get the connected source.

Returns
Connected source (empty if none connected).

◆ GetSourceProperty()

VideoProperty wpi::cs::VideoSink::GetSourceProperty ( std::string_view name)
inline

Get a property of the associated source.

Parameters
nameProperty name
Returns
Property (kind Property::kNone if no property with the given name exists or no source connected)

◆ operator bool()

wpi::cs::VideoSink::operator bool ( ) const
inlineexplicit

Returns true if the VideoSink is valid.

Returns
True if the VideoSink is valid.

◆ operator=()

VideoSink & wpi::cs::VideoSink::operator= ( VideoSink other)
inlinenoexcept

◆ operator==()

bool wpi::cs::VideoSink::operator== ( const VideoSink & other) const
inline

◆ SetConfigJson() [1/2]

bool wpi::cs::VideoSink::SetConfigJson ( const wpi::util::json & config)
inline

Set properties from a JSON configuration object.

Parameters
configconfiguration
Returns
True if set successfully

◆ SetConfigJson() [2/2]

bool wpi::cs::VideoSink::SetConfigJson ( std::string_view config)
inline

Set properties from a JSON configuration string.

The format of the JSON input is:

{
    "properties": [
        {
            "name": property name
            "value": property value
        }
    ]
}
Parameters
configconfiguration
Returns
True if set successfully

◆ SetSource()

void wpi::cs::VideoSink::SetSource ( VideoSource source)
inline

Configure which source should provide frames to this sink.

Each sink can accept frames from only a single source, but a single source can provide frames to multiple clients.

Parameters
sourceSource

◆ swap

void swap ( VideoSink & first,
VideoSink & second )
friend

◆ VideoEvent

friend class VideoEvent
friend

◆ VideoSource

friend class VideoSource
friend

Member Data Documentation

◆ m_handle

CS_Sink wpi::cs::VideoSink::m_handle {0}
protected

◆ m_status

CS_Status wpi::cs::VideoSink::m_status = 0
mutableprotected

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