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);
112 if (
st.first ==
p->get_stream_type())
114 if (
st.second !=
p->get_stream_index())
123 config.
enable_stream(vp->get_stream_type(), vp->get_stream_index(), vp->get_width(), vp->get_height(), vp->get_format(), vp->get_framerate());
145 for (
size_t i = 0;
i <
dev->get_sensors_count(); ++
i)
147 auto&& sub =
dev->get_sensor(
i);
170 if (
st.first ==
r.stream)
172 if (
st.second > 0 &&
st.second !=
r.index)
break;
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());
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++)
320 return default_profiles;