14 m_is_recording(false),
15 m_parent_device(device),
16 m_is_sensor_hooked(false),
17 m_register_notification_to_base(true),
18 m_before_start_callback_token(-1)
50 if (m_sensor.is_streaming())
60 return m_sensor.get_stream_profiles(tag);
65 m_sensor.open(requests);
75 return m_sensor.get_option(
id);
79 return m_sensor.get_option(
id);
83 return m_sensor.get_info(info);
87 return m_sensor.supports_info(info);
91 return m_sensor.supports_option(
id);
98 m_sensor.register_notifications_callback(
std::move(callback));
114 m_sensor.register_notifications_callback(
std::move(from_live_sensor));
119 return m_sensor.get_notifications_callback();
124 m_sensor.start(callback);
132 return m_sensor.is_streaming();
135 template <rs2_extension E,
typename P>
139 auto ptr = As<EXT_TYPE>(
p);
147 record_snapshot<EXT_TYPE>(E, ext1);
164 switch (extension_type)
202 return m_sensor.get_active_streams();
215 template <
typename T>
220 auto ext_snapshot = As<extension_snapshot>(
snapshot);
233 std::string msg =
to_string() <<
"Stopping recording for sensor (streaming will continue). (Error: " << error_msg <<
")";
247 return m_sensor.get_recommended_processing_blocks();
302 return std::make_shared<frame_holder_callback>(record_cb);
322 if (!m_sensor.supports_option(
id))
334 auto& opt = m_sensor.get_option(
id);
337 std::shared_ptr<librealsense::option> option_snapshot;
344 catch (
const std::exception&
e)
346 LOG_ERROR(
"Failed to enable recording for option " <<
get_string(
id) <<
", Error: " << e.what());
354 auto&
option = m_sensor.get_option(
id);
360 auto streams = m_sensor.get_active_streams();
366 std::shared_ptr<stream_profile_interface>
snapshot;
367 stream->create_snapshot(snapshot);
369 if (Is<librealsense::video_stream_profile_interface>(
stream))
371 else if (Is<librealsense::motion_stream_profile_interface>(
stream))
373 else if (Is<librealsense::pose_stream_profile_interface>(
stream))
376 throw std::runtime_error(
"Unsupported stream");
378 on_extension_change(extension_type, std::dynamic_pointer_cast<extension_snapshot>(snapshot));
stream_profiles get_active_streams() const override
private const recordable< T > & snapshot
static const textual_icon lock
rs2_camera_info
Read-only strings that can be queried from the device. Not all information attributes are available o...
option & get_option(rs2_option id) override
boost_foreach_argument_dependent_lookup_hack tag
const char * get_string(rs2_rs400_visual_preset value)
bool m_register_notification_to_base
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
virtual processing_blocks get_recommended_processing_blocks() const override
std::shared_ptr< T > As(std::shared_ptr< P > ptr)
const librealsense::notification * _notification
std::shared_ptr< rs2_frame_callback > frame_callback_ptr
frame_callback_ptr m_frame_callback
int m_before_start_callback_token
void start(frame_callback_ptr callback) override
void stop_with_error(const std::string &message)
void hook_sensor_callbacks()
librealsense::notifications_callback_ptr m_user_notification_callback
virtual void create_snapshot(std::shared_ptr< option > &snapshot) const
GLsizei const GLchar *const * string
stream_profiles get_stream_profiles(int tag=profile_tag::PROFILE_TAG_ANY) const override
virtual void enable_recording(std::function< void(const T &)> recording_function)=0
void record_frame(frame_holder holder)
int register_before_streaming_changes_callback(std::function< void(bool)> callback) override
void open(const stream_profiles &requests) override
void register_option(rs2_option id, std::shared_ptr< option > option)
def info(name, value, persistent=False)
virtual void create_snapshot(std::shared_ptr< T > &snapshot) const =0
device_interface & get_device() override
frame_callback_ptr m_original_callback
notifications_callback_ptr get_notifications_callback() const override
int get_unique_id() const override
std::atomic_bool m_is_recording
bool supports_option(rs2_option id) const override
std::shared_ptr< rs2_notifications_callback > notifications_callback_ptr
const std::string & get_info(rs2_camera_info info) const override
bool extend_to_aux(P *p, void **ext)
void unregister_before_start_callback(int token) override
signal< record_sensor, frame_holder > on_frame
bool is_streaming() const override
frame_callback_ptr wrap_frame_callback(frame_callback_ptr callback)
void register_notifications_callback(notifications_callback_ptr callback) override
signal< record_sensor, rs2_extension, std::shared_ptr< extension_snapshot > > on_extension_change
record_sensor(device_interface &device, sensor_interface &sensor)
signal< record_sensor, const notification & > on_notification
void swap(nlohmann::json &j1, nlohmann::json &j2) noexcept(is_nothrow_move_constructible< nlohmann::json >::value andis_nothrow_move_assignable< nlohmann::json >::value)
exchanges the values of two JSON objects
std::vector< std::shared_ptr< stream_profile_interface >> stream_profiles
frame_callback_ptr get_frames_callback() const override
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
void set_frames_callback(frame_callback_ptr callback) override
void enable_sensor_options_recording()
bool extend_to(rs2_extension extension_type, void **ext) override
void disable_sensor_options_recording()
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT
std::set< int > m_recorded_streams_ids
void disable_sensor_hooks()
void enable_sensor_hooks()
bool supports_info(rs2_camera_info info) const override
void unhook_sensor_callbacks()
std::set< rs2_option > m_recording_options
device_interface & m_parent_device
struct rs2_frame rs2_frame
std::string to_string(T value)