Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
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 
11 namespace librealsense
12 {
13  class option;
14 
16  {
17  public:
18  frame_source(uint32_t max_publish_list_size = 16);
19 
20  void init(std::shared_ptr<metadata_parser_map> metadata_parsers);
21 
23 
24  void reset();
25 
26  std::shared_ptr<option> get_published_size_option();
27 
28  frame_interface* alloc_frame(rs2_extension type, size_t size, frame_additional_data additional_data, bool requires_memory) const;
29 
30  void set_callback(frame_callback_ptr callback);
32 
34 
35  void flush() const;
36 
37  virtual ~frame_source() { flush(); }
38 
39  double get_time() const { return _ts ? _ts->get_time() : 0; }
40 
41  void set_sensor(std::shared_ptr<sensor_interface> s);
42 
43  private:
44  friend class syncer_process_unit;
45 
46  mutable std::mutex _callback_mutex;
47 
48  std::map<rs2_extension, std::shared_ptr<archive_interface>> _archive;
49 
50  std::atomic<uint32_t> _max_publish_list_size;
51  frame_callback_ptr _callback;
52  std::shared_ptr<platform::time_service> _ts;
53  };
54 }
Definition: streaming.h:63
void init(std::shared_ptr< metadata_parser_map > metadata_parsers)
std::shared_ptr< rs2_frame_callback > frame_callback_ptr
Definition: types.h:896
Definition: options.h:20
Definition: archive.h:20
Definition: syncer-processing-block.h:17
frame_interface * alloc_frame(rs2_extension type, size_t size, frame_additional_data additional_data, bool requires_memory) const
std::shared_ptr< option > get_published_size_option()
Definition: archive.h:63
Definition: algo.h:16
frame_callback_ptr get_callback() const
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition: rs_types.h:94
frame_source(uint32_t max_publish_list_size=16)
Definition: backend.h:377
Definition: types.h:637
void set_callback(frame_callback_ptr callback)
void set_sensor(std::shared_ptr< sensor_interface > s)
virtual ~frame_source()
Definition: source.h:37
double get_time() const
Definition: source.h:39
void invoke_callback(frame_holder frame) const
callback_invocation_holder begin_callback()
Definition: source.h:15