14 class archive_interface;
15 class md_attribute_parser_base;
20 typedef std::multimap<rs2_frame_metadata_value, std::shared_ptr<md_attribute_parser_base>>
metadata_parser_map;
49 unsigned long long in_frame_number,
50 double in_system_time,
55 unsigned long long last_frame_number,
58 : timestamp(in_timestamp),
59 frame_number(in_frame_number),
60 system_time(in_system_time),
61 metadata_size(md_size),
62 backend_timestamp(backend_time),
63 last_timestamp(last_timestamp),
64 last_frame_number(last_frame_number),
65 is_blocking(in_is_blocking),
66 raw_size(transmitted_size)
81 virtual std::shared_ptr<metadata_parser_map> get_md_parsers()
const = 0;
83 virtual void flush() = 0;
92 std::atomic<uint32_t>* in_max_frame_queue_size,
93 std::shared_ptr<platform::time_service> ts,
94 std::shared_ptr<metadata_parser_map> parsers);
102 std::shared_ptr<metadata_parser_map> metadata_parsers =
nullptr;
103 explicit frame() : ref_count(0), owner(nullptr), on_release(),_kept(false) {}
106 : ref_count(r.ref_count.exchange(0)), owner(r.owner), on_release(), _kept(r._kept.exchange(false))
109 if (owner) metadata_parsers = owner->get_md_parsers();
119 _kept = r.
_kept.exchange(
false);
123 if (owner) metadata_parsers = owner->get_md_parsers();
131 int get_frame_data_size()
const override;
132 const byte* get_frame_data()
const override;
133 rs2_time_t get_frame_timestamp()
const override;
136 unsigned long long get_frame_number()
const override;
142 rs2_time_t get_frame_system_time()
const override;
147 rs2_time_t get_frame_callback_start_time_point()
const override;
148 void update_frame_callback_start_ts(
rs2_time_t ts)
override;
150 void acquire()
override { ref_count.fetch_add(1); }
151 void release()
override;
152 void keep()
override;
154 frame_interface* publish(std::shared_ptr<archive_interface> new_owner)
override;
161 std::shared_ptr<sensor_interface> get_sensor()
const override;
162 void set_sensor(std::shared_ptr<sensor_interface>
s)
override;
166 void log_callback_end(
rs2_time_t timestamp)
const override;
177 std::shared_ptr<archive_interface>
owner;
182 std::shared_ptr<stream_profile_interface>
stream;
190 size_t get_vertex_count()
const;
191 float2* get_texture_coordinates();
221 for (
size_t i = 0;
i < get_embedded_frames_count();
i++)
231 return first()->get_frame_metadata(frame_metadata);
235 return first()->supports_frame_metadata(frame_metadata);
239 return first()->get_frame_data_size();
243 return first()->get_frame_data();
247 return first()->get_frame_timestamp();
251 return first()->get_frame_timestamp_domain();
256 return first()->get_frame_number();
262 return first()->get_frame_system_time();
264 std::shared_ptr<sensor_interface>
get_sensor()
const override 266 return first()->get_sensor();
276 :
frame(), _width(0), _height(0), _bpp(0), _stride(0)
313 if (_original) _original->keep();
322 return((
depth_frame*)_original.frame)->get_distance(x, y);
325 switch (get_bpp() / 8)
327 case 1: pixel = get_frame_data()[y*get_width() +
x];
break;
328 case 2: pixel =
reinterpret_cast<const uint16_t*
>(get_frame_data())[y*get_width() +
x];
break;
329 case 4: pixel =
reinterpret_cast<const uint32_t*
>(get_frame_data())[y*get_width() +
x];
break;
330 case 8: pixel =
reinterpret_cast<const uint64_t*
>(get_frame_data())[y*get_width() +
x];
break;
331 default:
throw std::runtime_error(
to_string() <<
"Unrecognized depth format " <<
int(get_bpp() / 8) <<
" bytes per pixel");
334 return pixel * get_units();
340 _depth_units = query_units(get_sensor());
341 return _depth_units.value();
358 if (sensor !=
nullptr)
370 auto extendable = As<librealsense::extendable_interface>(
sensor);
377 catch (
const std::exception&
e)
379 LOG_ERROR(
"Failed to query depth units from sensor. " << e.what());
383 LOG_ERROR(
"Failed to query depth units from sensor");
416 if (sensor !=
nullptr)
420 auto stereo_sensor = As<librealsense::depth_stereo_sensor>(
sensor);
421 if (stereo_sensor !=
nullptr)
423 return stereo_sensor->get_stereo_baseline_mm();
428 auto extendable = As<librealsense::extendable_interface>(
sensor);
431 return stereo_sensor->get_stereo_baseline_mm();
435 catch (
const std::exception&
e)
437 LOG_ERROR(
"Failed to query stereo baseline from sensor. " << e.what());
441 LOG_ERROR(
"Failed to query stereo baseline from sensor");
const frame_interface * first() const
std::shared_ptr< stream_profile_interface > get_stream() const override
float4 get_rotation() const
void disable_continuation() override
uint32_t mapper_confidence
frame_interface * get_frame(int i) const
float3 get_acceleration() const
frame_interface * publish(std::shared_ptr< archive_interface > new_owner) override
void export_to_ply(Mat points, Mat normals)
std::atomic< int > ref_count
int get_frame_data_size() const override
std::shared_ptr< archive_interface > make_archive(rs2_extension type, std::atomic< uint32_t > *in_max_frame_queue_size, std::shared_ptr< platform::time_service > ts, std::shared_ptr< metadata_parser_map > parsers)
rs2_time_t get_frame_system_time() const override
const uint8_t MAX_META_DATA_SIZE
rs2_time_t frame_callback_started
unsigned long long get_frame_number() const override
std::shared_ptr< stream_profile_interface > stream
std::shared_ptr< archive_interface > owner
void mark_fixed() override
float3 get_angular_velocity() const
optional_value< float > _depth_units
void set_timestamp_domain(rs2_timestamp_domain timestamp_domain) override
GLsizei const GLchar *const * string
size_t get_embedded_frames_count() const
void set_original(frame_holder h)
void unpublish() override
archive_interface * get_owner() const override
rs2_time_t last_timestamp
#define LRS_EXTENSION_API
GLfloat GLfloat GLfloat GLfloat h
uint32_t tracker_confidence
frame & operator=(frame &&r)
frame_additional_data additional_data
float3 get_angular_acceleration() const
virtual float get_depth_scale() const =0
float get_distance(int x, int y) const
void set_timestamp(double new_ts) override
float3 get_translation() const
std::shared_ptr< sensor_interface > get_sensor() const override
frame_interface ** get_frames() const
std::vector< rs2::frame > get_frames(std::vector< rs2::sensor > sensors)
void set_stream(std::shared_ptr< stream_profile_interface > sp) override
std::multimap< rs2_frame_metadata_value, std::shared_ptr< md_attribute_parser_base > > metadata_parser_map
rs2_time_t backend_timestamp
GLint GLsizei GLsizei height
rs2_time_t get_frame_timestamp() const override
float3 get_velocity() const
void attach_continuation(frame_continuation &&continuation) override
unsigned __int64 uint64_t
unsigned long long frame_number
void set_blocking(bool state) override
GLdouble GLdouble GLint stride
static float query_units(const std::shared_ptr< sensor_interface > &sensor)
bool supports_frame_metadata(const rs2_frame_metadata_value &frame_metadata) const override
uint32_t get_tracker_confidence() const
const byte * get_frame_data() const override
std::shared_ptr< metadata_parser_map > metadata_parsers
uint32_t get_mapper_confidence() const
frame_continuation on_release
float get_stereo_baseline(void) const
unsigned long long get_frame_number() const override
frame_additional_data(double in_timestamp, unsigned long long in_frame_number, double in_system_time, uint8_t md_size, const uint8_t *md_buf, double backend_time, rs2_time_t last_timestamp, unsigned long long last_frame_number, bool in_is_blocking, uint32_t transmitted_size=0)
void assign(int width, int height, int stride, int bpp)
std::weak_ptr< sensor_interface > sensor
frame_interface * publish(std::shared_ptr< archive_interface > new_owner) override
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
rs2_metadata_type get_frame_metadata(const rs2_frame_metadata_value &frame_metadata) const override
bool is_blocking() const override
long long rs2_metadata_type
rs2_timestamp_domain timestamp_domain
bool is_fixed() const override
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT
float3 angular_acceleration
frame_interface * first()
static float query_stereo_baseline(const std::shared_ptr< sensor_interface > &sensor)
rs2_timestamp_domain get_frame_timestamp_domain() const override
std::array< uint8_t, MAX_META_DATA_SIZE > metadata_blob
rs2_frame_metadata_value
Per-Frame-Metadata is the set of read-only properties that might be exposed for each individual frame...
MAP_EXTENSION(RS2_EXTENSION_POINTS, librealsense::points)
struct rs2_frame rs2_frame
void copy(void *dst, void const *src, size_t size)
unsigned long long last_frame_number
std::string to_string(T value)
rs2_timestamp_domain
Specifies the clock in relation to which the frame timestamp was measured.