80 explicit McapReader(
const std::string& path,
bool read_only =
true,
bool try_to_fix =
false);
157 void jump(int64_t begin_time,
double rate,
int times,
bool force_to_play =
false)
override;
179 std::future<bool>
fix(
bool rebuild =
false)
override;
186 void tag(
const std::string& tag_name)
override;
229 [[nodiscard]] std::string
get_ser_type(
const std::string& url)
const override;
262 void update_status(
Status status);
268 void prepare_file(
void* file);
270 void open(
const std::string& path);
274 int get_reset_index(
const Config& config);
276 void read(
const Config& config);
278 std::unique_ptr<struct McapReaderImpl> impl_;
Abstract base class for VLink bag file playback with time-based seeking and rate control.
BagReader(const std::string &path, bool read_only=true, bool try_to_fix=false)
Constructs the reader for path.
Status
Playback state of the reader.
Definition bag_reader.h:109
std::function< void(bool is_interrupted)> FinishCallback
Callback fired when playback has finished (or was interrupted).
Definition bag_reader.h:225
std::function< void()> ReadyCallback
Callback fired when the reader has opened the file and is ready to start playing.
Definition bag_reader.h:218
std::function< void(Status status)> StatusCallback
Callback fired whenever the playback Status changes.
Definition bag_reader.h:213
std::function< void(int64_t microseconds_timestamp, const std::string &url, ActionType action_type, const Bytes &data)> OutputCallback
Callback type fired for each replayed message.
Definition bag_reader.h:205
void tag(const std::string &tag_name) override
Updates the tag name stored in the bag metadata.
SchemaType get_schema_type(const std::string &url) const override
Returns the coarse schema family for a given URL.
void register_status_callback(StatusCallback &&status_callback) override
Registers a callback fired whenever the playback status changes.
void register_finish_callback(FinishCallback &&finish_callback) override
Registers a callback fired when playback ends or is interrupted.
~McapReader() override
Destructor – stops playback and releases the MCAP file handle.
void on_end() override
Called from the loop thread just after the last task has been processed.
bool is_split_mode() const override
Returns true if the bag spans multiple split files.
void resume() override
Resumes a paused playback from the current position.
std::vector< SchemaData > detect_schema() override
Scans the MCAP file and returns all embedded schemas.
void play(const Config &config) override
Starts playback with the given configuration.
void stop() override
Stops playback and resets the reader to the beginning.
McapReader(const std::string &path, bool read_only=true, bool try_to_fix=false)
Constructs an McapReader for the given path.
std::future< bool > reindex() override
Rebuilds the index tables asynchronously.
int get_split_index() const override
Returns the zero-based index of the current split file being read.
void pause() override
Pauses playback at the current position.
std::string get_ser_type(const std::string &url) const override
Returns the serialisation type string for a given URL.
void jump(int64_t begin_time, double rate, int times, bool force_to_play=false) override
Seeks to begin_time and resumes playback.
void on_begin() override
Called from the loop thread just before the first task is processed.
void bind_plugin_interface(const std::shared_ptr< BagReaderPluginInterface > &plugin_interface) override
Attaches a BagReaderPluginInterface for custom URL/type conversion.
std::future< bool > check() override
Verifies the integrity of the MCAP file asynchronously.
bool is_jumping() const override
Returns true if a jump-to-timestamp seek is currently in progress.
void register_ready_callback(ReadyCallback &&ready_callback) override
Registers a callback fired when the reader is ready to start playing.
void register_output_callback(OutputCallback &&output_callback) override
Registers the callback that receives replayed messages.
Status get_status() const override
Returns the current playback status.
size_t get_max_task_count() const override
Returns the maximum queue depth.
const Info & get_info() const override
Returns the bag file metadata and per-URL statistics.
std::future< bool > fix(bool rebuild=false) override
Repairs a corrupt MCAP file asynchronously.
void pause_to_next() override
Advances one message while paused, then pauses again.
int64_t get_real_timestamp() const override
Returns the real elapsed wall-clock time since playback started.
int64_t get_timestamp() const override
Returns the current playback position as a recording-relative timestamp.
#define VLINK_EXPORT
Definition macros.h:85
#define VLINK_DISALLOW_COPY_AND_ASSIGN(classname)
Deletes the copy constructor and copy-assignment operator of classname.
Definition macros.h:184
SchemaType
Coarse runtime schema family used by discovery, bag metadata, and proxy routing.
Definition types.h:184
Playback configuration passed to play().
Definition bag_reader.h:181
Metadata extracted from the bag file header and index.
Definition bag_reader.h:122