VLink 2.0.0
A high-performance communication middleware
载入中...
搜索中...
未找到
bag_reader.h 文件参考

Abstract base class for VLink bag file playback with time-based seeking and rate control. 更多...

#include <cstdint>
#include <functional>
#include <future>
#include <memory>
#include <string>
#include <string_view>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "../base/bytes.h"
#include "../base/macros.h"
#include "../base/message_loop.h"
#include "../impl/types.h"
#include "./bag_reader_plugin_interface.h"
bag_reader.h 的引用(Include)关系图:
此图展示该文件被哪些文件直接或间接地引用了:

浏览该文件的源代码.

 Abstract VLink bag file player with time control, seeking, and integrity tools. 更多...
 Metadata extracted from the bag file header and index. 更多...
 Per-URL statistics extracted from the bag index. 更多...
 Playback configuration passed to play(). 更多...

命名空间

详细描述

Abstract base class for VLink bag file playback with time-based seeking and rate control.

BagReader is an abstract MessageLoop-based player that reads VLink bag files and replays recorded messages through an OutputCallback. Concrete implementations are DatabaseReader (SQLite-backed) and McapReader (MCAP-format).

Playback features:

  • Configurable playback rate (e.g., rate=2.0 for 2x speed).
  • Loop playback via the times field (kInfinite = -1 for endless loop).
  • Time-range filtering via begin_time and end_time.
  • Jump-to-timestamp seeking with optional forced play.
  • Per-URL output filtering via Config::filter_urls whitelist.
  • Background integrity check, reindex, and fix operations via std::future.
  • Plugin interface for custom URL/type mapping.
Playback example
auto reader = vlink::BagReader::create("/data/log.vdb");
reader->register_output_callback([](int64_t ts, const std::string& url,
vlink::ActionType action, const vlink::Bytes& data) {
VLOG_I("ts=", ts, " url=", url, " size=", data.size());
});
reader->async_run();
cfg.rate = 1.0;
reader->play(cfg);
#define VLOG_I(...)
定义 logger.h:850
注解
  • Call async_run() before play().
  • check(), reindex(), and fix() run on a background thread and return a std::future<bool> for result polling.
  • The file format is auto-detected from the extension by create() (.vcap / .vcapx -> McapReader, otherwise -> DatabaseReader).