Repository navigation
obs-core: port the raw video callback entry points to Rust (Fixes #5514) - #5516
Merged
Merged
Conversation
rdoupe
force-pushed
the
port/raw-video-callbacks
branch
from
November 23, 2026 15:16
d3acdab to
80a3194
Compare
rdoupe
enabled auto-merge
November 23, 2026 16:05
…() stub (Refs #5514) RED: the obs-core core is todo!(), so all eight Tier 1 cases (one per test_raw_video_callbacks case, plus the before-first-reset calls of test_main_mix_before_video) and the Tier 3 parity test fail. Co-Authored-By: Claude Opus 5.5 <[email protected]>
obs_add_raw_video_callback, obs_add_raw_video_callback2 and obs_remove_raw_video_callback move to obs-core. The main canvas's mix is read once through the existing obs_get_video() field adapter; with no canvas or no mix the add logs its LOG_WARNING and keeps nothing and the removal does nothing; otherwise exactly one start_raw_video / stop_raw_video (still C) on the mix's video with the arguments unchanged. The C moves to its own ported unity group, so the C reference keeps compiling it and hybrid libobs links the Rust. Co-Authored-By: Claude Opus 5.5 <[email protected]> Ci-Attestation: {"at":1795451559,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":92,"stamp":"f59e3bec81e3c500733d6b608d83037c","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451559,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":92,"stamp":"0c3155738420ba1f7b8ddd1d1878ccb7","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451559,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":92,"stamp":"b2baabfa1622849e4e5b25d17b585bb7","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451559,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":92,"stamp":"acbaa74fa63c13757aa6ca8b59c7281c","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451466,"gate":"general/all/client-lint","host":"linux-x86_64","key":"ae878c8a1b304ea1a71a8acd18af046fc569c9289cb81723fc5613f712ad4d33","lane":"client-lint","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":50,"stamp":"4681c145455fcc1d9ee6bdfc5489ba1c","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451559,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":92,"stamp":"bfb34953665c3cee46bc868d21c62b3a","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451466,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"ae878c8a1b304ea1a71a8acd18af046fc569c9289cb81723fc5613f712ad4d33","lane":"client-lint","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":50,"stamp":"c9f60dbcc3d589ae865d5e55d6a547bc","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451466,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"ae878c8a1b304ea1a71a8acd18af046fc569c9289cb81723fc5613f712ad4d33","lane":"client-lint","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":50,"stamp":"212f2888f9bcfc838cafb25749e4f734","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451466,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"ae878c8a1b304ea1a71a8acd18af046fc569c9289cb81723fc5613f712ad4d33","lane":"client-lint","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":50,"stamp":"1e5efe03e0a2d40fc7970a59e3dc739b","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451466,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"ae878c8a1b304ea1a71a8acd18af046fc569c9289cb81723fc5613f712ad4d33","lane":"client-lint","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":50,"stamp":"dcdd1725ab6dbbefea02c8a56557d825","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451466,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"ae878c8a1b304ea1a71a8acd18af046fc569c9289cb81723fc5613f712ad4d33","lane":"client-lint","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":50,"stamp":"1c591cacc032d7e9d6ddd99e121dd1ba","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451466,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"ae878c8a1b304ea1a71a8acd18af046fc569c9289cb81723fc5613f712ad4d33","lane":"client-lint","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":50,"stamp":"4589ec4509ff1467694292bf67c18ca7","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451466,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"ae878c8a1b304ea1a71a8acd18af046fc569c9289cb81723fc5613f712ad4d33","lane":"client-lint","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":50,"stamp":"23cb5111487863cfbad698da2b49dfea","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451466,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"ae878c8a1b304ea1a71a8acd18af046fc569c9289cb81723fc5613f712ad4d33","lane":"client-lint","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":50,"stamp":"d5cfc6a5c6186724e0273e128738fe62","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451466,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"ae878c8a1b304ea1a71a8acd18af046fc569c9289cb81723fc5613f712ad4d33","lane":"client-lint","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":50,"stamp":"43b8c48a1059a6c76485d50a9b92a11d","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451466,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"ae878c8a1b304ea1a71a8acd18af046fc569c9289cb81723fc5613f712ad4d33","lane":"client-lint","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":50,"stamp":"7bafcdfe497489b9811632295ad32760","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451466,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"ae878c8a1b304ea1a71a8acd18af046fc569c9289cb81723fc5613f712ad4d33","lane":"client-lint","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":50,"stamp":"5222b89f6ea038cf1cf7f57f23d8f827","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451466,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"ae878c8a1b304ea1a71a8acd18af046fc569c9289cb81723fc5613f712ad4d33","lane":"client-lint","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":50,"stamp":"7645a9ee1e72a24850ee2ff8b7956227","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Ci-Attestation: {"at":1795451769,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"8811839e47d0b0618d27e0351586e5925854dc6e9b8381298481ec25b270f1a9","lane":"client-test-x86_64-unknown-linux-gnu","parents":["a4314f740ecadb5409faf3a4539c4e6f6172dbec"],"secs":209,"stamp":"6b19e6c27a62b7999c57dadee62d74b0","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34","v":1,"via":"run"} Client-Checks: {"checks":{"base":"f97bee2b3dad98db4d5d88adf49cee22d8bd6a64","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core+.h.c","libobs/build/libobs.ported-raw-video-callbacks+.h.c","libobs/build/ported-source-sets/raw-video-callbacks.json","libobs/cmake/rust-exports.d/obs-core-raw_video_callbacks.txt","rust/README.md","rust/obs-c-oracle/oracle/raw_video_callbacks.c","rust/obs-c-oracle/oracle/raw_video_callbacks_links.c","rust/obs-core/src/ffi/mod.rs","rust/obs-core/src/ffi/raw_video_callbacks.rs","rust/obs-core/src/lib.rs","rust/obs-core/src/raw_video_callbacks.rs","rust/obs-core/tests/obs_core/main.rs","rust/obs-core/tests/obs_core/raw_video_callbacks.rs","rust/obs-core/tests/obs_core/raw_video_callbacks_parity.rs"],"head":"0fb4c2299a88e7bf6d8e4016323f213379587bd3","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":"cd28e628302aecedc86e14468f7507282eb89f0085fb4587c0e2c9c4ac23ba44","tree":"70e1748876a60d32aeff5fd37d589366c32b9a34"}}
rdoupe
force-pushed
the
port/raw-video-callbacks
branch
from
November 23, 2026 16:36
80a3194 to
ceaaf67
Compare
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.
Fixes #5514
Rebased onto master after #5509 (the extraction of
libobs/obs-raw-video-callbacks.c.handtest_raw_video_callbacks) merged.What and why
obs_add_raw_video_callback,obs_add_raw_video_callback2andobs_remove_raw_video_callback(libobs/obs-raw-video-callbacks.c.h, extracted and characterized by #5509) move to Rust inobs-core, the video counterpart of the raw audio pair (#5003, #5512). The safe core (raw_video_callbacks::{add, add2, remove}) makesaddthe divisor-1 form ofadd2; it reads the main canvas's mix video once and, with no main canvas or no mix, the add logs itsLOG_WARNING(obs_add_raw_video_callback2: video is not set up yet, the raw video callback was not added, word for word, also through the divisor-1 form) and keeps nothing, while the removal does nothing. Otherwise exactly one call to libobs' hiddenstart_raw_video/stop_raw_video(they stay C inobs.c.h, also used by outputs and encoders) on the mix'svideo_t, with the conversion pointer, divisor, callback and param unchanged. No validation, locking or fallback is added: the divisor/NULL/duplicate checks, the locking and theraw_activecount stay instart_raw_video/ video-io.The main canvas and mix are read through the existing private
obs_get_video_fields()adapter (the one the Rustobs_get_videouses: canvas,canvas->mix,mix->video), so no new libobs seam is added; a mix whosevideois NULL is passed on as the C does. The C file moves to its own ported unity group (libobs.ported-raw-video-callbacks+), so the C reference keeps compiling it and hybrid libobs links the Rust; the three symbols are inrust-exports.d/obs-core-raw_video_callbacks.txt. For the Windows/macOS test links,rust/obs-c-oracle/oracle/raw_video_callbacks_links.cgivesobs-tests-corestand-ins forstart_raw_video/stop_raw_video(the shim names them;obs_get_video_fieldsandblogalready have definitions there). No intentional differences from the C.Tiers: Tier 1 mirrors all seven
test_raw_video_callbackscases, plus the before-first-reset calls oftest_main_mix_before_video(no canvas, and a canvas with no mix), in the Core state binary, over a synchronous model of the canvas, its mix and video-io's connect2/disconnect2 rules (no threads or waits). Tier 2 is the unchangedtest_raw_video_callbacks,test_main_mix_before_videoandtest_video_activeagainst both libraries. Tier 3 runs the original C (compiled against a real-header core and the realobs_get_video()field adapter) and the Rust bridge against one recorder forstart_raw_video,stop_raw_videoand the warning, comparing call counts, the video, conversion, divisor, callback and param identities, the warning level and text, and that neither the core/canvas/mixes nor the conversions are written, over five main-canvas states (no canvas, no mix, mix with NULL video, two mixes) x add/add2/remove x divisors 0, 1, 2, 3,u32::MAXx three conversions x four callbacks x four params, plus 256 proptest cases over anyu32divisor and 1..3 repeats; it also checks the real-header layouts ofstruct video_scale_info, the callback type and the field adapter. Tier 4 does not apply. No existing C test or public header changes.Evidence
todo!()core):soldr cargo test -p obs-data --test obs-tests-core -- raw_video_callbacks→ 0 passed, 9 failed (not yet implemented: obs_add_raw_video_callback/..._callback2; the parity child aborts on thetodo!()inside theextern "C"bridge).add2failsraw_video_callbacks_parity::original_c_arguments_calls_and_warningand four Tier 1 cases (5 failed, 4 passed).OBS_CTEST_JOBS=10 uv run rust/tools/linux-validate/run.py --repeat 5 --tests '^test_(raw_video_callbacks|main_mix_before_video|video_active)$'): full suite 1090/1090 on the C reference and 1090/1090 on hybrid libobs; the three tests 5/5 repeats on each; exported symbols identical (1769)../lint: ok.Test cost: eight Tier 1 tests in microseconds, no threads; the parity test runs in one child process (~10 ms), no threads of its own.
🤖 Generated with Claude Code