[RFI]: Updating Tally Behavior : Nothing or Preview and/or Program + Per Source settings
Following some discussion in #687 and #1083 this issue is to address a broader need / discussion for managing Tally Lights.
As of 4.14: if settings to send tally is enable in general Plugin settings to Tally True
This will result int he following behavior:
- Whatever the source used in Preview or Program they will show Tally on.
- If a source is in preview then pushed to program > this will have both Preview & program tally flagged. (even if really just in Program)
This can be seen in the log with : 23:36:00.708: [DistroAV] 'NDI 3' ndi_source_thread: tally changed; Sending tally on_preview=1, on_program=1 In that example : Tally must be only in progam.
As of 4.14 : Tally feedback is enabled either for Preview Or Program, no matter the source. There are some case or source that you might not want to send the tally for (or be more selective) > For example an OBS acting as NDI Feed recorder, still want to see some of the source in Program tally but not in preview (preview would be managed otherwise)
Should a source be sent Program & preview ? : I believe not. (might be wrong)
New suggestion for behavior:
Step 1 : Tally can only be 1 thing at a time:
- OFF
- Preview
- Program
Program here should be understood as in "active", "shown" and used either in the Program pane, Stream, or any displays.
this is discussed and supposedly being fixed via : #1083 & #687.
Step 2 (improvement) : Allow each source to have their own tally settings as:
- Follow default settings (plugin settings) - default option when creating a source
- Tally update Disabled - override
- Tally update only while in preview - override
- Tally update only while in program - override
- Full Tally status (OFF/Preview/Program) - override
The general settings in the NDI output settings to be renamed as: "Tally - Send Source status to Tally (default behavior)" Program/Display [] Preview []
Argument for the change in Step 2:
- More granularity
- Migration of old settings simplified (they are still used and applies by default)
Argument against changes in step 2:
- add complexity / might be confusing for new users (could be hidden in the "advanced" section of a source settings.
- more code to maintain
This is a suggestion, open for discussion in this issue.
Thanks for capturing this and putting it out for discussion. The purpose of tally is to give feedback to the person on camera, operating the camera, or producing the broadcast as to whether or not the camera is live (on_program) or being previewed for the next shot (on preview). The API allows either or both to be set. OBS allows a source to be both on_preview and on_program. A typical use of the 'both' scenario is previewing an overlay of another source on top of the live source. Both tallies should be on in this case. Having on_preview on, will help confirm you are indeed previewing the same source as is on_program.
In addition to the cons for step 2, I would add:
- The NDI camera or viewers of a source have ways of turning off tally if it isn't wanted.
Valuable insights, thanks.
Expected Behavior (unless i an missing something): For any "active" source (not disabled) here would be the expected behavior:
- Not use in scene in Preview/Program : Tally OFF (on-preview=0 / on-program=0)
- Used only in preview : on-preview=1, on-program=0
- Used only in program : on-preview=0, on-program=1
- Used in Preview & Program (or any display) : on-preview=1, on-program=1
Seems that "On Program" in OBS is more of a "Displayed on any screens" (including Multiview (to be confirmed!))
From the OBS API there are couple things we can hook to :
activate (ptr source) Called when the source has been activated in the main view (visible on stream/recording).
deactivate (ptr source) Called when the source has been deactivated from the main view (no longer visible on stream/recording).
show (ptr source) Called when the source is visible on any display and/or on the main view.
hide (ptr source) Called when the source is no longer visible on any display and/or on the main view.
obs_source_active Returns true if active, false if not. A source is only considered active if it’s being shown on the final mix.
obs_source_showing Returns true if showing, false if not. A source is considered showing if it’s being displayed anywhere at all, whether on a display context or on the final output
Seem this was a concern back in 2021 as well and pretty tricky to know if the source was used in Preview or not : https://github.com/DistroAV/DistroAV/pull/609
There was similar simplification work done by tt2468 back on the rewrite branch : https://github.com/DistroAV/DistroAV/blob/81a16120c704201d304f84d6793d686d8addc367/src/input.cpp#L130C1-L174
Looking at a more visual representation:
| Source Status | On-Preview | On-Program |
|---|---|---|
| obs_source_active | unchanged | true:1 |
| obs_source_showing | true:1/false:0 | false:0 |
| activate | tbc | 1 |
| deactivate | tbc | 0 |
| show | tbc | tbc |
| hide | tbc | tbc |
obs_source_active & obs_source_showing could be a way to "force set" the tally at a specific instant T (not exactly what we need here)
We need a clear path to detect the following source status:
- Source shown in Preview only
- Source shown in Program Only - obs_source_active or activate (or show - if we want to trigger this for other display as well like multiview/projector)
- Source Shown in Preview & Program
I could not find detailed documentation on preview screen behavior.
In OBS, the user can toggle the visibility of a source in a scene. In order to handle tally correctly, we need to tie preview and program status to the scene item and use the scene APIs instead of activate/deactivate/show/hide source APIs. The source APIs are good for sources to determine how it is being used, however since a source can be in multiple scenes and even be in a projector, the source APIs are not useful for determining preview or program visibility.
on_preview = source visible in current preview scene on_program = source visible in current program scene
We should take action on setting the tally by registering a callback for a ndi source using obs_frontend_add_event_callback passing the callback data as ndi_source_t. This callback will be called when the current preview scene or program scene changes and will supply our ndi_source_t structure.
If the preview scene changes:
- get the current preview scene (
obs_frontend_get_current_preview_scene) - go through all scene items (
obs_scene_enum_items) - if the source is in the scene (
obs_sceneitem_get_source) and it is visible (obs_sceneitem_visible) set the on_preview tally of the source to true, otherwise set it to false.
If the program scene changes:
- get the current program scene (
obs_frontend_get_current_scene) - go through all scene items (
obs_scene_enum_items) - if the source is in the scene (
obs_sceneitem_get_source) and it is visible (obs_sceneitem_visible) set the on_program tally of the source to true, otherwise set it to false.
There is a signal on scene items that communicates item visibility change: https://docs.obsproject.com/reference-scenes#scene-signals (item_visible (ptr scene, ptr item, bool visible)). We should also respond to this signal and set the tally.
- If scene item is a ndi source and the scene is in preview then set on_preview to true, otherwise set it to false.
- If scene item is a ndi source and the scene is in program then set on_program to true, otherwise set it to false.
https://github.com/DistroAV/DistroAV/pull/1083 does the navigating of the scenes, except it doesn't look at the sceneitem visibility nor does it register a scene signal callback. I will be modifying the PR to reflect the above logic and test out.
I updated the https://github.com/DistroAV/DistroAV/pull/1083 to implement the logic proposed above. It works great! The discussion to move the tally output selection to the source is still up for discussion.
Great news.
For the source-specific tally settings, this can be done in a further update.
As this is quite a change as well, might be a 6.1 release depending on testing results.
In 6.0, the Preview tally mark is ON when the source is displayed in MultiView and MultiView is open. Displaying an NDI source in MultiView should NOT set the Preview tally mark for the source. The Pause/Stop/Always behavior property for the source has no impact on the behavior.
This requires changes to the OBS source API. The required changes are in this PR https://github.com/obsproject/obs-studio/pull/11898 Feel free to express the importance of this new feature as OBS is not very open to including it.