WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
VideoMode.hpp
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include "wpi/cs/cscore_c.h"
9
10namespace wpi::cs {
11
12/**
13 * Video mode
14 */
15struct VideoMode {
16 VideoMode() = default;
17 VideoMode(wpi::util::PixelFormat pixelFormat_, int width_, int height_,
18 int fps_)
19 : pixelFormat{pixelFormat_}, width{width_}, height{height_}, fps{fps_} {}
20 VideoMode(const CS_VideoMode& mode) // NOLINT
21 : pixelFormat{static_cast<wpi::util::PixelFormat>(mode.pixelFormat)},
22 width{mode.width},
23 height{mode.height},
24 fps{mode.fps} {}
25
26 operator CS_VideoMode() const { // NOLINT
27 CS_VideoMode mode;
28 mode.pixelFormat = static_cast<int>(pixelFormat);
29 mode.width = width;
30 mode.height = height;
31 mode.fps = fps;
32 return mode;
33 }
34
35 explicit operator bool() const {
37 }
38
39 bool operator==(const VideoMode& other) const {
40 return pixelFormat == other.pixelFormat && width == other.width &&
41 height == other.height && fps == other.fps;
42 }
43
44 bool CompareWithoutFps(const VideoMode& other) const {
45 return pixelFormat == other.pixelFormat && width == other.width &&
46 height == other.height;
47 }
48
50 int width = 0;
51 int height = 0;
52 int fps = 0;
53};
54
55} // namespace wpi::cs
struct CS_VideoMode CS_VideoMode
Video mode.
CameraServer (cscore) namespace.
Definition CvSource.hpp:15
Definition raw_os_ostream.hpp:19
PixelFormat
Pixel formats.
Definition PixelFormat.hpp:14
@ kUnknown
Definition PixelFormat.hpp:15
Definition CvSource.hpp:15
Video mode.
Definition cscore_c.h:87
int width
Definition cscore_c.h:89
int pixelFormat
Definition cscore_c.h:88
int fps
Definition cscore_c.h:91
int height
Definition cscore_c.h:90
bool operator==(const VideoMode &other) const
Definition VideoMode.hpp:39
int fps
Definition VideoMode.hpp:52
VideoMode(wpi::util::PixelFormat pixelFormat_, int width_, int height_, int fps_)
Definition VideoMode.hpp:17
VideoMode(const CS_VideoMode &mode)
Definition VideoMode.hpp:20
wpi::util::PixelFormat pixelFormat
Definition VideoMode.hpp:49
int height
Definition VideoMode.hpp:51
int width
Definition VideoMode.hpp:50
bool CompareWithoutFps(const VideoMode &other) const
Definition VideoMode.hpp:44