public class VideoSource extends Object implements AutoCloseable
Modifier and Type | Class and Description |
---|---|
static class |
VideoSource.ConnectionStrategy
Connection strategy.
|
static class |
VideoSource.Kind |
Modifier and Type | Field and Description |
---|---|
protected int |
m_handle |
Modifier | Constructor and Description |
---|---|
protected |
VideoSource(int handle) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
VideoProperty[] |
enumerateProperties()
Enumerate all properties of this source.
|
VideoSink[] |
enumerateSinks()
Enumerate all sinks connected to this source.
|
static VideoSource[] |
enumerateSources()
Enumerate all existing sources.
|
VideoMode[] |
enumerateVideoModes()
Enumerate all known video modes for this source.
|
boolean |
equals(Object other) |
void |
free()
Deprecated.
|
double |
getActualDataRate()
Get the data rate (in bytes per second).
|
double |
getActualFPS()
Get the actual FPS.
|
String |
getDescription()
Get the source description.
|
int |
getHandle() |
VideoSource.Kind |
getKind()
Get the kind of the source.
|
static VideoSource.Kind |
getKindFromInt(int kind)
Convert from the numerical representation of kind to an enum type.
|
long |
getLastFrameTime()
Get the last time a frame was captured.
|
String |
getName()
Get the name of the source.
|
VideoProperty |
getProperty(String name)
Get a property.
|
VideoMode |
getVideoMode()
Get the current video mode.
|
int |
hashCode() |
boolean |
isConnected()
Returns if the source currently connected to whatever is providing the images.
|
boolean |
isEnabled()
Gets source enable status.
|
boolean |
isValid() |
void |
setConnectionStrategy(VideoSource.ConnectionStrategy strategy)
Sets the connection strategy.
|
boolean |
setFPS(int fps)
Set the frames per second (FPS).
|
boolean |
setPixelFormat(VideoMode.PixelFormat pixelFormat)
Set the pixel format.
|
boolean |
setResolution(int width,
int height)
Set the resolution.
|
boolean |
setVideoMode(VideoMode.PixelFormat pixelFormat,
int width,
int height,
int fps)
Set the video mode.
|
boolean |
setVideoMode(VideoMode mode)
Set the video mode.
|
public static VideoSource.Kind getKindFromInt(int kind)
kind
- The numerical representation of kind@Deprecated public void free()
public void close()
close
in interface AutoCloseable
public boolean isValid()
public int getHandle()
public VideoSource.Kind getKind()
public String getName()
public String getDescription()
public long getLastFrameTime()
public void setConnectionStrategy(VideoSource.ConnectionStrategy strategy)
This function is non-blocking; look for either a connection open or
close event or call isConnected()
to determine the connection
state.
strategy
- connection strategy (auto, keep open, or force close)public boolean isConnected()
public boolean isEnabled()
public VideoProperty getProperty(String name)
name
- Property namepublic VideoProperty[] enumerateProperties()
public VideoMode getVideoMode()
public boolean setVideoMode(VideoMode mode)
mode
- Video modepublic boolean setVideoMode(VideoMode.PixelFormat pixelFormat, int width, int height, int fps)
pixelFormat
- desired pixel formatwidth
- desired widthheight
- desired heightfps
- desired FPSpublic boolean setPixelFormat(VideoMode.PixelFormat pixelFormat)
pixelFormat
- desired pixel formatpublic boolean setResolution(int width, int height)
width
- desired widthheight
- desired heightpublic boolean setFPS(int fps)
fps
- desired FPSpublic double getActualFPS()
CameraServerJNI#setTelemetryPeriod() must be called for this to be valid (throws VisionException if telemetry is not enabled).
public double getActualDataRate()
CameraServerJNI#setTelemetryPeriod() must be called for this to be valid (throws VisionException if telemetry is not enabled).
public VideoMode[] enumerateVideoModes()
public VideoSink[] enumerateSinks()
public static VideoSource[] enumerateSources()