Conversation
There was a problem hiding this comment.
Pull request overview
This PR refines the PTZ device proc_handler API by introducing a ptz_-prefixed command surface and moving camera “commands” (power, white balance actions) out of persistent settings updates into explicit command calls, reducing naming conflicts and clarifying intent between configuration/state vs. commands.
Changes:
- Rename per-device proc_handler methods to
ptz_*and update call sites to use the new names. - Route “trigger” style operations through
ptz_setarguments (e.g., focus one-touch) instead of separate proc calls/settings writes. - Add VISCA-specific
set(calldata_t*)handling and a WB mode modified callback to issue commands immediately from the properties UI.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/ptz-visca.hpp |
Declares VISCA override for the refined set(calldata_t*) command handler. |
src/ptz-visca.cpp |
Moves VISCA command behaviors (power/WB) into set() and adds WB UI callback to send commands on change. |
src/ptz-device.hpp |
Removes the proc-handler wrapper slot for focus one-touch in favor of ptz_set trigger semantics. |
src/ptz-device.cpp |
Renames per-device proc methods to ptz_*, updates global proc routing, and adds focus_onetouch_trigger handling in set(). |
src/ptz-controls.hpp |
Updates preset APIs to use long long and adds typed callCurrentDevice helpers. |
src/ptz-controls.cpp |
Migrates UI command dispatch to ptz_* methods and introduces fixed-stack calldata helpers for common calls. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
glikely
force-pushed
the
staging
branch
3 times, most recently
from
June 2, 2026 14:47
cf7401f to
6cd8b96
Compare
This reverts commit b19d21d. Using pull requests is a better workflow for validating branches than adding 'staging' to the list
The function pointer form allows the function signatures to be checked at compile time, and is the method recommended by the Qt docs. Also fixes a bug where a joystick event was being connected when CONFIG_JOYSTICK was disabled. With the function pointer binding the code fails to compile because the method was configured out. Fixed by moving the call site. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
It is possible for a proc_handler to provide the PTZ api in addition to other functions. Add a prefix namespace to the PTZ api so that if that happens there will not be a conflict. This patch also removes the 'focus_onetouch' method and merges it into 'ptz_set'. The plan is to activate triggers using bool arguments to the ptz_set method. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
A calldata stack can be allocated with a fixed size on the function stack, which eliminates bzalloc()/bfree() calls. Switch all the PTZControls device calls to use fixed calldata so that we're not dynamically allocating memory in a hot path. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
This renames the property name used in the 'ptz_set' proc handler from "autofocus" to "focus_af_enabled". The rest of the code was already using the later string for storing autofocus state, so that string should be used here too. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
The configuration and control architecture of this plugin was overloading set_settings() to manipulate both device settings and to send transient commands. e.g., "power_on" and "power_off" were triggered by calling set_settings(). Then to avoid transient properties in the device configuration, a separate get/set_config() API is provided that handles a subset of properties. This is just confusing. It would be better to split commands and transient state into a separate API, and restrict get/set_settings() to only the device configuration. Fortunately, there aren't many commands implemented at this time, so it is simple to remove them from the set_settings() path. This commit moves all device commands to the set() proc_handler call. It also changes the device's obs_properties to use a callback for changes to the White Balance mode, which processes the change immediately instead of waiting for a call to set_settings(). Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
The get_config() methods were allocating and returning a new obs_data_t structure on each call, and in many cases the caller was then using obs_data_apply() to copy the data into another obs_data_t. This pattern is a little awkward, and it doesn't match the pattern used by sources in OBS Studio. The sources pattern has the obs_data instance managed by the caller, and is passed into the save() callback to get updated before saving to the config file. This patch reworks the save path by: - renaming 'get_config()' to 'save()' - Pass the obs_data_t structure into the save() method - Make all save methods 'const' as they don't change the state Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Matches the pattern in OBS Studio sources, where the defaults can be retrieved separate from the object instance. Is useful for using the OBSPropertiesView widget. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
THe ptz controls were accessing the device's settings structure to query device state for autofocus mode and whitebalance mode. Fetching the settings structure is potentially a heavyweight process for fetching a couple of bools. Instead use the "ptz_get" proc handler method to query just the values that are needed. This change also removes another direct access of PTZDevice from the PTZControls widget. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
get_settings() is an empty shell now. All of the functionality is now in `save()`. Remove the method and convert the remaining user over to calling `save()`. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Consolidate set_config and set_settings into a single method and rename it 'update' to match the naming used by OBS studio sources for configuration management. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
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.
No description provided.