WPILibC++  2019.3.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
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::CvSink cs::MjpegServer

Public Types

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

Public Member Functions

 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
 

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
 

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 Function Documentation

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

Enumerate all existing sinks.

Returns
Vector of sinks.
std::string cs::VideoSink::GetConfigJson ( ) const
inline

Get a JSON configuration string.

Returns
JSON configuration string
wpi::json cs::VideoSink::GetConfigJsonObject ( ) const

Get a JSON configuration object.

Returns
JSON configuration object
std::string cs::VideoSink::GetDescription ( ) const
inline

Get the sink description.

This is sink-kind specific.

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.

VideoProperty cs::VideoSink::GetProperty ( const wpi::Twine name)
inline

Get a property of the sink.

Parameters
nameProperty name
Returns
Property (kind Property::kNone if no property with the given name exists)
VideoSource cs::VideoSink::GetSource ( ) const
inline

Get the connected source.

Returns
Connected source (empty if none connected).
VideoProperty cs::VideoSink::GetSourceProperty ( const wpi::Twine 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)
bool cs::VideoSink::SetConfigJson ( wpi::StringRef  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
bool cs::VideoSink::SetConfigJson ( const wpi::json config)
inline

Set properties from a JSON configuration object.

Parameters
configconfiguration
Returns
True if set successfully
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

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