composite-frame.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2021 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
6 #include "frame.h"
7 
8 namespace librealsense {
9 class composite_frame : public frame
10 {
11 public:
13  : frame()
14  {
15  }
16 
17  frame_interface * get_frame( int i ) const
18  {
19  auto frames = get_frames();
20  return frames[i];
21  }
22 
23  frame_interface ** get_frames() const { return (frame_interface **)data.data(); }
24 
25  const frame_interface * first() const { return get_frame( 0 ); }
26  frame_interface * first() { return get_frame( 0 ); }
27 
28  void keep() override
29  {
30  auto frames = get_frames();
31  for( size_t i = 0; i < get_embedded_frames_count(); i++ )
32  if( frames[i] )
33  frames[i]->keep();
34  frame::keep();
35  }
36 
37  size_t get_embedded_frames_count() const { return data.size() / sizeof( rs2_frame * ); }
38 
39  // In the next section we make the composite frame "look and feel" like the first of its
40  // children
41  frame_header const & get_header() const override { return first()->get_header(); }
43  {
44  return first()->find_metadata( frame_metadata, p_output_value );
45  }
46  int get_frame_data_size() const override { return first()->get_frame_data_size(); }
47  const uint8_t * get_frame_data() const override { return first()->get_frame_data(); }
48  rs2_time_t get_frame_timestamp() const override { return first()->get_frame_timestamp(); }
50  {
52  }
53  unsigned long long get_frame_number() const override
54  {
55  if( first() )
56  return first()->get_frame_number();
57  else
58  return frame::get_frame_number();
59  }
60  rs2_time_t get_frame_system_time() const override { return first()->get_frame_system_time(); }
61  std::shared_ptr< sensor_interface > get_sensor() const override
62  {
63  return first()->get_sensor();
64  }
65 };
66 
68 } // namespace librealsense
librealsense::frame_interface::find_metadata
virtual bool find_metadata(rs2_frame_metadata_value, rs2_metadata_type *p_output_value) const =0
librealsense
Definition: algo.h:18
uint8_t
unsigned char uint8_t
Definition: stdint.h:78
librealsense::MAP_EXTENSION
MAP_EXTENSION(RS2_EXTENSION_AUTO_CALIBRATED_DEVICE, auto_calibrated_interface)
test-projection-from-recording.frames
frames
Definition: test-projection-from-recording.py:30
data
Definition: parser.hpp:153
rs2_frame
struct rs2_frame rs2_frame
Definition: rs_types.h:230
librealsense::composite_frame::get_frame_data_size
int get_frame_data_size() const override
Definition: composite-frame.h:46
librealsense::composite_frame::get_header
const frame_header & get_header() const override
Definition: composite-frame.h:41
librealsense::frame_interface::get_frame_data_size
virtual int get_frame_data_size() const =0
RS2_EXTENSION_COMPOSITE_FRAME
@ RS2_EXTENSION_COMPOSITE_FRAME
Definition: rs_types.h:146
librealsense::frame_interface::get_header
virtual const frame_header & get_header() const =0
librealsense::frame_interface::get_frame_number
virtual unsigned long long get_frame_number() const =0
librealsense::frame_interface
Definition: frame-interface.h:20
librealsense::composite_frame::keep
void keep() override
Definition: composite-frame.h:28
frame_metadata
Definition: unit-tests-common.h:237
librealsense::composite_frame::get_sensor
std::shared_ptr< sensor_interface > get_sensor() const override
Definition: composite-frame.h:61
librealsense::frame_interface::get_frame_data
virtual const uint8_t * get_frame_data() const =0
librealsense::composite_frame::first
frame_interface * first()
Definition: composite-frame.h:26
i
int i
Definition: rs-pcl-color.cpp:54
librealsense::frame::keep
void keep() override
Definition: frame.cpp:120
librealsense::composite_frame::get_frame_number
unsigned long long get_frame_number() const override
Definition: composite-frame.h:53
librealsense::frame_interface::get_frame_system_time
virtual rs2_time_t get_frame_system_time() const =0
librealsense::frame_header
Definition: frame-header.h:18
rs2_metadata_type
long long rs2_metadata_type
Definition: rs_types.h:272
librealsense::composite_frame::get_frame_system_time
rs2_time_t get_frame_system_time() const override
Definition: composite-frame.h:60
librealsense::composite_frame::get_frame_data
const uint8_t * get_frame_data() const override
Definition: composite-frame.h:47
librealsense::composite_frame
Definition: composite-frame.h:9
librealsense::composite_frame::find_metadata
bool find_metadata(rs2_frame_metadata_value frame_metadata, rs2_metadata_type *p_output_value) const override
Definition: composite-frame.h:42
librealsense::frame::get_frame_number
unsigned long long get_frame_number() const override
Definition: frame.cpp:177
librealsense::composite_frame::composite_frame
composite_frame()
Definition: composite-frame.h:12
frame.h
librealsense::frame
Definition: frame.h:19
librealsense::composite_frame::get_embedded_frames_count
size_t get_embedded_frames_count() const
Definition: composite-frame.h:37
librealsense::composite_frame::first
const frame_interface * first() const
Definition: composite-frame.h:25
librealsense::composite_frame::get_frame
frame_interface * get_frame(int i) const
Definition: composite-frame.h:17
librealsense::composite_frame::get_frame_timestamp_domain
rs2_timestamp_domain get_frame_timestamp_domain() const override
Definition: composite-frame.h:49
rs2_time_t
double rs2_time_t
Definition: rs_types.h:271
librealsense::frame_interface::get_frame_timestamp
virtual rs2_time_t get_frame_timestamp() const =0
rs2_timestamp_domain
rs2_timestamp_domain
Specifies the clock in relation to which the frame timestamp was measured.
Definition: rs_frame.h:19
librealsense::frame_interface::get_frame_timestamp_domain
virtual rs2_timestamp_domain get_frame_timestamp_domain() const =0
rs2_frame_metadata_value
rs2_frame_metadata_value
Per-Frame-Metadata is the set of read-only properties that might be exposed for each individual frame...
Definition: rs_frame.h:29
librealsense::composite_frame::get_frame_timestamp
rs2_time_t get_frame_timestamp() const override
Definition: composite-frame.h:48
librealsense::frame_interface::get_sensor
virtual std::shared_ptr< sensor_interface > get_sensor() const =0
librealsense::composite_frame::get_frames
frame_interface ** get_frames() const
Definition: composite-frame.h:23


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Fri Aug 2 2024 08:30:01