Skip to content

rust: port obs_source_enum_full_tree to obs-source #5833

Done

Description

@rdoupe

Port the public obs_source_enum_full_tree() (declared in libobs/obs.h, defined in libobs/obs-source.c.h) and its hidden stop-source wrapper obs_source_active_child_enum_full_tree() into obs-source. Together with their static helpers enum_source_full_tree() and enum_source_full_tree_callback(), they are the walk over every child of a source, active or not: the scene item recursion check (obs-scene.c.h), the transition recursion check (obs-source-transition-switch.c.h) and obs_source_add_active_child() (obs-source-active-child.c.h, through the hidden wrapper) use it, and plugins call it through the C ABI. It is the sibling of the active-tree walk (#5729, PR #5735). Nothing in the issue list or open PRs covers it.

Contract to keep:

  • NULL source: one LOG_DEBUG "obs_source_enum_full_tree: Null 'source' parameter" line, return (the hidden wrapper logs the same name). No context.data: return silently.
  • A source that is not a transition and has neither enum_all_sources nor enum_active_sources: return without a reference.
  • Otherwise take obs_source_get_ref(); a dying source logs the NULL line and returns.
  • A transition walks its two slots through obs_transition_enum_sources(); then the type's enum_all_sources runs if it has one, else enum_active_sources; then the reference is released.
  • Per child (the wrapped callback): the stop source's edge is reported at once with no descent (the admission rule obs_source_add_active_child() relies on); otherwise a transition child's slots, then its enum_all_sources (else enum_active_sources) when it has context data, are walked first, then the edge (parent, child) is reported. Depth first, post-order; no references taken on children.

Stays C, reached through a hidden non-EXPORT -fields.c.h adapter: the type, callback and context-data reads and the plugin calls. obs_transition_enum_sources(), obs_source_get_ref() and obs_source_release() are called by symbol.

Plan (pattern of #5729 / #5831): extract the four bodies verbatim into their own file in the live core-source group; characterize with a new cmocka test calling the export against hybrid libobs and the C reference (NULL, no data, no callbacks, enum_all_sources preferred over enum_active_sources, transition slots, nested post-order, a child without data, the stop source through obs_source_add_active_child()); Tier 1 RED against todo!() in obs-source's existing test binary; then the Rust swap with a Tier 3 differential against the original C that records every call and edge in order. The existing scene, transition and active-child tests run unchanged. No public-header, existing-C-test, WebSocket or workflow edits. Tier 4 does not apply.

Activity

  1. added
    port
    on Nov 27, 2026
  2. rdoupe commented on Nov 27, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: I'll extract, characterize, Tier 1 RED, then GREEN with Tier 3 parity, on branch port/5833-enum-full-tree. Adjacent to #5729 (PR #5735) in obs-source.c.h; whoever lands second rebases.

  3. added
    ready
    on Nov 27, 2026
  4. added a commit that references this issue on Nov 29, 2026
    dec4f60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

portready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions