Open3D (C++ API)  0.17.0
WebRTCWindowSystem.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
10 
11 #pragma once
12 
13 #include <functional>
14 #include <memory>
15 #include <string>
16 #include <vector>
17 
19 
20 namespace open3d {
21 namespace visualization {
22 namespace webrtc_server {
23 
41 public:
42  static std::shared_ptr<WebRTCWindowSystem> GetInstance();
43  virtual ~WebRTCWindowSystem();
45  int width,
46  int height,
47  const char* title,
48  int flags) override;
49  void DestroyWindow(OSWindow w) override;
50 
52  std::vector<std::string> GetWindowUIDs() const;
53  std::string GetWindowUID(OSWindow w) const;
54  OSWindow GetOSWindowByUID(const std::string& uid) const;
55 
57  void StartWebRTCServer();
58 
61  std::string OnDataChannelMessage(const std::string& message);
62 
94  const std::string& class_name,
95  const std::function<std::string(const std::string&)> callback);
96 
98  void OnFrame(const std::string& window_uid,
99  const std::shared_ptr<core::Tensor>& im);
100 
103  void SendInitFrames(const std::string& window_uid);
104 
123  std::string CallHttpAPI(const std::string& entry_point,
124  const std::string& query_string = "",
125  const std::string& data = "") const;
126 
130  void EnableWebRTC();
131 
134  void DisableHttpHandshake();
135 
137  void CloseWindowConnections(const std::string& window_uid);
138 
139 private:
141  struct Impl;
142  std::unique_ptr<Impl> impl_;
143 };
144 
145 } // namespace webrtc_server
146 } // namespace visualization
147 } // namespace open3d
Window * o3d_window
Definition: BitmapWindowSystem.cpp:29
std::function< void(std::shared_ptr< core::Tensor >)> callback
Definition: FilamentRenderer.cpp:182
Definition: BitmapWindowSystem.h:28
Definition: Window.h:30
void * OSWindow
Definition: WindowSystem.h:29
WebRTCWindowSystem is a BitmapWindowSystem with a WebRTC server that sends video frames to remote cli...
Definition: WebRTCWindowSystem.h:40
virtual ~WebRTCWindowSystem()
Definition: WebRTCWindowSystem.cpp:199
void DestroyWindow(OSWindow w) override
Definition: WebRTCWindowSystem.cpp:220
void StartWebRTCServer()
Start WebRTC server in a background thread.
Definition: WebRTCWindowSystem.cpp:257
OSWindow CreateOSWindow(gui::Window *o3d_window, int width, int height, const char *title, int flags) override
Definition: WebRTCWindowSystem.cpp:204
void EnableWebRTC()
Definition: WebRTCWindowSystem.cpp:485
static std::shared_ptr< WebRTCWindowSystem > GetInstance()
Definition: WebRTCWindowSystem.cpp:111
void DisableHttpHandshake()
Definition: WebRTCWindowSystem.cpp:490
std::vector< std::string > GetWindowUIDs() const
List available windows.
Definition: WebRTCWindowSystem.cpp:228
std::string CallHttpAPI(const std::string &entry_point, const std::string &query_string="", const std::string &data="") const
Call PeerConnectionManager's web request API.
Definition: WebRTCWindowSystem.cpp:419
void SendInitFrames(const std::string &window_uid)
Definition: WebRTCWindowSystem.cpp:405
void OnFrame(const std::string &window_uid, const std::shared_ptr< core::Tensor > &im)
Server -> client frame.
Definition: WebRTCWindowSystem.cpp:400
std::string OnDataChannelMessage(const std::string &message)
Definition: WebRTCWindowSystem.cpp:355
void RegisterDataChannelMessageCallback(const std::string &class_name, const std::function< std::string(const std::string &)> callback)
Definition: WebRTCWindowSystem.cpp:391
void CloseWindowConnections(const std::string &window_uid)
Close all WebRTC connections that correspond to a Window.
Definition: WebRTCWindowSystem.cpp:495
OSWindow GetOSWindowByUID(const std::string &uid) const
Definition: WebRTCWindowSystem.cpp:245
std::string GetWindowUID(OSWindow w) const
Definition: WebRTCWindowSystem.cpp:236
int width
Definition: FilePCD.cpp:52
int height
Definition: FilePCD.cpp:53
const char const char value recording_handle imu_sample recording_handle uint8_t data
Definition: K4aPlugin.cpp:269
Definition: PinholeCameraIntrinsic.cpp:16