Loading [MathJax]/extensions/TeX/AMSsymbols.js
Open3D (C++ API)  0.16.0
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
WebRTCWindowSystem.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018-2021 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
29 
30 #pragma once
31 
32 #include <functional>
33 #include <memory>
34 #include <string>
35 #include <vector>
36 
38 
39 namespace open3d {
40 namespace visualization {
41 namespace webrtc_server {
42 
60 public:
61  static std::shared_ptr<WebRTCWindowSystem> GetInstance();
62  virtual ~WebRTCWindowSystem();
64  int width,
65  int height,
66  const char* title,
67  int flags) override;
68  void DestroyWindow(OSWindow w) override;
69 
71  std::vector<std::string> GetWindowUIDs() const;
72  std::string GetWindowUID(OSWindow w) const;
73  OSWindow GetOSWindowByUID(const std::string& uid) const;
74 
76  void StartWebRTCServer();
77 
80  std::string OnDataChannelMessage(const std::string& message);
81 
113  const std::string& class_name,
114  const std::function<std::string(const std::string&)> callback);
115 
117  void OnFrame(const std::string& window_uid,
118  const std::shared_ptr<core::Tensor>& im);
119 
122  void SendInitFrames(const std::string& window_uid);
123 
142  std::string CallHttpAPI(const std::string& entry_point,
143  const std::string& query_string = "",
144  const std::string& data = "") const;
145 
149  void EnableWebRTC();
150 
153  void DisableHttpHandshake();
154 
156  void CloseWindowConnections(const std::string& window_uid);
157 
158 private:
160  struct Impl;
161  std::unique_ptr<Impl> impl_;
162 };
163 
164 } // namespace webrtc_server
165 } // namespace visualization
166 } // namespace open3d
WebRTCWindowSystem is a BitmapWindowSystem with a WebRTC server that sends video frames to remote cli...
Definition: WebRTCWindowSystem.h:59
int height
Definition: FilePCD.cpp:72
Definition: Window.h:49
std::vector< std::string > GetWindowUIDs() const
List available windows.
Definition: WebRTCWindowSystem.cpp:247
static std::shared_ptr< WebRTCWindowSystem > GetInstance()
Definition: WebRTCWindowSystem.cpp:130
std::string GetWindowUID(OSWindow w) const
Definition: WebRTCWindowSystem.cpp:255
void StartWebRTCServer()
Start WebRTC server in a background thread.
Definition: WebRTCWindowSystem.cpp:276
void RegisterDataChannelMessageCallback(const std::string &class_name, const std::function< std::string(const std::string &)> callback)
Definition: WebRTCWindowSystem.cpp:410
OSWindow CreateOSWindow(gui::Window *o3d_window, int width, int height, const char *title, int flags) override
Definition: WebRTCWindowSystem.cpp:223
void CloseWindowConnections(const std::string &window_uid)
Close all WebRTC connections that correspond to a Window.
Definition: WebRTCWindowSystem.cpp:514
std::string CallHttpAPI(const std::string &entry_point, const std::string &query_string="", const std::string &data="") const
Call PeerConnectionManager&#39;s web request API.
Definition: WebRTCWindowSystem.cpp:438
void OnFrame(const std::string &window_uid, const std::shared_ptr< core::Tensor > &im)
Server -> client frame.
Definition: WebRTCWindowSystem.cpp:419
std::string OnDataChannelMessage(const std::string &message)
Definition: WebRTCWindowSystem.cpp:374
void SendInitFrames(const std::string &window_uid)
Definition: WebRTCWindowSystem.cpp:424
Definition: BitmapWindowSystem.h:47
void DestroyWindow(OSWindow w) override
Definition: WebRTCWindowSystem.cpp:239
Definition: PinholeCameraIntrinsic.cpp:35
Window * o3d_window
Definition: BitmapWindowSystem.cpp:48
void * OSWindow
Definition: WindowSystem.h:48
OSWindow GetOSWindowByUID(const std::string &uid) const
Definition: WebRTCWindowSystem.cpp:264
void DisableHttpHandshake()
Definition: WebRTCWindowSystem.cpp:509
virtual ~WebRTCWindowSystem()
Definition: WebRTCWindowSystem.cpp:218
void EnableWebRTC()
Definition: WebRTCWindowSystem.cpp:504
int width
Definition: FilePCD.cpp:71
std::function< void(std::shared_ptr< core::Tensor >)> callback
Definition: FilamentRenderer.cpp:201
const char const char value recording_handle imu_sample recording_handle uint8_t data
Definition: K4aPlugin.cpp:284