mirror of
https://github.com/DeeJanuz/frametop.git
synced 2026-10-06 03:00:06 +02:00
The history of frame-hands (~/Desktop/Projects/frame-hands on the Frame), filtered to what moves: the camera broker (camd/), the tracker and its offline tools (trackd/), the shared file layouts (include/), the ncnn models, the analysis tools, and the calibration and model helpers they import from the Python prototype. The reverse-engineering notes, probes, camprobe, and the rest of the prototype stay in frame-hands. Unchanged here: the renames to ft- names and Frametop paths follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.3 KiB
C++
47 lines
1.3 KiB
C++
// Frames in from fh-camd's ring (camd/fhring.h), hands out to the hands file
|
|
// (include/fh_hands.h, read by Frametop's ft-screens).
|
|
#pragma once
|
|
|
|
#include "tracker.h"
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
extern "C" {
|
|
#include "../camd/fhring.h"
|
|
#include "../include/fh_hands.h"
|
|
}
|
|
|
|
class Ring {
|
|
public:
|
|
bool open(const char *path, std::string &err);
|
|
bool alive() const; // the writer's heartbeat is fresh
|
|
int cameras() const { return int(hdr_->ncams); }
|
|
const fh_ring_cam_t &camera(int i) const { return hdr_->cams[i]; }
|
|
uint64_t latest(int i) const;
|
|
// Copy frame n of camera i into out (width x height, tightly packed). False if it's
|
|
// gone or was being written.
|
|
bool read(int i, uint64_t n, std::vector<uint8_t> &out, fh_ring_slot_t *meta) const;
|
|
// Just frame n's slot header (capture time etc.), without copying the image.
|
|
bool meta(int i, uint64_t n, fh_ring_slot_t *meta) const;
|
|
|
|
private:
|
|
const uint8_t *map_ = nullptr;
|
|
const fh_ring_hdr_t *hdr_ = nullptr;
|
|
size_t len_ = 0;
|
|
};
|
|
|
|
class Publisher {
|
|
public:
|
|
bool open(std::string &err);
|
|
void write(const std::vector<const Hand *> &hands, uint64_t capture_ns);
|
|
|
|
private:
|
|
fh_hands_t *out_ = nullptr;
|
|
uint64_t seq_ = 0;
|
|
};
|
|
|
|
uint64_t mono_ns();
|
|
int64_t raw_minus_mono_ns(); // camera timestamps are CLOCK_MONOTONIC_RAW
|