mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Add support for enumerating and changing USB camera video mode.
This commit is contained in:
41
java/src/edu/wpi/cameraserver/VideoMode.java
Normal file
41
java/src/edu/wpi/cameraserver/VideoMode.java
Normal file
@@ -0,0 +1,41 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
package edu.wpi.cameraserver;
|
||||
|
||||
/// Video mode
|
||||
public class VideoMode {
|
||||
public enum PixelFormat {
|
||||
kUnknown(0), kMJPEG(1), kYUYV(2), kRGB565(3);
|
||||
private int value;
|
||||
|
||||
private PixelFormat(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
private static final PixelFormat[] m_pixelFormatValues = PixelFormat.values();
|
||||
|
||||
public VideoMode(int pixelFormat, int width, int height, int fps) {
|
||||
this.pixelFormat = m_pixelFormatValues[pixelFormat];
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.fps = fps;
|
||||
}
|
||||
|
||||
/// Pixel format
|
||||
public PixelFormat pixelFormat;
|
||||
/// Width in pixels
|
||||
public int width;
|
||||
/// Height in pixels
|
||||
public int height;
|
||||
/// Frames per second
|
||||
public int fps;
|
||||
}
|
||||
Reference in New Issue
Block a user