-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Frontend_API: Expose Studio mode:"Swap preview/program after transitioning" via the frontend API #12770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
The instructions on where to find the clang formatting scripts, and how to properly format the commit titles and descriptions can be found in the contribution guidelines. If the PR is a draft, you should set it as draft on github. |
frontend/api/obs-frontend-api.h
Outdated
| OBS_FRONTEND_EVENT_STUDIO_MODE_ENABLED, | ||
| OBS_FRONTEND_EVENT_STUDIO_MODE_DISABLED, | ||
| OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED, | ||
| OBS_FRONTEND_EVENT_SWAP_SCENES_MODE_CHANGED, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New events have to be added at the end of the enum to not break ABI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated 11/2/25. Is this the change you wanted?
|
|
||
| swapScenesMode = enabled; | ||
|
|
||
| blog(LOG_INFO, "SwapScenesMode set to: %s", enabled ? "true" : "false"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true and false are not really very descriptive of which mode it's being set to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
11/2/25: Switched to "enabled" and "disabled"
Description
This one is simple: This pull request adds an API call to toggle "Swap preview/program after transitioning" in the transition menu. It also adds an API call to check the value of that mode.
Motivation and Context
While I know it is not the primary objective of OBS, I have been personally experimenting with the usage of OBS as a cost effective video switcher for IMAG, Streaming, and Education (teaching people how to direct). Especially since a surprising amount of medium size shows do hack OBS to be their primary switching utility. When it came to replicating a basic video switcher with OBS, the only major issue I ran across was that I could not program a TRANSITION button and a PROGRAM button to work exactly like a real video switcher. With PROGRAM, the input corresponding to the button that is pressed is pushed immediately to program, where as a TRANSITION button/slider swaps preview and program. Because both buttons need the swap option to be different, I decided to try my hand at writing a new API call after the maintainer of the plugin I was using said there were API limitations when it came to my goal. I am not the best coder in the world so please feel free to provide feedback if you have any!
https://ideas.obsproject.com/posts/3029/make-swap-preview-program-scenes-after-transitioning-option-accessible-via-obs-api
How Has This Been Tested?
This has been tested lightly using a test plugin on my laptop. I noticed no performance issues or missing functionality. I made sure that the options still persisted after rebooting the program and that no feature I use with OBS is affected.
Testing device: i7 8th gen laptop with a 1080p screen
Testing os: Arch Linux (Garuda)
Testing mode: OBS portable
Used a test plugin which changed the "swap" functionality every 5 seconds for over 30 minutes with no issues. Also ensured that there would be no adverse effects if you take obs out of studio mode.
Types of changes
Tweak (non-breaking change to improve existing functionality)
Documentation (a change to documentation pages)
Checklist:
Please let me know how to fix the commit messages and clang-format the PR. I made the commits to my personal repo before reading the guidelines. Thanks!