2016-09-29 00:04:16 -07:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* 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. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
2016-11-05 22:11:55 -07:00
|
|
|
package edu.wpi.cscore;
|
2016-09-29 00:04:16 -07:00
|
|
|
|
|
|
|
|
/// 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();
|
|
|
|
|
|
2016-11-18 10:44:31 -08:00
|
|
|
public static PixelFormat getPixelFormatFromInt(int pixelFormat) {
|
|
|
|
|
return m_pixelFormatValues[pixelFormat];
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-29 00:04:16 -07:00
|
|
|
public VideoMode(int pixelFormat, int width, int height, int fps) {
|
2016-11-18 10:44:31 -08:00
|
|
|
this.pixelFormat = getPixelFormatFromInt(pixelFormat);
|
2016-09-29 00:04:16 -07:00
|
|
|
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;
|
|
|
|
|
}
|