001/*----------------------------------------------------------------------------*/ 002/* Copyright (c) 2016-2018 FIRST. 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/** 011 * Video mode 012 */ 013public class VideoMode { 014 public enum PixelFormat { 015 kUnknown(0), kMJPEG(1), kYUYV(2), kRGB565(3), kBGR(4), kGray(5); 016 private int value; 017 018 private PixelFormat(int value) { 019 this.value = value; 020 } 021 022 public int getValue() { 023 return value; 024 } 025 } 026 private static final PixelFormat[] m_pixelFormatValues = PixelFormat.values(); 027 028 public static PixelFormat getPixelFormatFromInt(int pixelFormat) { 029 return m_pixelFormatValues[pixelFormat]; 030 } 031 032 public VideoMode(int pixelFormat, int width, int height, int fps) { 033 this.pixelFormat = getPixelFormatFromInt(pixelFormat); 034 this.width = width; 035 this.height = height; 036 this.fps = fps; 037 } 038 039 public VideoMode(PixelFormat pixelFormat, int width, int height, int fps) { 040 this.pixelFormat = pixelFormat; 041 this.width = width; 042 this.height = height; 043 this.fps = fps; 044 } 045 046 /** 047 * Pixel format 048 */ 049 public PixelFormat pixelFormat; 050 051 /** 052 * Width in pixels 053 */ 054 public int width; 055 056 /** 057 * Height in pixels 058 */ 059 public int height; 060 061 /** 062 * Frames per second 063 */ 064 public int fps; 065}