pyrs_record_playback.cpp
Go to the documentation of this file.
1 /* License: Apache 2.0. See LICENSE file in root directory.
2 Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
3 
4 #include "python.hpp"
5 #include "../include/librealsense2/hpp/rs_record_playback.hpp"
6 
7 void init_record_playback(py::module &m) {
9 // Not binding status_changed_callback, templated
10 
11  py::class_<rs2::playback, rs2::device> playback(m, "playback"); // No docstring in C++
12  playback.def(py::init<rs2::device>(), "device"_a)
13  .def("pause", &rs2::playback::pause, "Pauses the playback. Calling pause() in \"Paused\" status does nothing. If "
14  "pause() is called while playback status is \"Playing\" or \"Stopped\", the playback will not play until resume() is called.")
15  .def("resume", &rs2::playback::resume, "Un-pauses the playback. Calling resume() while playback status is \"Playing\" or \"Stopped\" does nothing.")
16  .def("file_name", &rs2::playback::file_name, "The name of the playback file.")
17  .def("get_position", &rs2::playback::get_position, "Retrieves the current position of the playback in the file in terms of time. Units are expressed in nanoseconds.")
18  .def("get_duration", &rs2::playback::get_duration, "Retrieves the total duration of the file.")
19  .def("seek", &rs2::playback::seek, "Sets the playback to a specified time point of the played data.", "time"_a)
20  .def("is_real_time", &rs2::playback::is_real_time, "Indicates if playback is in real time mode or non real time.")
21  .def("set_real_time", &rs2::playback::set_real_time, "Set the playback to work in real time or non real time. In real time mode, playback will "
22  "play the same way the file was recorded. If the application takes too long to handle the callback, frames may be dropped. In non real time "
23  "mode, playback will wait for each callback to finish handling the data before reading the next frame. In this mode no frames will be dropped, "
24  "and the application controls the framerate of playback via callback duration.", "real_time"_a)
25  // set_playback_speed?
26  .def("set_status_changed_callback", [](rs2::playback& self, std::function<void(rs2_playback_status)> callback) {
27  self.set_status_changed_callback(callback);
28  }, "Register to receive callback from playback device upon its status changes. Callbacks are invoked from the reading thread, "
29  "and as such any heavy processing in the callback handler will affect the reading thread and may cause frame drops/high latency.", "callback"_a)
30  .def("current_status", &rs2::playback::current_status, "Returns the current state of the playback device");
31  // Stop?
32 
33  py::class_<rs2::recorder, rs2::device> recorder(m, "recorder", "Records the given device and saves it to the given file as rosbag format.");
34  recorder.def(py::init<const std::string&, rs2::device>())
35  .def(py::init<const std::string&, rs2::device, bool>())
36  .def("pause", &rs2::recorder::pause, "Pause the recording device without stopping the actual device from streaming.")
37  .def("resume", &rs2::recorder::resume, "Unpauses the recording device, making it resume recording.");
38  // filename?
40 }
bool is_real_time() const
void seek(std::chrono::nanoseconds time)
const GLfloat * m
Definition: glext.h:6814
rs2_playback_status
def callback(frame)
Definition: t265_stereo.py:91
uint64_t get_position() const
void init_record_playback(py::module &m)
rs2_playback_status current_status() const
std::chrono::nanoseconds get_duration() const
void set_real_time(bool real_time) const
std::string file_name() const


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:39