Open3D (C++ API)  0.13.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) 2020 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 <memory>
33 #include <string>
34 #include <vector>
35 
37 
38 namespace open3d {
39 namespace visualization {
40 namespace webrtc_server {
41 
59 public:
60  static std::shared_ptr<WebRTCWindowSystem> GetInstance();
61  virtual ~WebRTCWindowSystem();
63  int width,
64  int height,
65  const char* title,
66  int flags) override;
67  void DestroyWindow(OSWindow w) override;
68 
70  std::vector<std::string> GetWindowUIDs() const;
71  std::string GetWindowUID(OSWindow w) const;
72  OSWindow GetOSWindowByUID(const std::string& uid) const;
73 
75  void StartWebRTCServer();
76 
78  void OnDataChannelMessage(const std::string& message);
79 
81  void OnFrame(const std::string& window_uid,
82  const std::shared_ptr<core::Tensor>& im);
83 
86  void SendInitFrames(const std::string& window_uid);
87 
106  std::string CallHttpAPI(const std::string& entry_point,
107  const std::string& query_string = "",
108  const std::string& data = "") const;
109 
113  void EnableWebRTC();
114 
117  void DisableHttpHandshake();
118 
120  void CloseWindowConnections(const std::string& window_uid);
121 
122 private:
124  struct Impl;
125  std::unique_ptr<Impl> impl_;
126 };
127 
128 } // namespace webrtc_server
129 } // namespace visualization
130 } // namespace open3d
WebRTCWindowSystem is a BitmapWindowSystem with a WebRTC server that sends video frames to remote cli...
Definition: WebRTCWindowSystem.h:58
Definition: Window.h:49
std::vector< std::string > GetWindowUIDs() const
List available windows.
Definition: WebRTCWindowSystem.cpp:184
static std::shared_ptr< WebRTCWindowSystem > GetInstance()
Definition: WebRTCWindowSystem.cpp:127
std::string GetWindowUID(OSWindow w) const
Definition: WebRTCWindowSystem.cpp:192
void StartWebRTCServer()
Start WebRTC server in a background thread.
Definition: WebRTCWindowSystem.cpp:213
OSWindow CreateOSWindow(gui::Window *o3d_window, int width, int height, const char *title, int flags) override
Definition: WebRTCWindowSystem.cpp:160
void CloseWindowConnections(const std::string &window_uid)
Close all WebRTC connections that correspond to a Window.
Definition: WebRTCWindowSystem.cpp:436
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:360
void OnFrame(const std::string &window_uid, const std::shared_ptr< core::Tensor > &im)
Server -> client frame.
Definition: WebRTCWindowSystem.cpp:343
void SendInitFrames(const std::string &window_uid)
Definition: WebRTCWindowSystem.cpp:348
Definition: BitmapWindowSystem.h:47
void DestroyWindow(OSWindow w) override
Definition: WebRTCWindowSystem.cpp:176
Definition: PinholeCameraIntrinsic.cpp:35
Window * o3d_window
Definition: BitmapWindowSystem.cpp:47
void * OSWindow
Definition: WindowSystem.h:48
int height
Definition: FilePCD.cpp:72
OSWindow GetOSWindowByUID(const std::string &uid) const
Definition: WebRTCWindowSystem.cpp:201
void DisableHttpHandshake()
Definition: WebRTCWindowSystem.cpp:431
virtual ~WebRTCWindowSystem()
Definition: WebRTCWindowSystem.cpp:155
void EnableWebRTC()
Definition: WebRTCWindowSystem.cpp:426
void OnDataChannelMessage(const std::string &message)
Client -> server message.
Definition: WebRTCWindowSystem.cpp:311
int width
Definition: FilePCD.cpp:71
const char const char value recording_handle imu_sample recording_handle uint8_t data
Definition: K4aPlugin.cpp:274