WPILibC++  2020.2.2-33-g65eab93
cscore_oo.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2015-2019 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #ifndef CSCORE_CSCORE_OO_H_
9 #define CSCORE_CSCORE_OO_H_
10 
11 #include <initializer_list>
12 #include <string>
13 #include <utility>
14 #include <vector>
15 
16 #include "cscore_cpp.h"
17 
18 namespace cs {
19 
30 // Forward declarations so friend declarations work correctly
31 class ImageSource;
32 class VideoEvent;
33 class VideoSink;
34 class VideoSource;
35 
40  friend class ImageSource;
41  friend class VideoEvent;
42  friend class VideoSink;
43  friend class VideoSource;
44 
45  public:
46  enum Kind {
47  kNone = CS_PROP_NONE,
48  kBoolean = CS_PROP_BOOLEAN,
49  kInteger = CS_PROP_INTEGER,
50  kString = CS_PROP_STRING,
51  kEnum = CS_PROP_ENUM
52  };
53 
54  VideoProperty() : m_status(0), m_handle(0), m_kind(kNone) {}
55 
56  std::string GetName() const;
57 
58  Kind GetKind() const { return m_kind; }
59 
60  explicit operator bool() const { return m_kind != kNone; }
61 
62  // Kind checkers
63  bool IsBoolean() const { return m_kind == kBoolean; }
64  bool IsInteger() const { return m_kind == kInteger; }
65  bool IsString() const { return m_kind == kString; }
66  bool IsEnum() const { return m_kind == kEnum; }
67 
68  int Get() const;
69  void Set(int value);
70  int GetMin() const;
71  int GetMax() const;
72  int GetStep() const;
73  int GetDefault() const;
74 
75  // String-specific functions
76  std::string GetString() const;
77  wpi::StringRef GetString(wpi::SmallVectorImpl<char>& buf) const;
78  void SetString(const wpi::Twine& value);
79 
80  // Enum-specific functions
81  std::vector<std::string> GetChoices() const;
82 
83  CS_Status GetLastStatus() const { return m_status; }
84 
85  private:
86  explicit VideoProperty(CS_Property handle);
87  VideoProperty(CS_Property handle, Kind kind);
88 
89  mutable CS_Status m_status;
90  CS_Property m_handle;
91  Kind m_kind;
92 };
93 
97 class VideoSource {
98  friend class VideoEvent;
99  friend class VideoSink;
100 
101  public:
102  enum Kind {
103  kUnknown = CS_SOURCE_UNKNOWN,
104  kUsb = CS_SOURCE_USB,
105  kHttp = CS_SOURCE_HTTP,
106  kCv = CS_SOURCE_CV
107  };
108 
116 
122 
128  };
129 
130  VideoSource() noexcept : m_handle(0) {}
131  VideoSource(const VideoSource& source);
132  VideoSource(VideoSource&& other) noexcept;
133  VideoSource& operator=(VideoSource other) noexcept;
134  ~VideoSource();
135 
136  explicit operator bool() const { return m_handle != 0; }
137 
138  int GetHandle() const { return m_handle; }
139 
140  bool operator==(const VideoSource& other) const {
141  return m_handle == other.m_handle;
142  }
143 
144  bool operator!=(const VideoSource& other) const { return !(*this == other); }
145 
149  Kind GetKind() const;
150 
155  std::string GetName() const;
156 
160  std::string GetDescription() const;
161 
168  uint64_t GetLastFrameTime() const;
169 
180 
184  bool IsConnected() const;
185 
192  bool IsEnabled() const;
193 
200  VideoProperty GetProperty(const wpi::Twine& name);
201 
205  std::vector<VideoProperty> EnumerateProperties() const;
206 
210  VideoMode GetVideoMode() const;
211 
217  bool SetVideoMode(const VideoMode& mode);
218 
228  bool SetVideoMode(VideoMode::PixelFormat pixelFormat, int width, int height,
229  int fps);
230 
237  bool SetPixelFormat(VideoMode::PixelFormat pixelFormat);
238 
246  bool SetResolution(int width, int height);
247 
254  bool SetFPS(int fps);
255 
282  bool SetConfigJson(wpi::StringRef config);
283 
290  bool SetConfigJson(const wpi::json& config);
291 
297  std::string GetConfigJson() const;
298 
305 
313  double GetActualFPS() const;
314 
322  double GetActualDataRate() const;
323 
327  std::vector<VideoMode> EnumerateVideoModes() const;
328 
329  CS_Status GetLastStatus() const { return m_status; }
330 
336  std::vector<VideoSink> EnumerateSinks();
337 
343  static std::vector<VideoSource> EnumerateSources();
344 
345  friend void swap(VideoSource& first, VideoSource& second) noexcept {
346  using std::swap;
347  swap(first.m_status, second.m_status);
348  swap(first.m_handle, second.m_handle);
349  }
350 
351  protected:
352  explicit VideoSource(CS_Source handle) : m_handle(handle) {}
353 
354  mutable CS_Status m_status = 0;
355  CS_Source m_handle;
356 };
357 
361 class VideoCamera : public VideoSource {
362  public:
363  enum WhiteBalance {
364  kFixedIndoor = 3000,
365  kFixedOutdoor1 = 4000,
366  kFixedOutdoor2 = 5000,
367  kFixedFluorescent1 = 5100,
368  kFixedFlourescent2 = 5200
369  };
370 
371  VideoCamera() = default;
372 
376  void SetBrightness(int brightness);
377 
381  int GetBrightness();
382 
386  void SetWhiteBalanceAuto();
387 
392 
396  void SetWhiteBalanceManual(int value);
397 
401  void SetExposureAuto();
402 
406  void SetExposureHoldCurrent();
407 
411  void SetExposureManual(int value);
412 
413  protected:
414  explicit VideoCamera(CS_Source handle) : VideoSource(handle) {}
415 };
416 
420 class UsbCamera : public VideoCamera {
421  public:
422  UsbCamera() = default;
423 
430  UsbCamera(const wpi::Twine& name, int dev);
431 
438  UsbCamera(const wpi::Twine& name, const wpi::Twine& path);
439 
445  static std::vector<UsbCameraInfo> EnumerateUsbCameras();
446 
450  std::string GetPath() const;
451 
455  UsbCameraInfo GetInfo() const;
456 
462  void SetConnectVerbose(int level);
463 };
464 
468 class HttpCamera : public VideoCamera {
469  public:
470  enum HttpCameraKind {
471  kUnknown = CS_HTTP_UNKNOWN,
472  kMJPGStreamer = CS_HTTP_MJPGSTREAMER,
473  kCSCore = CS_HTTP_CSCORE,
474  kAxis = CS_HTTP_AXIS
475  };
476 
484  HttpCamera(const wpi::Twine& name, const wpi::Twine& url,
485  HttpCameraKind kind = kUnknown);
486 
494  HttpCamera(const wpi::Twine& name, const char* url,
495  HttpCameraKind kind = kUnknown);
496 
504  HttpCamera(const wpi::Twine& name, const std::string& url,
505  HttpCameraKind kind = kUnknown);
506 
515  HttpCameraKind kind = kUnknown);
516 
524  template <typename T>
525  HttpCamera(const wpi::Twine& name, std::initializer_list<T> urls,
526  HttpCameraKind kind = kUnknown);
527 
534  HttpCameraKind GetHttpCameraKind() const;
535 
540 
544  template <typename T>
545  void SetUrls(std::initializer_list<T> urls);
546 
550  std::vector<std::string> GetUrls() const;
551 };
552 
556 class AxisCamera : public HttpCamera {
557  static std::string HostToUrl(const wpi::Twine& host);
558  static std::vector<std::string> HostToUrl(wpi::ArrayRef<std::string> hosts);
559  template <typename T>
560  static std::vector<std::string> HostToUrl(std::initializer_list<T> hosts);
561 
562  public:
570  AxisCamera(const wpi::Twine& name, const wpi::Twine& host);
571 
579  AxisCamera(const wpi::Twine& name, const char* host);
580 
588  AxisCamera(const wpi::Twine& name, const std::string& host);
589 
597  AxisCamera(const wpi::Twine& name, wpi::StringRef host);
598 
607 
615  template <typename T>
616  AxisCamera(const wpi::Twine& name, std::initializer_list<T> hosts);
617 };
618 
622 class ImageSource : public VideoSource {
623  protected:
624  ImageSource() = default;
625 
626  public:
631  void NotifyError(const wpi::Twine& msg);
632 
638  void SetConnected(bool connected);
639 
645  void SetDescription(const wpi::Twine& description);
646 
659  VideoProperty CreateProperty(const wpi::Twine& name, VideoProperty::Kind kind,
660  int minimum, int maximum, int step,
661  int defaultValue, int value);
662 
674  VideoProperty CreateIntegerProperty(const wpi::Twine& name, int minimum,
675  int maximum, int step, int defaultValue,
676  int value);
677 
686  VideoProperty CreateBooleanProperty(const wpi::Twine& name, bool defaultValue,
687  bool value);
688 
698  const wpi::Twine& value);
699 
706  void SetEnumPropertyChoices(const VideoProperty& property,
708 
715  template <typename T>
716  void SetEnumPropertyChoices(const VideoProperty& property,
717  std::initializer_list<T> choices);
718 };
719 
723 class VideoSink {
724  friend class VideoEvent;
725  friend class VideoSource;
726 
727  public:
728  enum Kind {
729  kUnknown = CS_SINK_UNKNOWN,
730  kMjpeg = CS_SINK_MJPEG,
731  kCv = CS_SINK_CV
732  };
733 
734  VideoSink() noexcept : m_handle(0) {}
735  VideoSink(const VideoSink& sink);
736  VideoSink(VideoSink&& sink) noexcept;
737  VideoSink& operator=(VideoSink other) noexcept;
738  ~VideoSink();
739 
740  explicit operator bool() const { return m_handle != 0; }
741 
742  int GetHandle() const { return m_handle; }
743 
744  bool operator==(const VideoSink& other) const {
745  return m_handle == other.m_handle;
746  }
747 
748  bool operator!=(const VideoSink& other) const { return !(*this == other); }
749 
753  Kind GetKind() const;
754 
759  std::string GetName() const;
760 
764  std::string GetDescription() const;
765 
773  VideoProperty GetProperty(const wpi::Twine& name);
774 
778  std::vector<VideoProperty> EnumerateProperties() const;
779 
799  bool SetConfigJson(wpi::StringRef config);
800 
807  bool SetConfigJson(const wpi::json& config);
808 
814  std::string GetConfigJson() const;
815 
822 
830  void SetSource(VideoSource source);
831 
837  VideoSource GetSource() const;
838 
847 
848  CS_Status GetLastStatus() const { return m_status; }
849 
855  static std::vector<VideoSink> EnumerateSinks();
856 
857  friend void swap(VideoSink& first, VideoSink& second) noexcept {
858  using std::swap;
859  swap(first.m_status, second.m_status);
860  swap(first.m_handle, second.m_handle);
861  }
862 
863  protected:
864  explicit VideoSink(CS_Sink handle) : m_handle(handle) {}
865 
866  mutable CS_Status m_status = 0;
867  CS_Sink m_handle;
868 };
869 
873 class MjpegServer : public VideoSink {
874  public:
875  MjpegServer() = default;
876 
884  MjpegServer(const wpi::Twine& name, const wpi::Twine& listenAddress,
885  int port);
886 
893  MjpegServer(const wpi::Twine& name, int port) : MjpegServer(name, "", port) {}
894 
898  std::string GetListenAddress() const;
899 
903  int GetPort() const;
904 
919  void SetResolution(int width, int height);
920 
928  void SetFPS(int fps);
929 
939  void SetCompression(int quality);
940 
948  void SetDefaultCompression(int quality);
949 };
950 
954 class ImageSink : public VideoSink {
955  protected:
956  ImageSink() = default;
957 
958  public:
964  void SetDescription(const wpi::Twine& description);
965 
970  std::string GetError() const;
971 
979  void SetEnabled(bool enabled);
980 };
981 
985 class VideoEvent : public RawEvent {
986  public:
990  VideoSource GetSource() const;
991 
995  VideoSink GetSink() const;
996 
1000  VideoProperty GetProperty() const;
1001 };
1002 
1008  public:
1009  VideoListener() : m_handle(0) {}
1010 
1019  VideoListener(std::function<void(const VideoEvent& event)> callback,
1020  int eventMask, bool immediateNotify);
1021 
1022  VideoListener(const VideoListener&) = delete;
1023  VideoListener& operator=(const VideoListener&) = delete;
1024  VideoListener(VideoListener&& other) noexcept;
1025  VideoListener& operator=(VideoListener&& other) noexcept;
1026  ~VideoListener();
1027 
1028  friend void swap(VideoListener& first, VideoListener& second) noexcept {
1029  using std::swap;
1030  swap(first.m_handle, second.m_handle);
1031  }
1032 
1033  private:
1034  CS_Listener m_handle;
1035 };
1036 
1039 } // namespace cs
1040 
1041 #include "cscore_oo.inl"
1042 
1043 #endif // CSCORE_CSCORE_OO_H_
wpi::json
a class to store JSON values
Definition: json.h:2655
cs::VideoCamera::SetWhiteBalanceAuto
void SetWhiteBalanceAuto()
Set the white balance to auto.
Definition: cscore_oo.inl:215
cs::ImageSource::CreateBooleanProperty
VideoProperty CreateBooleanProperty(const wpi::Twine &name, bool defaultValue, bool value)
Create a boolean property.
Definition: cscore_oo.inl:417
cs::VideoSource::SetVideoMode
bool SetVideoMode(const VideoMode &mode)
Set the video mode.
Definition: cscore_oo.inl:146
cs::VideoSink::GetName
std::string GetName() const
Get the name of the sink.
Definition: cscore_oo.inl:475
cs::ImageSource::NotifyError
void NotifyError(const wpi::Twine &msg)
Signal sinks that an error has occurred.
Definition: cscore_oo.inl:381
cs::VideoSource::GetActualFPS
double GetActualFPS() const
Get the actual FPS.
Definition: cscore_oo.inl:188
cs::UsbCamera::GetInfo
UsbCameraInfo GetInfo() const
Get the full camera information for the device.
Definition: cscore_oo.inl:263
cs::VideoCamera::SetWhiteBalanceManual
void SetWhiteBalanceManual(int value)
Set the white balance to manual, with specified color temperature.
Definition: cscore_oo.inl:225
cs::VideoSink::GetProperty
VideoProperty GetProperty(const wpi::Twine &name)
Get a property of the sink.
Definition: cscore_oo.inl:485
cs::AxisCamera
A source that represents an Axis IP camera.
Definition: cscore_oo.h:556
cs::VideoSink
A sink for video that accepts a sequence of frames.
Definition: cscore_oo.h:723
cs::VideoCamera::SetBrightness
void SetBrightness(int brightness)
Set the brightness, as a percentage (0-100).
Definition: cscore_oo.inl:205
cs::UsbCamera::SetConnectVerbose
void SetConnectVerbose(int level)
Set how verbose the camera connection messages are.
Definition: cscore_oo.inl:268
cs::VideoSource::GetActualDataRate
double GetActualDataRate() const
Get the data rate (in bytes per second).
Definition: cscore_oo.inl:194
cs::VideoSource::GetConfigJson
std::string GetConfigJson() const
Get a JSON configuration string.
Definition: cscore_oo.inl:183
cs::RawEvent
Listener event.
Definition: cscore_cpp.h:102
cs::UsbCamera
A source that represents a USB camera.
Definition: cscore_oo.h:420
cs::VideoSource::GetConfigJsonObject
wpi::json GetConfigJsonObject() const
Get a JSON configuration object.
wpi::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:42
cs::VideoCamera::SetExposureHoldCurrent
void SetExposureHoldCurrent()
Set the exposure to hold current.
Definition: cscore_oo.inl:235
cs::VideoProperty
A source or sink property.
Definition: cscore_oo.h:39
wpi::SmallVectorImpl< char >
CS_CONNECTION_KEEP_OPEN
Try to keep the connection open regardless of whether any sinks are connected.
Definition: cscore_c.h:198
cs::ImageSource::CreateIntegerProperty
VideoProperty CreateIntegerProperty(const wpi::Twine &name, int minimum, int maximum, int step, int defaultValue, int value)
Create an integer property.
Definition: cscore_oo.inl:407
cs::VideoSource::kConnectionForceClose
Never open the connection.
Definition: cscore_oo.h:127
cs::VideoCamera
A source that represents a video camera.
Definition: cscore_oo.h:361
cs::ImageSource::SetConnected
void SetConnected(bool connected)
Set source connection status.
Definition: cscore_oo.inl:386
cs::VideoSource::GetKind
Kind GetKind() const
Get the kind of the source.
Definition: cscore_oo.inl:99
cs::UsbCamera::GetPath
std::string GetPath() const
Get the path to the device.
Definition: cscore_oo.inl:258
cs::HttpCamera::GetHttpCameraKind
HttpCameraKind GetHttpCameraKind() const
Get the kind of HTTP camera.
Definition: cscore_oo.inl:312
cs::MjpegServer
A sink that acts as a MJPEG-over-HTTP network server.
Definition: cscore_oo.h:873
cs::VideoSink::SetSource
void SetSource(VideoSource source)
Configure which source should provide frames to this sink.
Definition: cscore_oo.inl:490
cs::VideoSource::EnumerateProperties
std::vector< VideoProperty > EnumerateProperties() const
Enumerate all properties of this source.
cs::UsbCamera::EnumerateUsbCameras
static std::vector< UsbCameraInfo > EnumerateUsbCameras()
Enumerate USB cameras on the local system.
Definition: cscore_oo.inl:253
CS_CONNECTION_AUTO_MANAGE
Automatically connect or disconnect based on whether any sinks are connected to this source.
Definition: cscore_c.h:192
cs::VideoCamera::SetExposureManual
void SetExposureManual(int value)
Set the exposure to manual, as a percentage (0-100).
Definition: cscore_oo.inl:240
cs::HttpCamera::HttpCamera
HttpCamera(const wpi::Twine &name, const wpi::Twine &url, HttpCameraKind kind=kUnknown)
Create a source for a MJPEG-over-HTTP (IP) camera.
Definition: cscore_oo.inl:274
cs::VideoSource::SetFPS
bool SetFPS(int fps)
Set the frames per second (FPS).
Definition: cscore_oo.inl:168
cs::VideoSink::SetConfigJson
bool SetConfigJson(wpi::StringRef config)
Set properties from a JSON configuration string.
Definition: cscore_oo.inl:509
cs::VideoEvent
An event generated by the library and provided to event listeners.
Definition: cscore_oo.h:985
cs::MjpegServer::GetPort
int GetPort() const
Get the port number of the server.
Definition: cscore_oo.inl:534
cs::VideoSource::EnumerateSinks
std::vector< VideoSink > EnumerateSinks()
Enumerate all sinks connected to this source.
cs::HttpCamera::GetUrls
std::vector< std::string > GetUrls() const
Get the URLs used to connect to the camera.
Definition: cscore_oo.inl:332
cs::VideoListener
An event listener.
Definition: cscore_oo.h:1007
cs::ImageSink
A base class for single image reading sinks.
Definition: cscore_oo.h:954
cs::MjpegServer::GetListenAddress
std::string GetListenAddress() const
Get the listen address of the server.
Definition: cscore_oo.inl:529
cs::VideoCamera::SetWhiteBalanceHoldCurrent
void SetWhiteBalanceHoldCurrent()
Set the white balance to hold current.
Definition: cscore_oo.inl:220
cs
CameraServer (cscore) namespace.
Definition: cscore_oo.h:18
cs::UsbCameraInfo
USB camera information.
Definition: cscore_cpp.h:50
cs::VideoSource::EnumerateSources
static std::vector< VideoSource > EnumerateSources()
Enumerate all existing sources.
cs::VideoSource::SetConnectionStrategy
void SetConnectionStrategy(ConnectionStrategy strategy)
Sets the connection strategy.
Definition: cscore_oo.inl:119
cs::VideoSource::EnumerateVideoModes
std::vector< VideoMode > EnumerateVideoModes() const
Enumerate all known video modes for this source.
Definition: cscore_oo.inl:200
cs::VideoSink::GetConfigJson
std::string GetConfigJson() const
Get a JSON configuration string.
Definition: cscore_oo.inl:519
cs::VideoSink::GetSource
VideoSource GetSource() const
Get the connected source.
Definition: cscore_oo.inl:498
cs::VideoSource::SetConfigJson
bool SetConfigJson(wpi::StringRef config)
Set video mode and properties from a JSON configuration string.
Definition: cscore_oo.inl:173
cs::VideoSource::GetVideoMode
VideoMode GetVideoMode() const
Get the current video mode.
Definition: cscore_oo.inl:141
cs::ImageSource::SetDescription
void SetDescription(const wpi::Twine &description)
Set source description.
Definition: cscore_oo.inl:391
cs::HttpCamera
A source that represents a MJPEG-over-HTTP (IP) camera.
Definition: cscore_oo.h:468
cs::VideoEvent::GetSink
VideoSink GetSink() const
Get the sink associated with the event (if any).
Definition: cscore_oo.inl:583
cs::MjpegServer::SetDefaultCompression
void SetDefaultCompression(int quality)
Set the default compression used for non-MJPEG sources.
Definition: cscore_oo.inl:557
wpi::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
cs::VideoSource::kConnectionKeepOpen
Try to keep the connection open regardless of whether any sinks are connected.
Definition: cscore_oo.h:121
cs::VideoSource::kConnectionAutoManage
Automatically connect or disconnect based on whether any sinks are connected to this source.
Definition: cscore_oo.h:115
cs::MjpegServer::SetResolution
void SetResolution(int width, int height)
Set the stream resolution for clients that don't specify it.
Definition: cscore_oo.inl:539
cs::VideoEvent::GetProperty
VideoProperty GetProperty() const
Get the property associated with the event (if any).
Definition: cscore_oo.inl:588
cs::VideoSource::SetResolution
bool SetResolution(int width, int height)
Set the resolution.
Definition: cscore_oo.inl:163
cs::VideoSource::GetProperty
VideoProperty GetProperty(const wpi::Twine &name)
Get a property.
Definition: cscore_oo.inl:136
cs::VideoSource::GetLastFrameTime
uint64_t GetLastFrameTime() const
Get the last time a frame was captured.
Definition: cscore_oo.inl:114
cs::VideoSink::GetConfigJsonObject
wpi::json GetConfigJsonObject() const
Get a JSON configuration object.
cs::ImageSource::CreateProperty
VideoProperty CreateProperty(const wpi::Twine &name, VideoProperty::Kind kind, int minimum, int maximum, int step, int defaultValue, int value)
Create a property.
Definition: cscore_oo.inl:396
CS_CONNECTION_FORCE_CLOSE
Never open the connection.
Definition: cscore_c.h:204
cs::VideoSource::ConnectionStrategy
ConnectionStrategy
Connection strategy.
Definition: cscore_oo.h:110
cs::VideoCamera::SetExposureAuto
void SetExposureAuto()
Set the exposure to auto aperature.
Definition: cscore_oo.inl:230
cs::VideoSource::GetName
std::string GetName() const
Get the name of the source.
Definition: cscore_oo.inl:104
cs::ImageSink::SetEnabled
void SetEnabled(bool enabled)
Enable or disable getting new frames.
Definition: cscore_oo.inl:573
cs::VideoSink::GetKind
Kind GetKind() const
Get the kind of the sink.
Definition: cscore_oo.inl:470
cs::VideoSink::GetDescription
std::string GetDescription() const
Get the sink description.
Definition: cscore_oo.inl:480
cs::VideoSource
A source for video that provides a sequence of frames.
Definition: cscore_oo.h:97
cs::VideoSink::EnumerateSinks
static std::vector< VideoSink > EnumerateSinks()
Enumerate all existing sinks.
cs::HttpCamera::SetUrls
void SetUrls(wpi::ArrayRef< std::string > urls)
Change the URLs used to connect to the camera.
Definition: cscore_oo.inl:318
cs::MjpegServer::MjpegServer
MjpegServer(const wpi::Twine &name, int port)
Create a MJPEG-over-HTTP server sink.
Definition: cscore_oo.h:893
cs::VideoSink::GetSourceProperty
VideoProperty GetSourceProperty(const wpi::Twine &name)
Get a property of the associated source.
Definition: cscore_oo.inl:504
cs::VideoSink::EnumerateProperties
std::vector< VideoProperty > EnumerateProperties() const
Enumerate all properties of this sink.
cs::AxisCamera::AxisCamera
AxisCamera(const wpi::Twine &name, const wpi::Twine &host)
Create a source for an Axis IP camera.
Definition: cscore_oo.inl:360
cs::VideoSource::SetPixelFormat
bool SetPixelFormat(VideoMode::PixelFormat pixelFormat)
Set the pixel format.
Definition: cscore_oo.inl:158
cs::MjpegServer::SetFPS
void SetFPS(int fps)
Set the stream frames per second (FPS) for clients that don't specify it.
Definition: cscore_oo.inl:546
cs::ImageSink::SetDescription
void SetDescription(const wpi::Twine &description)
Set sink description.
Definition: cscore_oo.inl:563
wpi::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:85
cs::ImageSource::CreateStringProperty
VideoProperty CreateStringProperty(const wpi::Twine &name, const wpi::Twine &value)
Create a string property.
Definition: cscore_oo.inl:426
cs::ImageSource::SetEnumPropertyChoices
void SetEnumPropertyChoices(const VideoProperty &property, wpi::ArrayRef< std::string > choices)
Configure enum property choices.
Definition: cscore_oo.inl:437
cs::VideoSource::GetDescription
std::string GetDescription() const
Get the source description.
Definition: cscore_oo.inl:109
cs::VideoCamera::GetBrightness
int GetBrightness()
Get the brightness, as a percentage (0-100).
Definition: cscore_oo.inl:210
cs::ImageSource
A base class for single image providing sources.
Definition: cscore_oo.h:622
cs::VideoSource::IsEnabled
bool IsEnabled() const
Gets source enable status.
Definition: cscore_oo.inl:131
cs::ImageSink::GetError
std::string GetError() const
Get error string.
Definition: cscore_oo.inl:568
cs::VideoSource::IsConnected
bool IsConnected() const
Is the source currently connected to whatever is providing the images?
Definition: cscore_oo.inl:126
cs::MjpegServer::SetCompression
void SetCompression(int quality)
Set the compression for clients that don't specify it.
Definition: cscore_oo.inl:551
cs::VideoEvent::GetSource
VideoSource GetSource() const
Get the source associated with the event (if any).
Definition: cscore_oo.inl:578