15 #include "ErrorBase.h"
17 #include "llvm/DenseMap.h"
18 #include "llvm/StringMap.h"
19 #include "llvm/StringRef.h"
20 #include "networktables/NetworkTable.h"
30 static constexpr uint16_t kBasePort = 1181;
31 static constexpr
int kSize640x480 = 0;
32 static constexpr
int kSize320x240 = 1;
33 static constexpr
int kSize160x120 = 2;
77 llvm::StringRef path);
102 cs::CvSink
GetVideo(
const cs::VideoSource& camera);
110 cs::CvSink
GetVideo(llvm::StringRef name);
120 cs::CvSource
PutVideo(llvm::StringRef name,
int width,
int height);
127 cs::MjpegServer
AddServer(llvm::StringRef name);
134 cs::MjpegServer
AddServer(llvm::StringRef name,
int port);
141 void AddServer(
const cs::VideoSink& server);
155 void AddCamera(
const cs::VideoSource& camera);
178 std::shared_ptr<ITable> GetSourceTable(CS_Source source);
179 void UpdateStreamValues();
181 static constexpr
char const* kPublishName =
"/CameraPublisher";
184 std::string m_primarySourceName;
185 llvm::StringMap<cs::VideoSource> m_sources;
186 llvm::StringMap<cs::VideoSink> m_sinks;
187 llvm::DenseMap<CS_Source, std::shared_ptr<ITable>> m_tables;
188 std::shared_ptr<NetworkTable> m_publishTable;
189 cs::VideoListener m_videoListener;
192 std::vector<std::string> m_addresses;
void SetSize(int size)
Sets the size of the image to use.
Definition: CameraServer.cpp:344
cs::UsbCamera StartAutomaticCapture()
Start automatically capturing images to send to the dashboard.
Definition: CameraServer.cpp:202
static CameraServer * GetInstance()
Get the CameraServer instance.
Definition: CameraServer.cpp:17
cs::CvSource PutVideo(llvm::StringRef name, int width, int height)
Create a MJPEG stream with OpenCV input.
Definition: CameraServer.cpp:300
Base class for most objects.
Definition: ErrorBase.h:72
void RemoveCamera(llvm::StringRef name)
Removes a camera by name.
Definition: CameraServer.cpp:339
cs::MjpegServer AddServer(llvm::StringRef name)
Adds a MJPEG server at the next available port.
Definition: CameraServer.cpp:307
void AddCamera(const cs::VideoSource &camera)
Adds an already created camera.
Definition: CameraServer.cpp:332
Singleton class for creating and keeping camera servers.
Definition: CameraServer.h:28
void RemoveServer(llvm::StringRef name)
Removes a server by name.
Definition: CameraServer.cpp:327
cs::CvSink GetVideo()
Get OpenCV access to the primary camera feed.
Definition: CameraServer.cpp:239