Package edu.wpi.cscore
Class VideoSink
- java.lang.Object
-
- edu.wpi.cscore.VideoSink
-
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
ImageSink,MjpegServer
public class VideoSink extends Object implements AutoCloseable
A source for video that provides a sequence of frames. Each frame may consist of multiple images (e.g. from a stereo or depth camera); these are called channels.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVideoSink.Kind
-
Field Summary
Fields Modifier and Type Field Description protected intm_handle
-
Constructor Summary
Constructors Modifier Constructor Description protectedVideoSink(int handle)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()VideoProperty[]enumerateProperties()Enumerate all properties of this sink.static VideoSink[]enumerateSinks()Enumerate all existing sinks.booleanequals(Object other)StringgetConfigJson()Get a JSON configuration string.StringgetDescription()Get the sink description.intgetHandle()VideoSink.KindgetKind()Get the kind of the sink.static VideoSink.KindgetKindFromInt(int kind)Convert from the numerical representation of kind to an enum type.StringgetName()Get the name of the sink.VideoPropertygetProperty(String name)Get a property of the sink.VideoSourcegetSource()Get the connected source.VideoPropertygetSourceProperty(String name)Get a property of the associated source.inthashCode()booleanisValid()booleansetConfigJson(String config)Set properties from a JSON configuration string.voidsetSource(VideoSource source)Configure which source should provide frames to this sink.
-
-
-
Method Detail
-
getKindFromInt
public static VideoSink.Kind getKindFromInt(int kind)
Convert from the numerical representation of kind to an enum type.- Parameters:
kind- The numerical representation of kind- Returns:
- The kind
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
isValid
public boolean isValid()
-
getHandle
public int getHandle()
-
getKind
public VideoSink.Kind getKind()
Get the kind of the sink.
-
getName
public String getName()
Get the name of the sink. The name is an arbitrary identifier provided when the sink is created, and should be unique.
-
getDescription
public String getDescription()
Get the sink description. This is sink-kind specific.
-
getProperty
public VideoProperty getProperty(String name)
Get a property of the sink.- Parameters:
name- Property name- Returns:
- Property (kind Property::kNone if no property with the given name exists)
-
enumerateProperties
public VideoProperty[] enumerateProperties()
Enumerate all properties of this sink.
-
setConfigJson
public boolean setConfigJson(String config)
Set properties from a JSON configuration string.The format of the JSON input is:
{ "properties": [ { "name": property name "value": property value } ] }- Parameters:
config- configuration- Returns:
- True if set successfully
-
getConfigJson
public String getConfigJson()
Get a JSON configuration string.- Returns:
- JSON configuration string
-
setSource
public void setSource(VideoSource source)
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:
source- Source
-
getSource
public VideoSource getSource()
Get the connected source.- Returns:
- Connected source; nullptr if no source connected.
-
getSourceProperty
public VideoProperty getSourceProperty(String name)
Get a property of the associated source.- Parameters:
name- Property name- Returns:
- Property (kind Property::kNone if no property with the given name exists or no source connected)
-
enumerateSinks
public static VideoSink[] enumerateSinks()
Enumerate all existing sinks.- Returns:
- Vector of sinks.
-
-