Add method to get source/sink type.

Also provide convenience method to enumerate all sinks connected to a source.
This commit is contained in:
Peter Johnson
2016-11-15 22:18:32 -08:00
parent 6446b9ef10
commit 3381340eb5
17 changed files with 253 additions and 34 deletions

View File

@@ -11,6 +11,20 @@ package edu.wpi.cscore;
/// consist of multiple images (e.g. from a stereo or depth camera); these
/// are called channels.
public class VideoSink {
public enum Type {
kUnknown(0), kMJPEG(2), kCv(4);
private int value;
private Type(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
static final Type[] m_typeValues = Type.values();
protected VideoSink(int handle) {
m_handle = handle;
}
@@ -42,6 +56,11 @@ public class VideoSink {
return m_handle;
}
/// Get the type of the sink.
public Type getType() {
return m_typeValues[CameraServerJNI.getSinkType(m_handle)];
}
/// Get the name of the sink. The name is an arbitrary identifier
/// provided when the sink is created, and should be unique.
public String getName() {