frontend: Add output wrapper class
Description
Makes a class for simplifying outputs, so there is not so much duplicate code.
Motivation and Context
Less code
- Currently, only the virtual camera is using this code
- This makes it easier to develop a single UI for outputs in the future
How Has This Been Tested?
Tested with Decklink output
Types of changes
- New feature (non-breaking change which adds functionality) -->
- Code cleanup (non-breaking change which makes code smaller or more readable)
Checklist:
- [x] My code has been run through clang-format.
- [x] I have read the contributing document.
- [x] My code is not on the master branch.
- [x] The code has been tested.
- [x] All commit messages are properly formatted and commits squashed where appropriate.
- [x] I have included updates to all appropriate documentation.
For the implementation allowing you to select a specific source, it may make more sense to create a private scene and add the source as a scene item with inner scaling applied.
It may be worthwhile to consider hooking frontend events on construct and removing on destruct, then adding a switch or if statement to only run SetSource() when the current type is Preview. It would also be possible to allow changing the type between Preview and Source without restarting the output, if you feel like that's worthwhile implementing.
Pinging @jpark37 since this touches some of the decklink output code that he's maintained. Want to make sure there's not a specific reason we're doing custom texrender stuff there.
The texrender stuff allows conversion from any pixel format type, e.g. NV12, not just BGRA, because it's converting from the main texture, and not the video output texture. It's also a lot faster to convert on the GPU than use swscale. From skimming over the DeckLink changes, it looks we're losing both in this PR.
@jpark37 would it be possible for the Decklink gpu stuff you wrote to be implemented in libobs, so any output could use it?
Anything's possible, but I didn't think it would be easy, which is why I made as many changes in DeckLink as I did. I saw Palana do some things around GPU rescaling, but I didn't look at his changes, so maybe some progress has already been made.
Converted to draft, as we need to make this an output UI, so AJA, Decklink, etc. frontend plugins can be removed in favor of an agnostic output UI.
This PR really shouldn't get UI code added to it. It should be a class that a UI dialog class/whatever implements as a member variable.
@jpark37 would it be possible for the Decklink gpu stuff you wrote to be implemented in libobs, so any output could use it?
We'd definitely appreciate being able to perform GPU format conversions in the AJA Output plugin. Right now, the swscale path is too slow for UHD/4Kp60 so I've disabled those formats in the AJA output plugin.
I've updated and refactored the code a bit.
Updated to latest frontend.