source.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 
6 #include "core/processing.h"
7 #include "concurrency.h"
8 #include "archive.h"
9 #include "metadata-parser.h"
10 #include "frame-archive.h"
11 
12 namespace librealsense
13 {
14  class option;
15 
17  {
18  public:
19  frame_source(uint32_t max_publish_list_size = 16);
20 
21  void init(std::shared_ptr<metadata_parser_map> metadata_parsers);
22 
23  callback_invocation_holder begin_callback();
24 
25  void reset();
26 
27  std::shared_ptr<option> get_published_size_option();
28 
29  frame_interface* alloc_frame(rs2_extension type, size_t size, frame_additional_data additional_data, bool requires_memory) const;
30 
31  void set_callback(frame_callback_ptr callback);
32  frame_callback_ptr get_callback() const;
33 
34  void invoke_callback(frame_holder frame) const;
35 
36  void flush() const;
37 
38  virtual ~frame_source() { flush(); }
39 
40  double get_time() const { return _ts ? _ts->get_time() : 0; }
41 
42  void set_sensor(const std::shared_ptr<sensor_interface>& s);
43 
44  template<class T>
46  {
47  _archive[ex] = std::make_shared<frame_archive<T>>(&_max_publish_list_size, _ts, _metadata_parsers);
48  }
49 
50  void set_max_publish_list_size(int qsize) {_max_publish_list_size = qsize; }
51 
52  private:
53  friend class syncer_process_unit;
54 
55  mutable std::mutex _callback_mutex;
56 
57  std::map<rs2_extension, std::shared_ptr<archive_interface>> _archive;
58 
59  std::atomic<uint32_t> _max_publish_list_size;
61  std::shared_ptr<platform::time_service> _ts;
62  std::shared_ptr<metadata_parser_map> _metadata_parsers;
63  };
64 }
frame_callback_ptr _callback
Definition: source.h:60
std::shared_ptr< platform::time_service > _ts
Definition: source.h:61
void add_extension(rs2_extension ex)
Definition: source.h:45
std::map< rs2_extension, std::shared_ptr< archive_interface > > _archive
Definition: source.h:57
GLdouble s
std::shared_ptr< rs2_frame_callback > frame_callback_ptr
Definition: src/types.h:1071
GLboolean reset
std::atomic< uint32_t > _max_publish_list_size
Definition: source.h:59
double get_time() const
Definition: source.h:40
#define LRS_EXTENSION_API
Definition: src/types.h:20
void set_max_publish_list_size(int qsize)
Definition: source.h:50
std::mutex _callback_mutex
Definition: source.h:55
Definition: getopt.h:41
GLsizeiptr size
unsigned int uint32_t
Definition: stdint.h:80
def callback(frame)
Definition: t265_stereo.py:91
void init(void)
Definition: boing.c:180
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition: rs_types.h:166
GLenum type
std::shared_ptr< metadata_parser_map > _metadata_parsers
Definition: source.h:62
virtual ~frame_source()
Definition: source.h:38


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:41