VLink  2.0.0
A high-performance communication middleware
vcap_reader.h File Reference

Indexed playback of MCAP-format bag files (.vcap / .vcapx). More...

#include <future>
#include <memory>
#include <string>
#include <vector>
#include "./bag_reader.h"
Include dependency graph for vcap_reader.h:

Go to the source code of this file.

Classes

class  vlink::VCAPReader
 Concrete MCAP-format BagReader implementation with index-driven seek. More...
 

Namespaces

 

Detailed Description

Indexed playback of MCAP-format bag files (.vcap / .vcapx).

VCAPReader concretises BagReader for the MCAP container used by Foxglove Studio and other MCAP-compatible visualisers. Splits captured into .vcapx manifests are followed transparently; reindex() and fix() resolve to false because MCAP itself owns the footer index and does not support in-place repair through this implementation.

VCAP file format
+---------------------------------------------------------------+
| MCAP magic + header |
+---------------------------------------------------------------+
| schemas (encoded SchemaData) | <- detect_schema() enumerates these
+---------------------------------------------------------------+
| channels (topic url -> schema) |
+---------------------------------------------------------------+
| message chunks (optionally Zstd compressed) | <- streamed during play()
+---------------------------------------------------------------+
| attachments / metadata |
+---------------------------------------------------------------+
| summary section (message + chunk + channel + schema indexes) | <- used for fast seek / jump
+---------------------------------------------------------------+
| footer (offset of summary section) |
+---------------------------------------------------------------+
Reader states
+---------+ play() +---------+ pause() +---------+
| stopped | --------------> | playing | --------------> | paused |
+---------+ +---------+ +---------+
^ | ^ |
| | | resume() / pause_to_next()|
+--- stop() or EOF -------+ +--------------------------+
|
| jump(time, rate, times)
v
+---------+
| seeking | briefly during random access
+---------+
Example
auto reader = vlink::BagReader::create("/data/recording.vcap");
reader->register_output_callback([](const vlink::Frame& frame) {
VLOG_I(frame.timestamp, " ", frame.url, " bytes=", frame.data.size());
});
reader->async_run();
reader->play({});
#define VLOG_I(...)
Definition: logger.h:785
See also
BagReader, VDBReader