obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

frontend: Add output wrapper class

Open cg2121 opened this issue 2 years ago • 10 comments

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.

cg2121 avatar May 17 '23 00:05 cg2121

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.

tt2468 avatar May 23 '23 01:05 tt2468

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.

tt2468 avatar May 23 '23 01:05 tt2468

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 avatar May 23 '23 07:05 jpark37

@jpark37 would it be possible for the Decklink gpu stuff you wrote to be implemented in libobs, so any output could use it?

cg2121 avatar Dec 13 '23 19:12 cg2121

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.

jpark37 avatar Dec 13 '23 19:12 jpark37

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.

cg2121 avatar Dec 16 '23 19:12 cg2121

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.

tt2468 avatar Dec 16 '23 19:12 tt2468

@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.

paulh-aja avatar Mar 29 '24 05:03 paulh-aja

I've updated and refactored the code a bit.

cg2121 avatar Dec 11 '24 17:12 cg2121

Updated to latest frontend.

cg2121 avatar May 21 '25 22:05 cg2121