Repository navigation
Description
Unit
Port the string codec of the window setting in libobs/util/windows/window-helpers.c.h to rust/obs-util, in the existing window_match module. Window capture and game capture save the chosen window as one string, title:class:exe, each part escaped (# as #22, then : as #3A), and split it back when the source loads:
encode_dstr(7-11): replace-all#with#22, then:with#3A;decode_str(13-20): a copy, then#3Aback to:, then#22back to#;ms_build_window_strings(22-43, EXPORT inwindow-helpers.h): all three outputs NULL first, a NULL string returns at once,strlist_split(str, ':', true)keeps empty fields, fields 0, 1 and 2 decode as the title, class and exe, later fields are ignored, and with fewer than three fields all three stay NULL.
The core moves into libobs/util/windows/window-match.c.h (the ported-window-match+ group) as three hidden functions over bytes and lengths: ms_window_match_encode (snprintf-style, returns the length needed), ms_window_match_decode (in place, returns the new length) and ms_window_match_split (the first three fields' offsets and lengths, false with fewer than three).
These stay in C: every bmalloc, bstrndup, bfree and dstr_* call, add_window's description and join, insert_preserved_val and ms_check_window_property_setting with their obs_property_list_* calls.
Phase and position
Phase 6, Windows host code, the second unit beside the window match decisions (#3154, merged in #3156). Tracking: #4.
Dependencies and existing tests
- Builds on the landed
window_matchmodule and itsported-window-match+group; no open PR toucheswindow-helpers.c.h,window-match.*or the module. - Real libobs: no test reaches the codec;
window-helpers.c.hbuilds only on Windows. - Characterization:
test_window_match_stepscovers the decisions only; the codec's cases are added to it first. The moved code includes no Windows header, so it runs on every OS.
Notes
One PR, separate commits: the behaviour-neutral move, characterization ("", ":", "::", "a:b:c", "a:b:c:d", "a:b", "#", "#22", "#3A", "#223A", "##3A22", "#2222", lower-case "x#3a", NULL, and round trips), RED, GREEN, Tier 3 (random byte strings rich in #, :, 2, 3, A, and the round-trip property), docs.
No intentional difference is expected. dstr_replace replaces non-overlapping matches scanning forward and never rescans its own output ("#2222" decodes to "#22"); the Rust works the same way, on bytes rather than UTF-8. ms_build_window_strings stays EXPORT and its NULL outputs ("no saved window") stay exactly as they are.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Nov 1, 2026
Claiming: the window setting's string codec port.
Plan, one PR:
encode_dstr,decode_strandms_build_window_stringsintolibobs/util/windows/window-match.c.has three hidden functions (ms_window_match_encode,ms_window_match_decode,ms_window_match_split); every allocation, free anddstr_*call stays inwindow-helpers.c.h.test_window_match_steps(cmocka, every OS).obs_util::window_matchTier 1 againsttodo!().src/ffi/window_match.rs, hidden.#/:-rich byte strings, the round trip, and a mutation check.Draft PR expected today.
libobs: Move the window setting's string codec
test: Characterize the window string codec
obs-util: Test the window string codec
obs-util: Port the window string codec
obs-util: Compare the window string codec with C
docs: Document the window string codec port
test: Run the window match steps against Rust
libobs: Move the window setting's string codec
test: Characterize the window string codec
obs-util: Test the window string codec
obs-util: Port the window string codec
obs-util: Compare the window string codec with C
docs: Document the window string codec port
test: Run the window match steps against Rust
rdoupe commentedon Nov 1, 2026
Fixed by PR #3386 (merged through the merge queue as b447b30): the window setting's string codec (
encode_dstr,decode_strand the split inms_build_window_strings) now has its core inobs_util::window_match, with the moved C inwindow-match.c.h, the Rust shims behind it, and Tier 1, Tier 2 and Tier 3 coverage. No intentional difference from the C.What's left: nothing of this unit. The allocations and frees, the
dstr_*calls,add_window's description and join, andinsert_preserved_val/ms_check_window_property_settingwith their property-list calls stay in C by design.Follow-up issue: none needed; nothing was carried over.
obs-util: Port the window setting's string codec (obs-rust#3386)