Repository navigation
libobs: characterize and extract obs_enum_sources and the source/canvas enumerators (Refs #5493) - #5494
Merged
Conversation
… (Refs #5493) obs_enum_sources calls back for public inputs and public groups only, never private sources, scenes, filters or transitions, in creation order, with one reference held for each call and released after; a source with no reference left is skipped and a false return stops the walk with every reference balanced. obs_enum_all_sources visits every source, private ones included, in creation order, without references. obs_enum_canvases visits the named canvases, main first, without references; private canvases are absent and a removed one stays until destroyed. obs_canvas_enum_scenes on a non-main canvas visits only its scenes, each referenced for the call. Each stops on false. The transition case resets video, since a transition needs a graphics device; the other cases run without a video thread so the reference counts are exact. Linux with OpenGL, like test_item_transition_empty_source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…efs #5493) Moves obs_enum_sources, obs_canvas_enum_scenes, the static inline obs_enum_uuid, obs_enum_all_sources and obs_enum_canvases verbatim from obs.c.h into obs-enum-sources.c.h, a member of the core unity group (alphabetical, after obs-enum-scenes-fields.c.h), ahead of their Rust swap. Only obs_enum_all_sources used obs_enum_uuid. The new file sorts before obs.c.h, which declares group_info, so it declares group_info itself, as obs-scene-kind.c.h does. No behavior change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Ci-Attestation: {"at":1795415442,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":94,"stamp":"57e66c48c04eccfacd963133cb322c94","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415442,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":94,"stamp":"18fdb95a6ebc8779e3c8b19a32a9fe55","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415442,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":94,"stamp":"616172e95e74b813766b86749dd8f0cd","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415442,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":94,"stamp":"9d2249009c8f8992f679523104e92539","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415347,"gate":"general/all/client-lint","host":"linux-x86_64","key":"b3cb196e06118f1b4e2123e11552f186419a7c599e1d02f74c3e81977f5da20b","lane":"client-lint","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":12,"stamp":"d3b85a7d4eb8e81ad53d3ea0d9e0b35d","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415442,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":94,"stamp":"591deb6331b19cb88cc82e7e43b56b55","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415348,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"b3cb196e06118f1b4e2123e11552f186419a7c599e1d02f74c3e81977f5da20b","lane":"client-lint","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":12,"stamp":"3ff4cccb7a995ab7df58ac81efd3e252","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415348,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"b3cb196e06118f1b4e2123e11552f186419a7c599e1d02f74c3e81977f5da20b","lane":"client-lint","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":12,"stamp":"e4b6c29bf31b3324e88447e88b2a141a","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415348,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"b3cb196e06118f1b4e2123e11552f186419a7c599e1d02f74c3e81977f5da20b","lane":"client-lint","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":12,"stamp":"d9e34914884568c873b6f6a77dd3737f","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415348,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"b3cb196e06118f1b4e2123e11552f186419a7c599e1d02f74c3e81977f5da20b","lane":"client-lint","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":12,"stamp":"c16d2b639e9ddf34b205a754c0ec0ed2","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415348,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"b3cb196e06118f1b4e2123e11552f186419a7c599e1d02f74c3e81977f5da20b","lane":"client-lint","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":12,"stamp":"0862e2e805238cf650a00f553830bcd2","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415348,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"b3cb196e06118f1b4e2123e11552f186419a7c599e1d02f74c3e81977f5da20b","lane":"client-lint","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":12,"stamp":"71006449d4896789a3ddbf1a1cc31f59","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415348,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"b3cb196e06118f1b4e2123e11552f186419a7c599e1d02f74c3e81977f5da20b","lane":"client-lint","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":12,"stamp":"a14222fdde5926211f446b7ca201b5c6","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415348,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"b3cb196e06118f1b4e2123e11552f186419a7c599e1d02f74c3e81977f5da20b","lane":"client-lint","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":12,"stamp":"b2df45b63d6ff466fe7d7dcdadbaca25","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415348,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"b3cb196e06118f1b4e2123e11552f186419a7c599e1d02f74c3e81977f5da20b","lane":"client-lint","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":12,"stamp":"9099bed971ed43ca0de844c9886a0e7a","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415348,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"b3cb196e06118f1b4e2123e11552f186419a7c599e1d02f74c3e81977f5da20b","lane":"client-lint","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":12,"stamp":"e77da54850e886e5fb2524ebea454895","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415347,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"b3cb196e06118f1b4e2123e11552f186419a7c599e1d02f74c3e81977f5da20b","lane":"client-lint","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":12,"stamp":"bcefa58dcf03c52d9e0a2779953fdc40","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415347,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"b3cb196e06118f1b4e2123e11552f186419a7c599e1d02f74c3e81977f5da20b","lane":"client-lint","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":12,"stamp":"97ccfec233ca1c5f2ce5ce7b4fb10b5c","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Ci-Attestation: {"at":1795415663,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"04401f2f6eca1e9eaf972ce3d2cdb1ff94dbbca0795128855b10f4bc6b34c592","lane":"client-test-x86_64-unknown-linux-gnu","parents":["5df6cdde82469025e0180b0471ea195a7b90b704"],"secs":219,"stamp":"2d4544581ceb1f6f132d0b1e4b7d9e3b","tree":"83fc512dc146494862fe3cb0c42dc636459f5979","v":1,"via":"run"} Client-Checks: {"checks":{"base":"b0806bb796050bb254015051233dbebbd53440e2","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core+.h.c","libobs/obs-enum-sources.c.h","libobs/obs.c.h","test/cmocka/build/test-graph.json","test/cmocka/test_enum_sources.c","test/cmocka/tests.d/test_enum_sources.cmake"],"head":"da2ce0df533b10b5ee9785433be23ac5e6aa1e44","tools":{"orchestrator-python":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]","schema-dependencies":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504-GITv2.15.4\n compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ICU ISO8859X Regexps Automata RelaxNG Schemas Schematron Modules Debug Zlib"},"tracked-digest":"9fcc2676a87752c0cc853ed0ac7bb602c1e97e92b039490b70443f41e1389222","tree":"83fc512dc146494862fe3cb0c42dc636459f5979"}}
rdoupe
enabled auto-merge
November 23, 2026 06:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a C characterization of
obs_enum_sources,obs_enum_all_sources,obs_enum_canvasesandobs_canvas_enum_scenes(on a non-main canvas), then moves them (with their static helperobs_enum_uuid) verbatim fromlibobs/obs.c.hintolibobs/obs-enum-sources.c.h, a member of the core unity group (libobs/build/libobs.core+.h.c, alphabetical, right afterobs-enum-scenes-fields.c.h).test_enum_sourcesis registered once in the canonical test graph with itstests.dmarker. No behavior change; existing C tests and public headers are unchanged.Refs #5493. This is the C-only prerequisite; the Rust swap follows separately (as
obs_set_audio_monitoring_devicedid in #5490).What the test pins
test_enum_scenesalready pinsobs_canvas_enum_scenesthrough the main-canvas wrapperobs_enum_scenes. The new test covers the rest. Each case starts its own core.obs_enum_sources: of a public input, a private input, a scene, a filter, a group, a second public input, a private group and a private scene (created in that order), only the two inputs and the group are visited, in creation order. Each callback sees one reference held (count + 1), and every count is back where it was afterwards.obs_enum_sourcesand still visited byobs_enum_all_sources.obs_enum_all_sources: every one of the eight sources, private ones included, in creation order, with no reference taken; a false return stops it at each position.obs_enum_sources, and is visited byobs_enum_all_sources. A transition needs a graphics device to be created, so this one case resets video and checks only which sources are visited (the video thread references sources while it ticks them). The other cases run without a video thread, so their reference counts are exact.obs_enum_canvases: with no other canvas, only the main canvas. With two public canvases and a private one: main, then the two public ones in creation order, no reference taken; a false return stops it. A removed canvas stays in the walk while it is still referenced and leaves it once destroyed.obs_canvas_enum_sceneson a non-main canvas: its three scenes in creation order, each referenced for the call and released after, not a main-canvas scene created between them; a false return stops it. The main canvas walk sees only its own scene.Like
test_item_transition_empty_source, the target needs Linux with OpenGL (OS_LINUX,HAVE_OBS_OPENGL) and runs in the graphics suite.The move
obs-enum-sources.c.hsorts beforeobs.c.hin the group.obs_enum_sourcescompares againstgroup_info, whichobs.c.hdeclares later in the group, so the new file declaresextern const struct obs_source_info group_info;itself, asobs-scene-kind.c.hdoes. Nothing else inobs.c.husesobs_enum_uuid. Only the group includes the new file.Evidence
test:commit 5df6cdd): the test and its registration alone, against the C still inobs.c.h.OBS_CTEST_JOBS=10 uv run rust/tools/linux-validate/run.py --repeat 1 --tests 'test_enum_sources|test_enum_scenes': full Linux Tier 2 passed on the C reference and hybrid libobs (1087/1087 each), then the two related tests again on each (2/2).libobs:commit 549404e): the 89 moved lines are identical (diff) to the lines removed fromobs.c.h(plus one blank separator); the new file only adds the group's PCH include and thegroup_infodeclaration.xvfb-run, from the graphics working directory) printsRunning 8 test(s)andPASSED 8 test(s)on both libraries.libobsandlibobs-c-referencein the kept Tier 2 volume, run on both libraries, then reverted, then 8/8 again on both):obs_enum_sources(if (!s->context.private)→if (1)):enum_sources_visits_public_inputs_and_groups(5 visited instead of 3, line 281),enum_sources_stops_on_falseandenum_sources_skips_source_without_referencesfail; 5 of 8 pass.strcmp(s->info.id, group_info.id) == 0→false): the same three cases fail (2 visited instead of 3); 5 of 8 pass.obs_enum_canvasesignores a false return: onlyenum_canvases_visits_named_canvasesfails (3 visited instead of 1, line 426); 7 of 8 pass../lintpasses.🤖 Generated with Claude Code