mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
USBCamera, HTTPCamera: Name functions consistent with classes.
This commit is contained in:
@@ -104,10 +104,10 @@ char** CS_GetEnumPropertyChoices(CS_Property property, int* count,
|
||||
//
|
||||
// Source Creation Functions
|
||||
//
|
||||
CS_Source CS_CreateUSBSourceDev(const char* name, int dev, CS_Status* status);
|
||||
CS_Source CS_CreateUSBSourcePath(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_CreateHTTPSource(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);
|
||||
|
||||
@@ -92,10 +92,10 @@ std::vector<std::string> GetEnumPropertyChoices(CS_Property property,
|
||||
//
|
||||
// Source Creation Functions
|
||||
//
|
||||
CS_Source CreateUSBSourceDev(llvm::StringRef name, int dev, CS_Status* status);
|
||||
CS_Source CreateUSBSourcePath(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 CreateHTTPSource(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);
|
||||
|
||||
@@ -156,11 +156,11 @@ inline std::vector<VideoMode> VideoSource::EnumerateVideoModes() const {
|
||||
}
|
||||
|
||||
inline USBCamera::USBCamera(llvm::StringRef name, int dev) {
|
||||
m_handle = CreateUSBSourceDev(name, dev, &m_status);
|
||||
m_handle = CreateUSBCameraDev(name, dev, &m_status);
|
||||
}
|
||||
|
||||
inline USBCamera::USBCamera(llvm::StringRef name, llvm::StringRef path) {
|
||||
m_handle = CreateUSBSourcePath(name, path, &m_status);
|
||||
m_handle = CreateUSBCameraPath(name, path, &m_status);
|
||||
}
|
||||
|
||||
inline std::vector<USBCameraInfo> USBCamera::EnumerateUSBCameras() {
|
||||
@@ -169,7 +169,7 @@ inline std::vector<USBCameraInfo> USBCamera::EnumerateUSBCameras() {
|
||||
}
|
||||
|
||||
inline HTTPCamera::HTTPCamera(llvm::StringRef name, llvm::StringRef url) {
|
||||
m_handle = CreateHTTPSource(name, url, &m_status);
|
||||
m_handle = CreateHTTPCamera(name, url, &m_status);
|
||||
}
|
||||
|
||||
inline CvSource::CvSource(llvm::StringRef name, const VideoMode& mode) {
|
||||
|
||||
@@ -248,28 +248,28 @@ JNIEXPORT jobjectArray JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getEnum
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: createUSBSourceDev
|
||||
* Method: createUSBCameraDev
|
||||
* Signature: (Ljava/lang/String;I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_createUSBSourceDev
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_createUSBCameraDev
|
||||
(JNIEnv *env, jclass, jstring name, jint dev)
|
||||
{
|
||||
CS_Status status;
|
||||
auto val = cs::CreateUSBSourceDev(JStringRef{env, name}, dev, &status);
|
||||
auto val = cs::CreateUSBCameraDev(JStringRef{env, name}, dev, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: createUSBSourcePath
|
||||
* Method: createUSBCameraPath
|
||||
* Signature: (Ljava/lang/String;Ljava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_createUSBSourcePath
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_createUSBCameraPath
|
||||
(JNIEnv *env, jclass, jstring name, jstring path)
|
||||
{
|
||||
CS_Status status;
|
||||
auto val = cs::CreateUSBSourcePath(JStringRef{env, name},
|
||||
auto val = cs::CreateUSBCameraPath(JStringRef{env, name},
|
||||
JStringRef{env, path}, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
@@ -277,14 +277,14 @@ JNIEXPORT jint JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_createUSBSource
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: createHTTPSource
|
||||
* Method: createHTTPCamera
|
||||
* Signature: (Ljava/lang/String;Ljava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_createHTTPSource
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_createHTTPCamera
|
||||
(JNIEnv *env, jclass, jstring name, jstring url)
|
||||
{
|
||||
CS_Status status;
|
||||
auto val = cs::CreateHTTPSource(JStringRef{env, name},
|
||||
auto val = cs::CreateHTTPCamera(JStringRef{env, name},
|
||||
JStringRef{env, url}, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
|
||||
@@ -90,9 +90,9 @@ public class CameraServerJNI {
|
||||
//
|
||||
// Source Creation Functions
|
||||
//
|
||||
public static native int createUSBSourceDev(String name, int dev);
|
||||
public static native int createUSBSourcePath(String name, String path);
|
||||
public static native int createHTTPSource(String name, String url);
|
||||
public static native int createUSBCameraDev(String name, int dev);
|
||||
public static native int createUSBCameraPath(String name, String path);
|
||||
public static native int createHTTPCamera(String name, String url);
|
||||
public static native int createCvSource(String name, int pixelFormat, int width, int height, int fps);
|
||||
|
||||
//
|
||||
|
||||
@@ -13,6 +13,6 @@ public class HTTPCamera extends VideoSource {
|
||||
/// @param name Source name (arbitrary unique identifier)
|
||||
/// @param url Camera URL (e.g. "http://10.x.y.11/video/stream.mjpg")
|
||||
public HTTPCamera(String name, String url) {
|
||||
super(CameraServerJNI.createHTTPSource(name, url));
|
||||
super(CameraServerJNI.createHTTPCamera(name, url));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,14 +13,14 @@ public class USBCamera extends VideoSource {
|
||||
/// @param name Source name (arbitrary unique identifier)
|
||||
/// @param dev Device number (e.g. 0 for /dev/video0)
|
||||
public USBCamera(String name, int dev) {
|
||||
super(CameraServerJNI.createUSBSourceDev(name, dev));
|
||||
super(CameraServerJNI.createUSBCameraDev(name, 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)
|
||||
public USBCamera(String name, String path) {
|
||||
super(CameraServerJNI.createUSBSourcePath(name, path));
|
||||
super(CameraServerJNI.createUSBCameraPath(name, path));
|
||||
}
|
||||
|
||||
/// Enumerate USB cameras on the local system.
|
||||
|
||||
@@ -1517,14 +1517,14 @@ void USBCameraImpl::NumSinksEnabledChanged() {
|
||||
|
||||
namespace cs {
|
||||
|
||||
CS_Source CreateUSBSourceDev(llvm::StringRef name, int dev, CS_Status* status) {
|
||||
CS_Source CreateUSBCameraDev(llvm::StringRef name, int dev, CS_Status* status) {
|
||||
llvm::SmallString<32> path;
|
||||
llvm::raw_svector_ostream oss{path};
|
||||
oss << "/dev/video" << dev;
|
||||
return CreateUSBSourcePath(name, oss.str(), status);
|
||||
return CreateUSBCameraPath(name, oss.str(), status);
|
||||
}
|
||||
|
||||
CS_Source CreateUSBSourcePath(llvm::StringRef name, llvm::StringRef path,
|
||||
CS_Source CreateUSBCameraPath(llvm::StringRef name, llvm::StringRef path,
|
||||
CS_Status* status) {
|
||||
auto source = std::make_shared<USBCameraImpl>(name, path);
|
||||
return Sources::GetInstance().Allocate(SourceData::kUSB, source);
|
||||
@@ -1570,13 +1570,13 @@ std::vector<USBCameraInfo> EnumerateUSBCameras(CS_Status* status) {
|
||||
|
||||
extern "C" {
|
||||
|
||||
CS_Source CS_CreateUSBSourceDev(const char* name, int dev, CS_Status* status) {
|
||||
return cs::CreateUSBSourceDev(name, dev, status);
|
||||
CS_Source CS_CreateUSBCameraDev(const char* name, int dev, CS_Status* status) {
|
||||
return cs::CreateUSBCameraDev(name, dev, status);
|
||||
}
|
||||
|
||||
CS_Source CS_CreateUSBSourcePath(const char* name, const char* path,
|
||||
CS_Source CS_CreateUSBCameraPath(const char* name, const char* path,
|
||||
CS_Status* status) {
|
||||
return cs::CreateUSBSourcePath(name, path, status);
|
||||
return cs::CreateUSBCameraPath(name, path, status);
|
||||
}
|
||||
|
||||
CS_USBCameraInfo* CS_EnumerateUSBCameras(int* count, CS_Status* status) {
|
||||
|
||||
@@ -74,9 +74,9 @@ char** CS_GetEnumPropertyChoices(CS_Property property, int* count,
|
||||
return out;
|
||||
}
|
||||
|
||||
CS_Source CS_CreateHTTPSource(const char* name, const char* url,
|
||||
CS_Source CS_CreateHTTPCamera(const char* name, const char* url,
|
||||
CS_Status* status) {
|
||||
return cs::CreateHTTPSource(name, url, status);
|
||||
return cs::CreateHTTPCamera(name, url, status);
|
||||
}
|
||||
|
||||
CS_Source CS_CreateCvSource(const char* name, const CS_VideoMode* mode,
|
||||
|
||||
@@ -142,7 +142,7 @@ std::vector<std::string> GetEnumPropertyChoices(CS_Property property,
|
||||
// Source Creation Functions
|
||||
//
|
||||
|
||||
CS_Source CreateHTTPSource(llvm::StringRef name, llvm::StringRef url,
|
||||
CS_Source CreateHTTPCamera(llvm::StringRef name, llvm::StringRef url,
|
||||
CS_Status* status) {
|
||||
return 0; // TODO
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user