stream.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 #ifndef LIBREALSENSE_STREAM_H
6 #define LIBREALSENSE_STREAM_H
7 
8 #include "types.h"
9 
10 #include <memory> // For shared_ptr
11 
12 namespace rsimpl
13 {
15  {
16  stream_interface(calibration_validator in_validator, rs_stream in_stream) : stream(in_stream), validator(in_validator){};
17 
18  virtual rs_extrinsics get_extrinsics_to(const rs_stream_interface & other) const override;
19  virtual rsimpl::pose get_pose() const = 0;
20  virtual int get_mode_count() const override { return 0; }
21  virtual void get_mode(int /*mode*/, int * /*w*/, int * /*h*/, rs_format * /*f*/, int * /*fps*/) const override { throw std::logic_error("no modes"); }
22  virtual rs_stream get_stream_type()const override { return stream; }
23 
25 
26  protected:
28  };
29 
30  class frame_archive;
32 
33  struct native_stream final : public stream_interface
34  {
36 
37  std::vector<subdevice_mode_selection> modes;
38  std::shared_ptr<syncronizing_archive> archive;
39 
41 
42  pose get_pose() const override { return config.info.stream_poses[stream]; }
43  float get_depth_scale() const override { return config.depth_scale; }
44  int get_mode_count() const override { return (int)modes.size(); }
45  void get_mode(int mode, int * w, int * h, rs_format * f, int * fps) const override;
46 
47  bool is_enabled() const override;
49  rs_intrinsics get_intrinsics() const override;
50  rs_intrinsics get_rectified_intrinsics() const override;
51  rs_format get_format() const override { return get_mode().get_format(stream); }
52  int get_framerate() const override { return get_mode().get_framerate(); }
53 
55  bool supports_frame_metadata(rs_frame_metadata frame_metadata) const override;
56  unsigned long long get_frame_number() const override;
57  double get_frame_timestamp() const override;
58  long long get_frame_system_time() const override;
59  const uint8_t * get_frame_data() const override;
60 
61  int get_frame_stride() const override;
62  int get_frame_bpp() const override;
63  };
64 
65  class point_stream final : public stream_interface
66  {
68  mutable std::vector<uint8_t> image;
69  mutable unsigned long long number;
70  public:
71  point_stream(const stream_interface & source) :stream_interface(calibration_validator(), RS_STREAM_POINTS), source(source), number() {}
72 
73  pose get_pose() const override { return {{{1,0,0},{0,1,0},{0,0,1}}, source.get_pose().position}; }
74  float get_depth_scale() const override { return source.get_depth_scale(); }
75 
76  bool is_enabled() const override { return source.is_enabled(); }
77  rs_intrinsics get_intrinsics() const override { return source.get_intrinsics(); }
78  rs_intrinsics get_rectified_intrinsics() const override { return source.get_rectified_intrinsics(); }
79  rs_format get_format() const override { return RS_FORMAT_XYZ32F; }
80  int get_framerate() const override { return source.get_framerate(); }
81 
82  double get_frame_metadata(rs_frame_metadata frame_metadata) const override { return source.get_frame_metadata(frame_metadata); }
83  bool supports_frame_metadata(rs_frame_metadata frame_metadata) const override { return source.supports_frame_metadata(frame_metadata); }
84  unsigned long long get_frame_number() const override { return source.get_frame_number(); }
85  double get_frame_timestamp() const override{ return source.get_frame_timestamp(); }
86  long long get_frame_system_time() const override { return source.get_frame_system_time(); }
87  const uint8_t * get_frame_data() const override;
88 
89  int get_frame_stride() const override { return source.get_frame_stride(); }
90  int get_frame_bpp() const override { return source.get_frame_bpp(); }
91  };
92 
93  class rectified_stream final : public stream_interface
94  {
96  mutable std::vector<int> table;
97  mutable std::vector<uint8_t> image;
98  mutable unsigned long long number;
99  public:
101 
102  pose get_pose() const override { return {{{1,0,0},{0,1,0},{0,0,1}}, source.get_pose().position}; }
103  float get_depth_scale() const override { return source.get_depth_scale(); }
104 
105  bool is_enabled() const override { return source.is_enabled(); }
106  rs_intrinsics get_intrinsics() const override { return source.get_rectified_intrinsics(); }
108  rs_format get_format() const override { return source.get_format(); }
109  int get_framerate() const override { return source.get_framerate(); }
110 
111  double get_frame_metadata(rs_frame_metadata frame_metadata) const override { return source.get_frame_metadata(frame_metadata); }
112  bool supports_frame_metadata(rs_frame_metadata frame_metadata) const override { return source.supports_frame_metadata(frame_metadata); }
113  unsigned long long get_frame_number() const override { return source.get_frame_number(); }
114  double get_frame_timestamp() const override { return source.get_frame_timestamp(); }
115  long long get_frame_system_time() const override { return source.get_frame_system_time(); }
116  const uint8_t * get_frame_data() const override;
117 
118  int get_frame_stride() const override { return source.get_frame_stride(); }
119  int get_frame_bpp() const override { return source.get_frame_bpp(); }
120  };
121 
122  class aligned_stream final : public stream_interface
123  {
124  const stream_interface & from, & to;
125  mutable std::vector<uint8_t> image;
126  mutable unsigned long long number;
127  public:
129 
130  pose get_pose() const override { return to.get_pose(); }
131  float get_depth_scale() const override { return to.get_depth_scale(); }
132 
133  bool is_enabled() const override { return from.is_enabled() && to.is_enabled(); }
134  rs_intrinsics get_intrinsics() const override { return to.get_intrinsics(); }
136  rs_format get_format() const override { return from.get_format(); }
137  int get_framerate() const override { return from.get_framerate(); }
138 
139  double get_frame_metadata(rs_frame_metadata frame_metadata) const override { return from.get_frame_metadata(frame_metadata); }
140  bool supports_frame_metadata(rs_frame_metadata frame_metadata) const override { return from.supports_frame_metadata(frame_metadata); }
141  unsigned long long get_frame_number() const override { return from.get_frame_number(); }
142  double get_frame_timestamp() const override { return from.get_frame_timestamp(); }
143  long long get_frame_system_time() const override { return from.get_frame_system_time(); }
144  const unsigned char * get_frame_data() const override;
145 
146  int get_frame_stride() const override { return from.get_frame_stride(); }
147  int get_frame_bpp() const override { return from.get_frame_bpp(); }
148  };
149 }
150 
151 #endif
rs_intrinsics get_rectified_intrinsics() const override
Definition: stream.h:135
pose get_pose() const override
Definition: stream.h:130
rs_intrinsics get_intrinsics() const override
Definition: stream.h:134
pose get_pose() const override
Definition: stream.h:102
int get_framerate() const override
Definition: stream.h:137
int get_frame_bpp() const override
Definition: stream.h:90
int get_frame_stride() const override
Definition: stream.h:118
unsigned long long get_frame_number() const override
Definition: stream.h:84
std::vector< uint8_t > image
Definition: stream.h:97
virtual rs_extrinsics get_extrinsics_to(const rs_stream_interface &other) const override
Definition: stream.cpp:12
float get_depth_scale() const override
Definition: stream.h:74
rs_intrinsics get_intrinsics() const override
Definition: stream.h:77
virtual bool supports_frame_metadata(rs_frame_metadata frame_metadata) const =0
const rs_stream stream
Definition: stream.h:24
virtual rsimpl::pose get_pose() const =0
double get_frame_metadata(rs_frame_metadata frame_metadata) const override
Definition: stream.h:139
virtual rs_intrinsics get_rectified_intrinsics() const =0
virtual rs_intrinsics get_intrinsics() const =0
virtual int get_frame_stride() const =0
pose stream_poses[RS_STREAM_NATIVE_COUNT]
Definition: types.h:277
frame_metadata
Types of value provided from the device with each frame.
Definition: rs.hpp:160
double get_frame_timestamp() const override
Definition: stream.h:142
virtual int get_mode_count() const override
Definition: stream.h:20
virtual const uint8_t * get_frame_data() const =0
bool is_enabled() const override
Definition: stream.h:76
rs_intrinsics get_rectified_intrinsics() const override
Definition: stream.h:107
double get_frame_timestamp() const override
Definition: stream.h:114
Definition: archive.h:12
int get_framerate() const override
Definition: stream.h:109
virtual long long get_frame_system_time() const =0
int get_frame_stride() const override
Definition: stream.h:89
bool is_enabled() const override
Definition: stream.h:133
GLuint GLuint stream
Definition: glext.h:1774
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:1944
rs_intrinsics get_rectified_intrinsics() const override
Definition: stream.h:78
unsigned long long number
Definition: stream.h:69
bool supports_frame_metadata(rs_frame_metadata frame_metadata) const override
Definition: stream.h:83
std::shared_ptr< syncronizing_archive > archive
Definition: stream.h:38
rs_format get_format() const override
Definition: stream.h:79
float get_depth_scale() const override
Definition: stream.h:103
unsigned long long number
Definition: stream.h:126
unsigned long long get_frame_number() const override
Definition: stream.h:141
virtual void get_mode(int, int *, int *, rs_format *, int *) const override
Definition: stream.h:21
std::vector< subdevice_mode_selection > modes
Definition: stream.h:37
virtual rs_stream get_stream_type() const override
Definition: stream.h:22
std::vector< int > table
Definition: stream.h:96
aligned_stream(const stream_interface &from, const stream_interface &to)
Definition: stream.h:128
std::vector< uint8_t > image
Definition: stream.h:68
virtual bool is_enabled() const =0
point_stream(const stream_interface &source)
Definition: stream.h:71
GLfloat f
Definition: glext.h:1868
virtual unsigned long long get_frame_number() const =0
double get_frame_timestamp() const override
Definition: stream.h:85
unsigned long long number
Definition: stream.h:98
virtual int get_framerate() const =0
virtual double get_frame_timestamp() const =0
rs_format get_format() const override
Definition: stream.h:136
int get_mode_count() const override
Definition: stream.h:44
rs_format get_format() const override
Definition: stream.h:51
rs_format
Formats: defines how each stream can be encoded.
Definition: rs.h:53
float get_depth_scale() const override
Definition: stream.h:131
int get_frame_stride() const override
Definition: stream.h:146
rectified_stream(const stream_interface &source)
Definition: stream.h:100
int get_framerate() const override
Definition: stream.h:52
GLenum mode
Definition: glext.h:1117
const device_config & config
Definition: stream.h:35
const static_device_info info
Definition: types.h:450
int get_frame_bpp() const override
Definition: stream.h:147
Video stream intrinsics.
Definition: rs.h:300
Cross-stream extrinsics: encode the topology describing how the different devices are connected...
Definition: rs.h:332
double get_frame_metadata(rs_frame_metadata frame_metadata) const override
Definition: stream.h:82
const stream_interface & source
Definition: stream.h:67
virtual int get_frame_bpp() const =0
int get_framerate() const override
Definition: stream.h:80
bool supports_frame_metadata(rs_frame_metadata frame_metadata) const override
Definition: stream.h:140
long long get_frame_system_time() const override
Definition: stream.h:143
int get_frame_bpp() const override
Definition: stream.h:119
rs_stream
Streams are different types of data provided by RealSense devices.
Definition: rs.h:33
calibration_validator validator
Definition: stream.h:27
const stream_interface & source
Definition: stream.h:95
pose get_pose() const override
Definition: stream.h:42
float get_depth_scale() const override
Definition: stream.h:43
rs_intrinsics get_intrinsics() const override
Definition: stream.h:106
rs_frame_metadata
Types of value provided from the device with each frame.
Definition: rs.h:203
stream_interface(calibration_validator in_validator, rs_stream in_stream)
Definition: stream.h:16
unsigned long long get_frame_number() const override
Definition: stream.h:113
double get_frame_metadata(rs_frame_metadata frame_metadata) const override
Definition: stream.h:111
const stream_interface & to
Definition: stream.h:124
float3 position
Definition: types.h:112
virtual rs_format get_format() const =0
virtual float get_depth_scale() const =0
pose get_pose() const override
Definition: stream.h:73
rs_format get_format() const override
Definition: stream.h:108
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:726
std::vector< uint8_t > image
Definition: stream.h:125
bool supports_frame_metadata(rs_frame_metadata frame_metadata) const override
Definition: stream.h:112
long long get_frame_system_time() const override
Definition: stream.h:115
bool is_enabled() const override
Definition: stream.h:105
virtual double get_frame_metadata(rs_frame_metadata frame_metadata) const =0
long long get_frame_system_time() const override
Definition: stream.h:86


librealsense
Author(s): Sergey Dorodnicov , Mark Horn , Reagan Lopez
autogenerated on Fri Mar 13 2020 03:16:17