mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Use std::string_view and fmtlib across all libraries (#3402)
- Twine, StringRef, Format, and NativeFormatting have been removed - Logging now uses fmtlib style formatting - Nearly all uses of wpi::outs/errs have been replaced with fmt::print() or std::puts()/std::fputs() (for unformatted strings). - A wpi/fmt/raw_ostream.h header has been added to enable fmt::print() with wpi::raw_ostream
This commit is contained in:
@@ -9,12 +9,11 @@
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/ArrayRef.h>
|
||||
#include <wpi/SmallVector.h>
|
||||
#include <wpi/StringRef.h>
|
||||
#include <wpi/Twine.h>
|
||||
|
||||
#include "cscore_c.h"
|
||||
|
||||
@@ -122,8 +121,8 @@ struct RawEvent {
|
||||
|
||||
RawEvent() = default;
|
||||
explicit RawEvent(RawEvent::Kind kind_) : kind{kind_} {}
|
||||
RawEvent(const wpi::Twine& name_, CS_Handle handle_, RawEvent::Kind kind_)
|
||||
: kind{kind_}, name{name_.str()} {
|
||||
RawEvent(std::string_view name_, CS_Handle handle_, RawEvent::Kind kind_)
|
||||
: kind{kind_}, name{name_} {
|
||||
if (kind_ == kSinkCreated || kind_ == kSinkDestroyed ||
|
||||
kind_ == kSinkEnabled || kind_ == kSinkDisabled) {
|
||||
sinkHandle = handle_;
|
||||
@@ -131,21 +130,21 @@ struct RawEvent {
|
||||
sourceHandle = handle_;
|
||||
}
|
||||
}
|
||||
RawEvent(const wpi::Twine& name_, CS_Source source_, const VideoMode& mode_)
|
||||
RawEvent(std::string_view name_, CS_Source source_, const VideoMode& mode_)
|
||||
: kind{kSourceVideoModeChanged},
|
||||
sourceHandle{source_},
|
||||
name{name_.str()},
|
||||
name{name_},
|
||||
mode{mode_} {}
|
||||
RawEvent(const wpi::Twine& name_, CS_Source source_, RawEvent::Kind kind_,
|
||||
RawEvent(std::string_view name_, CS_Source source_, RawEvent::Kind kind_,
|
||||
CS_Property property_, CS_PropertyKind propertyKind_, int value_,
|
||||
const wpi::Twine& valueStr_)
|
||||
std::string_view valueStr_)
|
||||
: kind{kind_},
|
||||
sourceHandle{source_},
|
||||
name{name_.str()},
|
||||
name{name_},
|
||||
propertyHandle{property_},
|
||||
propertyKind{propertyKind_},
|
||||
value{value_},
|
||||
valueStr{valueStr_.str()} {}
|
||||
valueStr{valueStr_} {}
|
||||
|
||||
Kind kind;
|
||||
|
||||
@@ -175,9 +174,9 @@ struct RawEvent {
|
||||
*/
|
||||
CS_PropertyKind GetPropertyKind(CS_Property property, CS_Status* status);
|
||||
std::string GetPropertyName(CS_Property property, CS_Status* status);
|
||||
wpi::StringRef GetPropertyName(CS_Property property,
|
||||
wpi::SmallVectorImpl<char>& buf,
|
||||
CS_Status* status);
|
||||
std::string_view GetPropertyName(CS_Property property,
|
||||
wpi::SmallVectorImpl<char>& buf,
|
||||
CS_Status* status);
|
||||
int GetProperty(CS_Property property, CS_Status* status);
|
||||
void SetProperty(CS_Property property, int value, CS_Status* status);
|
||||
int GetPropertyMin(CS_Property property, CS_Status* status);
|
||||
@@ -185,10 +184,10 @@ int GetPropertyMax(CS_Property property, CS_Status* status);
|
||||
int GetPropertyStep(CS_Property property, CS_Status* status);
|
||||
int GetPropertyDefault(CS_Property property, CS_Status* status);
|
||||
std::string GetStringProperty(CS_Property property, CS_Status* status);
|
||||
wpi::StringRef GetStringProperty(CS_Property property,
|
||||
wpi::SmallVectorImpl<char>& buf,
|
||||
CS_Status* status);
|
||||
void SetStringProperty(CS_Property property, const wpi::Twine& value,
|
||||
std::string_view GetStringProperty(CS_Property property,
|
||||
wpi::SmallVectorImpl<char>& buf,
|
||||
CS_Status* status);
|
||||
void SetStringProperty(CS_Property property, std::string_view value,
|
||||
CS_Status* status);
|
||||
std::vector<std::string> GetEnumPropertyChoices(CS_Property property,
|
||||
CS_Status* status);
|
||||
@@ -198,16 +197,15 @@ std::vector<std::string> GetEnumPropertyChoices(CS_Property property,
|
||||
* @defgroup cscore_source_create_func Source Creation Functions
|
||||
* @{
|
||||
*/
|
||||
CS_Source CreateUsbCameraDev(const wpi::Twine& name, int dev,
|
||||
CS_Status* status);
|
||||
CS_Source CreateUsbCameraPath(const wpi::Twine& name, const wpi::Twine& path,
|
||||
CS_Source CreateUsbCameraDev(std::string_view name, int dev, CS_Status* status);
|
||||
CS_Source CreateUsbCameraPath(std::string_view name, std::string_view path,
|
||||
CS_Status* status);
|
||||
CS_Source CreateHttpCamera(const wpi::Twine& name, const wpi::Twine& url,
|
||||
CS_Source CreateHttpCamera(std::string_view name, std::string_view url,
|
||||
CS_HttpCameraKind kind, CS_Status* status);
|
||||
CS_Source CreateHttpCamera(const wpi::Twine& name,
|
||||
CS_Source CreateHttpCamera(std::string_view name,
|
||||
wpi::ArrayRef<std::string> urls,
|
||||
CS_HttpCameraKind kind, CS_Status* status);
|
||||
CS_Source CreateCvSource(const wpi::Twine& name, const VideoMode& mode,
|
||||
CS_Source CreateCvSource(std::string_view name, const VideoMode& mode,
|
||||
CS_Status* status);
|
||||
/** @} */
|
||||
|
||||
@@ -217,19 +215,20 @@ CS_Source CreateCvSource(const wpi::Twine& name, const VideoMode& mode,
|
||||
*/
|
||||
CS_SourceKind GetSourceKind(CS_Source source, CS_Status* status);
|
||||
std::string GetSourceName(CS_Source source, CS_Status* status);
|
||||
wpi::StringRef GetSourceName(CS_Source source, wpi::SmallVectorImpl<char>& buf,
|
||||
CS_Status* status);
|
||||
std::string_view GetSourceName(CS_Source source,
|
||||
wpi::SmallVectorImpl<char>& buf,
|
||||
CS_Status* status);
|
||||
std::string GetSourceDescription(CS_Source source, CS_Status* status);
|
||||
wpi::StringRef GetSourceDescription(CS_Source source,
|
||||
wpi::SmallVectorImpl<char>& buf,
|
||||
CS_Status* status);
|
||||
std::string_view GetSourceDescription(CS_Source source,
|
||||
wpi::SmallVectorImpl<char>& buf,
|
||||
CS_Status* status);
|
||||
uint64_t GetSourceLastFrameTime(CS_Source source, CS_Status* status);
|
||||
void SetSourceConnectionStrategy(CS_Source source,
|
||||
CS_ConnectionStrategy strategy,
|
||||
CS_Status* status);
|
||||
bool IsSourceConnected(CS_Source source, CS_Status* status);
|
||||
bool IsSourceEnabled(CS_Source source, CS_Status* status);
|
||||
CS_Property GetSourceProperty(CS_Source source, const wpi::Twine& name,
|
||||
CS_Property GetSourceProperty(CS_Source source, std::string_view name,
|
||||
CS_Status* status);
|
||||
wpi::ArrayRef<CS_Property> EnumerateSourceProperties(
|
||||
CS_Source source, wpi::SmallVectorImpl<CS_Property>& vec,
|
||||
@@ -242,7 +241,7 @@ bool SetSourcePixelFormat(CS_Source source, VideoMode::PixelFormat pixelFormat,
|
||||
bool SetSourceResolution(CS_Source source, int width, int height,
|
||||
CS_Status* status);
|
||||
bool SetSourceFPS(CS_Source source, int fps, CS_Status* status);
|
||||
bool SetSourceConfigJson(CS_Source source, wpi::StringRef config,
|
||||
bool SetSourceConfigJson(CS_Source source, std::string_view config,
|
||||
CS_Status* status);
|
||||
bool SetSourceConfigJson(CS_Source source, const wpi::json& config,
|
||||
CS_Status* status);
|
||||
@@ -276,7 +275,7 @@ void SetCameraExposureManual(CS_Source source, int value, CS_Status* status);
|
||||
* @defgroup cscore_usbcamera_func UsbCamera Source Functions
|
||||
* @{
|
||||
*/
|
||||
void SetUsbCameraPath(CS_Source, const wpi::Twine& path, CS_Status* status);
|
||||
void SetUsbCameraPath(CS_Source, std::string_view path, CS_Status* status);
|
||||
std::string GetUsbCameraPath(CS_Source source, CS_Status* status);
|
||||
UsbCameraInfo GetUsbCameraInfo(CS_Source source, CS_Status* status);
|
||||
/** @} */
|
||||
@@ -295,12 +294,12 @@ std::vector<std::string> GetHttpCameraUrls(CS_Source source, CS_Status* status);
|
||||
* @defgroup cscore_opencv_source_func OpenCV Source Functions
|
||||
* @{
|
||||
*/
|
||||
void NotifySourceError(CS_Source source, const wpi::Twine& msg,
|
||||
void NotifySourceError(CS_Source source, std::string_view msg,
|
||||
CS_Status* status);
|
||||
void SetSourceConnected(CS_Source source, bool connected, CS_Status* status);
|
||||
void SetSourceDescription(CS_Source source, const wpi::Twine& description,
|
||||
void SetSourceDescription(CS_Source source, std::string_view description,
|
||||
CS_Status* status);
|
||||
CS_Property CreateSourceProperty(CS_Source source, const wpi::Twine& name,
|
||||
CS_Property CreateSourceProperty(CS_Source source, std::string_view name,
|
||||
CS_PropertyKind kind, int minimum, int maximum,
|
||||
int step, int defaultValue, int value,
|
||||
CS_Status* status);
|
||||
@@ -313,11 +312,10 @@ void SetSourceEnumPropertyChoices(CS_Source source, CS_Property property,
|
||||
* @defgroup cscore_sink_create_func Sink Creation Functions
|
||||
* @{
|
||||
*/
|
||||
CS_Sink CreateMjpegServer(const wpi::Twine& name,
|
||||
const wpi::Twine& listenAddress, int port,
|
||||
CS_Status* status);
|
||||
CS_Sink CreateCvSink(const wpi::Twine& name, CS_Status* status);
|
||||
CS_Sink CreateCvSinkCallback(const wpi::Twine& name,
|
||||
CS_Sink CreateMjpegServer(std::string_view name, std::string_view listenAddress,
|
||||
int port, CS_Status* status);
|
||||
CS_Sink CreateCvSink(std::string_view name, CS_Status* status);
|
||||
CS_Sink CreateCvSinkCallback(std::string_view name,
|
||||
std::function<void(uint64_t time)> processFrame,
|
||||
CS_Status* status);
|
||||
|
||||
@@ -329,19 +327,21 @@ CS_Sink CreateCvSinkCallback(const wpi::Twine& name,
|
||||
*/
|
||||
CS_SinkKind GetSinkKind(CS_Sink sink, CS_Status* status);
|
||||
std::string GetSinkName(CS_Sink sink, CS_Status* status);
|
||||
wpi::StringRef GetSinkName(CS_Sink sink, wpi::SmallVectorImpl<char>& buf,
|
||||
CS_Status* status);
|
||||
std::string_view GetSinkName(CS_Sink sink, wpi::SmallVectorImpl<char>& buf,
|
||||
CS_Status* status);
|
||||
std::string GetSinkDescription(CS_Sink sink, CS_Status* status);
|
||||
wpi::StringRef GetSinkDescription(CS_Sink sink, wpi::SmallVectorImpl<char>& buf,
|
||||
CS_Status* status);
|
||||
CS_Property GetSinkProperty(CS_Sink sink, const wpi::Twine& name,
|
||||
std::string_view GetSinkDescription(CS_Sink sink,
|
||||
wpi::SmallVectorImpl<char>& buf,
|
||||
CS_Status* status);
|
||||
CS_Property GetSinkProperty(CS_Sink sink, std::string_view name,
|
||||
CS_Status* status);
|
||||
wpi::ArrayRef<CS_Property> EnumerateSinkProperties(
|
||||
CS_Sink sink, wpi::SmallVectorImpl<CS_Property>& vec, CS_Status* status);
|
||||
void SetSinkSource(CS_Sink sink, CS_Source source, CS_Status* status);
|
||||
CS_Property GetSinkSourceProperty(CS_Sink sink, const wpi::Twine& name,
|
||||
CS_Property GetSinkSourceProperty(CS_Sink sink, std::string_view name,
|
||||
CS_Status* status);
|
||||
bool SetSinkConfigJson(CS_Sink sink, wpi::StringRef config, CS_Status* status);
|
||||
bool SetSinkConfigJson(CS_Sink sink, std::string_view config,
|
||||
CS_Status* status);
|
||||
bool SetSinkConfigJson(CS_Sink sink, const wpi::json& config,
|
||||
CS_Status* status);
|
||||
std::string GetSinkConfigJson(CS_Sink sink, CS_Status* status);
|
||||
@@ -363,11 +363,11 @@ int GetMjpegServerPort(CS_Sink sink, CS_Status* status);
|
||||
* @defgroup cscore_opencv_sink_func OpenCV Sink Functions
|
||||
* @{
|
||||
*/
|
||||
void SetSinkDescription(CS_Sink sink, const wpi::Twine& description,
|
||||
void SetSinkDescription(CS_Sink sink, std::string_view description,
|
||||
CS_Status* status);
|
||||
std::string GetSinkError(CS_Sink sink, CS_Status* status);
|
||||
wpi::StringRef GetSinkError(CS_Sink sink, wpi::SmallVectorImpl<char>& buf,
|
||||
CS_Status* status);
|
||||
std::string_view GetSinkError(CS_Sink sink, wpi::SmallVectorImpl<char>& buf,
|
||||
CS_Status* status);
|
||||
void SetSinkEnabled(CS_Sink sink, bool enabled, CS_Status* status);
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class CvSource : public ImageSource {
|
||||
* @param name Source name (arbitrary unique identifier)
|
||||
* @param mode Video mode being generated
|
||||
*/
|
||||
CvSource(const wpi::Twine& name, const VideoMode& mode);
|
||||
CvSource(std::string_view name, const VideoMode& mode);
|
||||
|
||||
/**
|
||||
* Create an OpenCV source.
|
||||
@@ -93,8 +93,8 @@ class CvSource : public ImageSource {
|
||||
* @param height height
|
||||
* @param fps fps
|
||||
*/
|
||||
CvSource(const wpi::Twine& name, VideoMode::PixelFormat pixelFormat,
|
||||
int width, int height, int fps);
|
||||
CvSource(std::string_view name, VideoMode::PixelFormat pixelFormat, int width,
|
||||
int height, int fps);
|
||||
|
||||
/**
|
||||
* Put an OpenCV image and notify sinks.
|
||||
@@ -126,7 +126,7 @@ class CvSink : public ImageSink {
|
||||
*
|
||||
* @param name Source name (arbitrary unique identifier)
|
||||
*/
|
||||
explicit CvSink(const wpi::Twine& name);
|
||||
explicit CvSink(std::string_view name);
|
||||
|
||||
/**
|
||||
* Create a sink for accepting OpenCV images in a separate thread.
|
||||
@@ -140,7 +140,7 @@ class CvSink : public ImageSink {
|
||||
* or GetError() as needed, but should not call (except in very
|
||||
* unusual circumstances) WaitForImage().
|
||||
*/
|
||||
CvSink(const wpi::Twine& name,
|
||||
CvSink(std::string_view name,
|
||||
std::function<void(uint64_t time)> processFrame);
|
||||
|
||||
/**
|
||||
@@ -165,11 +165,11 @@ class CvSink : public ImageSink {
|
||||
uint64_t GrabFrameNoTimeout(cv::Mat& image) const;
|
||||
};
|
||||
|
||||
inline CvSource::CvSource(const wpi::Twine& name, const VideoMode& mode) {
|
||||
inline CvSource::CvSource(std::string_view name, const VideoMode& mode) {
|
||||
m_handle = CreateCvSource(name, mode, &m_status);
|
||||
}
|
||||
|
||||
inline CvSource::CvSource(const wpi::Twine& name, VideoMode::PixelFormat format,
|
||||
inline CvSource::CvSource(std::string_view name, VideoMode::PixelFormat format,
|
||||
int width, int height, int fps) {
|
||||
m_handle =
|
||||
CreateCvSource(name, VideoMode{format, width, height, fps}, &m_status);
|
||||
@@ -180,11 +180,11 @@ inline void CvSource::PutFrame(cv::Mat& image) {
|
||||
PutSourceFrame(m_handle, image, &m_status);
|
||||
}
|
||||
|
||||
inline CvSink::CvSink(const wpi::Twine& name) {
|
||||
inline CvSink::CvSink(std::string_view name) {
|
||||
m_handle = CreateCvSink(name, &m_status);
|
||||
}
|
||||
|
||||
inline CvSink::CvSink(const wpi::Twine& name,
|
||||
inline CvSink::CvSink(std::string_view name,
|
||||
std::function<void(uint64_t time)> processFrame) {
|
||||
m_handle = CreateCvSinkCallback(name, processFrame, &m_status);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <initializer_list>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -71,8 +72,8 @@ class VideoProperty {
|
||||
|
||||
// String-specific functions
|
||||
std::string GetString() const;
|
||||
wpi::StringRef GetString(wpi::SmallVectorImpl<char>& buf) const;
|
||||
void SetString(const wpi::Twine& value);
|
||||
std::string_view GetString(wpi::SmallVectorImpl<char>& buf) const;
|
||||
void SetString(std::string_view value);
|
||||
|
||||
// Enum-specific functions
|
||||
std::vector<std::string> GetChoices() const;
|
||||
@@ -194,7 +195,7 @@ class VideoSource {
|
||||
* @return Property contents (of kind Property::kNone if no property with
|
||||
* the given name exists)
|
||||
*/
|
||||
VideoProperty GetProperty(const wpi::Twine& name);
|
||||
VideoProperty GetProperty(std::string_view name);
|
||||
|
||||
/**
|
||||
* Enumerate all properties of this source.
|
||||
@@ -276,7 +277,7 @@ class VideoSource {
|
||||
* @param config configuration
|
||||
* @return True if set successfully
|
||||
*/
|
||||
bool SetConfigJson(wpi::StringRef config);
|
||||
bool SetConfigJson(std::string_view config);
|
||||
|
||||
/**
|
||||
* Set video mode and properties from a JSON configuration object.
|
||||
@@ -424,7 +425,7 @@ class UsbCamera : public VideoCamera {
|
||||
* @param name Source name (arbitrary unique identifier)
|
||||
* @param dev Device number (e.g. 0 for /dev/video0)
|
||||
*/
|
||||
UsbCamera(const wpi::Twine& name, int dev);
|
||||
UsbCamera(std::string_view name, int dev);
|
||||
|
||||
/**
|
||||
* Create a source for a USB camera based on device path.
|
||||
@@ -432,7 +433,7 @@ class UsbCamera : public VideoCamera {
|
||||
* @param name Source name (arbitrary unique identifier)
|
||||
* @param path Path to device (e.g. "/dev/video0" on Linux)
|
||||
*/
|
||||
UsbCamera(const wpi::Twine& name, const wpi::Twine& path);
|
||||
UsbCamera(std::string_view name, std::string_view path);
|
||||
|
||||
/**
|
||||
* Enumerate USB cameras on the local system.
|
||||
@@ -444,7 +445,7 @@ class UsbCamera : public VideoCamera {
|
||||
/**
|
||||
* Change the path to the device.
|
||||
*/
|
||||
void SetPath(const wpi::Twine& path);
|
||||
void SetPath(std::string_view path);
|
||||
|
||||
/**
|
||||
* Get the path to the device.
|
||||
@@ -483,7 +484,7 @@ class HttpCamera : public VideoCamera {
|
||||
* @param url Camera URL (e.g. "http://10.x.y.11/video/stream.mjpg")
|
||||
* @param kind Camera kind (e.g. kAxis)
|
||||
*/
|
||||
HttpCamera(const wpi::Twine& name, const wpi::Twine& url,
|
||||
HttpCamera(std::string_view name, std::string_view url,
|
||||
HttpCameraKind kind = kUnknown);
|
||||
|
||||
/**
|
||||
@@ -493,7 +494,7 @@ class HttpCamera : public VideoCamera {
|
||||
* @param url Camera URL (e.g. "http://10.x.y.11/video/stream.mjpg")
|
||||
* @param kind Camera kind (e.g. kAxis)
|
||||
*/
|
||||
HttpCamera(const wpi::Twine& name, const char* url,
|
||||
HttpCamera(std::string_view name, const char* url,
|
||||
HttpCameraKind kind = kUnknown);
|
||||
|
||||
/**
|
||||
@@ -503,7 +504,7 @@ class HttpCamera : public VideoCamera {
|
||||
* @param url Camera URL (e.g. "http://10.x.y.11/video/stream.mjpg")
|
||||
* @param kind Camera kind (e.g. kAxis)
|
||||
*/
|
||||
HttpCamera(const wpi::Twine& name, const std::string& url,
|
||||
HttpCamera(std::string_view name, const std::string& url,
|
||||
HttpCameraKind kind = kUnknown);
|
||||
|
||||
/**
|
||||
@@ -513,7 +514,7 @@ class HttpCamera : public VideoCamera {
|
||||
* @param urls Array of Camera URLs
|
||||
* @param kind Camera kind (e.g. kAxis)
|
||||
*/
|
||||
HttpCamera(const wpi::Twine& name, wpi::ArrayRef<std::string> urls,
|
||||
HttpCamera(std::string_view name, wpi::ArrayRef<std::string> urls,
|
||||
HttpCameraKind kind = kUnknown);
|
||||
|
||||
/**
|
||||
@@ -524,7 +525,7 @@ class HttpCamera : public VideoCamera {
|
||||
* @param kind Camera kind (e.g. kAxis)
|
||||
*/
|
||||
template <typename T>
|
||||
HttpCamera(const wpi::Twine& name, std::initializer_list<T> urls,
|
||||
HttpCamera(std::string_view name, std::initializer_list<T> urls,
|
||||
HttpCameraKind kind = kUnknown);
|
||||
|
||||
/**
|
||||
@@ -556,7 +557,7 @@ class HttpCamera : public VideoCamera {
|
||||
* A source that represents an Axis IP camera.
|
||||
*/
|
||||
class AxisCamera : public HttpCamera {
|
||||
static std::string HostToUrl(const wpi::Twine& host);
|
||||
static std::string HostToUrl(std::string_view host);
|
||||
static std::vector<std::string> HostToUrl(wpi::ArrayRef<std::string> hosts);
|
||||
template <typename T>
|
||||
static std::vector<std::string> HostToUrl(std::initializer_list<T> hosts);
|
||||
@@ -569,7 +570,7 @@ class AxisCamera : public HttpCamera {
|
||||
* @param host Camera host IP or DNS name (e.g. "10.x.y.11")
|
||||
* @param kind Camera kind (e.g. kAxis)
|
||||
*/
|
||||
AxisCamera(const wpi::Twine& name, const wpi::Twine& host);
|
||||
AxisCamera(std::string_view name, std::string_view host);
|
||||
|
||||
/**
|
||||
* Create a source for an Axis IP camera.
|
||||
@@ -578,7 +579,7 @@ class AxisCamera : public HttpCamera {
|
||||
* @param host Camera host IP or DNS name (e.g. "10.x.y.11")
|
||||
* @param kind Camera kind (e.g. kAxis)
|
||||
*/
|
||||
AxisCamera(const wpi::Twine& name, const char* host);
|
||||
AxisCamera(std::string_view name, const char* host);
|
||||
|
||||
/**
|
||||
* Create a source for an Axis IP camera.
|
||||
@@ -587,16 +588,7 @@ class AxisCamera : public HttpCamera {
|
||||
* @param host Camera host IP or DNS name (e.g. "10.x.y.11")
|
||||
* @param kind Camera kind (e.g. kAxis)
|
||||
*/
|
||||
AxisCamera(const wpi::Twine& name, const std::string& host);
|
||||
|
||||
/**
|
||||
* Create a source for an Axis IP camera.
|
||||
*
|
||||
* @param name Source name (arbitrary unique identifier)
|
||||
* @param host Camera host IP or DNS name (e.g. "10.x.y.11")
|
||||
* @param kind Camera kind (e.g. kAxis)
|
||||
*/
|
||||
AxisCamera(const wpi::Twine& name, wpi::StringRef host);
|
||||
AxisCamera(std::string_view name, const std::string& host);
|
||||
|
||||
/**
|
||||
* Create a source for an Axis IP camera.
|
||||
@@ -605,7 +597,7 @@ class AxisCamera : public HttpCamera {
|
||||
* @param hosts Array of Camera host IPs/DNS names
|
||||
* @param kind Camera kind (e.g. kAxis)
|
||||
*/
|
||||
AxisCamera(const wpi::Twine& name, wpi::ArrayRef<std::string> hosts);
|
||||
AxisCamera(std::string_view name, wpi::ArrayRef<std::string> hosts);
|
||||
|
||||
/**
|
||||
* Create a source for an Axis IP camera.
|
||||
@@ -615,7 +607,7 @@ class AxisCamera : public HttpCamera {
|
||||
* @param kind Camera kind (e.g. kAxis)
|
||||
*/
|
||||
template <typename T>
|
||||
AxisCamera(const wpi::Twine& name, std::initializer_list<T> hosts);
|
||||
AxisCamera(std::string_view name, std::initializer_list<T> hosts);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -630,7 +622,7 @@ class ImageSource : public VideoSource {
|
||||
* Signal sinks that an error has occurred. This should be called instead
|
||||
* of NotifyFrame when an error occurs.
|
||||
*/
|
||||
void NotifyError(const wpi::Twine& msg);
|
||||
void NotifyError(std::string_view msg);
|
||||
|
||||
/**
|
||||
* Set source connection status. Defaults to true.
|
||||
@@ -644,7 +636,7 @@ class ImageSource : public VideoSource {
|
||||
*
|
||||
* @param description Description
|
||||
*/
|
||||
void SetDescription(const wpi::Twine& description);
|
||||
void SetDescription(std::string_view description);
|
||||
|
||||
/**
|
||||
* Create a property.
|
||||
@@ -658,7 +650,7 @@ class ImageSource : public VideoSource {
|
||||
* @param value Current value
|
||||
* @return Property
|
||||
*/
|
||||
VideoProperty CreateProperty(const wpi::Twine& name, VideoProperty::Kind kind,
|
||||
VideoProperty CreateProperty(std::string_view name, VideoProperty::Kind kind,
|
||||
int minimum, int maximum, int step,
|
||||
int defaultValue, int value);
|
||||
|
||||
@@ -673,7 +665,7 @@ class ImageSource : public VideoSource {
|
||||
* @param value Current value
|
||||
* @return Property
|
||||
*/
|
||||
VideoProperty CreateIntegerProperty(const wpi::Twine& name, int minimum,
|
||||
VideoProperty CreateIntegerProperty(std::string_view name, int minimum,
|
||||
int maximum, int step, int defaultValue,
|
||||
int value);
|
||||
|
||||
@@ -685,7 +677,7 @@ class ImageSource : public VideoSource {
|
||||
* @param value Current value
|
||||
* @return Property
|
||||
*/
|
||||
VideoProperty CreateBooleanProperty(const wpi::Twine& name, bool defaultValue,
|
||||
VideoProperty CreateBooleanProperty(std::string_view name, bool defaultValue,
|
||||
bool value);
|
||||
|
||||
/**
|
||||
@@ -696,8 +688,8 @@ class ImageSource : public VideoSource {
|
||||
* @param value Current value
|
||||
* @return Property
|
||||
*/
|
||||
VideoProperty CreateStringProperty(const wpi::Twine& name,
|
||||
const wpi::Twine& value);
|
||||
VideoProperty CreateStringProperty(std::string_view name,
|
||||
std::string_view value);
|
||||
|
||||
/**
|
||||
* Configure enum property choices.
|
||||
@@ -772,7 +764,7 @@ class VideoSink {
|
||||
* @return Property (kind Property::kNone if no property with
|
||||
* the given name exists)
|
||||
*/
|
||||
VideoProperty GetProperty(const wpi::Twine& name);
|
||||
VideoProperty GetProperty(std::string_view name);
|
||||
|
||||
/**
|
||||
* Enumerate all properties of this sink.
|
||||
@@ -798,7 +790,7 @@ class VideoSink {
|
||||
* @param config configuration
|
||||
* @return True if set successfully
|
||||
*/
|
||||
bool SetConfigJson(wpi::StringRef config);
|
||||
bool SetConfigJson(std::string_view config);
|
||||
|
||||
/**
|
||||
* Set properties from a JSON configuration object.
|
||||
@@ -845,7 +837,7 @@ class VideoSink {
|
||||
* @return Property (kind Property::kNone if no property with
|
||||
* the given name exists or no source connected)
|
||||
*/
|
||||
VideoProperty GetSourceProperty(const wpi::Twine& name);
|
||||
VideoProperty GetSourceProperty(std::string_view name);
|
||||
|
||||
CS_Status GetLastStatus() const { return m_status; }
|
||||
|
||||
@@ -883,8 +875,7 @@ class MjpegServer : public VideoSink {
|
||||
* @param listenAddress TCP listen address (empty string for all addresses)
|
||||
* @param port TCP port number
|
||||
*/
|
||||
MjpegServer(const wpi::Twine& name, const wpi::Twine& listenAddress,
|
||||
int port);
|
||||
MjpegServer(std::string_view name, std::string_view listenAddress, int port);
|
||||
|
||||
/**
|
||||
* Create a MJPEG-over-HTTP server sink.
|
||||
@@ -892,7 +883,7 @@ class MjpegServer : public VideoSink {
|
||||
* @param name Sink name (arbitrary unique identifier)
|
||||
* @param port TCP port number
|
||||
*/
|
||||
MjpegServer(const wpi::Twine& name, int port) : MjpegServer(name, "", port) {}
|
||||
MjpegServer(std::string_view name, int port) : MjpegServer(name, "", port) {}
|
||||
|
||||
/**
|
||||
* Get the listen address of the server.
|
||||
@@ -963,7 +954,7 @@ class ImageSink : public VideoSink {
|
||||
*
|
||||
* @param description Description
|
||||
*/
|
||||
void SetDescription(const wpi::Twine& description);
|
||||
void SetDescription(std::string_view description);
|
||||
|
||||
/**
|
||||
* Get error string. Call this if WaitForFrame() returns 0 to determine
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#define CSCORE_CSCORE_OO_INC_
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -53,13 +54,13 @@ inline std::string VideoProperty::GetString() const {
|
||||
return GetStringProperty(m_handle, &m_status);
|
||||
}
|
||||
|
||||
inline wpi::StringRef VideoProperty::GetString(
|
||||
inline std::string_view VideoProperty::GetString(
|
||||
wpi::SmallVectorImpl<char>& buf) const {
|
||||
m_status = 0;
|
||||
return GetStringProperty(m_handle, buf, &m_status);
|
||||
}
|
||||
|
||||
inline void VideoProperty::SetString(const wpi::Twine& value) {
|
||||
inline void VideoProperty::SetString(std::string_view value) {
|
||||
m_status = 0;
|
||||
SetStringProperty(m_handle, value, &m_status);
|
||||
}
|
||||
@@ -139,7 +140,7 @@ inline bool VideoSource::IsEnabled() const {
|
||||
return IsSourceEnabled(m_handle, &m_status);
|
||||
}
|
||||
|
||||
inline VideoProperty VideoSource::GetProperty(const wpi::Twine& name) {
|
||||
inline VideoProperty VideoSource::GetProperty(std::string_view name) {
|
||||
m_status = 0;
|
||||
return VideoProperty{GetSourceProperty(m_handle, name, &m_status)};
|
||||
}
|
||||
@@ -176,7 +177,7 @@ inline bool VideoSource::SetFPS(int fps) {
|
||||
return SetSourceFPS(m_handle, fps, &m_status);
|
||||
}
|
||||
|
||||
inline bool VideoSource::SetConfigJson(wpi::StringRef config) {
|
||||
inline bool VideoSource::SetConfigJson(std::string_view config) {
|
||||
m_status = 0;
|
||||
return SetSourceConfigJson(m_handle, config, &m_status);
|
||||
}
|
||||
@@ -248,11 +249,11 @@ inline void VideoCamera::SetExposureManual(int value) {
|
||||
SetCameraExposureManual(m_handle, value, &m_status);
|
||||
}
|
||||
|
||||
inline UsbCamera::UsbCamera(const wpi::Twine& name, int dev) {
|
||||
inline UsbCamera::UsbCamera(std::string_view name, int dev) {
|
||||
m_handle = CreateUsbCameraDev(name, dev, &m_status);
|
||||
}
|
||||
|
||||
inline UsbCamera::UsbCamera(const wpi::Twine& name, const wpi::Twine& path) {
|
||||
inline UsbCamera::UsbCamera(std::string_view name, std::string_view path) {
|
||||
m_handle = CreateUsbCameraPath(name, path, &m_status);
|
||||
}
|
||||
|
||||
@@ -261,7 +262,7 @@ inline std::vector<UsbCameraInfo> UsbCamera::EnumerateUsbCameras() {
|
||||
return ::cs::EnumerateUsbCameras(&status);
|
||||
}
|
||||
|
||||
inline void UsbCamera::SetPath(const wpi::Twine& path) {
|
||||
inline void UsbCamera::SetPath(std::string_view path) {
|
||||
m_status = 0;
|
||||
return ::cs::SetUsbCameraPath(m_handle, path, &m_status);
|
||||
}
|
||||
@@ -282,25 +283,25 @@ inline void UsbCamera::SetConnectVerbose(int level) {
|
||||
&m_status);
|
||||
}
|
||||
|
||||
inline HttpCamera::HttpCamera(const wpi::Twine& name, const wpi::Twine& url,
|
||||
inline HttpCamera::HttpCamera(std::string_view name, std::string_view url,
|
||||
HttpCameraKind kind) {
|
||||
m_handle = CreateHttpCamera(
|
||||
name, url, static_cast<CS_HttpCameraKind>(static_cast<int>(kind)),
|
||||
&m_status);
|
||||
}
|
||||
|
||||
inline HttpCamera::HttpCamera(const wpi::Twine& name, const char* url,
|
||||
inline HttpCamera::HttpCamera(std::string_view name, const char* url,
|
||||
HttpCameraKind kind) {
|
||||
m_handle = CreateHttpCamera(
|
||||
name, url, static_cast<CS_HttpCameraKind>(static_cast<int>(kind)),
|
||||
&m_status);
|
||||
}
|
||||
|
||||
inline HttpCamera::HttpCamera(const wpi::Twine& name, const std::string& url,
|
||||
inline HttpCamera::HttpCamera(std::string_view name, const std::string& url,
|
||||
HttpCameraKind kind)
|
||||
: HttpCamera(name, wpi::Twine{url}, kind) {}
|
||||
: HttpCamera(name, std::string_view{url}, kind) {}
|
||||
|
||||
inline HttpCamera::HttpCamera(const wpi::Twine& name,
|
||||
inline HttpCamera::HttpCamera(std::string_view name,
|
||||
wpi::ArrayRef<std::string> urls,
|
||||
HttpCameraKind kind) {
|
||||
m_handle = CreateHttpCamera(
|
||||
@@ -309,7 +310,7 @@ inline HttpCamera::HttpCamera(const wpi::Twine& name,
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline HttpCamera::HttpCamera(const wpi::Twine& name,
|
||||
inline HttpCamera::HttpCamera(std::string_view name,
|
||||
std::initializer_list<T> urls,
|
||||
HttpCameraKind kind) {
|
||||
std::vector<std::string> vec;
|
||||
@@ -349,16 +350,12 @@ inline std::vector<std::string> HttpCamera::GetUrls() const {
|
||||
return ::cs::GetHttpCameraUrls(m_handle, &m_status);
|
||||
}
|
||||
|
||||
inline std::string AxisCamera::HostToUrl(const wpi::Twine& host) {
|
||||
return ("http://" + host + "/mjpg/video.mjpg").str();
|
||||
}
|
||||
|
||||
inline std::vector<std::string> AxisCamera::HostToUrl(
|
||||
wpi::ArrayRef<std::string> hosts) {
|
||||
std::vector<std::string> rv;
|
||||
rv.reserve(hosts.size());
|
||||
for (const auto& host : hosts) {
|
||||
rv.emplace_back(HostToUrl(wpi::StringRef{host}));
|
||||
rv.emplace_back(HostToUrl(std::string_view{host}));
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@@ -369,33 +366,30 @@ inline std::vector<std::string> AxisCamera::HostToUrl(
|
||||
std::vector<std::string> rv;
|
||||
rv.reserve(hosts.size());
|
||||
for (const auto& host : hosts) {
|
||||
rv.emplace_back(HostToUrl(wpi::StringRef{host}));
|
||||
rv.emplace_back(HostToUrl(std::string_view{host}));
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
inline AxisCamera::AxisCamera(const wpi::Twine& name, const wpi::Twine& host)
|
||||
inline AxisCamera::AxisCamera(std::string_view name, std::string_view host)
|
||||
: HttpCamera(name, HostToUrl(host), kAxis) {}
|
||||
|
||||
inline AxisCamera::AxisCamera(const wpi::Twine& name, const char* host)
|
||||
inline AxisCamera::AxisCamera(std::string_view name, const char* host)
|
||||
: HttpCamera(name, HostToUrl(host), kAxis) {}
|
||||
|
||||
inline AxisCamera::AxisCamera(const wpi::Twine& name, const std::string& host)
|
||||
: HttpCamera(name, HostToUrl(wpi::Twine{host}), kAxis) {}
|
||||
inline AxisCamera::AxisCamera(std::string_view name, const std::string& host)
|
||||
: HttpCamera(name, HostToUrl(std::string_view{host}), kAxis) {}
|
||||
|
||||
inline AxisCamera::AxisCamera(const wpi::Twine& name, wpi::StringRef host)
|
||||
: HttpCamera(name, HostToUrl(host), kAxis) {}
|
||||
|
||||
inline AxisCamera::AxisCamera(const wpi::Twine& name,
|
||||
inline AxisCamera::AxisCamera(std::string_view name,
|
||||
wpi::ArrayRef<std::string> hosts)
|
||||
: HttpCamera(name, HostToUrl(hosts), kAxis) {}
|
||||
|
||||
template <typename T>
|
||||
inline AxisCamera::AxisCamera(const wpi::Twine& name,
|
||||
inline AxisCamera::AxisCamera(std::string_view name,
|
||||
std::initializer_list<T> hosts)
|
||||
: HttpCamera(name, HostToUrl(hosts), kAxis) {}
|
||||
|
||||
inline void ImageSource::NotifyError(const wpi::Twine& msg) {
|
||||
inline void ImageSource::NotifyError(std::string_view msg) {
|
||||
m_status = 0;
|
||||
NotifySourceError(m_handle, msg, &m_status);
|
||||
}
|
||||
@@ -405,12 +399,12 @@ inline void ImageSource::SetConnected(bool connected) {
|
||||
SetSourceConnected(m_handle, connected, &m_status);
|
||||
}
|
||||
|
||||
inline void ImageSource::SetDescription(const wpi::Twine& description) {
|
||||
inline void ImageSource::SetDescription(std::string_view description) {
|
||||
m_status = 0;
|
||||
SetSourceDescription(m_handle, description, &m_status);
|
||||
}
|
||||
|
||||
inline VideoProperty ImageSource::CreateProperty(const wpi::Twine& name,
|
||||
inline VideoProperty ImageSource::CreateProperty(std::string_view name,
|
||||
VideoProperty::Kind kind,
|
||||
int minimum, int maximum,
|
||||
int step, int defaultValue,
|
||||
@@ -421,7 +415,7 @@ inline VideoProperty ImageSource::CreateProperty(const wpi::Twine& name,
|
||||
minimum, maximum, step, defaultValue, value, &m_status)};
|
||||
}
|
||||
|
||||
inline VideoProperty ImageSource::CreateIntegerProperty(const wpi::Twine& name,
|
||||
inline VideoProperty ImageSource::CreateIntegerProperty(std::string_view name,
|
||||
int minimum,
|
||||
int maximum, int step,
|
||||
int defaultValue,
|
||||
@@ -434,7 +428,7 @@ inline VideoProperty ImageSource::CreateIntegerProperty(const wpi::Twine& name,
|
||||
minimum, maximum, step, defaultValue, value, &m_status)};
|
||||
}
|
||||
|
||||
inline VideoProperty ImageSource::CreateBooleanProperty(const wpi::Twine& name,
|
||||
inline VideoProperty ImageSource::CreateBooleanProperty(std::string_view name,
|
||||
bool defaultValue,
|
||||
bool value) {
|
||||
m_status = 0;
|
||||
@@ -445,8 +439,8 @@ inline VideoProperty ImageSource::CreateBooleanProperty(const wpi::Twine& name,
|
||||
0, 1, 1, defaultValue ? 1 : 0, value ? 1 : 0, &m_status)};
|
||||
}
|
||||
|
||||
inline VideoProperty ImageSource::CreateStringProperty(
|
||||
const wpi::Twine& name, const wpi::Twine& value) {
|
||||
inline VideoProperty ImageSource::CreateStringProperty(std::string_view name,
|
||||
std::string_view value) {
|
||||
m_status = 0;
|
||||
auto prop = VideoProperty{
|
||||
CreateSourceProperty(m_handle, name,
|
||||
@@ -509,7 +503,7 @@ inline std::string VideoSink::GetDescription() const {
|
||||
return GetSinkDescription(m_handle, &m_status);
|
||||
}
|
||||
|
||||
inline VideoProperty VideoSink::GetProperty(const wpi::Twine& name) {
|
||||
inline VideoProperty VideoSink::GetProperty(std::string_view name) {
|
||||
m_status = 0;
|
||||
return VideoProperty{GetSinkProperty(m_handle, name, &m_status)};
|
||||
}
|
||||
@@ -529,12 +523,12 @@ inline VideoSource VideoSink::GetSource() const {
|
||||
return VideoSource{handle == 0 ? 0 : CopySource(handle, &m_status)};
|
||||
}
|
||||
|
||||
inline VideoProperty VideoSink::GetSourceProperty(const wpi::Twine& name) {
|
||||
inline VideoProperty VideoSink::GetSourceProperty(std::string_view name) {
|
||||
m_status = 0;
|
||||
return VideoProperty{GetSinkSourceProperty(m_handle, name, &m_status)};
|
||||
}
|
||||
|
||||
inline bool VideoSink::SetConfigJson(wpi::StringRef config) {
|
||||
inline bool VideoSink::SetConfigJson(std::string_view config) {
|
||||
m_status = 0;
|
||||
return SetSinkConfigJson(m_handle, config, &m_status);
|
||||
}
|
||||
@@ -549,8 +543,8 @@ inline std::string VideoSink::GetConfigJson() const {
|
||||
return GetSinkConfigJson(m_handle, &m_status);
|
||||
}
|
||||
|
||||
inline MjpegServer::MjpegServer(const wpi::Twine& name,
|
||||
const wpi::Twine& listenAddress, int port) {
|
||||
inline MjpegServer::MjpegServer(std::string_view name,
|
||||
std::string_view listenAddress, int port) {
|
||||
m_handle = CreateMjpegServer(name, listenAddress, port, &m_status);
|
||||
}
|
||||
|
||||
@@ -588,7 +582,7 @@ inline void MjpegServer::SetDefaultCompression(int quality) {
|
||||
quality, &m_status);
|
||||
}
|
||||
|
||||
inline void ImageSink::SetDescription(const wpi::Twine& description) {
|
||||
inline void ImageSink::SetDescription(std::string_view description) {
|
||||
m_status = 0;
|
||||
SetSinkDescription(m_handle, description, &m_status);
|
||||
}
|
||||
|
||||
@@ -78,11 +78,11 @@ struct RawFrame : public CS_RawFrame {
|
||||
* @{
|
||||
*/
|
||||
|
||||
CS_Source CreateRawSource(const wpi::Twine& name, const VideoMode& mode,
|
||||
CS_Source CreateRawSource(std::string_view name, const VideoMode& mode,
|
||||
CS_Status* status);
|
||||
|
||||
CS_Sink CreateRawSink(const wpi::Twine& name, CS_Status* status);
|
||||
CS_Sink CreateRawSinkCallback(const wpi::Twine& name,
|
||||
CS_Sink CreateRawSink(std::string_view name, CS_Status* status);
|
||||
CS_Sink CreateRawSinkCallback(std::string_view name,
|
||||
std::function<void(uint64_t time)> processFrame,
|
||||
CS_Status* status);
|
||||
|
||||
@@ -107,7 +107,7 @@ class RawSource : public ImageSource {
|
||||
* @param name Source name (arbitrary unique identifier)
|
||||
* @param mode Video mode being generated
|
||||
*/
|
||||
RawSource(const wpi::Twine& name, const VideoMode& mode);
|
||||
RawSource(std::string_view name, const VideoMode& mode);
|
||||
|
||||
/**
|
||||
* Create a raw frame source.
|
||||
@@ -118,7 +118,7 @@ class RawSource : public ImageSource {
|
||||
* @param height height
|
||||
* @param fps fps
|
||||
*/
|
||||
RawSource(const wpi::Twine& name, VideoMode::PixelFormat pixelFormat,
|
||||
RawSource(std::string_view name, VideoMode::PixelFormat pixelFormat,
|
||||
int width, int height, int fps);
|
||||
|
||||
protected:
|
||||
@@ -147,7 +147,7 @@ class RawSink : public ImageSink {
|
||||
*
|
||||
* @param name Source name (arbitrary unique identifier)
|
||||
*/
|
||||
explicit RawSink(const wpi::Twine& name);
|
||||
explicit RawSink(std::string_view name);
|
||||
|
||||
/**
|
||||
* Create a sink for accepting raws images in a separate thread.
|
||||
@@ -161,7 +161,7 @@ class RawSink : public ImageSink {
|
||||
* or GetError() as needed, but should not call (except in very
|
||||
* unusual circumstances) WaitForImage().
|
||||
*/
|
||||
RawSink(const wpi::Twine& name,
|
||||
RawSink(std::string_view name,
|
||||
std::function<void(uint64_t time)> processFrame);
|
||||
|
||||
protected:
|
||||
@@ -187,11 +187,11 @@ class RawSink : public ImageSink {
|
||||
uint64_t GrabFrameNoTimeout(RawFrame& image) const;
|
||||
};
|
||||
|
||||
inline RawSource::RawSource(const wpi::Twine& name, const VideoMode& mode) {
|
||||
inline RawSource::RawSource(std::string_view name, const VideoMode& mode) {
|
||||
m_handle = CreateRawSource(name, mode, &m_status);
|
||||
}
|
||||
|
||||
inline RawSource::RawSource(const wpi::Twine& name,
|
||||
inline RawSource::RawSource(std::string_view name,
|
||||
VideoMode::PixelFormat format, int width,
|
||||
int height, int fps) {
|
||||
m_handle =
|
||||
@@ -203,11 +203,11 @@ inline void RawSource::PutFrame(RawFrame& image) {
|
||||
PutSourceFrame(m_handle, image, &m_status);
|
||||
}
|
||||
|
||||
inline RawSink::RawSink(const wpi::Twine& name) {
|
||||
inline RawSink::RawSink(std::string_view name) {
|
||||
m_handle = CreateRawSink(name, &m_status);
|
||||
}
|
||||
|
||||
inline RawSink::RawSink(const wpi::Twine& name,
|
||||
inline RawSink::RawSink(std::string_view name,
|
||||
std::function<void(uint64_t time)> processFrame) {
|
||||
m_handle = CreateRawSinkCallback(name, processFrame, &m_status);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class RawCvSource : public RawSource {
|
||||
* @param name Source name (arbitrary unique identifier)
|
||||
* @param mode Video mode being generated
|
||||
*/
|
||||
RawCvSource(const wpi::Twine& name, const VideoMode& mode);
|
||||
RawCvSource(std::string_view name, const VideoMode& mode);
|
||||
|
||||
/**
|
||||
* Create a Raw OpenCV source.
|
||||
@@ -43,7 +43,7 @@ class RawCvSource : public RawSource {
|
||||
* @param height height
|
||||
* @param fps fps
|
||||
*/
|
||||
RawCvSource(const wpi::Twine& name, VideoMode::PixelFormat pixelFormat,
|
||||
RawCvSource(std::string_view name, VideoMode::PixelFormat pixelFormat,
|
||||
int width, int height, int fps);
|
||||
|
||||
/**
|
||||
@@ -83,7 +83,7 @@ class RawCvSink : public RawSink {
|
||||
*
|
||||
* @param name Source name (arbitrary unique identifier)
|
||||
*/
|
||||
explicit RawCvSink(const wpi::Twine& name);
|
||||
explicit RawCvSink(std::string_view name);
|
||||
|
||||
/**
|
||||
* Create a sink for accepting OpenCV images in a separate thread.
|
||||
@@ -97,7 +97,7 @@ class RawCvSink : public RawSink {
|
||||
* or GetError() as needed, but should not call (except in very
|
||||
* unusual circumstances) WaitForImage().
|
||||
*/
|
||||
RawCvSink(const wpi::Twine& name,
|
||||
RawCvSink(std::string_view name,
|
||||
std::function<void(uint64_t time)> processFrame);
|
||||
|
||||
/**
|
||||
@@ -146,10 +146,10 @@ class RawCvSink : public RawSink {
|
||||
RawFrame rawFrame;
|
||||
};
|
||||
|
||||
inline RawCvSource::RawCvSource(const wpi::Twine& name, const VideoMode& mode)
|
||||
inline RawCvSource::RawCvSource(std::string_view name, const VideoMode& mode)
|
||||
: RawSource{name, mode} {}
|
||||
|
||||
inline RawCvSource::RawCvSource(const wpi::Twine& name,
|
||||
inline RawCvSource::RawCvSource(std::string_view name,
|
||||
VideoMode::PixelFormat format, int width,
|
||||
int height, int fps)
|
||||
: RawSource{name, format, width, height, fps} {}
|
||||
@@ -164,9 +164,9 @@ inline void RawCvSource::PutFrame(cv::Mat& image) {
|
||||
PutSourceFrame(m_handle, rawFrame, &m_status);
|
||||
}
|
||||
|
||||
inline RawCvSink::RawCvSink(const wpi::Twine& name) : RawSink{name} {}
|
||||
inline RawCvSink::RawCvSink(std::string_view name) : RawSink{name} {}
|
||||
|
||||
inline RawCvSink::RawCvSink(const wpi::Twine& name,
|
||||
inline RawCvSink::RawCvSink(std::string_view name,
|
||||
std::function<void(uint64_t time)> processFrame)
|
||||
: RawSink{name, processFrame} {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user