forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstream.cpp
120 lines (99 loc) · 2.83 KB
/
stream.cpp
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2015 Intel Corporation. All Rights Reserved.
#include "stream.h"
namespace librealsense
{
stream::stream(rs2_stream stream_type, int index)
: _index(index), _type(stream_type)
{
_uid = environment::get_instance().generate_stream_id();
}
int stream::get_stream_index() const
{
return _index;
}
void stream::set_stream_index(int index)
{
_index = index;
}
rs2_stream stream::get_stream_type() const
{
return _type;
}
void stream::set_stream_type(rs2_stream stream)
{
_type = stream;
}
stream_profile_base::stream_profile_base(platform::stream_profile sp)
: backend_stream_profile(std::move(sp))
{
_c_ptr = &_c_wrapper;
_c_wrapper.profile = this;
_c_wrapper.clone = nullptr;
}
int stream_profile_base::get_stream_index() const
{
return _index;
}
void stream_profile_base::set_stream_index(int index)
{
_index = index;
}
rs2_stream stream_profile_base::get_stream_type() const
{
return _type;
}
void stream_profile_base::set_stream_type(rs2_stream stream)
{
_type = stream;
}
rs2_format stream_profile_base::get_format() const
{
return _format;
}
void stream_profile_base::set_format(rs2_format format)
{
_format = format;
}
uint32_t stream_profile_base::get_framerate() const
{
return _framerate;
}
void stream_profile_base::set_framerate(uint32_t val)
{
_framerate = val;
}
int stream_profile_base::get_tag() const
{
return _tag;
}
void stream_profile_base::tag_profile(int tag)
{
_tag = tag;
}
std::shared_ptr<stream_profile_interface> stream_profile_base::clone() const
{
auto res = std::make_shared<stream_profile_base>(get_backend_profile());
res->set_unique_id(environment::get_instance().generate_stream_id());
res->set_framerate(get_framerate());
return res;
}
rs2_stream_profile* stream_profile_base::get_c_wrapper() const
{
return _c_ptr;
}
void stream_profile_base::set_c_wrapper(rs2_stream_profile* wrapper)
{
_c_ptr = wrapper;
}
void stream_profile_base::create_snapshot(std::shared_ptr<stream_profile_interface>& snapshot) const
{
auto ptr = std::const_pointer_cast<stream_interface>(shared_from_this());
snapshot = std::dynamic_pointer_cast<stream_profile_interface>(ptr);
}
void stream_profile_base::enable_recording(std::function<void(const stream_profile_interface&)> record_action)
{
//TODO: implement or remove inheritance from recordable<T>
throw not_implemented_exception(__FUNCTION__);
}
}