Files
DeeJanuz--frametop/hands/track/io.h
T
DeeJanuzandClaude Opus 5.5 e2abaa06b6 Hands: fixes from the first headset test
- The runtime files move to /run/user/UID/frametop-hands/: the desktop
  session deletes /run/user/UID/frametop at every start.
- The cutout copy shader runs at highp: mediump (16-bit on Adreno)
  stepped 1.7 texels across a 3440-pixel screen.
- One hand no longer pinches both sides after its left/right call flips
  mid-pinch, and --pinch-palm-down (0.6) holds back pinches with the palm
  facing down (typing on a lap keyboard).
- ft-camd judges a colour frame fresh by its luma rows only, and logs
  per-buffer changes at stale colour frames with FT_CAMD_DEBUG=1.
- hands/run.sh caps skips the setcap when ft-camd already has them.
- The replay tool dumps poses (--poses), and its pinch events carry the
  hand id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 14:00:54 -06:00

53 lines
1.7 KiB
C++

// Frames in from ft-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
// /run/user/UID/frametop-hands, created private to the user if it's missing: where ft-camd's ring
// (FH_RING_NAME) and the hands and gestures files live. Not $XDG_RUNTIME_DIR: a terminal in
// the Frametop desktop has a private one of its own. And not /run/user/UID/frametop: that is
// the desktop session's private runtime folder, which it deletes whenever it starts.
std::string run_dir();