From f547fcc354671c672fffb20092e72d231e6ed1e4 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 2 Aug 2026 01:36:33 +0200 Subject: Add gsr-cli program that sends ipc commands to gpu-screen-recorder gsr-cli sends a command to the ipc socket of a running GPU Screen Recorder and exits with 0 when it replied with ok, printing the reason to stderr when it didn't, which means the commands don't have to be sent blindly like signals are. The status command checks if GPU Screen Recorder is running by connecting to the socket without sending a command, so it's also correct when a killed instance left the socket behind. The json helpers moved into src/json.c to be shared between the two programs. --- include/json.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 include/json.h (limited to 'include') diff --git a/include/json.h b/include/json.h new file mode 100644 index 0000000..3bf8a9e --- /dev/null +++ b/include/json.h @@ -0,0 +1,15 @@ +#ifndef GSR_JSON_H +#define GSR_JSON_H + +#include +#include +#include +#include "../external/sj.h" + +bool gsr_json_string_equals(const sj_Value *value, const char *str); +/* Fails if |value| is not a json number without a fractional part */ +bool gsr_json_number_to_int64(const sj_Value *value, int64_t *result); +/* An escaped string can become 6 times as large as |str|. The result is truncated when it doesn't fit in |buffer| */ +void gsr_json_escape_string(char *buffer, size_t buffer_size, const char *str); + +#endif /* GSR_JSON_H */ -- cgit v1.2.3