Repository navigation
Description
Rust port: the canvas flag rules and setter checks in libobs/obs-canvas.c.h, moved to obs-core as a new module canvas_rules, next to canvas_draw.
Scope
Rust takes over these decisions:
- the flags each constructor passes: the main canvas's
MAIN | PROGRAM, andobs_canvas_create,obs_canvas_create_privateandobs_load_canvasmasked to the public flags (load keeps its(uint32_t)cast of the savedint64in C); obs_canvas_create_internal: the view type (ACTIVATEgives the main view), the mix'smix_audiofromMIX_AUDIO, and whether the canvas is named and signalled (not private);obs_canvas_destroy: per source, whether a scene ref is released (SCENE_REFand a scene), and whether the name entry is removed (not private);obs_save_canvas: no save for an ephemeral or removed canvas;obs_canvas_has_valid_video_infoandobs_canvas_reset_video_internal(mix_audio, the result);obs_canvas_insert_sourceandobs_canvas_remove_source: the scene ref take and release, and the group walk only for a group;obs_canvas_rename_source: the globalsource_renamesignal only for the main canvas;obs_canvas_reset_video: the refusal (no video info, the main canvas, video active);obs_canvas_set_channel: the channel bound, the same-source shortcut, the globalchannel_changesignal only for the main canvas, and the activate and deactivate steps;obs_canvas_set_name: the refusals (no name, the main canvas, the same name), the private or hashed rename, and the globalcanvas_renamesignal only for a public canvas;obs_canvas_remove: the refusal for a removed or main canvas, and the new flags.
C keeps every read of canvas->flags where it is today (it is read without a lock, and obs_canvas_remove writes it from any thread), and asks the core with that read. C also keeps every allocation and free, the context data calls, the signal handler setup, the mutexes, obs_view_init/_free, the mix create and free under mixes_mutex, HASH_CLEAR and the walk that takes next before each release (the #2038 and #2049 order), obs_source_is_scene/_is_group, every ref and weak ref, channels_mutex, the calldata and every signal, obs_source_activate/_deactivate, strcmp (its result is passed in), obs_video_active(), obs_canvas_enum_scenes and every log.
Plan
The standard six commits:
- move;
- characterization test;
- Tier 1 RED;
- GREEN in a
libobs.ported-*group; - Tier 3 parity;
- docs.
Dependencies and existing tests
No other unit. Real-libobs tests that must stay green: the canvas tests under test/cmocka (ctest -N listed in the PR), test_view, and the multi-canvas frontend tests if any.
Notes
No SIMD, no per-OS code, no MSVC traps (masks and compares only; the int64 to uint32_t cast stays in C).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 27, 2026
Claiming: #2544.
Draft PR once the RED commit exists, within the day.
libobs: Move the canvas flag rules
test: Characterize the canvas flag rules
obs-core: Test the canvas_rules port
obs-core: Port the canvas flag rules
obs-core: Check canvas_rules against the C
docs: Record the canvas_rules port
test: Characterize the canvas rules' callers
libobs: Move the canvas flag rules
test: Characterize the canvas flag rules
obs-core: Test the canvas_rules port
obs-core: Port the canvas flag rules
obs-core: Check canvas_rules against the C
docs: Record the canvas_rules port
test: Characterize the canvas rules' callers
rdoupe commentedon Oct 27, 2026
Fixed by PR #2546 (merged through the merge queue): the canvas flag rules and setter checks of
libobs/obs-canvas.c.hnow run inrust/obs-coreas thecanvas_rulesmodule, seventeen hidden shims in thelibobs.ported-canvas-rulesgroup, with Tier 1, Tier 2 (including the new caller test) and Tier 3 parity tests. The exported symbol sets are unchanged.What is left: by design, the rest of
obs-canvas.c.hstays C at its original points: allocations and frees, locks, the view and mix,HASH_CLEARand the destroy walk, references, signals,obs_source_activate()/_deactivate()and logging. Kept as characterized, not endorsed: a saved flags value above 32 bits or negative keeps the low word's public flags; an out-of-enum video format counts as set; a removed canvas can still be reset and renamed.Follow-up issue: none filed. I found no open issue that tracks the remainder of the canvas code (searched open issues for "canvas" and "obs-canvas"), so the rest has no issue yet.
obs-core: Port the canvas flag rules (obs-rust#2546)