Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
processing.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2015 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 #include "streaming.h"
6 
7 namespace librealsense
8 {
9  class synthetic_source_interface;
10 }
11 
12 struct rs2_source
13 {
15 };
16 
17 namespace librealsense
18 {
20  {
21  public:
22  virtual ~synthetic_source_interface() = default;
23 
24  virtual frame_interface* allocate_video_frame(std::shared_ptr<stream_profile_interface> stream,
25  frame_interface* original,
26  int new_bpp = 0,
27  int new_width = 0,
28  int new_height = 0,
29  int new_stride = 0,
30  rs2_extension frame_type = RS2_EXTENSION_VIDEO_FRAME) = 0;
31 
32  virtual frame_interface* allocate_composite_frame(std::vector<frame_holder> frames) = 0;
33 
34  virtual frame_interface* allocate_points(std::shared_ptr<stream_profile_interface> stream, frame_interface* original) = 0;
35 
36  virtual void frame_ready(frame_holder result) = 0;
37  virtual rs2_source* get_c_wrapper() = 0;
38  };
39 
41  {
42  public:
43  virtual void set_processing_callback(frame_processor_callback_ptr callback) = 0;
44  virtual void set_output_callback(frame_callback_ptr callback) = 0;
45  virtual void invoke(frame_holder frame) = 0;
46  virtual synthetic_source_interface& get_source() = 0;
47 
48  virtual ~processing_block_interface() = default;
49  };
50 
51  template<class T>
53  {
54  T on_frame_function;
55  public:
56  explicit internal_frame_processor_callback(T on_frame) : on_frame_function(on_frame) {}
57 
58  void on_frame(rs2_frame * f, rs2_source * source) override
59  {
60  frame_holder front((frame_interface*)f);
61  on_frame_function(std::move(front), source->source);
62  }
63 
64  void release() override { delete this; }
65  };
66 }
Definition: streaming.h:63
std::shared_ptr< rs2_frame_callback > frame_callback_ptr
Definition: types.h:896
std::function< void(frame_interface *)> on_frame
Definition: streaming.h:103
internal_frame_processor_callback(T on_frame)
Definition: processing.h:56
void on_frame(rs2_frame *f, rs2_source *source) override
Definition: processing.h:58
Definition: archive.h:63
Definition: algo.h:16
Definition: processing.h:12
Definition: rs_types.hpp:34
std::shared_ptr< rs2_frame_processor_callback > frame_processor_callback_ptr
Definition: types.h:897
librealsense::synthetic_source_interface * source
Definition: processing.h:14
Definition: rs_types.h:104
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition: rs_types.h:94
Definition: stream.h:14
Definition: types.h:637
Definition: processing.h:19
void release() override
Definition: processing.h:64
Definition: processing.h:40
struct rs2_frame rs2_frame
Definition: rs_types.h:151