Repository navigation
Description
Goal
Move more of libobs from C to Rust, faster. The hybrid build (libobs/build/source-sets.json) still compiles about 25,000 lines of unported libobs C. The biggest files (obs-source, obs-scene, obs.c, graphics.c, obs-output, obs-encoder) need seams first (#444), so they move slowly. This meta picks 10 units that can each delete a whole .c.h file (or a clean slice of one) from the production unity groups, with no open seam work and no overlap with claimed issues.
Selection rules:
- Not already claimed or open: shader-parser rust: Port graphics/shader-parser.c to obs-graphics #1785, effect-lookups rust: Port graphics/effect-lookups.c to obs-graphics #1822, cf-lexer rust: Port util/cf-lexer.c (cf preprocessor) to obs-util #1499, hotkey press count rust: Port the hotkey binding press count in obs-hotkey.c to obs-hotkey #1836, output protocols rust: Port the output protocol-list match in obs-output.c to obs-output #1829, video output plan rust: Port the video output conversion plan in obs.c to obs-core #1713, scene visibility ramp rust: Port the scene item visibility audio ramp in obs-scene.c to obs-scene #1814, platform.c port: util/platform.c to obs-util #262.
- Little or no graphics-device or
obs_sourceprivate-layout dependency, so no seam has to be built first. - The Rust target crate already exists, so no unit adds a crate.
Units (one issue and one PR each)
Each worker files the unit issue (format like #1822), claims it, and ticks it here.
- 1. util: Port the platform string conversions to obs-util #1874
util/platform-conversions.c.h(211 lines) →obs-util. Pure UTF-8/wide/text conversions;platform.c(port: util/platform.c to obs-util #262) already uses them. - 2. rust: Port util/dstr-libc.c to obs-util #1855 (util: Port dstr-libc to obs-util #1857)
util/dstr-libc.c.h(272) →obs-util. The libc-backeddstrhelpers; the rest ofdstris already ported (Phase 3 remaining ports: utf8, lexers, text-lookup, dstr, base, bmem #43), so this removes the last part of it. - 3. util: Port profiler-io to obs-util #1875
util/profiler-io.c.h(363) →obs-util. Profiler snapshot save and CSV/gzip output, on top of the ported profiler (rust: Port util/profiler.c to obs-util #152). Do it together with the platform conditionals in facade: libobs/util/platform.c and profiler-io.c: move 7 platform conditionals into platform-<os> files #874. - 4. rust: Port util/source-profiler.c to obs-core #1886 (obs-core: Port util/source-profiler.c #1887)
util/source-profiler.c.h(627) →obs-util(orobs-core). Per-source render and tick timing. meta: Phase 6 libobs core migration through opaque C seams #444 already moved it into Phase 6; it reads source and graphics internals only through accessors, so add those first in the same PR. - 5. rust: Port graphics/texture-render.c.h to obs-graphics #1860 (obs-graphics: Port graphics/texture-render.c.h to Rust #1861)
graphics/texture-render.c.h(150) →obs-graphics.gs_texrender_*state machine over the existing device calls; the effect lifecycle and math are already inobs-graphics. - 6. rust: Port graphics/image-file.c.h to obs-graphics #1907 (obs-graphics: Port graphics/image-file.c.h #1911)
graphics/image-file.c.h(408) →obs-graphics.gs_image_file*load, animation timing and decode-to-texture. libnsgif stays C for now and is called through FFI. - 7. rust: Port media-io/media-remux.c.h to obs-media-io #1927 (obs-media-io: Port media-io/media-remux.c.h #1928)
media-io/media-remux.c.h(315) →obs-media-io. Remux job over libavformat; same FFmpeg FFI pattern as the media-io units already ported. Covers its facade: libobs top-level files (obs-module, obs-display, obs-hotkey, obs-source, obs-internal, gpu-encode, audio-controls, media-remux): move 14 platform conditionals #870 conditional. - 8. rust: Port the obs-service capability and connect-info getters to obs-output (#1846 unit 8, slice 1) #1899 rust: Port the obs-service settings, properties and identity functions to obs-output (#1846 unit 8, slice 2) #1913 rust: Port the obs-service lifecycle, references and activation to obs-output (#1846 unit 8, slice 3) #1920 (obs-output: port the obs-service getters to Rust (#1899) #1904, obs-output: port the obs-service settings, properties and identity functions (#1913) #1916, obs-output: port the obs-service lifecycle, references and activation (#1920) #1923)
obs-service.c.h(469) →obs-output. Service create/destroy/settings/connect info. Small, public API only, next to the ported output units. - 9. rust: Port the obs-module search paths and data-path lookup to obs-core (#1846 unit 9, slice 1) #1876 (libobs: Port the module search paths to obs-core #1894, slice 1)
obs-module.c.h(1,263), first slice: module search paths,obs_find_module_file/ data-path lookup and the module info list →obs-core. Loading (os_dlopen,obs_module_load) stays C in this slice. - 10. rust: Port the audio mix and buffering math in obs-audio.c to obs-core (#1846 unit 10, slice 1) #1903 (libobs: Move the audio tick arithmetic into obs-audio-mix.c (#1903) #1905, slice 1)
obs-audio.c.h(746), first slice: the pure mixing and buffering math (audio mix, clamping, buffering timestamps) →obs-core. The audio thread and source list walk stay C until the source seam in meta: Phase 6 libobs core migration through opaque C seams #444.
Units 1–8 are independent and can run in parallel. 3 waits on #152 if that has not merged. 9 and 10 are the first slices of large files; each should close by filing its next slice here.
Common rules
docs/rust-port/testing-policy.md, all four tiers: characterization intest/cmocka/against the C first (Tier 2, unchanged afterwards), RED then GREEN, Tier 1 unit tests, Tier 3 differential against the oracle inrust/obs-c-oracle/legacy/.- Move the include into a
ported-*group inlibobs/build/source-sets.json(seedocs/rust-port/hybrid-build.md, "Migrating another unit"), check that the production build excludes the C and the C reference still includes it. - Add cases to the category's existing test binary; no new test executables.
- Exported symbols and public headers stay unchanged.
- Each PR records
port_comparisonnumbers for its unit.
Done when
All 10 boxes are ticked and the listed C is out of the production libobs build (about 2,800 lines from units 1–8 removed whole, plus the first slices of obs-module and obs-audio, with their next slices filed).
Related: #444 (Phase 6), #153 (Phase 4), #45 (Phase 5), #4 (roadmap).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 23, 2026
A note on unit 8 (
obs-service.c.h), from checking it before claiming: it does need a seam. Only the fourobs_weak_service_*functions avoid private layout. The rest read:struct obs_servicefields afterstruct obs_context_data(info,active,destroy,output,owns_info_id), plus create'sbzalloc(sizeof(struct obs_service));struct obs_output(actually_destroy_service()clearsservice->output->service);obscore (find_service()walksobs->service_types; create links intoobs->data.first_serviceunderservices_mutex);struct obs_module(obs_service_get_module()walks the module lists).obs-output.c.h,obs.c.handobs-hotkey.c.halso readstruct obs_servicedirectly, so the struct can't move either. A port would be a #1550-style seam PR (hidden field/allocator/registry accessors) and then the port, so two PRs rather than one. I'm not claiming unit 8 for that reason, and am taking a different unit instead.zackees commentedon Oct 23, 2026
Unit 1 (
util/platform-conversions.c.h) is already #262 slice 1, claimed by @rdoupe on 2026-10-21 (the move andtest_platform_conversionslanded; the port is theirs). I am leaving it to them and not opening a parallel PR; the box ticks when their port merges.Found while reading it, for whoever ports it:
os_utf8_to_wcspassesout_len + 1(=dst_size) as the capacity toutf8_to_wchar, so text exactlydst_sizewide characters long converts in full anddst[dst_size] = 0writes one past the buffer.os_wcs_to_utf8passesdst_size - 1and does not have this. A Rust slice port cannot write pastdst, so it will differ there and should list it as an intentional difference.util: Port dstr-libc to obs-util (GREEN)
rdoupe commentedon Oct 23, 2026
Unit 2 (Withdrawn: #1855 / #1857 claimed unit 2 first. #1858 is closed as a duplicate and #1859 is closed.util/dstr-libc.c.h): #1858, PR #1859.rdoupe commentedon Oct 23, 2026
Unit 5 (
graphics/texture-render.c.h): #1860, PR #1861. No seam needed: the file only calls publicgs_*functions. Tier 3 compares against the original through a recordinggs_*stand-in in obs-c-oracle, so no GPU and no CI change. One deviation from the common rules: the cmocka characterization is a new executable,test_texture_render, because no existing graphics test fakes a device. #1823'stest_effect_lookupsis the precedent; the Rust side adds a module to the existingobs-tests-graphics.util: Port dstr-libc to obs-util (obs-rust#1857)
rdoupe commentedon Oct 23, 2026
Unit 9 (
obs-module.c.hslice 1: search paths, data-path lookup, module info list): claimed in #1876.test: Characterize profiler-io print output and CSV dumps
util: Test profiler-io against a Rust stub (RED)
util: Port profiler-io to obs-util (GREEN)
zackees commentedon Oct 23, 2026
Unit 4 (
util/source-profiler.c.h): #1886, intoobs-core. No seam needed: the two private reads already have accessors with the same result (obs_enter_graphics/obs_leave_graphics,obs_source_get_output_flags), details in #1886.test: Characterize the source profiler's public results
rdoupe commentedon Oct 23, 2026
Unit 9 slice 1 (module search paths): #1876, PR #1894. No seam: C passes
module->data_pathand eachobs->module_pathsentry in, plus the platform extension and the macOS bundle hook; the walk,obs_add_module_pathand all loading stay C. The extraction is its own behaviour-neutral commit inside the one PR. Next slice candidates:obs_module_get_config_pathandget_module_name.test: Characterize the source profiler's public results
test: Characterize profiler-io print output and CSV dumps
5 remaining items
test: Characterize the source profiler's public results
test: Characterize profiler-io print output and CSV dumps
util: Test profiler-io against a Rust stub (RED)
util: Port profiler-io to obs-util (GREEN)
vpacher commentedon Oct 23, 2026
Unit 10 (
obs-audio.c.hslice 1: the mix window and add loop,convert_time_to_frames, and the tick and timestamp arithmetic of the two buffering functions): claimed in #1903. No seam: the extracted helpers take plain values, and the source walk, locks, logging and deques stay C (precedent #1814 / #1842). Correction:obs-audio.c.hdoes not clamp, the clamping is inmedia-io/audio-io. Next slice candidates:ignore_audio/discard_audio, then the min-timestamp search.zackees commentedon Oct 23, 2026
Unit 6 (
graphics/image-file.c.h): claimed in #1907.zackees commentedon Oct 23, 2026
Unit 7 (
media-io/media-remux.c.h) needs a decision first. The unit text says "same FFmpeg FFI pattern as the media-io units already ported", but no Rust crate links FFmpeg today: noavutiloravformatin anyCargo.tomlorbuild.rs, and the oracle doesn't link it either. The file's logic is packet timestamp math built onav_rescale_q_rndandav_rescale_delta(with its per-stream state), plus theav_read_frame/av_interleaved_write_frameloop.There are two ways to do it, and each is a choice for maintainers:
obs-media-ioand the oracle. That's a new native dependency for the cargo test lanes on all three hosts.av_rescale*arithmetic in Rust for a pure timestamp core, and keep the FFmpeg I/O loop in C. The differential test would still need libavutil as the oracle for the rescale math.Decision needed: which one, or leave unit 7 until the FFmpeg-facing plugins are in scope. Units 1 and 5 are done (#1874, #1861), I ticked their boxes, and unit 8 slice 1 is #1899 (#1901 characterization, #1904 port).
util: Port profiler-io to obs-util (obs-rust#1875)
test: Characterize the source profiler's public results
obs-core: Port util/source-profiler.c (obs-rust#1887)
zackees commentedon Oct 23, 2026
Unit 7 filed and claimed: #1927 (media-remux → obs-media-io).
zackees commentedon Oct 23, 2026
All 10 units have landed. Mine: 2 (#1857), 3 (#1875), 4 (#1887), 6 (#1911), 7 (#1928). Other contributors: 1, 5, 8, 9, 10. Further obs-audio and obs-module slices continue under #1903 and #1876.