Open3D (C++ API)  0.18.0+252c867
VideoFilter.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 // ----------------------------------------------------------------------------
7 // ----------------------------------------------------------------------------
8 // Contains source code from
9 // https://github.com/mpromonet/webrtc-streamer
10 //
11 // This software is in the public domain, furnished "as is", without technical
12 // support, and with no warranty, express or implied, as to its usefulness for
13 // any purpose.
14 // ----------------------------------------------------------------------------
15 //
16 // This is a private header. It shall be hidden from Open3D's public API. Do not
17 // put this in Open3D.h.in.
18 
19 #pragma once
20 
21 #include <pc/video_track_source.h>
22 
24 
25 namespace open3d {
26 namespace visualization {
27 namespace webrtc_server {
28 
34 template <class T>
36 public:
37  static rtc::scoped_refptr<VideoFilter> Create(
38  rtc::scoped_refptr<BitmapTrackSourceInterface> video_source,
39  const std::map<std::string, std::string>& opts) {
40  std::unique_ptr<T> source = absl::WrapUnique(new T(video_source, opts));
41  if (!source) {
42  return nullptr;
43  }
44  return new rtc::RefCountedObject<VideoFilter>(std::move(source));
45  }
46 
47 protected:
48  explicit VideoFilter(std::unique_ptr<T> source)
49  : BitmapTrackSource(/*remote=*/false), source_(std::move(source)) {}
50 
51  SourceState state() const override { return kLive; }
52  bool GetStats(Stats* stats) override {
53  bool result = false;
54  T* source = source_.get();
55  if (source) {
56  stats->input_height = source->height();
57  stats->input_width = source->width();
58  result = true;
59  }
60  return result;
61  }
62 
63 private:
64  rtc::VideoSourceInterface<webrtc::VideoFrame>* source() override {
65  return source_.get();
66  }
67  std::unique_ptr<T> source_;
68 };
69 
70 } // namespace webrtc_server
71 } // namespace visualization
72 } // namespace open3d
core::Tensor result
Definition: VtkUtils.cpp:75
VideoFilter is a templated class for video frame processing.
Definition: VideoFilter.h:35
VideoFilter(std::unique_ptr< T > source)
Definition: VideoFilter.h:48
SourceState state() const override
Definition: VideoFilter.h:51
static rtc::scoped_refptr< VideoFilter > Create(rtc::scoped_refptr< BitmapTrackSourceInterface > video_source, const std::map< std::string, std::string > &opts)
Definition: VideoFilter.h:37
bool GetStats(Stats *stats) override
Definition: VideoFilter.h:52
Definition: PinholeCameraIntrinsic.cpp:16
Definition: Device.h:107