Repository navigation
Description
get_new_filter_name() and filter_compatible() in libobs/obs-source.c.h (~314-332 and ~769-772 on master, 914f81f) are still C. Both are internal (obs-internal.h, no EXPORT) and called from already-ported code: the copy-filters fields adapter (obs-source-copy-filters-fields.c.h), obs-source-copy-filters.c.h, and obs_source_filter_add (obs-source-filter-add.c.h). Every decision in them is already Rust: obs_source_duplicate_filter_number() (obs-source source_duplicate) and obs_source_filter_chain_compatible() (obs-source source_filter_chain). What is left is the field reads, the by-name lookup calls and the dstr building.
Behavior the port keeps, call for call:
get_new_filter_name(dst, name): trynamefirst, then"<name> N"with N fromobs_source_duplicate_filter_number(++inc), askingobs_source_get_filter_by_name(dst, candidate)each time and releasing every hit; return abmalloc'd string the caller frees withbfree(the C returnsdstr.array).filter_compatible(source, filter):obs_source_filter_chain_compatible(source->info.output_flags, filter->info.output_flags), one read of each.
The by-name lookup itself (obs_source_get_filter_by_name) stays C and is not part of this unit.
Plan, one PR into obs-source (the shape of #5977):
- Extract both verbatim into their own live
core-sourcefile, callers unchanged. No behavior change. - Tier 1 RED in obs-source's existing category binary against a
todo!()core over a trait for the field reads, the lookup/release calls and the allocation. - GREEN: safe core in
obs-source, the two symbols as hidden C ABI exports inffi/, a one-access field adapter, the extracted file moved to a reference-only ported group. - Tier 3 parity against the original C in
obs-c-oracle: free name, one and several taken names, a name ending in a number, compatible and incompatible flag pairs, comparing the returned name and the recorded lookup/release calls. - Tier 2:
test_source_copy_filters,test_source_duplicateandtest_source_duplicate_stepsagainst the hybrid libobs and the C reference.
No public header, C test or obs-websocket change.
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Nov 30, 2026
Claiming: #5978 port of get_new_filter_name and filter_compatible (extract, Tier 1 RED, GREEN, Tier 3 parity, Tier 2), alone, first PR within the next couple of hours.
rdoupe commentedon Nov 30, 2026
/ready
obs-source: port get_new_filter_name and filter_compatible to Rust (F…