Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
timestamps.h
Go to the documentation of this file.
1 #pragma once
2 #ifndef LIBREALSENSE_TIMESTAMPS_H
3 #define LIBREALSENSE_TIMESTAMPS_H
4 
5 #include "../include/librealsense/rs.h" // Inherit all type definitions in the public API
6 #include <deque>
7 #include <condition_variable>
8 #include <mutex>
9 #include <atomic>
10 
11 
12 namespace rsimpl
13 {
15  {
16  virtual ~frame_interface() {}
17  virtual double get_frame_metadata(rs_frame_metadata frame_metadata) const = 0;
19  virtual unsigned long long get_frame_number() const = 0;
20  virtual void set_timestamp(double new_ts) = 0;
22  virtual rs_stream get_stream_type()const = 0;
23  };
24 
25 
27  public:
29  bool pop_front_data();
30  bool erase(rs_timestamp_data data);
31  bool correct(frame_interface& frame);
32  size_t size();
33 
34  private:
35  std::deque<rs_timestamp_data> data_queue;
36  std::mutex mtx;
37 
38  };
39 
41  public:
43  virtual void on_timestamp(rs_timestamp_data data) = 0;
44  virtual void correct_timestamp(frame_interface& frame, rs_stream stream) = 0;
45  virtual void release() = 0;
46  };
47 
48 
50  public:
51  timestamp_corrector(std::atomic<uint32_t>* event_queue_size, std::atomic<uint32_t>* events_timeout);
52  ~timestamp_corrector() override;
53  void on_timestamp(rs_timestamp_data data) override;
54  void correct_timestamp(frame_interface& frame, rs_stream stream) override;
55  void release() override {delete this;}
56 
57  private:
58  void update_source_id(rs_event_source& source_id, const rs_stream stream);
59 
60  std::mutex mtx;
62  std::condition_variable cv;
63  std::atomic<uint32_t>* event_queue_size;
64  std::atomic<uint32_t>* events_timeout;
65 
66  };
67 
68 
69 
70 } // namespace rsimpl
71 #endif // LIBREALSENSE_TIMESTAMPS_H
rsimpl::concurrent_queue::push_back_data
void push_back_data(rs_timestamp_data data)
rs_stream
rs_stream
Streams are different types of data provided by RealSense devices.
Definition: rs.h:33
rs_frame_metadata
rs_frame_metadata
Types of value provided from the device with each frame.
Definition: rs.h:203
rs::stream
stream
Streams are different types of data provided by RealSense devices.
Definition: rs.hpp:24
rsimpl::frame_interface::get_stream_type
virtual rs_stream get_stream_type() const =0
rsimpl::timestamp_corrector::correct_timestamp
void correct_timestamp(frame_interface &frame, rs_stream stream) override
rsimpl::timestamp_corrector_interface
Definition: timestamps.h:40
rsimpl::timestamp_corrector::~timestamp_corrector
~timestamp_corrector() override
rsimpl::frame_interface::set_timestamp_domain
virtual void set_timestamp_domain(rs_timestamp_domain timestamp_domain)=0
rsimpl::timestamp_corrector::on_timestamp
void on_timestamp(rs_timestamp_data data) override
RS_EVENT_SOURCE_COUNT
Definition: rs.h:285
rsimpl::timestamp_corrector_interface::~timestamp_corrector_interface
virtual ~timestamp_corrector_interface()
Definition: timestamps.h:42
rsimpl::frame_interface::~frame_interface
virtual ~frame_interface()
Definition: timestamps.h:16
rsimpl::frame_interface::supports_frame_metadata
virtual bool supports_frame_metadata(rs_frame_metadata frame_metadata) const =0
rsimpl::concurrent_queue::size
size_t size()
rsimpl::frame_interface::get_frame_metadata
virtual double get_frame_metadata(rs_frame_metadata frame_metadata) const =0
rs_timestamp_domain
rs_timestamp_domain
Specifies the clock in relation to which the frame timestamp was measured.
Definition: rs.h:292
rsimpl
Definition: archive.h:12
rsimpl::frame_interface::get_frame_number
virtual unsigned long long get_frame_number() const =0
rsimpl::frame_interface
Definition: timestamps.h:14
rsimpl::timestamp_corrector
Definition: timestamps.h:49
rsimpl::concurrent_queue::pop_front_data
bool pop_front_data()
rsimpl::concurrent_queue
Definition: timestamps.h:26
rsimpl::timestamp_corrector_interface::correct_timestamp
virtual void correct_timestamp(frame_interface &frame, rs_stream stream)=0
rsimpl::timestamp_corrector_interface::release
virtual void release()=0
rsimpl::timestamp_corrector::timestamp_corrector
timestamp_corrector(std::atomic< uint32_t > *event_queue_size, std::atomic< uint32_t > *events_timeout)
rs::frame_metadata
frame_metadata
Types of value provided from the device with each frame.
Definition: rs.hpp:160
rsimpl::concurrent_queue::erase
bool erase(rs_timestamp_data data)
rsimpl::timestamp_corrector_interface::on_timestamp
virtual void on_timestamp(rs_timestamp_data data)=0
rs_timestamp_data
Timestamp data from the motion microcontroller.
Definition: rs.h:339
rsimpl::concurrent_queue::correct
bool correct(frame_interface &frame)
rsimpl::frame_interface::set_timestamp
virtual void set_timestamp(double new_ts)=0
rsimpl::timestamp_corrector::release
void release() override
Definition: timestamps.h:55
rs_event_source
rs_event_source
Source device that triggered a specific timestamp event from the motion module.
Definition: rs.h:276
rs::timestamp_domain
timestamp_domain
Specifies the clock in relation to which the frame timestamp was measured.
Definition: rs.hpp:242