Repository navigation
linux-pipewire: Disable manual camera controls while their automatic mode is on - #1054
Merged
zackees merged 2 commits intoOct 16, 2026
Merged
Conversation
In the Properties window of the "Video Capture Device (PipeWire)" source, ticking "Focus, Automatic Continuous" leaves "Focus, Absolute" enabled: the slider drags, and the camera ignores it. The same for Exposure Time, Absolute in Auto Mode, White Balance Temperature with White Balance, Automatic on, and Hue with Hue, Automatic on. The V4L2 driver flags these controls inactive (V4L2_CTRL_FLAG_INACTIVE), and the V4L2 source greys them out since obs-rust#895, but PipeWire's V4L2 node does not pass the flag on: its PropInfo params only carry each control's id, name and range. Menu controls (Auto Exposure, Power Line Frequency) are missing from the window altogether: the node publishes a menu as a plain Int with labels, and the source only reads a choice, so Auto Exposure cannot be switched to Manual Mode from OBS. test_pipewire_camera_control_refresh now plays two cameras the way PipeWire's V4L2 node publishes them (the same prop ids, menus, and the "device.api" and "object.path" node properties): - the "UHD Camera" of obs-rust#827, with the control list its driver reports (uvcvideo, kernel 7.2.9): Focus, Absolute comes before Focus, Automatic Continuous, Auto Exposure starts in Auto Mode, and Iris, Absolute has a step of 0; - a webcam with White Balance, Automatic (listed before its controls) and Hue, Automatic (listed after Hue), in Aperture Priority Mode. Brightness of the existing cases now uses the UHD Camera's range (0-14). Cases. Guards that pass: - control_change_reaches_the_camera, control_change_does_not_rebuild_ properties (obs-rust#829): unchanged apart from the range. - saved_manual_modes_enable_the_controls_on_load: saved settings with the automatic modes off leave the manual controls enabled. Failing: - manual_controls_are_disabled_on_load: Focus, Absolute and Exposure Time, Absolute of the UHD Camera, and the webcam's white balance, hue, exposure and focus controls are enabled while their automatic modes are on. Iris, Absolute and the controls after it must stay enabled. - toggling_autofocus_disables_and_enables_the_focus: unticking and ticking the checkbox, three times, asks for no rebuild and changes nothing. - switching_auto_exposure_disables_and_enables_the_exposure: no Auto Exposure list to switch. - toggling_white_balance_and_hue_automatic: the same for White Balance, Automatic and Hue, Automatic. - menu_controls_are_shown: Auto Exposure and Power Line Frequency are missing. The node's device path, name and fd must not show up. - moving_a_manual_control_keeps_the_properties: drags of Focus, Absolute with autofocus off and of Iris, Absolute pass; moving the overridden Focus, Absolute (from a script) sends it to the camera 8 of 8 times. 6 of 9 fail, in both lanes. Refs obs-rust#827. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mode is on With "Focus, Automatic Continuous" ticked in the Properties window of the "Video Capture Device (PipeWire)" source, "Focus, Absolute" stayed enabled: the slider dragged, and the camera ignored it (uvcvideo flags the control inactive and refuses it with EACCES). The same for Exposure Time, Absolute outside Manual Mode, White Balance Temperature, Red and Blue Balance with White Balance, Automatic on, and Hue with Hue, Automatic on. obs-rust#895 greys these out in the V4L2 source from the driver's V4L2_CTRL_FLAG_INACTIVE, but PipeWire's V4L2 node does not pass that flag on. For a V4L2 camera node ("device.api" v4l2, or an "object.path" starting with "v4l2:"), the source now knows the automatic/manual pairs the V4L2 spec defines, as uvcvideo implements them, by V4L2 control id: the node gives a control the prop id SPA_PROP_START_CUSTOM + its V4L2 id, or SPA_PROP_hue / SPA_PROP_exposure. A manual control is shown disabled while its automatic control, as the window shows it, is not in its manual mode (0, or Manual Mode for Auto Exposure), whatever the order the camera lists them in. When the window opens, and after each change, the states are worked out again; the window is rebuilt only when one of them changed, so dragging a slider still never rebuilds it (obs-rust#829). An overridden manual control is not sent to the camera; it keeps its value. Menu controls are shown again: the node publishes a menu (Auto Exposure, Power Line Frequency) as a plain Int with labels, not as a choice, so the source skipped it, and Auto Exposure could not be set to Manual Mode from OBS. A plain Int with labels is now a list. The node's other plain values (the device's path, name and fd) are still not shown. test_pipewire_camera_control_refresh: 9 of 9 pass, in both lanes. Refs obs-rust#827. Co-Authored-By: Claude Opus 5.5 <[email protected]>
zackees
approved these changes
Oct 16, 2026
zackees
enabled auto-merge
October 16, 2026 09:30
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.
Refs #827
What and why
In the "Video Capture Device (PipeWire)" source, a manual camera control now greys out while its automatic mode is on, and menu controls (Auto Exposure, Power Line Frequency) show up. The reporter's second camera ("UHD Camera", uvcvideo, kernel 7.2.9) kept "Focus, Absolute" enabled with "Focus, Automatic Continuous" ticked. The slider dragged, and the camera ignored it.
Cause
V4L2_CTRL_FLAG_INACTIVE.v4l2-ctl --list-ctrlsshowsfocus_absolute ... flags=inactive). PipeWire's V4L2 node does not pass the flag on: its PropInfo params carry only the id, name and range (spa_v4l2_enum_controls()).camera-portal.cnever enabled or disabled a control.add_control_property()parsed the type withSPA_POD_PodChoice, which rejects a plain value. So Auto Exposure could not be switched to Manual Mode from OBS at all.test_v4l2_controlsalready covers its bool master listed after its slave, both ways (turning_autofocus_off_enables_the_manual_focus), and its flag loop does not depend on a control's step.Fix (all in
plugins/linux-pipewire/camera-portal.c)device.api=v4l2, or anobject.pathstarting withv4l2:), the source maps each prop id back to its V4L2 control id. PipeWire usesSPA_PROP_START_CUSTOM+ the id, orSPA_PROP_hue/SPA_PROP_exposure.Not changed
RED → GREEN
RED commit: 9d231a4
test/cmocka: Add failing tests for PipeWire camera automatic controls.test_pipewire_camera_control_refreshnow plays two V4L2 cameras the way PipeWire's V4L2 node publishes them: the reporter's exact control list, and a webcam with White Balance, Automatic (listed before its controls) and Hue, Automatic (listed after Hue) in Aperture Priority Mode. 6 of 9 cases fail in both lanes:manual_controls_are_disabled_on_load("'Focus, Absolute' is enabled");toggling_autofocus_disables_and_enables_the_focus("rebuild 0 (expected 1), 'Focus, Absolute' enabled 1");switching_auto_exposure_disables_and_enables_the_exposureandmenu_controls_are_shown("'Auto Exposure' missing, 'Power Line Frequency' missing");toggling_white_balance_and_hue_automatic;moving_a_manual_control_keeps_the_properties("the disabled 'Focus, Absolute' was sent to the camera 8 times").The two linux-pipewire: Keep the Properties window when a camera control changes #829 cases and
saved_manual_modes_enable_the_controls_on_loadpass.GREEN: 8c9aec7. 9/9 with
ENABLE_RUST_LIBOBSOFF and ON, every case run against the private PipeWire daemon (no skips). The cases cover:Full ctest at
-j8(private Xvfb, systemlibobs-openglmasked, TMPDIR unset): C lane 258/258, Rust lane 258/258. Skips:open_crashes_without_obs_corein both lanes, as on master. In the C lane,test_startup_alloc_stablealso skipped once under load and passes alone (not touched here). All PipeWire/Pulse tests ran. clang-format 22.1.3, gersemi 0.25.0 andci/test_registration.pyclean.Real app: release 0.1.0-beta.20261014 AppImage on a private Xvfb, with a private PipeWire daemon, a fake camera portal on a private bus, and a stand-in camera node publishing the reporter's control list.
linux-pipewire.so: both are greyed out on open, and both menus are shown. Unticking autofocus enables Focus, Absolute. A 20-step drag then sends all 20 values to the camera and keeps the slider. Ticking greys it out again, and three more untick/tick rounds reach the camera each time. Picking Manual Mode in Auto Exposure enables Exposure Time.CI: the Tier 2 image has no PipeWire daemon, so
test_pipewire_camera_control_refreshskips there (exit 77), as since linux-pipewire: Keep the Properties window when a camera control changes #829.Checklist
master-W..., ratchets): noneAI note: Claude Code (Claude Opus 5.5) wrote the code, the tests, the commit messages and this text under the submitter's direction, and ran the tests above on the submitter's machines.
🤖 Generated with Claude Code