forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource.h
64 lines (43 loc) · 1.81 KB
/
source.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2015 Intel Corporation. All Rights Reserved.
#pragma once
#include "core/processing.h"
#include "concurrency.h"
#include "archive.h"
#include "metadata-parser.h"
#include "frame-archive.h"
namespace librealsense
{
class option;
class LRS_EXTENSION_API frame_source
{
public:
frame_source(uint32_t max_publish_list_size = 16);
void init(std::shared_ptr<metadata_parser_map> metadata_parsers);
callback_invocation_holder begin_callback();
void reset();
std::shared_ptr<option> get_published_size_option();
frame_interface* alloc_frame(rs2_extension type, size_t size, frame_additional_data additional_data, bool requires_memory) const;
void set_callback(frame_callback_ptr callback);
frame_callback_ptr get_callback() const;
void invoke_callback(frame_holder frame) const;
void flush() const;
virtual ~frame_source() { flush(); }
double get_time() const { return _ts ? _ts->get_time() : 0; }
void set_sensor(const std::shared_ptr<sensor_interface>& s);
template<class T>
void add_extension(rs2_extension ex)
{
_archive[ex] = std::make_shared<frame_archive<T>>(&_max_publish_list_size, _ts, _metadata_parsers);
}
void set_max_publish_list_size(int qsize) {_max_publish_list_size = qsize; }
private:
friend class syncer_process_unit;
mutable std::mutex _callback_mutex;
std::map<rs2_extension, std::shared_ptr<archive_interface>> _archive;
std::atomic<uint32_t> _max_publish_list_size;
frame_callback_ptr _callback;
std::shared_ptr<platform::time_service> _ts;
std::shared_ptr<metadata_parser_map> _metadata_parsers;
};
}