WPILibC++ 2024.3.2
cs::VideoSink Class Reference

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

#include <cscore_oo.h>

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

Public Types

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

Public Member Functions

 VideoSink () noexcept=default
 
 VideoSink (const VideoSink &sink)
 
 VideoSink (VideoSink &&sink) noexcept
 
VideoSinkoperator= (VideoSink other) noexcept
 
 ~VideoSink ()
 
 operator bool () const
 Returns true if the VideoSink is valid. More...
 
int GetHandle () const
 Returns the VideoSink handle. More...
 
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< VideoPropertyEnumerateProperties () 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
 

Static Public Member Functions

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

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.

Constructor & Destructor Documentation

◆ VideoSink() [1/4]

cs::VideoSink::VideoSink ( )
defaultnoexcept

◆ VideoSink() [2/4]

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

◆ VideoSink() [3/4]

cs::VideoSink::VideoSink ( VideoSink &&  sink)
inlinenoexcept

◆ ~VideoSink()

cs::VideoSink::~VideoSink ( )
inline

◆ VideoSink() [4/4]

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

Member Function Documentation

◆ EnumerateProperties()

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

Enumerate all properties of this sink.

◆ EnumerateSinks()

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

Enumerate all existing sinks.

Returns
Vector of sinks.

◆ GetConfigJson()

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

Get a JSON configuration string.

Returns
JSON configuration string

◆ GetConfigJsonObject()

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

Get a JSON configuration object.

Returns
JSON configuration object

◆ GetDescription()

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

Get the sink description.

This is sink-kind specific.

◆ GetHandle()

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

Returns the VideoSink handle.

Returns
The VideoSink handle.

◆ GetKind()

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

Get the kind of the sink.

◆ GetLastStatus()

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

◆ GetName()

std::string 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 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 cs::VideoSink::GetSource ( ) const
inline

Get the connected source.

Returns
Connected source (empty if none connected).

◆ GetSourceProperty()

VideoProperty 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()

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

Returns true if the VideoSink is valid.

Returns
True if the VideoSink is valid.

◆ operator=()

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

◆ operator==()

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

◆ SetConfigJson() [1/2]

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

Set properties from a JSON configuration object.

Parameters
configconfiguration
Returns
True if set successfully

◆ SetConfigJson() [2/2]

bool 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 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

Friends And Related Function Documentation

◆ 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 cs::VideoSink::m_handle {0}
protected

◆ m_status

CS_Status cs::VideoSink::m_status = 0
mutableprotected

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