feat: add status FIFO and parse status line in client

This commit is contained in:
Loic Coenen
2026-05-14 14:56:11 +00:00
committed by Loic Coenen (aider)
parent 791744beeb
commit 5341cb676a
3 changed files with 65 additions and 1 deletions

View File

@@ -63,6 +63,28 @@ typedef struct {
} FuzzySearch;
static FuzzySearch fuzzy_search = {0};
/* ---------- Parse status line from engine status FIFO ---------- */
typedef enum { STATE_IDLE, STATE_RECORD, STATE_LOOPING, STATE_PAUSED } ChannelState;
bool parse_status_line(const char *line, int *ch, int *scene, ChannelState *state) {
int sta;
if (sscanf(line, "CH=%d SC=%d STATE=%d", ch, scene, &sta) == 3) {
if (sta >= 0 && sta <= 3) {
*state = (ChannelState)sta;
return true;
}
}
/* try text-based format */
char state_str[32];
if (sscanf(line, "CH=%d SC=%d STATE=%31s", ch, scene, state_str) != 3)
return false;
if (strcmp(state_str, "IDLE") == 0) { *state = STATE_IDLE; return true; }
if (strcmp(state_str, "RECORD") == 0) { *state = STATE_RECORD; return true; }
if (strcmp(state_str, "LOOPING") == 0) { *state = STATE_LOOPING; return true; }
if (strcmp(state_str, "PAUSED") == 0) { *state = STATE_PAUSED; return true; }
return false;
}
/* ---------- State to color (dummy: all white) ---------- */
static int state_to_color(ClipState s) { (void)s; return COLOR_EMPTY; }