Skip to content

rust: Port scene-item transform and bounds read getters to obs-scene #3897

Closed

Description

@zackees

Unit

Scene-item transform and bounds read getters in libobs/obs-scene.c.h, targeting the existing obs-scene crate.

Phase and position

Phase 6, native child of #444. Follows selected/locked #3859; disjoint from item ID #3869 and render getters #3891.

Dependencies and existing tests

Preflight at origin/master 58d2c1155f9507da4728576f24f8aa68e2efefae: individual git grep -l '\b<fn>\b' origin/master -- rust/ checks found only bindings/callers for get_pos/get_scale/get_rot, and no Rust references for get_alignment/get_bounds_type/get_bounds_alignment/get_bounds_crop/get_bounds/get_crop/get_info2. Inspected all three sibling PR bodies, comments, changed-file lists and their obs-scene.c.h patches. No overlapping implementation or active transform/bounds getter PR found.

These are not unlocked field readers. All ten take item_fields_lock, which snapshots item->parent, locks that parent's video_mutex when non-null, returns the captured parent, and unlocks the same parent after the read. Detached items skip locking. The null checks happen before locking.

Getter Current C behavior beyond the lock
get_rot NULL returns +0.0f; otherwise copies stored rotation
get_alignment NULL returns 0; otherwise copies align
get_bounds_type NULL returns OBS_BOUNDS_NONE; otherwise copies bounds_type
get_bounds_alignment NULL returns 0; otherwise copies bounds_align
get_bounds_crop NULL returns false; otherwise copies crop_to_bounds
get_pos NULL item leaves output untouched; relative coordinates use pos_to_absolute, otherwise vec2_copy
get_scale NULL item leaves output untouched; relative coordinates use item_canvas_scale, otherwise vec2_copy
get_bounds NULL item leaves output untouched; relative coordinates use size_to_absolute, otherwise vec2_copy
get_crop Validates item then output with obs_ptr_valid (debug diagnostics); memcpy of the crop under the lock
get_info2 Only proceeds when item and output are non-null; copies all transform fields and crop_to_bounds under one lock; relative position/scale/bounds conversions apply

Sources: libobs/obs-scene.c.h:149-164, 2753-2872, 3121-3131. Conversion helpers at 297-377 read canvas/scene dimensions and group/scene flags; they must not be replaced with direct copies.

Notes and acceptance

Start with C-only characterization against both actual libraries, including parented/detached/null items and observable synchronization. A narrower first port can select the scalar readers, but must preserve the parent's lock; none of the requested getters qualifies for an unlocked plain-copy slice. A C/private locking adapter or equivalent portable lock boundary needs to be characterized before applying the sibling getter pattern.

Then verbatim extraction in its own commit, Tier 1 RED before Rust GREEN, real-header layout checks, Tier 3 differential plus mutation (proptest persistence disabled; NaN payloads, signed zero, infinities copied bit-exactly), unchanged Tier 2 via docker_task_command/warm volume with ldd proof and identical exports. Use the existing Core state test binary. Tier 4 does not apply.

Preserve conditional OBS::w32-pthreads, portable printf-format callbacks, Windows LLP64/MSVC layouts and exact native source/dependency registration. Replay with GCC and host Clang -Wformat-nonliteral -Werror. Run the assignment's three Python checks and any affected canonical_rust_static_ checks. Keep the README record in its sorted obs-scene table row, combine graph entries, rebase before the final push and run merge-tree. No existing C tests, public headers, websocket, workflow additions or out-of-scope units.

This issue records source inspection only: no runtime characterization or port has been performed yet.

Activity

  1. added
    enhancement
    port
    on Nov 7, 2026
  2. zackees commented on Nov 7, 2026

    @zackees
    MemberAuthor

    Claiming: investigation of the synchronized scene-item transform/bounds getter slice (pool port-scene4, slot obs-studio3).

    1. Confirm uncovered symbols against origin/master and obs-scene: Port selected and locked item getters (#3855) #3859/obs-scene: Port the scene item ID getter (#3865) #3869/obs-scene: Port scale filter and blending getters (#3889) #3891 and inspect the exact null/locking/conversion paths.
    2. Determine whether the assignment can be narrowed to plain unlocked readers before copying the sibling getter approach.
    3. Record the synchronization requirements and release if the plain-reader slice is empty. No port PR will be opened without actual-library locking characterization; the issue body records source evidence, not runtime proof.
  3. zackees commented on Nov 7, 2026

    @zackees
    MemberAuthor

    Releasing the port-scene4 investigation. Source inspection is recorded in the body: all requested getters take the captured parent video mutex, and four also convert relative coordinates. The plain unlocked-reader slice is empty. No runtime characterization, Rust port, RED/GREEN commits or PR was produced; the synchronized port remains unfinished. No claim-bot refusal was present at the final check. Returning obs-studio3 clean and detached for the pool; a future worker must preserve and characterize the locking contract rather than copy the unlocked sibling getter implementation.

  4. zackees commented on Nov 7, 2026

    @zackees
    MemberAuthor

    Claiming: implementation of a small synchronized scalar bounds-getter group for pool port-3897 in obs-studio3.

    1. Characterize bounds type/alignment/crop getters against the actual C library, including captured-parent video-mutex blocking, detached items and NULL handling.
    2. Extract the original C verbatim in its own commit; add Tier 1 RED, then Rust GREEN using the established C mutex boundary, real-header layouts and bit-exact Tier 3 differential/mutation coverage.
    3. Run applicable unchanged Tier 2, focused sanitizer and portability/registration checks; rebase with scene siblings, open a draft after RED and queue the validated GREEN head.

    First PR expected after characterization and the RED commit in this worker session. Checking for claim refusal before implementation and again before PR/auto-merge.

  5. added
    needs-investigation
    on Nov 7, 2026
  6. zackees commented on Nov 7, 2026

    @zackees
    MemberAuthor

    /ready

    The synchronized scalar bounds subset now has actual-library C characterization (commit dd751cf, pushed on port/3897-scene-bounds-getters): NULL defaults, parented/detached items, recursive ownership, and a started getter blocked by the parent video mutex until unlock. Three repeats pass against each actual library alongside unchanged canvas characterization; ldd confirms both loader paths and all 1,767 exports match. The original extraction is committed separately (ec92aab); Tier 1 RED fails both safe-core tests at todo!("#3897") (local-test-sILd3V.log).

    coordination.md section 2 delegates Ready to the claimant after investigation; the linked org WORKFLOW.md permits /ready by the claimant or a maintainer. The implementation claim is still pending behind the backlogged claim workflow; no refusal or conflicting claim is visible. Continuing only the three scalar bounds getters, with the other transform/bounds getters left for follow-up.

  7. 58 remaining items

  8. moved this from In progress to Ready in obs-rust Multiviewon Nov 8, 2026
  9. rdoupe commented on Nov 18, 2026

    @rdoupe
    Collaborator

    Claiming: the last three synchronized getters of #3897 still in C on master: obs_sceneitem_get_pos, obs_sceneitem_get_bounds and obs_sceneitem_get_info2 (libobs/obs-scene.c.h), on branch port/3897-scene-pos-bounds-info-getters.

    1. C characterization against hybrid and C-reference libobs: NULL item/output, absolute and relative coordinates (the pos/size conversions and canvas scale), detached and parented items, blocking on the captured parent's video mutex.
    2. Verbatim extraction into its own live group, same shape as the scale getter (obs-scene: Port synchronized scale getter (#3897) #3934).
    3. Tier 1 RED against stubs, then the Rust port in obs-scene, with a callback-only oracle and Tier 3 parity, unchanged Tier 2 on both libraries.

    One PR; draft expected this session.

  10. zackees commented on Nov 18, 2026

    @zackees
    MemberAuthor

    Coordination for #5090: pool slot obs-studio6 is extracting only obs_sceneitem_set_alignment from obs-scene.c.h into obs-scene-item-alignment-setter.c.h, reusing obs_sceneitem_fields_lock/unlock and obs_sceneitem_bounds_update_transform. Your three getters remain untouched. The only shared append point is the sorted libobs.core-source+.h.c group; I will check merge-tree against the in-flight #5098 source extraction and rebase on its merge before publication if necessary.

  11. moved this from Ready to In progress in obs-rust Multiviewon Nov 18, 2026
  12. rdoupe commented on Nov 18, 2026

    @rdoupe
    Collaborator

    Done: the last three synchronized getters (pos, bounds, info2) landed in #5110, after scale, rotation, alignment and the bounds getters in earlier PRs. Every getter in this unit now has its Rust definition.

  13. moved this from In progress to Done in obs-rust Multiviewon Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementportready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions