mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-30 02:31:44 +00:00
Change acronym class names to use MixedCase (UsbCamera, MjpegServer). (#22)
This commit is contained in:
@@ -169,10 +169,10 @@ char** CS_GetEnumPropertyChoices(CS_Property property, int* count,
|
||||
//
|
||||
// Source Creation Functions
|
||||
//
|
||||
CS_Source CS_CreateUSBCameraDev(const char* name, int dev, CS_Status* status);
|
||||
CS_Source CS_CreateUSBCameraPath(const char* name, const char* path,
|
||||
CS_Source CS_CreateUsbCameraDev(const char* name, int dev, CS_Status* status);
|
||||
CS_Source CS_CreateUsbCameraPath(const char* name, const char* path,
|
||||
CS_Status* status);
|
||||
CS_Source CS_CreateHTTPCamera(const char* name, const char* url,
|
||||
CS_Source CS_CreateHttpCamera(const char* name, const char* url,
|
||||
CS_Status* status);
|
||||
CS_Source CS_CreateCvSource(const char* name, const CS_VideoMode* mode,
|
||||
CS_Status* status);
|
||||
@@ -211,9 +211,9 @@ CS_Source CS_CopySource(CS_Source source, CS_Status* status);
|
||||
void CS_ReleaseSource(CS_Source source, CS_Status* status);
|
||||
|
||||
//
|
||||
// USBCamera Source Functions
|
||||
// UsbCamera Source Functions
|
||||
//
|
||||
char* CS_GetUSBCameraPath(CS_Source source, CS_Status* status);
|
||||
char* CS_GetUsbCameraPath(CS_Source source, CS_Status* status);
|
||||
|
||||
//
|
||||
// OpenCV Source Functions
|
||||
@@ -236,7 +236,7 @@ void CS_SetSourceEnumPropertyChoices(CS_Source source, CS_Property property,
|
||||
//
|
||||
// Sink Creation Functions
|
||||
//
|
||||
CS_Sink CS_CreateMJPEGServer(const char* name, const char* listenAddress,
|
||||
CS_Sink CS_CreateMjpegServer(const char* name, const char* listenAddress,
|
||||
int port, CS_Status* status);
|
||||
CS_Sink CS_CreateCvSink(const char* name, CS_Status* status);
|
||||
CS_Sink CS_CreateCvSinkCallback(const char* name, void* data,
|
||||
@@ -257,10 +257,10 @@ CS_Sink CS_CopySink(CS_Sink sink, CS_Status* status);
|
||||
void CS_ReleaseSink(CS_Sink sink, CS_Status* status);
|
||||
|
||||
//
|
||||
// MJPEGServer Sink Functions
|
||||
// MjpegServer Sink Functions
|
||||
//
|
||||
char* CS_GetMJPEGServerListenAddress(CS_Sink sink, CS_Status* status);
|
||||
int CS_GetMJPEGServerPort(CS_Sink sink, CS_Status* status);
|
||||
char* CS_GetMjpegServerListenAddress(CS_Sink sink, CS_Status* status);
|
||||
int CS_GetMjpegServerPort(CS_Sink sink, CS_Status* status);
|
||||
|
||||
//
|
||||
// OpenCV Sink Functions
|
||||
@@ -288,14 +288,14 @@ int CS_NotifierDestroyed(void);
|
||||
//
|
||||
// Utility Functions
|
||||
//
|
||||
typedef struct CS_USBCameraInfo {
|
||||
typedef struct CS_UsbCameraInfo {
|
||||
int dev;
|
||||
char* path;
|
||||
char* name;
|
||||
} CS_USBCameraInfo;
|
||||
} CS_UsbCameraInfo;
|
||||
|
||||
CS_USBCameraInfo* CS_EnumerateUSBCameras(int* count, CS_Status* status);
|
||||
void CS_FreeEnumeratedUSBCameras(CS_USBCameraInfo* cameras, int count);
|
||||
CS_UsbCameraInfo* CS_EnumerateUsbCameras(int* count, CS_Status* status);
|
||||
void CS_FreeEnumeratedUsbCameras(CS_UsbCameraInfo* cameras, int count);
|
||||
|
||||
CS_Source* CS_EnumerateSources(int* count, CS_Status* status);
|
||||
void CS_ReleaseEnumeratedSources(CS_Source* sources, int count);
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace cs {
|
||||
//
|
||||
|
||||
/// USB camera information
|
||||
struct USBCameraInfo {
|
||||
struct UsbCameraInfo {
|
||||
/// Device number (e.g. N in '/dev/videoN' on Linux)
|
||||
int dev;
|
||||
/// Path to device if available (e.g. '/dev/video0' on Linux)
|
||||
@@ -156,10 +156,10 @@ std::vector<std::string> GetEnumPropertyChoices(CS_Property property,
|
||||
//
|
||||
// Source Creation Functions
|
||||
//
|
||||
CS_Source CreateUSBCameraDev(llvm::StringRef name, int dev, CS_Status* status);
|
||||
CS_Source CreateUSBCameraPath(llvm::StringRef name, llvm::StringRef path,
|
||||
CS_Source CreateUsbCameraDev(llvm::StringRef name, int dev, CS_Status* status);
|
||||
CS_Source CreateUsbCameraPath(llvm::StringRef name, llvm::StringRef path,
|
||||
CS_Status* status);
|
||||
CS_Source CreateHTTPCamera(llvm::StringRef name, llvm::StringRef url,
|
||||
CS_Source CreateHttpCamera(llvm::StringRef name, llvm::StringRef url,
|
||||
CS_Status* status);
|
||||
CS_Source CreateCvSource(llvm::StringRef name, const VideoMode& mode,
|
||||
CS_Status* status);
|
||||
@@ -199,9 +199,9 @@ CS_Source CopySource(CS_Source source, CS_Status* status);
|
||||
void ReleaseSource(CS_Source source, CS_Status* status);
|
||||
|
||||
//
|
||||
// USBCamera Source Functions
|
||||
// UsbCamera Source Functions
|
||||
//
|
||||
std::string GetUSBCameraPath(CS_Source source, CS_Status* status);
|
||||
std::string GetUsbCameraPath(CS_Source source, CS_Status* status);
|
||||
|
||||
//
|
||||
// OpenCV Source Functions
|
||||
@@ -223,7 +223,7 @@ void SetSourceEnumPropertyChoices(CS_Source source, CS_Property property,
|
||||
//
|
||||
// Sink Creation Functions
|
||||
//
|
||||
CS_Sink CreateMJPEGServer(llvm::StringRef name, llvm::StringRef listenAddress,
|
||||
CS_Sink CreateMjpegServer(llvm::StringRef name, llvm::StringRef listenAddress,
|
||||
int port, CS_Status* status);
|
||||
CS_Sink CreateCvSink(llvm::StringRef name, CS_Status* status);
|
||||
CS_Sink CreateCvSinkCallback(llvm::StringRef name,
|
||||
@@ -249,10 +249,10 @@ CS_Sink CopySink(CS_Sink sink, CS_Status* status);
|
||||
void ReleaseSink(CS_Sink sink, CS_Status* status);
|
||||
|
||||
//
|
||||
// MJPEGServer Sink Functions
|
||||
// MjpegServer Sink Functions
|
||||
//
|
||||
std::string GetMJPEGServerListenAddress(CS_Sink sink, CS_Status* status);
|
||||
int GetMJPEGServerPort(CS_Sink sink, CS_Status* status);
|
||||
std::string GetMjpegServerListenAddress(CS_Sink sink, CS_Status* status);
|
||||
int GetMjpegServerPort(CS_Sink sink, CS_Status* status);
|
||||
|
||||
//
|
||||
// OpenCV Sink Functions
|
||||
@@ -281,7 +281,7 @@ bool NotifierDestroyed();
|
||||
//
|
||||
// Utility Functions
|
||||
//
|
||||
std::vector<USBCameraInfo> EnumerateUSBCameras(CS_Status* status);
|
||||
std::vector<UsbCameraInfo> EnumerateUsbCameras(CS_Status* status);
|
||||
|
||||
llvm::ArrayRef<CS_Source> EnumerateSourceHandles(
|
||||
llvm::SmallVectorImpl<CS_Source>& vec, CS_Status* status);
|
||||
|
||||
@@ -85,8 +85,8 @@ class VideoSource {
|
||||
public:
|
||||
enum Kind {
|
||||
kUnknown = CS_SOURCE_UNKNOWN,
|
||||
kUSB = CS_SOURCE_USB,
|
||||
kHTTP = CS_SOURCE_HTTP,
|
||||
kUsb = CS_SOURCE_USB,
|
||||
kHttp = CS_SOURCE_HTTP,
|
||||
kCv = CS_SOURCE_CV
|
||||
};
|
||||
|
||||
@@ -190,7 +190,7 @@ class VideoSource {
|
||||
};
|
||||
|
||||
/// A source that represents a USB camera.
|
||||
class USBCamera : public VideoSource {
|
||||
class UsbCamera : public VideoSource {
|
||||
private:
|
||||
static constexpr char const* kPropWbAuto = "white_balance_temperature_auto";
|
||||
static constexpr char const* kPropWbValue = "white_balance_temperature";
|
||||
@@ -207,21 +207,21 @@ class USBCamera : public VideoSource {
|
||||
kFixedFlourescent2 = 5200
|
||||
};
|
||||
|
||||
USBCamera() = default;
|
||||
UsbCamera() = default;
|
||||
|
||||
/// Create a source for a USB camera based on device number.
|
||||
/// @param name Source name (arbitrary unique identifier)
|
||||
/// @param dev Device number (e.g. 0 for /dev/video0)
|
||||
USBCamera(llvm::StringRef name, int dev);
|
||||
UsbCamera(llvm::StringRef name, int dev);
|
||||
|
||||
/// Create a source for a USB camera based on device path.
|
||||
/// @param name Source name (arbitrary unique identifier)
|
||||
/// @param path Path to device (e.g. "/dev/video0" on Linux)
|
||||
USBCamera(llvm::StringRef name, llvm::StringRef path);
|
||||
UsbCamera(llvm::StringRef name, llvm::StringRef path);
|
||||
|
||||
/// Enumerate USB cameras on the local system.
|
||||
/// @return Vector of USB camera information (one for each camera)
|
||||
static std::vector<USBCameraInfo> EnumerateUSBCameras();
|
||||
static std::vector<UsbCameraInfo> EnumerateUsbCameras();
|
||||
|
||||
/// Get the path to the device.
|
||||
std::string GetPath() const;
|
||||
@@ -252,12 +252,12 @@ class USBCamera : public VideoSource {
|
||||
};
|
||||
|
||||
/// A source that represents a MJPEG-over-HTTP (IP) camera.
|
||||
class HTTPCamera : public VideoSource {
|
||||
class HttpCamera : public VideoSource {
|
||||
public:
|
||||
/// Create a source for a MJPEG-over-HTTP (IP) camera.
|
||||
/// @param name Source name (arbitrary unique identifier)
|
||||
/// @param url Camera URL (e.g. "http://10.x.y.11/video/stream.mjpg")
|
||||
HTTPCamera(llvm::StringRef name, llvm::StringRef url);
|
||||
HttpCamera(llvm::StringRef name, llvm::StringRef url);
|
||||
};
|
||||
|
||||
/// A source for user code to provide OpenCV images as video frames.
|
||||
@@ -325,7 +325,7 @@ class VideoSink {
|
||||
public:
|
||||
enum Kind {
|
||||
kUnknown = CS_SINK_UNKNOWN,
|
||||
kMJPEG = CS_SINK_MJPEG,
|
||||
kMjpeg = CS_SINK_MJPEG,
|
||||
kCv = CS_SINK_CV
|
||||
};
|
||||
|
||||
@@ -391,20 +391,20 @@ class VideoSink {
|
||||
};
|
||||
|
||||
/// A sink that acts as a MJPEG-over-HTTP network server.
|
||||
class MJPEGServer : public VideoSink {
|
||||
class MjpegServer : public VideoSink {
|
||||
public:
|
||||
MJPEGServer() = default;
|
||||
MjpegServer() = default;
|
||||
|
||||
/// Create a MJPEG-over-HTTP server sink.
|
||||
/// @param name Sink name (arbitrary unique identifier)
|
||||
/// @param listenAddress TCP listen address (empty string for all addresses)
|
||||
/// @param port TCP port number
|
||||
MJPEGServer(llvm::StringRef name, llvm::StringRef listenAddress, int port);
|
||||
MjpegServer(llvm::StringRef name, llvm::StringRef listenAddress, int port);
|
||||
|
||||
/// Create a MJPEG-over-HTTP server sink.
|
||||
/// @param name Sink name (arbitrary unique identifier)
|
||||
/// @param port TCP port number
|
||||
MJPEGServer(llvm::StringRef name, int port) : MJPEGServer(name, "", port) {}
|
||||
MjpegServer(llvm::StringRef name, int port) : MjpegServer(name, "", port) {}
|
||||
|
||||
/// Get the listen address of the server.
|
||||
std::string GetListenAddress() const;
|
||||
|
||||
@@ -160,25 +160,25 @@ inline std::vector<VideoMode> VideoSource::EnumerateVideoModes() const {
|
||||
return EnumerateSourceVideoModes(m_handle, &status);
|
||||
}
|
||||
|
||||
inline USBCamera::USBCamera(llvm::StringRef name, int dev) {
|
||||
m_handle = CreateUSBCameraDev(name, dev, &m_status);
|
||||
inline UsbCamera::UsbCamera(llvm::StringRef name, int dev) {
|
||||
m_handle = CreateUsbCameraDev(name, dev, &m_status);
|
||||
}
|
||||
|
||||
inline USBCamera::USBCamera(llvm::StringRef name, llvm::StringRef path) {
|
||||
m_handle = CreateUSBCameraPath(name, path, &m_status);
|
||||
inline UsbCamera::UsbCamera(llvm::StringRef name, llvm::StringRef path) {
|
||||
m_handle = CreateUsbCameraPath(name, path, &m_status);
|
||||
}
|
||||
|
||||
inline std::vector<USBCameraInfo> USBCamera::EnumerateUSBCameras() {
|
||||
inline std::vector<UsbCameraInfo> UsbCamera::EnumerateUsbCameras() {
|
||||
CS_Status status = 0;
|
||||
return ::cs::EnumerateUSBCameras(&status);
|
||||
return ::cs::EnumerateUsbCameras(&status);
|
||||
}
|
||||
|
||||
inline std::string USBCamera::GetPath() const {
|
||||
CS_Status status = 0;
|
||||
return ::cs::GetUSBCameraPath(m_handle, &status);
|
||||
inline std::string UsbCamera::GetPath() const {
|
||||
m_status = 0;
|
||||
return ::cs::GetUsbCameraPath(m_handle, &m_status);
|
||||
}
|
||||
|
||||
inline void USBCamera::SetBrightness(int brightness) {
|
||||
inline void UsbCamera::SetBrightness(int brightness) {
|
||||
if (brightness > 100) {
|
||||
brightness = 100;
|
||||
} else if (brightness < 0) {
|
||||
@@ -187,32 +187,32 @@ inline void USBCamera::SetBrightness(int brightness) {
|
||||
GetProperty(kPropBrValue).Set(brightness);
|
||||
}
|
||||
|
||||
inline int USBCamera::GetBrightness() {
|
||||
inline int UsbCamera::GetBrightness() {
|
||||
return GetProperty(kPropBrValue).Get();
|
||||
}
|
||||
|
||||
inline void USBCamera::SetWhiteBalanceAuto() {
|
||||
inline void UsbCamera::SetWhiteBalanceAuto() {
|
||||
GetProperty(kPropWbAuto).Set(1); // auto
|
||||
}
|
||||
|
||||
inline void USBCamera::SetWhiteBalanceHoldCurrent() {
|
||||
inline void UsbCamera::SetWhiteBalanceHoldCurrent() {
|
||||
GetProperty(kPropWbAuto).Set(0); // manual
|
||||
}
|
||||
|
||||
inline void USBCamera::SetWhiteBalanceManual(int value) {
|
||||
inline void UsbCamera::SetWhiteBalanceManual(int value) {
|
||||
GetProperty(kPropWbAuto).Set(0); // manual
|
||||
GetProperty(kPropWbValue).Set(value);
|
||||
}
|
||||
|
||||
inline void USBCamera::SetExposureAuto() {
|
||||
inline void UsbCamera::SetExposureAuto() {
|
||||
GetProperty(kPropExAuto).Set(0); // auto; yes, this is opposite of WB
|
||||
}
|
||||
|
||||
inline void USBCamera::SetExposureHoldCurrent() {
|
||||
inline void UsbCamera::SetExposureHoldCurrent() {
|
||||
GetProperty(kPropExAuto).Set(1); // manual
|
||||
}
|
||||
|
||||
inline void USBCamera::SetExposureManual(int value) {
|
||||
inline void UsbCamera::SetExposureManual(int value) {
|
||||
GetProperty(kPropExAuto).Set(1); // manual
|
||||
if (value > 100) {
|
||||
value = 100;
|
||||
@@ -222,8 +222,8 @@ inline void USBCamera::SetExposureManual(int value) {
|
||||
GetProperty(kPropExValue).Set(value);
|
||||
}
|
||||
|
||||
inline HTTPCamera::HTTPCamera(llvm::StringRef name, llvm::StringRef url) {
|
||||
m_handle = CreateHTTPCamera(name, url, &m_status);
|
||||
inline HttpCamera::HttpCamera(llvm::StringRef name, llvm::StringRef url) {
|
||||
m_handle = CreateHttpCamera(name, url, &m_status);
|
||||
}
|
||||
|
||||
inline CvSource::CvSource(llvm::StringRef name, const VideoMode& mode) {
|
||||
@@ -323,19 +323,19 @@ inline VideoProperty VideoSink::GetSourceProperty(llvm::StringRef name) {
|
||||
return VideoProperty{GetSinkSourceProperty(m_handle, name, &m_status)};
|
||||
}
|
||||
|
||||
inline MJPEGServer::MJPEGServer(llvm::StringRef name,
|
||||
inline MjpegServer::MjpegServer(llvm::StringRef name,
|
||||
llvm::StringRef listenAddress, int port) {
|
||||
m_handle = CreateMJPEGServer(name, listenAddress, port, &m_status);
|
||||
m_handle = CreateMjpegServer(name, listenAddress, port, &m_status);
|
||||
}
|
||||
|
||||
inline std::string MJPEGServer::GetListenAddress() const {
|
||||
inline std::string MjpegServer::GetListenAddress() const {
|
||||
m_status = 0;
|
||||
return cs::GetMJPEGServerListenAddress(m_handle, &m_status);
|
||||
return cs::GetMjpegServerListenAddress(m_handle, &m_status);
|
||||
}
|
||||
|
||||
inline int MJPEGServer::GetPort() const {
|
||||
inline int MjpegServer::GetPort() const {
|
||||
m_status = 0;
|
||||
return cs::GetMJPEGServerPort(m_handle, &m_status);
|
||||
return cs::GetMjpegServerPort(m_handle, &m_status);
|
||||
}
|
||||
|
||||
inline CvSink::CvSink(llvm::StringRef name) {
|
||||
|
||||
Reference in New Issue
Block a user