17 std::lock_guard<std::mutex>
lock(
_mtx);
27 std::lock_guard<std::mutex>
lock(
_mtx);
36 std::lock_guard<std::mutex>
lock(
_mtx);
43 std::lock_guard<std::mutex>
lock(
_mtx);
46 throw std::runtime_error(
"Configuring both device from file, and record to file is unsupported");
55 std::lock_guard<std::mutex>
lock(
_mtx);
58 throw std::runtime_error(
"Configuring both device from file, and record to file is unsupported");
66 std::lock_guard<std::mutex>
lock(
_mtx);
72 std::lock_guard<std::mutex>
lock(
_mtx);
79 if (itr->first.first == stream && (index == -1 || itr->first.second == index))
93 std::lock_guard<std::mutex>
lock(
_mtx);
105 for (
auto prof : profiles)
112 if (
st.first ==
p->get_stream_type())
114 if (
st.second !=
p->get_stream_index())
116 disable_stream =
true;
123 config.
enable_stream(vp->get_stream_type(), vp->get_stream_index(), vp->get_width(), vp->get_height(), vp->get_format(), vp->get_framerate());
125 config.
enable_stream(
p->get_stream_type(),
p->get_stream_index(), 0, 0,
p->get_format(),
p->get_framerate());
145 for (
size_t i = 0;
i < dev->get_sensors_count(); ++
i)
147 auto&& sub = dev->get_sensor(
i);
149 profiles.insert(profiles.end(),
p.begin(),
p.end());
170 if (
st.first ==
r.stream)
172 if (
st.second > 0 &&
st.second !=
r.index)
break;
173 disable_stream =
true;
177 if (disable_stream)
continue;
185 std::lock_guard<std::mutex>
lock(
_mtx);
190 if (requested_device !=
nullptr)
198 for (
auto dev_info : devs)
202 auto dev = dev_info->create_device();
206 catch (
const std::exception&
e)
208 LOG_DEBUG(
"Iterate available devices - config can not be resolved. " << e.what());
213 auto dev = pipe->wait_for_device(timeout);
220 throw std::runtime_error(
"Failed to resolve request. No device found that satisfies all requirements");
232 catch (
const std::exception&
e)
234 LOG_DEBUG(
"Config can not be resolved. " << e.what());
249 auto playback_devs =
d->get_device_data().playback_devices;
250 for (
auto&&
p : playback_devs)
252 if (
p.file_path == file)
254 return d->create_device();
259 return ctx->add_device(file)->create_device();
267 std::shared_ptr<device_interface>
dev;
272 catch (
const std::exception&
e)
274 throw std::runtime_error(
to_string() <<
"Failed to resolve request. Request to enable_device_from_file(\"" <<
_device_request.
filename <<
"\") was invalid, Reason: " << e.what());
281 throw std::runtime_error(
to_string() <<
"Failed to resolve request. " 284 "File does not contain a device with such serial");
291 throw std::runtime_error(
to_string() <<
"Failed to resolve request. " 294 "File contains device with different serial number (" << s <<
"\")");
313 for (
unsigned int i = 0;
i < dev->get_sensors_count();
i++)
315 auto&&
sensor = dev->get_sensor(
i);
320 return default_profiles;
static const textual_icon lock
void enable_streams(stream_profiles profiles)
std::shared_ptr< device_interface > get_or_add_playback_device(std::shared_ptr< context > ctx, const std::string &file)
bool can_resolve(std::shared_ptr< pipeline > pipe)
void enable_device(const std::string &serial)
void enable_device_from_file(const std::string &file, bool repeat_playback)
std::shared_ptr< device_interface > resolve_device_requests(std::shared_ptr< pipeline > pipe, const std::chrono::milliseconds &timeout)
void disable_stream(rs2_stream stream, int index=-1)
#define assert(condition)
GLint GLsizei GLsizei height
GLint GLint GLsizei GLint GLenum format
std::shared_ptr< profile > get_cached_resolved_profile()
std::string record_output
rs2_format
A stream's format identifies how binary data is encoded within a frame.
stream_profiles get_default_configuration(std::shared_ptr< device_interface > dev)
#define RS2_PRODUCT_LINE_ANY_INTEL
rs2_stream
Streams are different types of data provided by RealSense devices.
void disable_all_streams()
void enable_stream(rs2_stream stream, int index, uint32_t width, uint32_t height, rs2_format format, uint32_t fps)
#define RS2_PRODUCT_LINE_ANY
std::shared_ptr< profile > _resolved_profile
device_request _device_request
GLbitfield GLuint64 timeout
std::vector< std::shared_ptr< stream_profile_interface > > stream_profiles
std::vector< std::pair< rs2_stream, int > > _streams_to_disable
void enable_record_to_file(const std::string &file)
util::config filter_stream_requests(const stream_profiles &profiles) const
std::map< std::pair< rs2_stream, int >, stream_profile > _stream_requests
bool get_repeat_playback()
void enable_stream(rs2_stream stream, int index, uint32_t width, uint32_t height, rs2_format format, uint32_t framerate)
std::shared_ptr< profile > resolve(std::shared_ptr< pipeline > pipe, const std::chrono::milliseconds &timeout=std::chrono::milliseconds(0))
std::string to_string(T value)