diff --git a/cscore/src/main/java/org/wpilib/vision/camera/AxisCamera.java b/cscore/src/main/java/org/wpilib/vision/camera/AxisCamera.java deleted file mode 100644 index 5190ef4449..0000000000 --- a/cscore/src/main/java/org/wpilib/vision/camera/AxisCamera.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -package org.wpilib.vision.camera; - -/** - * A source that represents an Axis IP camera. - * - * @deprecated Use HttpCamera instead. - */ -@Deprecated(forRemoval = true, since = "2025") -public class AxisCamera extends HttpCamera { - private static String hostToUrl(String host) { - return "http://" + host + "/mjpg/video.mjpg"; - } - - private static String[] hostToUrl(String[] hosts) { - String[] urls = new String[hosts.length]; - for (int i = 0; i < hosts.length; i++) { - urls[i] = hostToUrl(hosts[i]); - } - return urls; - } - - /** - * 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") - */ - public AxisCamera(String name, String host) { - super(name, hostToUrl(host), HttpCameraKind.kAxis); - } - - /** - * Create a source for an Axis IP camera. - * - * @param name Source name (arbitrary unique identifier) - * @param hosts Array of Camera host IPs/DNS names - */ - public AxisCamera(String name, String[] hosts) { - super(name, hostToUrl(hosts), HttpCameraKind.kAxis); - } -} diff --git a/cscore/src/main/java/org/wpilib/vision/camera/HttpCamera.java b/cscore/src/main/java/org/wpilib/vision/camera/HttpCamera.java index 84dce0c8b8..794ab6ec14 100644 --- a/cscore/src/main/java/org/wpilib/vision/camera/HttpCamera.java +++ b/cscore/src/main/java/org/wpilib/vision/camera/HttpCamera.java @@ -13,9 +13,7 @@ public class HttpCamera extends VideoCamera { /** MJPG Streamer camera. */ kMJPGStreamer(1), /** CS Core camera. */ - kCSCore(2), - /** Axis camera. */ - kAxis(3); + kCSCore(2); private final int value; @@ -43,7 +41,6 @@ public class HttpCamera extends VideoCamera { return switch (kind) { case 1 -> HttpCameraKind.kMJPGStreamer; case 2 -> HttpCameraKind.kCSCore; - case 3 -> HttpCameraKind.kAxis; default -> HttpCameraKind.kUnknown; }; } @@ -63,7 +60,7 @@ public class HttpCamera extends VideoCamera { * * @param name Source name (arbitrary unique identifier) * @param url Camera URL (e.g. "http://10.x.y.11/video/stream.mjpg") - * @param kind Camera kind (e.g. kAxis) + * @param kind Camera kind (e.g. kCSCore) */ public HttpCamera(String name, String url, HttpCameraKind kind) { super(CameraServerJNI.createHttpCamera(name, url, kind.getValue())); @@ -84,7 +81,7 @@ public class HttpCamera extends VideoCamera { * * @param name Source name (arbitrary unique identifier) * @param urls Array of Camera URLs - * @param kind Camera kind (e.g. kAxis) + * @param kind Camera kind (e.g. kCSCore) */ public HttpCamera(String name, String[] urls, HttpCameraKind kind) { super(CameraServerJNI.createHttpCameraMulti(name, urls, kind.getValue())); diff --git a/cscore/src/main/native/cpp/HttpCameraImpl.cpp b/cscore/src/main/native/cpp/HttpCameraImpl.cpp index 75f1ece679..4b46a3a765 100644 --- a/cscore/src/main/native/cpp/HttpCameraImpl.cpp +++ b/cscore/src/main/native/cpp/HttpCameraImpl.cpp @@ -550,50 +550,13 @@ void HttpCameraImpl::NumSinksEnabledChanged() { m_sinkEnabledCond.notify_one(); } -bool AxisCameraImpl::CacheProperties(CS_Status* status) const { - CreateProperty("brightness", "ImageSource.I0.Sensor.Brightness", true, - CS_PROP_INTEGER, 0, 100, 1, 50, 50); - CreateEnumProperty("white_balance", "ImageSource.I0.Sensor.WhiteBalance", - true, 0, 0, - {"auto", "hold", "fixed_outdoor1", "fixed_outdoor2", - "fixed_indoor", "fixed_fluor1", "fixed_fluor2"}); - CreateProperty("color_level", "ImageSource.I0.Sensor.ColorLevel", true, - CS_PROP_INTEGER, 0, 100, 1, 50, 50); - CreateEnumProperty("exposure", "ImageSource.I0.Sensor.Exposure", true, 0, 0, - {"auto", "hold", "flickerfree50", "flickerfree60"}); - CreateProperty("exposure_priority", "ImageSource.I0.Sensor.ExposurePriority", - true, CS_PROP_INTEGER, 0, 100, 1, 50, 50); - - // TODO: get video modes from device - std::scoped_lock lock(m_mutex); - m_videoModes.clear(); - m_videoModes.emplace_back(VideoMode::kMJPEG, 640, 480, 30); - m_videoModes.emplace_back(VideoMode::kMJPEG, 480, 360, 30); - m_videoModes.emplace_back(VideoMode::kMJPEG, 320, 240, 30); - m_videoModes.emplace_back(VideoMode::kMJPEG, 240, 180, 30); - m_videoModes.emplace_back(VideoMode::kMJPEG, 176, 144, 30); - m_videoModes.emplace_back(VideoMode::kMJPEG, 160, 120, 30); - - m_properties_cached = true; - return true; -} - namespace wpi::cs { CS_Source CreateHttpCamera(std::string_view name, std::string_view url, CS_HttpCameraKind kind, CS_Status* status) { auto& inst = Instance::GetInstance(); - std::shared_ptr source; - switch (kind) { - case CS_HTTP_AXIS: - source = std::make_shared(name, inst.logger, - inst.notifier, inst.telemetry); - break; - default: - source = std::make_shared(name, kind, inst.logger, - inst.notifier, inst.telemetry); - break; - } + auto source = std::make_shared(name, kind, inst.logger, + inst.notifier, inst.telemetry); std::string urlStr{url}; if (!source->SetUrls(std::span{&urlStr, 1}, status)) { return 0; diff --git a/cscore/src/main/native/cpp/HttpCameraImpl.hpp b/cscore/src/main/native/cpp/HttpCameraImpl.hpp index c2b595362b..d55a8ee8f7 100644 --- a/cscore/src/main/native/cpp/HttpCameraImpl.hpp +++ b/cscore/src/main/native/cpp/HttpCameraImpl.hpp @@ -143,18 +143,4 @@ class HttpCameraImpl : public SourceImpl { wpi::util::condition_variable m_monitorCond; }; -class AxisCameraImpl : public HttpCameraImpl { - public: - AxisCameraImpl(std::string_view name, wpi::util::Logger& logger, - Notifier& notifier, Telemetry& telemetry) - : HttpCameraImpl{name, CS_HTTP_AXIS, logger, notifier, telemetry} {} -#if 0 - void SetProperty(int property, int value, CS_Status* status) override; - void SetStringProperty(int property, std::string_view value, - CS_Status* status) override; -#endif - protected: - bool CacheProperties(CS_Status* status) const override; -}; - } // namespace wpi::cs diff --git a/cscore/src/main/native/cpp/cscore_oo.cpp b/cscore/src/main/native/cpp/cscore_oo.cpp index 19e21a254b..04e464482b 100644 --- a/cscore/src/main/native/cpp/cscore_oo.cpp +++ b/cscore/src/main/native/cpp/cscore_oo.cpp @@ -87,7 +87,3 @@ std::vector VideoSink::EnumerateSinks() { } return sinks; } - -std::string AxisCamera::HostToUrl(std::string_view host) { - return fmt::format("http://{}/mjpg/video.mjpg", host); -} diff --git a/cscore/src/main/native/include/wpi/cs/cscore_c.h b/cscore/src/main/native/include/wpi/cs/cscore_c.h index b6cd79b493..10dd483dfb 100644 --- a/cscore/src/main/native/include/wpi/cs/cscore_c.h +++ b/cscore/src/main/native/include/wpi/cs/cscore_c.h @@ -124,8 +124,7 @@ enum CS_SourceKind { enum CS_HttpCameraKind { CS_HTTP_UNKNOWN = 0, CS_HTTP_MJPGSTREAMER = 1, - CS_HTTP_CSCORE = 2, - CS_HTTP_AXIS = 3 + CS_HTTP_CSCORE = 2 }; /** diff --git a/cscore/src/main/native/include/wpi/cs/cscore_oo.hpp b/cscore/src/main/native/include/wpi/cs/cscore_oo.hpp index 849e329489..960abe1f34 100644 --- a/cscore/src/main/native/include/wpi/cs/cscore_oo.hpp +++ b/cscore/src/main/native/include/wpi/cs/cscore_oo.hpp @@ -13,7 +13,6 @@ #include #include "wpi/cs/cscore_cpp.hpp" -#include "wpi/util/deprecated.hpp" namespace wpi::cs { @@ -779,9 +778,7 @@ class HttpCamera : public VideoCamera { /// MJPG Streamer camera. kMJPGStreamer = CS_HTTP_MJPGSTREAMER, /// CS Core camera. - kCSCore = CS_HTTP_CSCORE, - /// Axis camera. - kAxis = CS_HTTP_AXIS + kCSCore = CS_HTTP_CSCORE }; /** @@ -789,7 +786,7 @@ class HttpCamera : public VideoCamera { * * @param name Source name (arbitrary unique identifier) * @param url Camera URL (e.g. "http://10.x.y.11/video/stream.mjpg") - * @param kind Camera kind (e.g. kAxis) + * @param kind Camera kind (e.g. kCSCore) */ HttpCamera(std::string_view name, std::string_view url, HttpCameraKind kind = kUnknown) { @@ -803,7 +800,7 @@ class HttpCamera : public VideoCamera { * * @param name Source name (arbitrary unique identifier) * @param url Camera URL (e.g. "http://10.x.y.11/video/stream.mjpg") - * @param kind Camera kind (e.g. kAxis) + * @param kind Camera kind (e.g. kCSCore) */ HttpCamera(std::string_view name, const char* url, HttpCameraKind kind = kUnknown) { @@ -817,7 +814,7 @@ class HttpCamera : public VideoCamera { * * @param name Source name (arbitrary unique identifier) * @param url Camera URL (e.g. "http://10.x.y.11/video/stream.mjpg") - * @param kind Camera kind (e.g. kAxis) + * @param kind Camera kind (e.g. kCSCore) */ HttpCamera(std::string_view name, const std::string& url, HttpCameraKind kind = kUnknown) @@ -828,7 +825,7 @@ class HttpCamera : public VideoCamera { * * @param name Source name (arbitrary unique identifier) * @param urls Array of Camera URLs - * @param kind Camera kind (e.g. kAxis) + * @param kind Camera kind (e.g. kCSCore) */ HttpCamera(std::string_view name, std::span urls, HttpCameraKind kind = kUnknown) { @@ -842,7 +839,7 @@ class HttpCamera : public VideoCamera { * * @param name Source name (arbitrary unique identifier) * @param urls Array of Camera URLs - * @param kind Camera kind (e.g. kAxis) + * @param kind Camera kind (e.g. kCSCore) */ template HttpCamera(std::string_view name, std::initializer_list urls, @@ -900,82 +897,6 @@ class HttpCamera : public VideoCamera { } }; -/** - * A source that represents an Axis IP camera. - * - * @deprecated Use HttpCamera instead. - */ -class [[deprecated("Use HttpCamera instead.")]] AxisCamera : public HttpCamera { - static std::string HostToUrl(std::string_view host); - - static std::vector HostToUrl( - std::span hosts) { - std::vector rv; - rv.reserve(hosts.size()); - for (const auto& host : hosts) { - rv.emplace_back(HostToUrl(std::string_view{host})); - } - return rv; - } - - template - static std::vector HostToUrl(std::initializer_list hosts) { - std::vector rv; - rv.reserve(hosts.size()); - for (const auto& host : hosts) { - rv.emplace_back(HostToUrl(std::string_view{host})); - } - return rv; - } - - public: - /** - * 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") - */ - AxisCamera(std::string_view name, std::string_view host) - : HttpCamera(name, HostToUrl(host), kAxis) {} - - /** - * 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") - */ - AxisCamera(std::string_view name, const char* host) - : HttpCamera(name, HostToUrl(host), kAxis) {} - - /** - * 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") - */ - AxisCamera(std::string_view name, const std::string& host) - : HttpCamera(name, HostToUrl(std::string_view{host}), kAxis) {} - - /** - * Create a source for an Axis IP camera. - * - * @param name Source name (arbitrary unique identifier) - * @param hosts Array of Camera host IPs/DNS names - */ - AxisCamera(std::string_view name, std::span hosts) - : HttpCamera(name, HostToUrl(hosts), kAxis) {} - - /** - * Create a source for an Axis IP camera. - * - * @param name Source name (arbitrary unique identifier) - * @param hosts Array of Camera host IPs/DNS names - */ - template - AxisCamera(std::string_view name, std::initializer_list hosts) - : HttpCamera(name, HostToUrl(hosts), kAxis) {} -}; - /** * A base class for single image providing sources. */ diff --git a/cscore/src/test/native/cpp/CameraSourceTest.cpp b/cscore/src/test/native/cpp/CameraSourceTest.cpp index bcc51e2965..f87f2d9772 100644 --- a/cscore/src/test/native/cpp/CameraSourceTest.cpp +++ b/cscore/src/test/native/cpp/CameraSourceTest.cpp @@ -14,7 +14,7 @@ class CameraSourceTest : public ::testing::Test { }; TEST_F(CameraSourceTest, HTTPCamera) { - auto source = HttpCamera("axis", "http://localhost:8000"); + auto source = HttpCamera("camera", "http://localhost:8000"); wpi::cs::Shutdown(); }