Nimbin[12]?Linux & System / webcam-loopback-manipulation-screensharing-and-stuff / commits / fffb925

webcam-loopback-manipulation-screensharing-and-stuff git · main

vcam: v4l2 loopback with overlays, filters, OpenCV and RVM matting

webcam v4l2 opencv onnx c · first commit 2026-06-29 · last commit 2026-11-12 (11 days ago) · synced 1 hour ago · upstream: github.com/nimbin2/Webcam-Filter---ScreenSharing---and-Stuff

C 51.3% C++ 40.7% Markdown 6.9% Makefile 1%
git clone https://git.christianimmanuel.de/linux-system/webcam-loopback-manipulation-screensharing-and-stuff.gitwget https://git.christianimmanuel.de/linux-system/webcam-loopback-manipulation-screensharing-and-stuff/archive/webcam-loopback-manipulation-screensharing-and-stuff.tar.gz

Fix 'capture set' size parsing (vcam 1.1.1)

Christian Immanuel · 2026-11-12 16:38 · fffb925376fef428080351011e3793f2c0efd4ee

A bare fps token like "30" was first tried as WxH; the failed sscanf
still wrote 30 into the width, so "capture set YUYV 320x240 30" asked
for 30x240. Parse WxH into temporaries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MZiVJi7adqtP79SuimnK7v
 API.md         | 8 ++++----
 include/vcam.h | 4 ++--
 src/api.c      | 8 +++++---
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/API.md b/API.md
index 6823ee3..524d311 100644
--- a/API.md
+++ b/API.md
@@ -85,9 +85,9 @@ The whole state in one line.
 
 ```
 → status
-← OK version=1.1.0 build=abc1234 input=webcam output_w=1280 output_h=720 fps=30 share=yes … recording=no
+← OK version=1.1.1 build=abc1234 input=webcam output_w=1280 output_h=720 fps=30 share=yes … recording=no
 → status json
-← {"ok":true,"version":"1.1.0","build":"abc1234","input":"webcam","output_w":1280,…,"recording":false}
+← {"ok":true,"version":"1.1.1","build":"abc1234","input":"webcam","output_w":1280,…,"recording":false}
 ```
 
 Plain form: `key=value` pairs separated by spaces, with booleans as `yes` / `no`.
@@ -96,7 +96,7 @@ Values never contain spaces.
 
 | Key | Type | Meaning |
 |---|---|---|
-| `version` | string | vcam version, e.g. `1.1.0` |
+| `version` | string | vcam version, e.g. `1.1.1` |
 | `build` | string | md5 build hash (7 chars) |
 | `input` | string | `webcam`, or `none` if vcam was started with `--no-input` |
 | `output_w`, `output_h` | int | output frame size |
@@ -147,7 +147,7 @@ One value from `status`, in plain form.
 ### `version`
 
 ```
-→ version   ← OK vcam 1.1.0 (build abc1234)
+→ version   ← OK vcam 1.1.1 (build abc1234)
 ```
 
 ### `monitors`
diff --git a/include/vcam.h b/include/vcam.h
index 29e5f10..85362a6 100644
--- a/include/vcam.h
+++ b/include/vcam.h
@@ -337,11 +337,11 @@ const char *ipc_sock_path(void);   /* the path actually in use */
  * on the same socket: status, get, share, cam, monitors, version.
  * [Claude Opus 5.5]
  * ────────────────────────────────────────────── */
-#define VCAM_VERSION "1.1.0"
+#define VCAM_VERSION "1.1.1"
 
 /* Returns true if <cmd> was an API command (reply already sent). */
 bool        api_handle(int fd, const char *cmd, char **save, OverlayRegistry *reg);
-const char *api_version_string(void);   /* "vcam 1.1.0 (build abc1234)" — see API.md */
+const char *api_version_string(void);   /* "vcam 1.1.1 (build abc1234)" — see API.md */
 
 /* ──────────────────────────────────────────────
  * V4L2 capture
diff --git a/src/api.c b/src/api.c
index 38583dd..f4c07e9 100644
--- a/src/api.c
+++ b/src/api.c
@@ -14,7 +14,7 @@
  *
  *   status [json]              whole state: "OK k=v k=v ..." or one JSON line
  *   get <key>                  one value from status, e.g. "get cam_pos" → "OK br"
- *   version                    "OK vcam 1.1.0 (build abc1234)"  — full reference: API.md
+ *   version                    "OK vcam 1.1.1 (build abc1234)"  — full reference: API.md
  *   monitors                   one line per monitor: "OK <n> <name> WxH+X+Y"
  *
  *   share start [<n>|<name>|<WxH+X+Y>] [fit=stretch|contain]
@@ -811,9 +811,11 @@ static bool capture_handle(int fd, char **save)
             else if (!strncmp(t, "fps=", 4)) { fps = atoi(t + 4); if (fps <= 0) goto bad; continue; }
             else if (!strncmp(t, "fit=", 4)) { fit = parse_fit(t + 4); if (fit < 0) goto bad; continue; }
             else if (!strncmp(t, "res=", 4)) v = t + 4;
-            char tail;
+            /* parse into temporaries: a failed sscanf may still have
+             * written the first number (a bare fps "30" clobbered w) */
+            int pw, ph; char tail;
             if (!strcmp(v, "max"))                                   { w = h = -1; continue; }
-            if (sscanf(v, "%dx%d%c", &w, &h, &tail) == 2 && w > 0 && h > 0) continue;
+            if (sscanf(v, "%dx%d%c", &pw, &ph, &tail) == 2 && pw > 0 && ph > 0) { w = pw; h = ph; continue; }
             if (v == t && strspn(t, "0123456789") == strlen(t))      { fps = atoi(t); if (fps <= 0) goto bad; continue; }
             if (v == t)                                              { fmt = t; continue; }
         bad: