edu.wpi.cscore

## Class VideoSource

- java.lang.Object
- - edu.wpi.cscore.VideoSource

- Direct Known Subclasses:
    CvSource, VideoCamera

      public class VideoSource
      extends java.lang.Object

  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 and Description
    --- | ---
    `static class` | `VideoSource.Kind`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `m_handle`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `VideoSource(int handle)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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(java.lang.Object other)`
    `void` | `free()`
    `java.lang.String` | `getDescription()` Get the source description.
    `int` | `getHandle()`
    `VideoSource.Kind` | `getKind()` Get the kind of the source.
    `static VideoSource.Kind` | `getKindFromInt(int kind)`
    `long` | `getLastFrameTime()` Get the last time a frame was captured.
    `java.lang.String` | `getName()` Get the name of the source.
    `VideoProperty` | `getProperty(java.lang.String name)` Get a property.
    `VideoMode` | `getVideoMode()` Get the current video mode.
    `int` | `hashCode()`
    `boolean` | `isConnected()` Is the source currently connected to whatever is providing the images?
    `boolean` | `isValid()`
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### m_handle

          protected int m_handle

  - ### Constructor Detail

    - #### VideoSource

          protected VideoSource(int handle)

  - ### Method Detail

    - #### getKindFromInt

          public static VideoSource.Kind getKindFromInt(int kind)

    - #### free

          public void free()

    - #### isValid

          public boolean isValid()

    - #### getHandle

          public int getHandle()

    - #### equals

          public boolean equals(java.lang.Object other)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### getKind

          public VideoSource.Kind getKind()

      Get the kind of the source.

    - #### getName

          public java.lang.String getName()

      Get the name of the source. The name is an arbitrary identifier provided when the source is created, and should be unique.

    - #### getDescription

          public java.lang.String getDescription()

      Get the source description. This is source-kind specific.

    - #### getLastFrameTime

          public long getLastFrameTime()

      Get the last time a frame was captured.

    - #### isConnected

          public boolean isConnected()

      Is the source currently connected to whatever is providing the images?

    - #### getProperty

          public VideoProperty getProperty(java.lang.String name)

      Get a property.
      Parameters:
        `name` - Property name
      Returns:
        Property contents (of kind Property::kNone if no property with the given name exists)

    - #### enumerateProperties

          public VideoProperty[] enumerateProperties()

      Enumerate all properties of this source.

    - #### getVideoMode

          public VideoMode getVideoMode()

      Get the current video mode.

    - #### setVideoMode

          public boolean setVideoMode(VideoMode mode)

      Set the video mode.
      Parameters:
        `mode` - Video mode

    - #### setVideoMode

          public boolean setVideoMode(VideoMode.PixelFormat pixelFormat,
                                      int width,
                                      int height,
                                      int fps)

      Set the video mode.
      Parameters:
        `pixelFormat` - desired pixel format
        `width` - desired width
        `height` - desired height
        `fps` - desired FPS
      Returns:
        True if set successfully

    - #### setPixelFormat

          public boolean setPixelFormat(VideoMode.PixelFormat pixelFormat)

      Set the pixel format.
      Parameters:
        `pixelFormat` - desired pixel format
      Returns:
        True if set successfully

    - #### setResolution

          public boolean setResolution(int width,
                                       int height)

      Set the resolution.
      Parameters:
        `width` - desired width
        `height` - desired height
      Returns:
        True if set successfully

    - #### setFPS

          public boolean setFPS(int fps)

      Set the frames per second (FPS).
      Parameters:
        `fps` - desired FPS
      Returns:
        True if set successfully

    - #### enumerateVideoModes

          public VideoMode[] enumerateVideoModes()

      Enumerate all known video modes for this source.

    - #### enumerateSinks

          public VideoSink[] enumerateSinks()

      Enumerate all sinks connected to this source.
      Returns:
        Vector of sinks.

    - #### enumerateSources

          public static VideoSource[] enumerateSources()

      Enumerate all existing sources.
      Returns:
        Vector of sources.