Skip to content

obs-source: port obs_source_get_width and obs_source_get_height to Rust (Refs #5726) - #5727

Merged
zackees merged 3 commits into
masterfrom
port-5726-source-size
Dec 4, 2026
Merged

zackees merged 3 commits into
masterfrom
port-5726-source-size

Conversation

@zackees

@zackees zackees commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Refs #5726.

Ports obs_source_get_width() and obs_source_get_height() from libobs/obs-source.c.h to obs-source, following #5633.

Commits (RED then GREEN):

  1. libobs: extract verbatim: the two bodies plus size_start(), get_recurse_width(), get_recurse_height() move unchanged into libobs/obs-source-get-size.c.h (live core-source group). data_valid() is static in obs-source.c.h, so the file keeps its one-line body under its own name behind a scoped macro.
  2. test: RED: Tier 1 in obs-tests-core (rust/obs-source/tests/source/get_size.rs) against todo!(): 1 passed; 7 failed ... not yet implemented: #5726.
  3. GREEN: safe core obs-source::get_size, C ABI shims ffi::source_get_size, field/lock adapter obs-source-get-size-fields.c.h (no EXPORT), reference-only group libobs.ported-source-get-size, rust-exports list, oracle (oracle/source_get_size.c), Tier 3 get_size_parity.rs (grid + proptest + pinned answers, six mutants rejected), obs-build registration test, README row.

Behavior kept: NULL logs one LOG_DEBUG <fn>: Null 'source' parameter and answers 0; no context.data answers 0 silently; a filter answers its own base size without a lock; any other source locks filter_mutex, starts at its first filter if it has one, reads that base size and unlocks.

Tier 2: no new or changed C tests; the existing tests reaching these exports (test_filter_size_no_target, test_async_rotation_normalize, test_group_empty_bounds, ...) run unchanged. No public header changes. One documented excluded input: a NULL filter-list entry (never stored by obs_source_filter_add(); the C dereferences it, the Rust answers 0).

Local evidence: soldr cargo test -p obs-data --test obs-tests-core -- get_size 10 passed; obs-tests-app -- canonical_source_get_size passed; full ./lint passed (228 s). Tier 2 C build not run locally.

Ordering: overlaps #5724 (obs_source_get_color_space, adjacent lines) only in append-only registration lines (core-source+.h.c, native.rs, ffi/mod.rs, lib.rs, tests/source/main.rs); obs-source.c.h merges cleanly. Whoever lands second rebases. No test-graph.json change.

Draft and unarmed: back pressure closed at publish (head 835f317).

🤖 Generated with Claude Code

@zackees zackees changed the title obs-source: port obs_source_get_width and obs_source_get_height to Rust (Fixes #5726) obs-source: port obs_source_get_width and obs_source_get_height to Rust (Refs #5726) Nov 25, 2026
@obs-rust-project-manager obs-rust-project-manager Bot moved this to In progress in obs-rust Multiview Nov 25, 2026
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In progress to Needs fix in obs-rust Multiview Nov 26, 2026
@zackees
zackees force-pushed the port-5726-source-size branch from 835f317 to cb67400 Compare November 26, 2026 10:42
@obs-rust-project-manager obs-rust-project-manager Bot moved this from Needs fix to In progress in obs-rust Multiview Nov 26, 2026
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In progress to Needs fix in obs-rust Multiview Nov 26, 2026
@obs-rust-project-manager obs-rust-project-manager Bot moved this from Needs fix to In progress in obs-rust Multiview Nov 29, 2026
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In progress to Needs fix in obs-rust Multiview Nov 29, 2026
@zackees
zackees force-pushed the port-5726-source-size branch from cb67400 to 0592d58 Compare December 3, 2026 23:40
@zackees
zackees marked this pull request as ready for review December 3, 2026 23:40
@zackees
zackees enabled auto-merge December 3, 2026 23:40
zackees and others added 3 commits December 3, 2026 23:29
…im (Refs #5726)

Move the two bodies, with size_start(), get_recurse_width() and
get_recurse_height() (used only by them), unchanged out of obs-source.c.h
into obs-source-get-size.c.h, still compiled in the live core-source
group.

data_valid() is static inline in obs-source.c.h; the extracted file keeps
its one-line body as obs_source_get_size_data_valid() and maps the
original name onto it with a scoped macro, so the bodies stay verbatim
and the file also builds in a translation unit of its own. No Rust, no
behavior change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…efs #5726)

Tier 1 cases in the existing obs-tests-core binary
(rust/obs-source/tests/source/get_size.rs) on a model of what
obs-source::get_size's Libobs trait reaches: sources with or without
context.data, a type, a filter list, a base width and height, and the
filter_mutex lock and unlock, recorded in call order. They pin NULL
(one log naming the call, 0), no data (0, silent), a filter (its own base,
no lock), and any other type (lock, first filter if any, its base,
unlock). They run against a todo!() core:

  test result: FAILED. 1 passed; 7 failed
  panicked at rust/obs-source/src/get_size.rs:75:5:
  not yet implemented: #5726

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…st (Fixes #5726)

- Safe core obs-source::get_size::get over a Libobs trait: a NULL source
  logs one LOG_DEBUG line naming the call and answers 0; no context.data
  answers 0 silently; a filter answers its own base size without a lock;
  any other source takes its filter_mutex, starts at its first filter
  when it has one (size_route::entry()), reads that base size and
  unlocks.
- C ABI shims in ffi/source_get_size.rs; the fields and the mutex through
  the new libobs/obs-source-get-size-fields.c.h (live core-source group,
  no EXPORT); the base size through obs_source_base_width()/_height().
- The extracted file moves to the reference-only group
  libobs.ported-source-get-size (+ ported-source-sets JSON); both names
  are EXPORT in obs.h, so they go into
  rust-exports.d/obs-source-source_get_size.txt.
- Oracle: oracle.d/source-get-size.list and oracle/source_get_size.c (the
  original C renamed oracle_*, the production adapters, error-checking
  filter mutexes, recording size callbacks).
- Tier 3 get_size_parity.rs: which node answered, on which axis, with
  which mutexes held, the result, the log lines and every mutex free
  afterwards, over a grid, a proptest and pinned answers; six shim
  mutants rejected. Excluded input: a NULL filter-list entry, never
  stored by obs_source_filter_add().
- Tier 1 model's first_filter now returns Option, as the trait does.
- obs-build registration test and a rust/README.md row.

Tier 2: the existing cmocka tests reaching these exports run unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Client-Checks: {"checks":{"base":"152c528e41cbfc33e0a17189d18f7ca81191937b","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core-source+.h.c","libobs/build/libobs.ported-source-get-size+.h.c","libobs/build/ported-source-sets/source-get-size.json","libobs/cmake/rust-exports.d/obs-source-source_get_size.txt","libobs/obs-source-get-size-fields.c.h","libobs/obs-source-get-size.c.h","libobs/obs-source.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_source_get_size_swap_is_registered.rs","rust/obs-c-oracle/oracle.d/source-get-size.list","rust/obs-c-oracle/oracle/source_get_size.c","rust/obs-source/src/ffi/mod.rs","rust/obs-source/src/ffi/source_get_size.rs","rust/obs-source/src/get_size.rs","rust/obs-source/src/lib.rs","rust/obs-source/tests/source/get_size.rs","rust/obs-source/tests/source/get_size_parity.rs","rust/obs-source/tests/source/main.rs"],"head":"0f510644b7f7adb7154da31a8bffff2d81633924","tools":{"orchestrator-python":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]","schema-dependencies":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21503\n   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ISO8859X Regexps Automata RelaxNG Schemas Modules Debug"},"tracked-digest":"99b00f09d2939a640db2f97ba04a823b6201211b9f43a51c2481bab079729e7b","tree":"15e9e0a0b729fc2d13783c4b3cc76ddab9a26942"}}
Ci-Attestation: {"at":1795689338,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5d8c7b19c35b9f9c2eac286a4e68d3814f4b60fc"],"secs":118,"stamp":"d011b7a2f12556261322d68788a35a1b","tree":"15e9e0a0b729fc2d13783c4b3cc76ddab9a26942","v":1,"via":"run"}
Ci-Attestation: {"at":1795689338,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5d8c7b19c35b9f9c2eac286a4e68d3814f4b60fc"],"secs":118,"stamp":"c3c6fc2f1c233442605116450acbf473","tree":"15e9e0a0b729fc2d13783c4b3cc76ddab9a26942","v":1,"via":"run"}
Ci-Attestation: {"at":1795689338,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5d8c7b19c35b9f9c2eac286a4e68d3814f4b60fc"],"secs":118,"stamp":"cfbe46213d3c820b77ef8bdee49d1490","tree":"15e9e0a0b729fc2d13783c4b3cc76ddab9a26942","v":1,"via":"run"}
Ci-Attestation: {"at":1795689338,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5d8c7b19c35b9f9c2eac286a4e68d3814f4b60fc"],"secs":118,"stamp":"3042cef0f942e891b98ba2374d5b129b","tree":"15e9e0a0b729fc2d13783c4b3cc76ddab9a26942","v":1,"via":"run"}
Ci-Attestation: {"at":1796369638,"gate":"general/all/client-lint","host":"linux-x86_64","key":"1c7423dfa392339f70ad82f0896cffb6d70361cf0564c55ee2dc721b6fba80a1","lane":"client-lint","parents":["2f4f9b67cb0620d13b8210e998ee9eed9663dc5f"],"secs":242,"stamp":"aa39b7a10a9e1c3b7fcad08da4fb1b52","tree":"96df878b76450f84a2652ff433126884b414fd66","v":1,"via":"run"}
Ci-Attestation: {"at":1795689338,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5d8c7b19c35b9f9c2eac286a4e68d3814f4b60fc"],"secs":118,"stamp":"f44c740e2fa5c3d9a1b4084918b8fc4a","tree":"15e9e0a0b729fc2d13783c4b3cc76ddab9a26942","v":1,"via":"run"}
Ci-Attestation: {"at":1796369639,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"1c7423dfa392339f70ad82f0896cffb6d70361cf0564c55ee2dc721b6fba80a1","lane":"client-lint","parents":["2f4f9b67cb0620d13b8210e998ee9eed9663dc5f"],"secs":242,"stamp":"8b0125864b8c9cc1b27eb67da10cf09e","tree":"96df878b76450f84a2652ff433126884b414fd66","v":1,"via":"run"}
Ci-Attestation: {"at":1796369639,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"1c7423dfa392339f70ad82f0896cffb6d70361cf0564c55ee2dc721b6fba80a1","lane":"client-lint","parents":["2f4f9b67cb0620d13b8210e998ee9eed9663dc5f"],"secs":242,"stamp":"d719a8a42482c703ca6e2b2d5bcadda0","tree":"96df878b76450f84a2652ff433126884b414fd66","v":1,"via":"run"}
Ci-Attestation: {"at":1796369639,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"1c7423dfa392339f70ad82f0896cffb6d70361cf0564c55ee2dc721b6fba80a1","lane":"client-lint","parents":["2f4f9b67cb0620d13b8210e998ee9eed9663dc5f"],"secs":242,"stamp":"e2f6c8a05fee69847bc21b5a06bb6b6b","tree":"96df878b76450f84a2652ff433126884b414fd66","v":1,"via":"run"}
Ci-Attestation: {"at":1796369639,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"1c7423dfa392339f70ad82f0896cffb6d70361cf0564c55ee2dc721b6fba80a1","lane":"client-lint","parents":["2f4f9b67cb0620d13b8210e998ee9eed9663dc5f"],"secs":242,"stamp":"b2949d914abe889b5d22c905d1f9a17f","tree":"96df878b76450f84a2652ff433126884b414fd66","v":1,"via":"run"}
Ci-Attestation: {"at":1796369638,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"1c7423dfa392339f70ad82f0896cffb6d70361cf0564c55ee2dc721b6fba80a1","lane":"client-lint","parents":["2f4f9b67cb0620d13b8210e998ee9eed9663dc5f"],"secs":242,"stamp":"92a4e7118d9a796254bb06f915deaef3","tree":"96df878b76450f84a2652ff433126884b414fd66","v":1,"via":"run"}
Ci-Attestation: {"at":1796369638,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"1c7423dfa392339f70ad82f0896cffb6d70361cf0564c55ee2dc721b6fba80a1","lane":"client-lint","parents":["2f4f9b67cb0620d13b8210e998ee9eed9663dc5f"],"secs":242,"stamp":"eb96c5011d62ee4c8a1cd56ef7121f69","tree":"96df878b76450f84a2652ff433126884b414fd66","v":1,"via":"run"}
Ci-Attestation: {"at":1796369639,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"1c7423dfa392339f70ad82f0896cffb6d70361cf0564c55ee2dc721b6fba80a1","lane":"client-lint","parents":["2f4f9b67cb0620d13b8210e998ee9eed9663dc5f"],"secs":242,"stamp":"f26a51d528e9f7c9df57c4961901a477","tree":"96df878b76450f84a2652ff433126884b414fd66","v":1,"via":"run"}
Ci-Attestation: {"at":1796369639,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"1c7423dfa392339f70ad82f0896cffb6d70361cf0564c55ee2dc721b6fba80a1","lane":"client-lint","parents":["2f4f9b67cb0620d13b8210e998ee9eed9663dc5f"],"secs":242,"stamp":"93f0a1a2d7d4674c84e080497a1d9363","tree":"96df878b76450f84a2652ff433126884b414fd66","v":1,"via":"run"}
Ci-Attestation: {"at":1796369638,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"1c7423dfa392339f70ad82f0896cffb6d70361cf0564c55ee2dc721b6fba80a1","lane":"client-lint","parents":["2f4f9b67cb0620d13b8210e998ee9eed9663dc5f"],"secs":242,"stamp":"da1e340286c818896e9f974c17acdb15","tree":"96df878b76450f84a2652ff433126884b414fd66","v":1,"via":"run"}
Ci-Attestation: {"at":1796369639,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"1c7423dfa392339f70ad82f0896cffb6d70361cf0564c55ee2dc721b6fba80a1","lane":"client-lint","parents":["2f4f9b67cb0620d13b8210e998ee9eed9663dc5f"],"secs":242,"stamp":"84db6173b26217e839cff43c67c1d930","tree":"96df878b76450f84a2652ff433126884b414fd66","v":1,"via":"run"}
Ci-Attestation: {"at":1796369638,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"1c7423dfa392339f70ad82f0896cffb6d70361cf0564c55ee2dc721b6fba80a1","lane":"client-lint","parents":["2f4f9b67cb0620d13b8210e998ee9eed9663dc5f"],"secs":242,"stamp":"55aaf541947414af2aac22954a88f024","tree":"96df878b76450f84a2652ff433126884b414fd66","v":1,"via":"run"}
Ci-Attestation: {"at":1796369638,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"1c7423dfa392339f70ad82f0896cffb6d70361cf0564c55ee2dc721b6fba80a1","lane":"client-lint","parents":["2f4f9b67cb0620d13b8210e998ee9eed9663dc5f"],"secs":242,"stamp":"be9722396000e7422a2c44ff911e84dd","tree":"96df878b76450f84a2652ff433126884b414fd66","v":1,"via":"run"}
Ci-Attestation: {"at":1795689758,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"1f4abf5b7c0df140683dacb679737e61be05eac2130b0e7b510a1c001ee17117","lane":"client-test-x86_64-unknown-linux-gnu","parents":["5d8c7b19c35b9f9c2eac286a4e68d3814f4b60fc"],"secs":418,"stamp":"7cf9e86993418aa62e56f7a218e6b6bb","tree":"15e9e0a0b729fc2d13783c4b3cc76ddab9a26942","v":1,"via":"run"}
@zackees
zackees force-pushed the port-5726-source-size branch from 0592d58 to 5156c30 Compare December 4, 2026 07:34
@zackees
zackees added this pull request to the merge queue Dec 4, 2026
@obs-rust-project-manager obs-rust-project-manager Bot moved this from Needs fix to In merge queue in obs-rust Multiview Dec 4, 2026
Merged via the queue into master with commit f69395e Dec 4, 2026
51 checks passed
@zackees
zackees deleted the port-5726-source-size branch December 4, 2026 10:32
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In merge queue to Done in obs-rust Multiview Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant