Skip to content

Commit 140c75f

Browse files
committed
Set frame number
1 parent 86dd879 commit 140c75f

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

src/FramePlayer.cpp

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
#include <vrs/IndexRecord.h>
2525

2626
namespace rerun_vrs {
27+
struct FrameNumberDataLayout : public vrs::AutoDataLayout {
28+
vrs::DataPieceValue<uint64_t> frameNumber{"frame_number"};
29+
30+
vrs::AutoDataLayoutEnd endLayout;
31+
};
32+
2733
RerunFramePlayer::RerunFramePlayer(vrs::StreamId id, rerun::RecordingStream& rec)
2834
: id_{id}, rec_{rec} {}
2935

@@ -34,29 +40,26 @@ namespace rerun_vrs {
3440
return false;
3541

3642
rec_.set_time_seconds("timestamp", record.timestamp);
43+
if (record.recordType == vrs::Record::Type::DATA) {
44+
auto& config = getExpectedLayout<FrameNumberDataLayout>(layout, blockIndex);
45+
uint64_t frame_number;
46+
if (config.frameNumber.get(frame_number))
47+
rec_.set_time_sequence("frame_number", frame_number);
48+
}
3749

38-
/* std::cout << "onDataLayoutRead " << std::endl; */
39-
std::ostringstream buffer;
40-
layout.printLayoutCompact(buffer);
41-
/* std::cout << buffer.str() << std::endl; */
4250
// TODO write this information to a markdown file
51+
/* std::ostringstream buffer; */
52+
/* layout.printLayoutCompact(buffer); */
53+
/* std::cout << buffer.str() << std::endl; */
4354

44-
// TODO figure out image width and height ?
45-
46-
/* descriptions_.setDescription(record.recordType, blockIndex, text); */
47-
/* if (firstImage_ && record.recordType == Record::Type::CONFIGURATION) { */
48-
/* vrs::DataPieceString* deviceType =
49-
* layout.findDataPieceString("device_type"); */
50-
/* if (deviceType != nullptr) { */
51-
/* widget_->setDeviceType(deviceType->get()); */
52-
/* } */
53-
/* } */
5455
return true; // read next blocks, if any
5556
}
5657

5758
bool RerunFramePlayer::onImageRead(
58-
const vrs::CurrentRecord& record, size_t /*blockIndex*/, const vrs::ContentBlock& contentBlock
59+
const vrs::CurrentRecord& record, size_t /*blockIndex*/,
60+
const vrs::ContentBlock& contentBlock
5961
) {
62+
/* std::cout << "onImageRead" << std::endl; */
6063
/* std::cout << "onImageRead" << std::endl; */
6164
const auto& spec = contentBlock.image();
6265
std::shared_ptr<vrs::utils::PixelFrame> frame;

0 commit comments

Comments
 (0)