Skip to content

rust: port get_source_info2 and obs_enable_source_type to obs-source #6014

Done

Description

@rdoupe

get_source_info2() (libobs/obs-source.c.h, the versioned source type lookup that obs_register_source_s() uses to refuse a duplicate registration) and the hidden export obs_enable_source_type() (same file, used by the scripting layer to disable and re-enable a source type it redefines) are still C. Their sibling get_source_info() is already Rust (#4608, rust/obs-source/src/ffi/source_info_lookup.rs), over the private registry view in libobs/obs-source-info-lookup-fields.c.h.

Behavior the port keeps:

  • get_source_info2(unversioned_id, ver): the first entry of obs->source_types, in registration order, whose unversioned_id equals the asked one bytewise and whose version equals ver; NULL when there is none. The entry's own address is returned (callers keep it).
  • So obs_register_source() refuses a second registration of the same ID and version ("Source '%s' already exists! Duplicate library?"), and accepts the same ID with another version.
  • obs_enable_source_type(name, enable): does nothing for an unknown (full, versioned) ID; otherwise clears OBS_SOURCE_CAP_DISABLED in the type's output_flags when enable, sets it otherwise, and leaves every other flag as it was.

Plan (the shape of #4608):

  1. Characterize in a new cmocka test on both builds: duplicate and other-version registrations through obs_register_source(), and obs_enable_source_type() seen through obs_get_source_output_flags().
  2. Extract the two bodies verbatim into their own live file in libobs.core-source.
  3. Tier 1 RED against todo!() cores in obs-source's existing test binary; GREEN: Rust get_source_info2 and obs_enable_source_type over the same registry adapter (new accessors for unversioned_id, version and output_flags), Tier 3 parity against the original C in obs-c-oracle.

A NULL asked ID finds nothing, as get_source_info() already does (the C passes it to strcmp).

Activity

  1. added
    enhancement
    on Nov 30, 2026
  2. rdoupe commented on Nov 30, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: get_source_info2 and obs_enable_source_type port to obs-source (characterize, extract, Tier 1 RED, GREEN with Tier 3 parity), the shape of #4608.

  3. added
    port
    on Nov 30, 2026
  4. added
    ready
    on Nov 30, 2026
  5. added a commit that references this issue on Dec 4, 2026
    e07c483
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