Skip to content

Conversation

@Overc1ocker
Copy link

@Overc1ocker Overc1ocker commented Oct 29, 2025

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:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

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!

@Overc1ocker Overc1ocker changed the title [Draft] Expose Stduio mode:"Swap preview/program after transitioning" via the frontend API [Draft] Expose Studio mode:"Swap preview/program after transitioning" via the frontend API Oct 29, 2025
@Penwy
Copy link
Contributor

Penwy commented Oct 29, 2025

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.
Squashing the commits mean grouping together into one commits that do the same thing. Each commit is an independent and coherent unit of modifications.

If the PR is a draft, you should set it as draft on github.

@Overc1ocker Overc1ocker changed the title [Draft] Expose Studio mode:"Swap preview/program after transitioning" via the frontend API [Draft] Frontend_API: Expose Studio mode:"Swap preview/program after transitioning" via the frontend API Oct 29, 2025
@Overc1ocker Overc1ocker changed the title [Draft] Frontend_API: Expose Studio mode:"Swap preview/program after transitioning" via the frontend API Frontend_API: Expose Studio mode:"Swap preview/program after transitioning" via the frontend API Oct 29, 2025
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,
Copy link
Contributor

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.


swapScenesMode = enabled;

blog(LOG_INFO, "SwapScenesMode set to: %s", enabled ? "true" : "false");
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants