Skip to content

rust: Port the source rename to obs-source #4857

Closed

Description

@rdoupe

Unit

libobs/obs-source-set-name.c.h (obs_source_set_name and its file-local source_set_name_requires_canvas) to rust/obs-source, new module set_name.

Phase and position

Phase 6 core, the core-source group: the next obs-source unit after the scene item bounds setters. The extraction and characterization landed in #4643 (issue #4630).

Dependencies and existing tests

  • Characterization exists: test/cmocka/test_source_set_name.c (global and local signal order, private sources and scenes, canvas-requiring sources, lookup updates, unchanged-name suppression). test_context_names and test_canvas_rules_callers cover the name tables and canvas paths too.
  • It calls, and leaves in C: obs_canvas_rename_source (obs-canvas.c.h), obs_context_data_setname_ht and obs_context_data_setname (obs.c.h). The calldata and signal calls go through the ported obs-callback.
  • No open PR edits the file.

Notes

  • A live adapter libobs/obs-source-set-name-fields.c.h, in the style of obs-canvas-set-name-fields.c.h, holds the private field reads (output flags, context.name, context.private, context.signals), the two name-table calls with &obs->data.public_sources, and obs->signals.
  • Keep the previous name's copy taken before the rename and freed after both signals; new_name is the context's own string, read after the rename. No Rust borrow of context.name is held across a C call.
  • A NULL or empty name takes the rename path, as in C.
  • The name table takes its own lock in C; the port adds none.
  • No intentional differences expected. Tier 3 compares the name, the call log and the signal payloads with random names (NULL, empty, equal, long, non-UTF-8 bytes), the private and canvas flags, and NULL sources.

Activity

  1. added
    enhancement
    port
    ready
    on Nov 14, 2026
  2. rdoupe commented on Nov 14, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: the source rename port to obs-source::set_name.

    1. The characterization test (test_source_set_name.c) and the extraction are already on master (libobs: Extract source name setter without behavior changes (Refs #4630) #4643); RED: Tier 1 cases in rust/obs-source/tests/source/set_name.rs against todo!() shims.
    2. GREEN: the safe core (no change, canvas path or table path, and whether the global signal goes out), the C shim exporting obs_source_set_name, and a live field adapter obs-source-set-name-fields.c.h for the private fields, the two name-table calls and obs->signals; the file's include moves into its own ported unity group.
    3. Tier 3 parity against the C over the adapter with recording calls, with mutation; Tier 2 unchanged on hybrid and c-ref; identical export sets.
    4. Docs rows.

    The audio-pause callbacks port planned beside it is left out: #4375 already has a branch with its port. Draft PR today, once the RED commit is in.

  3. rdoupe commented on Nov 14, 2026

    @rdoupe
    CollaboratorAuthor

    Fixed by PR #4860 (merged through the merge queue as d762f20): obs_source_set_name now runs in obs-source::set_name, with the C kept behind the live adapter libobs/obs-source-set-name-fields.c.h and the original file in its own ported group. No intentional differences from C.

    Left: nothing of this unit. The name-table calls, the canvas rename and signal delivery stay in C by design. The audio-pause callbacks that were planned beside it are not part of this port; issue #4375 already has a branch for them, so no new follow-up issue was needed.

  4. moved this from In merge queue to Done in obs-rust Multiviewon Nov 14, 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