Repository navigation
Closed
Labels
enhancementNew feature or requestportPort a C unit to Rust (four-tier policy)readyMeets the definition of Ready; claimable
Description
Unit
libobs/obs-source-info-lookup.c.h (get_source_info, declared in obs-internal.h, hidden) to rust/obs-source, new module info_lookup.
Phase and position
Phase 6, libobs core: obs-source. The extraction to obs-source-info-lookup.c.h is on master; this finishes the file. Its caller obs_source_get_icon_type is already Rust (#4231) and calls back into this C lookup.
Dependencies and existing tests
- No dependencies: the file is extracted and still compiled in
libobs.core-source+.h.c. - No characterization test pins the lookup directly. Commit 1 adds
test/cmocka/test_source_info_lookup.c: afterobs_startupand two registered test source types, it goes through the public calls that use the lookup (obs_get_source_output_flags,obs_source_get_display_name,obs_is_source_configurable,obs_get_source_defaults) and pins that a registered ID finds its type, that an unknown ID, an empty ID and an ID that differs only in case find nothing, and that IDs are compared as whole strings. - Existing parity tests nearby:
source_icon_type,type_id_getters.
Notes
- The returned pointer points into the core's
source_typesarray and callers keep it, so the Rust returns the C address, never a copy. A small live adapter (obs-source-info-lookup-fields.c.h) gives the array's address, its count, element size and each entry'sid; Rust never readsstruct obs_source_info's layout. - The compare stays bytewise, like
strcmp, and the first match wins. - One intentional difference: the C calls
strcmp(info->id, id)without checkingid, so a NULL ID crashes as soon as any source type is registered. It reaches the lookup throughobs_get_source_defaults,obs_is_source_configurable,obs_get_source_output_flags,obs_source_get_display_name,obs_source_get_icon_typeand the properties call. The port returns NULL for a NULL ID, which every caller already treats as "not found". The rest of this API forgives NULL. The Tier 3 parity test lists it. - No threading: the registry is filled at module load and only read here.
- Tier 4 does not apply.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestportPort a C unit to Rust (four-tier policy)readyMeets the definition of Ready; claimable
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Nov 10, 2026
Claiming: the source type lookup port (get_source_info), with its NULL-ID fix as the one intentional difference.
Draft PR at RED within a few hours.
rdoupe commentedon Nov 10, 2026
Progress: GREEN, Tier 3 and docs are committed on the branch of #4608 (local gates pass); they go up after review.
Intentional differences, as listed in the parity test:
obs_source_create_private(NULL, ...)takes the unknown-ID path ("Source ID '(null)' not found") instead of crashing.test: Characterize the source type lookup
obs-source: Add the source type lookup tests
obs-source: Port the source type lookup
obs-source: Compare the source type lookup with C
docs: Describe the source type lookup port
obs-source: Test when the type lookup reads its ID
obs-source: Read the type lookup's ID only to compare
27 remaining items
rdoupe commentedon Nov 14, 2026
Blocked: waiting on the merge queue. #4608 is green and mergeable, and goes in once the queue has room.
test: Characterize the source type lookup
obs-source: Add the source type lookup tests
obs-source: Port the source type lookup
obs-source: Compare the source type lookup with C
docs: Describe the source type lookup port
obs-source: Test when the type lookup reads its ID
obs-source: Read the type lookup's ID only to compare
rdoupe commentedon Nov 14, 2026
Closed by #4608, merged through the merge queue as 932a68c: the source type lookup (
get_source_info) now lives inrust/obs-source(moduleinfo_lookup), with the C address returned unchanged and one intentional difference: a NULL ID finds nothing instead of crashing instrcmp. The master push run for the merge commit is green (run 43623588540).Left: nothing for this unit. No follow-up issue is needed; the next source metadata unit that builds on this lookup is already filed as #4719 (port
obs-source-type-info.c.h).obs-source: Port the source type lookup (obs-rust#4608)