001/*----------------------------------------------------------------------------*/ 002/* Copyright (c) FIRST 2016. All Rights Reserved. */ 003/* Open Source Software - may be modified and shared by FRC teams. The code */ 004/* must be accompanied by the FIRST BSD license file in the root directory of */ 005/* the project. */ 006/*----------------------------------------------------------------------------*/ 007 008package edu.wpi.cscore; 009 010/// Video mode 011public class VideoMode { 012 public enum PixelFormat { 013 kUnknown(0), kMJPEG(1), kYUYV(2), kRGB565(3), kBGR(4), kGray(5); 014 private int value; 015 016 private PixelFormat(int value) { 017 this.value = value; 018 } 019 020 public int getValue() { 021 return value; 022 } 023 } 024 private static final PixelFormat[] m_pixelFormatValues = PixelFormat.values(); 025 026 public static PixelFormat getPixelFormatFromInt(int pixelFormat) { 027 return m_pixelFormatValues[pixelFormat]; 028 } 029 030 public VideoMode(int pixelFormat, int width, int height, int fps) { 031 this.pixelFormat = getPixelFormatFromInt(pixelFormat); 032 this.width = width; 033 this.height = height; 034 this.fps = fps; 035 } 036 037 public VideoMode(PixelFormat pixelFormat, int width, int height, int fps) { 038 this.pixelFormat = pixelFormat; 039 this.width = width; 040 this.height = height; 041 this.fps = fps; 042 } 043 044 /// Pixel format 045 public PixelFormat pixelFormat; 046 /// Width in pixels 047 public int width; 048 /// Height in pixels 049 public int height; 050 /// Frames per second 051 public int fps; 052}