feat: enable https camera stream mode

This commit is contained in:
Ian Chua
2026-09-16 16:24:29 +08:00
parent 2c2e91b629
commit cb16a2e547
6 changed files with 33 additions and 9 deletions
+3 -4
View File
@@ -375,10 +375,6 @@ include(libnoise/libnoise.cmake)
include(Draco/Draco.cmake) include(Draco/Draco.cmake)
include(FFMPEG/FFMPEG.cmake)
include(Assimp/Assimp.cmake)
# I *think* 1.1 is used for *just* md5 hashing? # I *think* 1.1 is used for *just* md5 hashing?
# 3.1 has everything in the right place, but the md5 funcs used are deprecated # 3.1 has everything in the right place, but the md5 funcs used are deprecated
# a grep across the repo shows it is used for other things # a grep across the repo shows it is used for other things
@@ -389,6 +385,9 @@ if(NOT OPENSSL_FOUND)
set(OPENSSL_PKG dep_OpenSSL) set(OPENSSL_PKG dep_OpenSSL)
endif() endif()
include(FFMPEG/FFMPEG.cmake)
include(Assimp/Assimp.cmake)
find_package(LibDataChannel QUIET) find_package(LibDataChannel QUIET)
set(DATACHANNEL_PKG "") set(DATACHANNEL_PKG "")
if (NOT LibDataChannel_FOUND) if (NOT LibDataChannel_FOUND)
+18 -2
View File
@@ -1,5 +1,16 @@
set(_conf_cmd ./configure) set(_conf_cmd ./configure)
set(_ffmpeg_depends)
set(_ffmpeg_configure_command ${_conf_cmd})
if (TARGET dep_OpenSSL)
set(_ffmpeg_depends DEPENDS dep_OpenSSL)
set(_ffmpeg_configure_command
${CMAKE_COMMAND} -E env
"PKG_CONFIG_PATH=${DESTDIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}"
${_conf_cmd}
)
endif()
if (MSVC) if (MSVC)
set(_source_dir "${CMAKE_BINARY_DIR}/dep_FFMPEG-prefix/src/dep_FFMPEG") set(_source_dir "${CMAKE_BINARY_DIR}/dep_FFMPEG-prefix/src/dep_FFMPEG")
@@ -9,6 +20,7 @@ if (MSVC)
set(PREBUILD_HASH_x64 "e65916020ddb9ef84b2666dfbcbfc9b1d67f69d15b4a66db53754637bf2d498c") set(PREBUILD_HASH_x64 "e65916020ddb9ef84b2666dfbcbfc9b1d67f69d15b4a66db53754637bf2d498c")
ExternalProject_Add(dep_FFMPEG ExternalProject_Add(dep_FFMPEG
${_ffmpeg_depends}
URL ${PREBUILD_URL_${DEPS_ARCH}} URL ${PREBUILD_URL_${DEPS_ARCH}}
URL_HASH SHA256=${PREBUILD_HASH_${DEPS_ARCH}} URL_HASH SHA256=${PREBUILD_HASH_${DEPS_ARCH}}
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/FFMPEG DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/FFMPEG
@@ -21,6 +33,8 @@ if (MSVC)
) )
else () else ()
set(_openssl_cmd --enable-openssl)
if (APPLE) if (APPLE)
set(_minos_cmd set(_minos_cmd
"--extra-cflags=-mmacosx-version-min=${DEP_OSX_TARGET}" "--extra-cflags=-mmacosx-version-min=${DEP_OSX_TARGET}"
@@ -52,10 +66,11 @@ else ()
endif() endif()
ExternalProject_Add(dep_FFMPEG ExternalProject_Add(dep_FFMPEG
${_ffmpeg_depends}
URL https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n7.0.3.tar.gz URL https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n7.0.3.tar.gz
URL_HASH SHA256=DEEDCABE339165214A3637DF4C86A507AEF0D793CF8774FF68735F4737E8DDBC URL_HASH SHA256=DEEDCABE339165214A3637DF4C86A507AEF0D793CF8774FF68735F4737E8DDBC
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/FFMPEG DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/FFMPEG
CONFIGURE_COMMAND ${_conf_cmd} CONFIGURE_COMMAND ${_ffmpeg_configure_command}
${_cross_cmd} ${_cross_cmd}
${_pic_cmd} ${_pic_cmd}
${_arch_cmd} ${_arch_cmd}
@@ -63,13 +78,14 @@ else ()
"--prefix=${DESTDIR}" "--prefix=${DESTDIR}"
${_link_cmd} ${_link_cmd}
${_minos_cmd} ${_minos_cmd}
${_openssl_cmd}
--disable-doc --disable-doc
--enable-small --enable-small
--disable-outdevs --disable-outdevs
--disable-filters --disable-filters
--enable-filter=*null*,afade,*fifo,*format,*resample,aeval,allrgb,allyuv,atempo,pan,*bars,color,*key,crop,draw*,eq*,framerate,*_qsv,*_vaapi,*v4l2*,hw*,scale,volume,test* --enable-filter=*null*,afade,*fifo,*format,*resample,aeval,allrgb,allyuv,atempo,pan,*bars,color,*key,crop,draw*,eq*,framerate,*_qsv,*_vaapi,*v4l2*,hw*,scale,volume,test*
--disable-protocols --disable-protocols
--enable-protocol=file,fd,pipe,http,rtp,tcp,udp --enable-protocol=file,fd,pipe,http,https,rtp,tcp,udp
--disable-muxers --disable-muxers
--enable-muxer=rtp --enable-muxer=rtp
--disable-encoders --disable-encoders
+4 -1
View File
@@ -184,6 +184,7 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
switch (mode) { switch (mode) {
case CameraStreamMode::http: case CameraStreamMode::http:
case CameraStreamMode::https:
case CameraStreamMode::http_snapshot: case CameraStreamMode::http_snapshot:
case CameraStreamMode::rtsp: { case CameraStreamMode::rtsp: {
std::string machine = obj ? obj->get_dev_id() : ""; std::string machine = obj ? obj->get_dev_id() : "";
@@ -346,6 +347,7 @@ void MediaPlayCtrl::Play()
SetStatus(_L("Playing..."), false); SetStatus(_L("Playing..."), false);
return; return;
case CameraStreamMode::http: case CameraStreamMode::http:
case CameraStreamMode::https:
case CameraStreamMode::rtsp: case CameraStreamMode::rtsp:
if (m_next_retry.IsValid() && wxDateTime::Now() < m_next_retry) if (m_next_retry.IsValid() && wxDateTime::Now() < m_next_retry)
return; return;
@@ -565,13 +567,14 @@ void MediaPlayCtrl::Stop(wxString const &msg, wxString const &msg2)
} }
switch (current_mode()) { switch (current_mode()) {
case CameraStreamMode::http: case CameraStreamMode::http:
case CameraStreamMode::https:
case CameraStreamMode::http_snapshot: { case CameraStreamMode::http_snapshot: {
const bool snapshot = current_mode() == CameraStreamMode::http_snapshot; const bool snapshot = current_mode() == CameraStreamMode::http_snapshot;
if (m_last_state != MEDIASTATE_IDLE) { if (m_last_state != MEDIASTATE_IDLE) {
if (snapshot) { if (snapshot) {
if (m_web_ctrl) m_web_ctrl->Stop(); if (m_web_ctrl) m_web_ctrl->Stop();
} else { } else {
// http mode plays through the ffmpeg backend (m_media_ctrl), not // http/https mode plays through the ffmpeg backend (m_media_ctrl), not
// the webview - tear its read thread down too, otherwise it keeps // the webview - tear its read thread down too, otherwise it keeps
// pulling and painting frames after the UI says "Video Stopped". // pulling and painting frames after the UI says "Video Stopped".
boost::unique_lock lock(m_mutex); boost::unique_lock lock(m_mutex);
+3 -2
View File
@@ -50,6 +50,7 @@ enum class FilamentSyncMode {
enum class CameraStreamMode { enum class CameraStreamMode {
none = 0, none = 0,
http, // LAN or Cloud http, // LAN or Cloud
https, // LAN or Cloud over TLS
rtsp, // LAN only rtsp, // LAN only
webrtc, // Cloud only webrtc, // Cloud only
http_snapshot // HTTP endpoint returning one image per request http_snapshot // HTTP endpoint returning one image per request
@@ -330,7 +331,7 @@ public:
/** /**
* Get the camera stream mode for this agent. This value can be deterministic and derived at * Get the camera stream mode for this agent. This value can be deterministic and derived at
* runtime if the printer supports multiple camera stream modes. E.g. LAN => HTTP/RTSP, Cloud => WebRTC. * runtime if the printer supports multiple camera stream modes. E.g. LAN => HTTP/HTTPS/RTSP, Cloud => WebRTC.
* *
* @return CameraStreamMode indicating how the camera stream is obtained or used: * @return CameraStreamMode indicating how the camera stream is obtained or used:
*/ */
@@ -355,7 +356,7 @@ public:
/** /**
* Get the current camera stream URL for this agent's active machine. * Get the current camera stream URL for this agent's active machine.
* Only meaningful when get_camera_stream_mode() returns an HTTP or RTSP mode. * Only meaningful when get_camera_stream_mode() returns an HTTP, HTTPS, or RTSP mode.
*/ */
virtual std::string get_camera_url() const { return {}; } virtual std::string get_camera_url() const { return {}; }
@@ -26,6 +26,7 @@ void PrinterAgentPluginCapability::RegisterBindings(pybind11::module_& module)
py::enum_<CameraStreamMode>(printer_agent_module, "CameraStreamMode") py::enum_<CameraStreamMode>(printer_agent_module, "CameraStreamMode")
.value("None_", CameraStreamMode::none) .value("None_", CameraStreamMode::none)
.value("HTTP", CameraStreamMode::http) .value("HTTP", CameraStreamMode::http)
.value("HTTPS", CameraStreamMode::https)
.value("HTTP_SNAPSHOT", CameraStreamMode::http_snapshot) .value("HTTP_SNAPSHOT", CameraStreamMode::http_snapshot)
.value("RTSP", CameraStreamMode::rtsp) .value("RTSP", CameraStreamMode::rtsp)
.value("WebRTC", CameraStreamMode::webrtc) .value("WebRTC", CameraStreamMode::webrtc)
+4
View File
@@ -92,6 +92,10 @@ TEST_CASE("integration: orca.printer_agent binding surface", "[integration][Pyth
CHECK(py::hasattr(mode, "Subscription")); CHECK(py::hasattr(mode, "Subscription"));
CHECK(py::hasattr(mode, "None_")); CHECK(py::hasattr(mode, "None_"));
REQUIRE(py::hasattr(pa, "CameraStreamMode"));
py::object camera_mode = pa.attr("CameraStreamMode");
CHECK(py::hasattr(camera_mode, "HTTPS"));
// Plugin-type enum exposed at module root (host reads it without the GIL). // Plugin-type enum exposed at module root (host reads it without the GIL).
CHECK(py::hasattr(orca, "PluginType")); CHECK(py::hasattr(orca, "PluginType"));
} }