Compare commits

...

44 Commits
5.3.1 ... 5.4.0

Author SHA1 Message Date
b61a5c2431 base: Update version to 5.4.0
New Features:
- Added `GetSourceFilterKindList` request
- Added `GetSceneItemSource` request
- Added `InputSettingsChanged` event
- Added `SourceFilterSettingsChanged` event
- Added UUID support to Sources (Inputs/Scenes), Inputs, Scenes,
Transitions
  - The `Source` requests/events use `sourceUuid`
  - The `Input` requests/events use `inputUuid`
  - The `Scene` requests/events use `sceneUuid`
  - The `Transition` requests/events use `transitionUuid`
  - Filters do not have support for UUIDs at this time.

Enhancements:
- Added `contextName` field to `TriggerHotkeyByName` (exeldro)

Bug Fixes:
- Fixed a crash on shutdown with notifications enabled (r1ch)
- Added safety check to prevent `null` `outputCongestion` values in
`GetStreamStatus`
- Fixed a memory leak when switching service kinds via
`SetStreamServiceSettings`

Other Notes:
- Documented missing `outputActive` `ToggleRecord` response field
- Added a few new client softwares to the README list
- Removed a mis-documented `imageData` field
- Added a note to the hotkey requests that they are as-is and we
will not provide support for them
2024-01-24 15:51:27 -08:00
fbd4cfb4af docs(ci): Update generated docs - e5aa4c2 [skip ci] 2024-01-19 03:35:08 +00:00
e5aa4c2f69 requesthandler: Rename GetSceneItemSourceName to GetSceneItemSource
Not an API break, this was introduced just a few commits ago.
2024-01-18 19:34:51 -08:00
4cf8de8382 docs(ci): Update generated docs - 7adfb58 [skip ci] 2024-01-19 03:30:20 +00:00
7adfb5874c requesthandler: Implement input, scene, and transition UUID support
Transition UUID support is partial due to the current state of the OBS
frontend API.

Most requests which accepted things like `sourceName` now allow
`sourceUuid` (or equivalent) to be specified instead. While both fields
on the various requests may be marked as optional, at least one field
will still be required.
2024-01-18 19:27:57 -08:00
f18f46543b eventhandler: Implement input, scene, and transition UUID support
Adds `inputUuid` next to `inputName` etc.
2024-01-18 16:58:40 -08:00
f40426efa1 utils: Implement input, scene, and transition UUID support 2024-01-18 16:56:20 -08:00
830f7eb931 utils: Use BPtr for strings instead of manual bfree() 2024-01-18 16:17:48 -08:00
5e3fff78f3 docs(ci): Update generated docs - b53527c [skip ci] 2024-01-19 00:06:25 +00:00
b53527cba8 requesthandler: Add note about as-is status of hotkey requests
Too much trouble for too little gain. Please stop using these requests.
2024-01-18 16:06:07 -08:00
b806a0cfb1 docs(ci): Update generated docs - 1d0db34 [skip ci] 2024-01-19 00:02:16 +00:00
1d0db34bb2 requesthandler: Add GetSceneItemSourceName request
Closes #1122
2024-01-18 16:01:41 -08:00
690726d281 docs(ci): Update generated docs - ef4142f [skip ci] 2024-01-18 23:54:27 +00:00
ef4142fe75 eventhandler: Add SourceFilterSettingsChanged event
Closes #1059
2024-01-18 15:54:08 -08:00
caaec5d97f requesthandler: Use Frontend API for CreateSceneCollection 2024-01-18 15:43:46 -08:00
6c67b276a7 lib: Fix compile errors on C and warnings on C++ 2024-01-16 01:39:27 -08:00
fad7dfd55c docs(ci): Update generated docs - a5c459b [skip ci] 2024-01-16 09:37:45 +00:00
a5c459b6d4 docs: Fix SaveSourceScreenshot's Response Field 2024-01-16 01:37:29 -08:00
899a9b3801 README: Bump Godot client library to 4.0.x 2024-01-16 01:36:49 -08:00
939e503736 README: Add MATRIC to client software list
Closes #1177
2024-01-16 01:35:11 -08:00
5b149add99 RequestHandler: Fix memory leak when setting streaming service 2024-01-16 01:33:29 -08:00
50b57d38d0 README: Add Macrograph to Client Software 2024-01-16 01:23:59 -08:00
9b58dd1627 docs(ci): Update generated docs - 81b307e [skip ci] 2024-01-16 08:41:23 +00:00
81b307e5ad eventhandler: Add InputSettingsChanged
Fired when an input's settings change, like via the properties dialog
or via `SetInputSettings`.

Closes #1157
2024-01-16 00:41:03 -08:00
52733ddce7 docs(ci): Update generated docs - 444caeb [skip ci] 2024-01-16 08:19:11 +00:00
444caeb1d7 requesthandler: Add GetSourceFilterKindList
Closes #1198
2024-01-16 00:18:52 -08:00
f03e82c3f8 docs(ci): Update generated docs - bbdc5bc [skip ci] 2024-01-16 07:46:34 +00:00
bbdc5bc823 requesthandler: Prevent NaN outputCongestion values (null) 2024-01-15 23:45:33 -08:00
9ecc9532e8 requesthandler: Document ToggleRecord outputActive response field 2024-01-15 23:44:50 -08:00
0189c3a3f5 Utils: Check system tray exists before trying to use it
Fixes https://github.com/obsproject/obs-studio/issues/9991
2024-01-15 23:19:09 -08:00
f48fcc06ec docs(ci): Update generated docs - f43ef8e [skip ci] 2024-01-09 07:06:29 +00:00
f43ef8e2da requesthandler: Add optional context to TriggerHotkeyByName 2024-01-08 23:06:12 -08:00
7a1c71bb96 base: Update version to 5.3.5
- CMake update, no functional changes
2023-12-22 16:38:27 -05:00
cf285b3761 cmake: Update formatting and switch to native find_package call for Qt6 2023-12-20 15:09:11 -05:00
ede66a68cb Update translations from Crowdin 2023-12-05 22:04:30 +00:00
e8089a5bbf base: Update version to 5.3.4
- eventhandler: Disconnect signals from all public sources on shutdown
- websocketserver: Check for EventHandler validity in de/constructor
2023-12-05 14:15:04 -05:00
07537a33fa websocketserver: Check for EventHandler validity in de/constructor
Redundant fix for shutdown crash
2023-11-14 00:07:05 -08:00
efeae8d640 eventhandler: Disconnect signals from all public sources on shutdown
Fixes crash on shutdown when memory leaks lead to un-destroyed
sources after plugin shutdown.
2023-11-14 00:07:05 -08:00
4ff109b62b base: Update version to 5.3.3
- Update translations and docs
2023-10-16 10:42:15 -04:00
42da47f81d docs(ci): Update generated docs - a889799 [skip ci] 2023-10-13 21:25:41 +00:00
a889799655 docs: Update introduction header to 5.x.x
We don't need to be having specific versions here, considering each event/request has its own "added at" version.
2023-10-13 14:25:23 -07:00
f52f47ec5d Update translations from Crowdin 2023-10-10 13:34:40 +00:00
08767ae5a7 base: Update version to 5.3.2
- Fix plugin tests being enabled by default
2023-10-09 16:34:30 -04:00
16bf61aab6 cmake: Fix condition to disable plugin tests
The CMake generator expression to enable plugin tests mistakenly used a
string literal, which evaluated to 1, which enabled the plugin tests by
default. Use variable notation to correctly test this value.
2023-10-02 14:37:04 -07:00
47 changed files with 2060 additions and 559 deletions

View File

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16...3.25)
legacy_check()
set(obs-websocket_VERSION 5.3.1)
set(obs-websocket_VERSION 5.4.0)
set(OBS_WEBSOCKET_RPC_VERSION 1)
option(ENABLE_WEBSOCKET "Enable building OBS with websocket plugin" ON)
@ -12,7 +12,7 @@ if(NOT ENABLE_WEBSOCKET)
endif()
# Find Qt
find_qt(COMPONENTS Core Widgets Svg Network)
find_package(Qt6 REQUIRED Core Widgets Svg Network)
# Find nlohmann JSON
find_package(nlohmann_json 3 REQUIRED)
@ -31,51 +31,53 @@ find_package(Asio 1.12.1 REQUIRED)
add_library(obs-websocket MODULE)
add_library(OBS::websocket ALIAS obs-websocket)
target_sources(obs-websocket PRIVATE)
target_sources(
obs-websocket
PRIVATE src/obs-websocket.cpp
src/obs-websocket.h
PRIVATE # cmake-format: sortable
lib/obs-websocket-api.h
src/Config.cpp
src/Config.h
lib/obs-websocket-api.h
src/forms/ConnectInfo.cpp
src/forms/ConnectInfo.h
src/forms/resources.qrc
src/forms/SettingsDialog.cpp
src/forms/SettingsDialog.h
src/obs-websocket.cpp
src/obs-websocket.h
src/WebSocketApi.cpp
src/WebSocketApi.h)
target_sources(
obs-websocket
PRIVATE src/websocketserver/WebSocketServer.cpp
src/websocketserver/WebSocketServer_Protocol.cpp
src/websocketserver/WebSocketServer.h
PRIVATE # cmake-format: sortable
src/websocketserver/rpc/WebSocketSession.h
src/websocketserver/types/WebSocketCloseCode.h
src/websocketserver/types/WebSocketOpCode.h)
src/websocketserver/types/WebSocketOpCode.h
src/websocketserver/WebSocketServer.cpp
src/websocketserver/WebSocketServer.h
src/websocketserver/WebSocketServer_Protocol.cpp)
target_sources(
obs-websocket
PRIVATE src/eventhandler/EventHandler.cpp
PRIVATE # cmake-format: sortable
src/eventhandler/EventHandler.cpp
src/eventhandler/EventHandler.h
src/eventhandler/EventHandler_Config.cpp
src/eventhandler/EventHandler_General.cpp
src/eventhandler/EventHandler_Filters.cpp
src/eventhandler/EventHandler_General.cpp
src/eventhandler/EventHandler_Inputs.cpp
src/eventhandler/EventHandler_MediaInputs.cpp
src/eventhandler/EventHandler_Outputs.cpp
src/eventhandler/EventHandler_Scenes.cpp
src/eventhandler/EventHandler_SceneItems.cpp
src/eventhandler/EventHandler_Scenes.cpp
src/eventhandler/EventHandler_Transitions.cpp
src/eventhandler/EventHandler_Ui.cpp
src/eventhandler/types/EventSubscription.h)
target_sources(
obs-websocket
PRIVATE src/requesthandler/RequestBatchHandler.cpp
PRIVATE # cmake-format: sortable
src/requesthandler/RequestBatchHandler.cpp
src/requesthandler/RequestBatchHandler.h
src/requesthandler/RequestHandler.cpp
src/requesthandler/RequestHandler.h
@ -85,10 +87,10 @@ target_sources(
src/requesthandler/RequestHandler_Inputs.cpp
src/requesthandler/RequestHandler_MediaInputs.cpp
src/requesthandler/RequestHandler_Outputs.cpp
src/requesthandler/RequestHandler_Sources.cpp
src/requesthandler/RequestHandler_Record.cpp
src/requesthandler/RequestHandler_Scenes.cpp
src/requesthandler/RequestHandler_SceneItems.cpp
src/requesthandler/RequestHandler_Scenes.cpp
src/requesthandler/RequestHandler_Sources.cpp
src/requesthandler/RequestHandler_Stream.cpp
src/requesthandler/RequestHandler_Transitions.cpp
src/requesthandler/RequestHandler_Ui.cpp
@ -98,12 +100,13 @@ target_sources(
src/requesthandler/rpc/RequestBatchRequest.h
src/requesthandler/rpc/RequestResult.cpp
src/requesthandler/rpc/RequestResult.h
src/requesthandler/types/RequestStatus.h
src/requesthandler/types/RequestBatchExecutionType.h)
src/requesthandler/types/RequestBatchExecutionType.h
src/requesthandler/types/RequestStatus.h)
target_sources(
obs-websocket
PRIVATE src/utils/Compat.cpp
PRIVATE # cmake-format: sortable
src/utils/Compat.cpp
src/utils/Compat.h
src/utils/Crypto.cpp
src/utils/Crypto.h
@ -115,8 +118,8 @@ target_sources(
src/utils/Obs_ArrayHelper.cpp
src/utils/Obs_NumberHelper.cpp
src/utils/Obs_ObjectHelper.cpp
src/utils/Obs_StringHelper.cpp
src/utils/Obs_SearchHelper.cpp
src/utils/Obs_StringHelper.cpp
src/utils/Obs_VolumeMeter.cpp
src/utils/Obs_VolumeMeter.h
src/utils/Obs_VolumeMeter_Helpers.h
@ -128,19 +131,24 @@ configure_file(src/plugin-macros.h.in plugin-macros.generated.h)
target_sources(obs-websocket PRIVATE plugin-macros.generated.h)
target_compile_definitions(
obs-websocket PRIVATE ASIO_STANDALONE $<$<BOOL:PLUGIN_TESTS>:PLUGIN_TESTS>
obs-websocket PRIVATE ASIO_STANDALONE $<$<BOOL:${PLUGIN_TESTS}>:PLUGIN_TESTS>
$<$<PLATFORM_ID:Windows>:_WEBSOCKETPP_CPP11_STL_> $<$<PLATFORM_ID:Windows>:_WIN32_WINNT=0x0603>)
target_compile_options(
obs-websocket
PRIVATE
$<$<PLATFORM_ID:Windows>:/wd4267>
$<$<PLATFORM_ID:Windows>:/wd4996>
$<$<PLATFORM_ID:Darwin,Linux,FreeBSD>:-Wall>
$<$<COMPILE_LANG_AND_ID:CXX,GNU,AppleClang,Clang>:-Wno-error=float-conversion;-Wno-error=shadow>
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wno-error=format-overflow;-Wno-error=int-conversion;-Wno-error=comment>
$<$<COMPILE_LANG_AND_ID:CXX,AppleClang,Clang>:-Wno-error=null-pointer-subtraction;-Wno-error=deprecated-declarations;-Wno-error=implicit-int-conversion;-Wno-error=shorten-64-to-32;-Wno-comma;-Wno-quoted-include-in-framework-header>
)
PRIVATE $<$<PLATFORM_ID:Windows>:/wd4267>
$<$<COMPILE_LANG_AND_ID:CXX,GNU,AppleClang,Clang>:-Wall>
$<$<COMPILE_LANG_AND_ID:CXX,GNU,AppleClang,Clang>:-Wno-error=float-conversion>
$<$<COMPILE_LANG_AND_ID:CXX,GNU,AppleClang,Clang>:-Wno-error=shadow>
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wno-error=format-overflow>
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wno-error=int-conversion>
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wno-error=comment>
$<$<COMPILE_LANG_AND_ID:CXX,AppleClang,Clang>:-Wno-error=null-pointer-subtraction>
$<$<COMPILE_LANG_AND_ID:CXX,AppleClang,Clang>:-Wno-error=deprecated-declarations>
$<$<COMPILE_LANG_AND_ID:CXX,AppleClang,Clang>:-Wno-error=implicit-int-conversion>
$<$<COMPILE_LANG_AND_ID:CXX,AppleClang,Clang>:-Wno-error=shorten-64-to-32>
$<$<COMPILE_LANG_AND_ID:CXX,AppleClang,Clang>:-Wno-comma>
$<$<COMPILE_LANG_AND_ID:CXX,AppleClang,Clang>:-Wno-quoted-include-in-framework-header>)
target_link_libraries(
obs-websocket
@ -155,6 +163,8 @@ target_link_libraries(
Asio::Asio
qrcodegencpp::qrcodegencpp)
target_link_options(obs-websocket PRIVATE $<$<PLATFORM_ID:Windows>:/IGNORE:4099>)
set_target_properties_obs(
obs-websocket
PROPERTIES FOLDER plugins
@ -168,6 +178,4 @@ if(OS_WINDOWS)
TARGET obs-websocket
APPEND
PROPERTY AUTORCC_OPTIONS --format-version 1)
target_link_options(obs-websocket PRIVATE /IGNORE:4099)
endif()

View File

@ -41,6 +41,8 @@ It is **highly recommended** to keep obs-websocket protected with a password aga
- [Aitum](https://aitum.tv/)
- [Kruiz Control](https://github.com/Kruiser8/Kruiz-Control)
- [Bitfocus Companion Module](https://bitfocus.io/companion/)
- [MacroGraph](https://github.com/Brendonovich/macrograph) - hosted client [here](https://macrograph.brendonovich.dev/)
- [MATRIC](https://matricapp.com/)
### Client libraries (for developers)
@ -49,7 +51,7 @@ Here's a list of available language APIs for obs-websocket:
- Python 3.7+ (Asyncio): [simpleobsws](https://github.com/IRLToolkit/simpleobsws/tree/master) by IRLToolkit
- Python 3.10+ (Non-Asyncio): [obsws-python](https://pypi.org/project/obsws-python) by aatikturk and onyx-and-iris
- Rust: [obws](https://github.com/dnaka91/obws) by dnaka91
- Godot 3.4.x: [obs-websocket-gd](https://github.com/you-win/obs-websocket-gd) by you-win
- Godot 4.0.x: [obs-websocket-gd](https://github.com/you-win/obs-websocket-gd) by you-win
- Javascript (Node and web): [obs-websocket-js](https://github.com/obs-websocket-community-projects/obs-websocket-js) by OBS Websocket Community
- C (uses obs-websocket-js): [v8-libwebsocket-obs-websocket](https://github.com/dgatwood/v8-libwebsocket-obs-websocket)
- Go: [goobs](https://github.com/andreykaipov/goobs) by andreykaipov

View File

@ -1,4 +1,4 @@
project(obs-websocket VERSION 5.3.1)
project(obs-websocket VERSION 5.4.0)
set(OBS_WEBSOCKET_RPC_VERSION 1)
option(ENABLE_WEBSOCKET "Enable building OBS with websocket plugin" ON)

View File

@ -1,9 +1,35 @@
OBSWebSocket.Plugin.Description="Afstandbeheer van OBS deur WebSocket"
OBSWebSocket.Settings.DialogTitle="WebSocket-bedienerinstellings"
OBSWebSocket.Settings.PluginSettingsTitle="Inpropinstellings"
OBSWebSocket.Settings.ServerEnable="Aktiveer WebSocket-diens"
OBSWebSocket.Settings.ServerSettingsTitle="Bedienerinstellings"
OBSWebSocket.Settings.Password="Bedienerwagwoord"
OBSWebSocket.Settings.GeneratePassword="Genereer wagwoord"
OBSWebSocket.Settings.ServerPort="Bedienerpoort"
OBSWebSocket.Settings.ShowConnectInfoWarningTitle="Waarskuwing: Tans regstreeks"
OBSWebSocket.Settings.ShowConnectInfoWarningMessage="Dit lyk of n afvoer (stroom, opname, ens.) tans aktief is."
OBSWebSocket.Settings.ShowConnectInfoWarningInfoText="Is u seker u wil u verbindingsinligting laat sien?"
OBSWebSocket.Settings.Save.UserPasswordWarningTitle="Waarskuwing: potensiële beveiligingsprobleem"
OBSWebSocket.Settings.Save.UserPasswordWarningMessage="obs-websok bewaar die bedienerwagwoord as platteks. Dit word ten sterkste aanbeveel om n wagwoord wat deur obs-websok geskep is te gebruik."
OBSWebSocket.Settings.Save.UserPasswordWarningInfoText="Is u seker u wil u eie wagwoord gebruik?"
OBSWebSocket.Settings.Save.PasswordInvalidErrorTitle="Fout: Ongeldige opstalling"
OBSWebSocket.Settings.Save.PasswordInvalidErrorMessage="U moet n wagwoord van meet as 6 karakters gebruik."
OBSWebSocket.SessionTable.Title="Gekoppelde WebSocket-sessies"
OBSWebSocket.SessionTable.RemoteAddressColumnTitle="Afstandsadres"
OBSWebSocket.SessionTable.SessionDurationColumnTitle="Sessieduur"
OBSWebSocket.SessionTable.MessagesInOutColumnTitle="Boodskappe In/Uit"
OBSWebSocket.SessionTable.IdentifiedTitle="Geïdentifiseer"
OBSWebSocket.SessionTable.KickButtonColumnTitle="Verwyder?"
OBSWebSocket.SessionTable.KickButtonText="Verwyder"
OBSWebSocket.ConnectInfo.DialogTitle="WebSocket-verbindingsinligting"
OBSWebSocket.ConnectInfo.CopyText="Kopieer"
OBSWebSocket.ConnectInfo.ServerIp="Bediener-IP (beste skatting)"
OBSWebSocket.ConnectInfo.ServerPort="Bedienerpoort"
OBSWebSocket.ConnectInfo.ServerPassword="Bedienerwagwoord"
OBSWebSocket.ConnectInfo.QrTitle="Koppel QR"
OBSWebSocket.TrayNotification.Identified.Title="Nuwe WebSocket-koppeling"
OBSWebSocket.TrayNotification.Identified.Body="Kliënt %1 geïdentifiseer."
OBSWebSocket.TrayNotification.AuthenticationFailed.Title="WebSocket-waarmerkfout"
OBSWebSocket.TrayNotification.AuthenticationFailed.Body="Kliënt %1 kon nie waarmerk nie."
OBSWebSocket.TrayNotification.Disconnected.Title="WebSocket-kliënt is ontkoppel"
OBSWebSocket.TrayNotification.Disconnected.Body="Kliënt %1 is ontkoppel."

View File

@ -4,7 +4,7 @@ OBSWebSocket.Settings.PluginSettingsTitle="Plugineinstellungen"
OBSWebSocket.Settings.ServerEnable="WebSocket-Server aktivieren"
OBSWebSocket.Settings.AlertsEnable="Warnungen im Infobereich aktivieren"
OBSWebSocket.Settings.DebugEnable="Debug-Logging aktivieren"
OBSWebSocket.Settings.DebugEnableHoverText="Aktiviert Debug-Logging für die aktuelle OBS-Instanz.\nVerwenden Sie „--websocket_debug“, damit die Option beim Laden aktiviert wird."
OBSWebSocket.Settings.DebugEnableHoverText="Aktiviert Debug-Logging für die aktuelle OBS-Instanz.\nVerwenden Sie „--websocket_debug“, damit die Option beim Starten aktiviert wird."
OBSWebSocket.Settings.ServerSettingsTitle="Servereinstellungen"
OBSWebSocket.Settings.AuthRequired="Authentifizierung aktivieren"
OBSWebSocket.Settings.Password="Serverpasswort"
@ -28,7 +28,7 @@ OBSWebSocket.SessionTable.KickButtonColumnTitle="Entfernen?"
OBSWebSocket.SessionTable.KickButtonText="Entfernen"
OBSWebSocket.ConnectInfo.DialogTitle="WebSocket-Verbindungsinformationen"
OBSWebSocket.ConnectInfo.CopyText="Kopieren"
OBSWebSocket.ConnectInfo.ServerIp="Server-IP (geschätzt)"
OBSWebSocket.ConnectInfo.ServerIp="Server-IP (Geschätzt)"
OBSWebSocket.ConnectInfo.ServerPort="Serverport"
OBSWebSocket.ConnectInfo.ServerPassword="Serverpasswort"
OBSWebSocket.ConnectInfo.ServerPasswordPlaceholderText="Authentifizierung deaktiviert"

View File

@ -16,9 +16,9 @@ OBSWebSocket.Settings.ShowConnectInfoWarningMessage="Il semble qu'une sortie (st
OBSWebSocket.Settings.ShowConnectInfoWarningInfoText="Êtes-vous sûr de vouloir afficher vos informations de connexion ?"
OBSWebSocket.Settings.Save.UserPasswordWarningTitle="Avertissement : Problème potentiel de sécurité"
OBSWebSocket.Settings.Save.UserPasswordWarningMessage="obs-websocket enregistre le mot de passe du serveur en texte brut. L'utilisation d'un mot de passe généré par obs-websocket est fortement recommandée."
OBSWebSocket.Settings.Save.UserPasswordWarningInfoText="Êtes-vous sûr de vouloir utiliser votre propre mot de passe ?"
OBSWebSocket.Settings.Save.UserPasswordWarningInfoText="Êtes-vous sûr(e) de vouloir utiliser votre propre mot de passe ?"
OBSWebSocket.Settings.Save.PasswordInvalidErrorTitle="Erreur : Configuration invalide"
OBSWebSocket.Settings.Save.PasswordInvalidErrorMessage="Vous devez utiliser un mot de passe d'au moins 6 caractères"
OBSWebSocket.Settings.Save.PasswordInvalidErrorMessage="Vous devez utiliser un mot de passe de 6 caractères ou plus."
OBSWebSocket.SessionTable.Title="Sessions WebSocket connectées"
OBSWebSocket.SessionTable.RemoteAddressColumnTitle="Adresse distante"
OBSWebSocket.SessionTable.SessionDurationColumnTitle="Durée de session"
@ -30,7 +30,7 @@ OBSWebSocket.ConnectInfo.DialogTitle="Informations de connexion WebSocket"
OBSWebSocket.ConnectInfo.CopyText="Copier"
OBSWebSocket.ConnectInfo.ServerIp="IP du serveur (meilleure estimation)"
OBSWebSocket.ConnectInfo.ServerPort="Port serveur"
OBSWebSocket.ConnectInfo.ServerPassword="Mot de passe serveur"
OBSWebSocket.ConnectInfo.ServerPassword="Mot de passe du serveur"
OBSWebSocket.ConnectInfo.ServerPasswordPlaceholderText="[Authentification désactivée]"
OBSWebSocket.ConnectInfo.QrTitle="QR code de connexion"
OBSWebSocket.TrayNotification.Identified.Title="Nouvelle connexion WebSocket"

View File

@ -1 +1,10 @@
OBSWebSocket.Settings.DialogTitle="Postavke servera WebSocket"
OBSWebSocket.Settings.Save.PasswordInvalidErrorTitle="Pogreška: Neispravna konfiguracija"
OBSWebSocket.Settings.Save.PasswordInvalidErrorMessage="Lozinka mora sadržavati barem 6 znakova."
OBSWebSocket.SessionTable.Title="Spojene sesije WebSocketa"
OBSWebSocket.SessionTable.RemoteAddressColumnTitle="Udaljena adresa"
OBSWebSocket.SessionTable.SessionDurationColumnTitle="Trajanje sesije"
OBSWebSocket.SessionTable.MessagesInOutColumnTitle="Ulaz/izlaz poruka"
OBSWebSocket.ConnectInfo.CopyText="Kopiraj"
OBSWebSocket.ConnectInfo.ServerPort="Vrata servera"
OBSWebSocket.ConnectInfo.ServerPassword="Lozinka servera"

View File

@ -1,4 +1,5 @@
OBSWebSocket.Plugin.Description="Kawalan-jauh OBS Studio melalui WebSocket"
OBSWebSocket.Settings.DialogTitle="Tetapan Pelayan WebSocket"
OBSWebSocket.Settings.PluginSettingsTitle="Tetapan Pemalam"
OBSWebSocket.Settings.ServerEnable="Benarkan pelayan WebSocket"
OBSWebSocket.Settings.AlertsEnable="Benarkan Amaran Talam Sistem"

View File

@ -1,2 +1,25 @@
OBSWebSocket.Settings.DialogTitle="WebSocket-tjenerinnstillinger"
OBSWebSocket.Settings.PluginSettingsTitle="Utvidelsesinnstillinger"
OBSWebSocket.Settings.ServerSettingsTitle="Tjenerinnstillinger"
OBSWebSocket.Settings.AuthRequired="Skru på autentisering"
OBSWebSocket.Settings.Password="Server Passord"
OBSWebSocket.Settings.GeneratePassword="Generer Passord"
OBSWebSocket.Settings.ShowConnectInfo="Vis tilkoblingsinfo"
OBSWebSocket.Settings.ShowConnectInfoWarningTitle="Advarsel: For øyeblikket på direktesending"
OBSWebSocket.Settings.Save.UserPasswordWarningTitle="Advarsel: Potensielt sikkerhetsproblem"
OBSWebSocket.Settings.Save.PasswordInvalidErrorTitle="Feil: Ugyldig konfigurasjon"
OBSWebSocket.Settings.Save.PasswordInvalidErrorMessage="Du må bruke et passord på minst 6 tegn."
OBSWebSocket.SessionTable.RemoteAddressColumnTitle="Ekstern adresse"
OBSWebSocket.SessionTable.SessionDurationColumnTitle="Øktens varighet"
OBSWebSocket.SessionTable.MessagesInOutColumnTitle="Innboks/Utboks"
OBSWebSocket.SessionTable.IdentifiedTitle="Identifisert"
OBSWebSocket.ConnectInfo.DialogTitle="WebSocket-tilkoblingsinfo"
OBSWebSocket.ConnectInfo.CopyText="Kopier"
OBSWebSocket.ConnectInfo.ServerIp="Tjenerens IP (beste gjetning)"
OBSWebSocket.ConnectInfo.ServerPort="Tjenerport"
OBSWebSocket.ConnectInfo.ServerPassword="Tjenerpassord"
OBSWebSocket.ConnectInfo.QrTitle="QR-tilkobling"
OBSWebSocket.TrayNotification.Identified.Title="Ny WebSocket-tilkobling"
OBSWebSocket.TrayNotification.Identified.Body="Klient %1 er identifisert."
OBSWebSocket.TrayNotification.Disconnected.Title="WebSocket-klient koblet fra"
OBSWebSocket.TrayNotification.Disconnected.Body="Klient %1 koblet fra."

View File

@ -1,16 +1,16 @@
OBSWebSocket.Plugin.Description="Control de la distanță pentru OBS Studio prin WebSocket"
OBSWebSocket.Settings.DialogTitle="Setări ale server-ului WebSocket"
OBSWebSocket.Settings.DialogTitle="Setări pentru serverul WebSocket"
OBSWebSocket.Settings.PluginSettingsTitle="Setări pentru plugin"
OBSWebSocket.Settings.ServerEnable="Activează serverul WebSocket"
OBSWebSocket.Settings.AlertsEnable="Activează alertele din bara de sistem"
OBSWebSocket.Settings.DebugEnable="Activează jurnalizarea de depanare"
OBSWebSocket.Settings.DebugEnableHoverText="Activează jurnalizarea de depanare pentru instanța actuală de OBS. Nu persistă la încărcare.\nFolosește --websocket_debug pentru a activa la încărcare."
OBSWebSocket.Settings.ServerSettingsTitle="Setări server"
OBSWebSocket.Settings.DebugEnable="Activează jurnalizarea pentru depanare"
OBSWebSocket.Settings.DebugEnableHoverText="Activează jurnalizarea pentru depanare în cazul instanței actuale de OBS. Nu persistă la încărcare.\nFolosește --websocket_debug pentru a activa la încărcare."
OBSWebSocket.Settings.ServerSettingsTitle="Setări pentru server"
OBSWebSocket.Settings.AuthRequired="Activează autentificarea"
OBSWebSocket.Settings.Password="Parola serverului"
OBSWebSocket.Settings.GeneratePassword="Generează parola"
OBSWebSocket.Settings.ServerPort="Portul serverului"
OBSWebSocket.Settings.ShowConnectInfo="Afișează informațiile de conectare"
OBSWebSocket.Settings.ShowConnectInfo="Afișează informațiile conexiunii"
OBSWebSocket.Settings.ShowConnectInfoWarningTitle="Avertisment: În prezent în direct"
OBSWebSocket.Settings.ShowConnectInfoWarningMessage="Se pare că un output (transmisiune, înregistrare etc.) este activ în prezent."
OBSWebSocket.Settings.ShowConnectInfoWarningInfoText="Sigur vrei să afișezi informațiile de conectare?"
@ -24,17 +24,17 @@ OBSWebSocket.SessionTable.RemoteAddressColumnTitle="Adresă la distanță"
OBSWebSocket.SessionTable.SessionDurationColumnTitle="Durata sesiunii"
OBSWebSocket.SessionTable.MessagesInOutColumnTitle="Mesaje de intrare/ieșire"
OBSWebSocket.SessionTable.IdentifiedTitle="Identificat"
OBSWebSocket.SessionTable.KickButtonColumnTitle="Înlătură?"
OBSWebSocket.SessionTable.KickButtonColumnTitle="Înlături?"
OBSWebSocket.SessionTable.KickButtonText="Înlătură"
OBSWebSocket.ConnectInfo.DialogTitle="Informații de conectare WebSocket"
OBSWebSocket.ConnectInfo.DialogTitle="Informațiile conexiunii WebSocket"
OBSWebSocket.ConnectInfo.CopyText="Copiază"
OBSWebSocket.ConnectInfo.ServerIp="IP-ul serverului (cea mai bună presupunere)"
OBSWebSocket.ConnectInfo.ServerPort="Portul serverului"
OBSWebSocket.ConnectInfo.ServerPassword="Parola serverului"
OBSWebSocket.ConnectInfo.ServerPasswordPlaceholderText="[Autentificare dezactivată]"
OBSWebSocket.ConnectInfo.QrTitle="Conectare QR"
OBSWebSocket.ConnectInfo.QrTitle="QR de conectare"
OBSWebSocket.TrayNotification.Identified.Title="O nouă conexiune WebSocket"
OBSWebSocket.TrayNotification.Identified.Body="Client %1 identificat."
OBSWebSocket.TrayNotification.Identified.Body="Clientul %1 identificat."
OBSWebSocket.TrayNotification.AuthenticationFailed.Title="Eroare de autentificare WebSocket"
OBSWebSocket.TrayNotification.AuthenticationFailed.Body="Client %1 nu a reușit să se autentifice."
OBSWebSocket.TrayNotification.Disconnected.Title="Client WebSocket deconectat"

View File

@ -6,13 +6,13 @@ OBSWebSocket.Settings.AlertsEnable="Включить оповещения в т
OBSWebSocket.Settings.DebugEnable="Включить отладочный журнал"
OBSWebSocket.Settings.DebugEnableHoverText="Включает ведение журнала отладки для текущего экземпляра OBS. Не сохраняется при запуске.\nИспользуйте --websocket_debug для включения при запуске."
OBSWebSocket.Settings.ServerSettingsTitle="Настройки сервера"
OBSWebSocket.Settings.AuthRequired="Включить аутентификацию"
OBSWebSocket.Settings.AuthRequired="Включить вход в аккаунт"
OBSWebSocket.Settings.Password="Пароль сервера"
OBSWebSocket.Settings.GeneratePassword="Сгенерировать пароль"
OBSWebSocket.Settings.GeneratePassword="Создать пароль"
OBSWebSocket.Settings.ServerPort="Порт сервера"
OBSWebSocket.Settings.ShowConnectInfo="Показать сведения о подключении"
OBSWebSocket.Settings.ShowConnectInfoWarningTitle="Предупреждение: Сейчас в эфире"
OBSWebSocket.Settings.ShowConnectInfoWarningMessage="Похоже, что вывод (поток, запись и т. д.) в настоящее время активен."
OBSWebSocket.Settings.ShowConnectInfoWarningMessage="Похоже, что вывод (поток, запись и т. д.) в настоящее время уже выбран."
OBSWebSocket.Settings.ShowConnectInfoWarningInfoText="Уверены, что хотите показать ваши сведения о подключении?"
OBSWebSocket.Settings.Save.UserPasswordWarningTitle="Предупреждение: Потенциальная проблема безопасности"
OBSWebSocket.Settings.Save.UserPasswordWarningMessage="obs-websocket хранит пароль сервера в виде обычного текста. Настоятельно рекомендуется использовать пароль, сгенерированный obs-websock."
@ -31,11 +31,11 @@ OBSWebSocket.ConnectInfo.CopyText="Копировать"
OBSWebSocket.ConnectInfo.ServerIp="IP сервера (лучшая догадка)"
OBSWebSocket.ConnectInfo.ServerPort="Порт сервера"
OBSWebSocket.ConnectInfo.ServerPassword="Пароль сервера"
OBSWebSocket.ConnectInfo.ServerPasswordPlaceholderText="[Авторизация отключена]"
OBSWebSocket.ConnectInfo.ServerPasswordPlaceholderText="[Вход отключён]"
OBSWebSocket.ConnectInfo.QrTitle="QR-код подключения"
OBSWebSocket.TrayNotification.Identified.Title="Новое подключение WebSocket"
OBSWebSocket.TrayNotification.Identified.Body="Клиент %1 распознан."
OBSWebSocket.TrayNotification.AuthenticationFailed.Title="Ошибка аутентификации WebSocket"
OBSWebSocket.TrayNotification.AuthenticationFailed.Body="Клиент %1 не смог аутентифицироваться."
OBSWebSocket.TrayNotification.AuthenticationFailed.Title="Ошибка входа WebSocket"
OBSWebSocket.TrayNotification.AuthenticationFailed.Body="Клиент %1 не смог войти."
OBSWebSocket.TrayNotification.Disconnected.Title="Клиент WebSocket отключился"
OBSWebSocket.TrayNotification.Disconnected.Body="Клиент %1 отключился."

View File

@ -29,7 +29,7 @@ OBSWebSocket.SessionTable.KickButtonText="Çıkar"
OBSWebSocket.ConnectInfo.DialogTitle="WebSocket Bağlanma Bilgileri"
OBSWebSocket.ConnectInfo.CopyText="Kopyala"
OBSWebSocket.ConnectInfo.ServerIp="Sunucu IP (En İyi Tahmin)"
OBSWebSocket.ConnectInfo.ServerPort="Sunucu Kapısı"
OBSWebSocket.ConnectInfo.ServerPort="Sunucu Portu"
OBSWebSocket.ConnectInfo.ServerPassword="Sunucu Parolası"
OBSWebSocket.ConnectInfo.ServerPasswordPlaceholderText="[Doğrulama Devre Dışı]"
OBSWebSocket.ConnectInfo.QrTitle="Kare Kod ile Bağlan"

View File

@ -1,5 +1,5 @@
# obs-websocket 5.1.0 Protocol
# obs-websocket 5.x.x Protocol
## Main Table of Contents

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@ struct obs_websocket_request_callback {
void *priv_data;
};
inline proc_handler_t *_ph;
static proc_handler_t *_ph;
/* ==================== INTERNAL API FUNCTIONS ==================== */
@ -53,7 +53,7 @@ static inline proc_handler_t *obs_websocket_get_ph(void)
proc_handler_t *global_ph = obs_get_proc_handler();
assert(global_ph != NULL);
calldata_t cd = {0};
calldata_t cd = {0, 0, 0, 0};
if (!proc_handler_call(global_ph, "obs_websocket_api_get_ph", &cd))
blog(LOG_DEBUG, "Unable to fetch obs-websocket proc handler object. obs-websocket not installed?");
proc_handler_t *ret = (proc_handler_t *)calldata_ptr(&cd, "ph");
@ -91,7 +91,7 @@ static inline unsigned int obs_websocket_get_api_version(void)
if (!obs_websocket_ensure_ph())
return 0;
calldata_t cd = {0};
calldata_t cd = {0, 0, 0, 0};
if (!proc_handler_call(_ph, "get_api_version", &cd))
return 1; // API v1 does not include get_api_version
@ -104,7 +104,11 @@ static inline unsigned int obs_websocket_get_api_version(void)
}
// Calls an obs-websocket request. Free response with `obs_websocket_request_response_free()`
static inline obs_websocket_request_response *obs_websocket_call_request(const char *request_type, obs_data_t *request_data = NULL)
static inline struct obs_websocket_request_response *obs_websocket_call_request(const char *request_type, obs_data_t *request_data
#ifdef __cplusplus
= NULL
#endif
)
{
if (!obs_websocket_ensure_ph())
return NULL;
@ -113,14 +117,14 @@ static inline obs_websocket_request_response *obs_websocket_call_request(const c
if (request_data)
request_data_string = obs_data_get_json(request_data);
calldata_t cd = {0};
calldata_t cd = {0, 0, 0, 0};
calldata_set_string(&cd, "request_type", request_type);
calldata_set_string(&cd, "request_data", request_data_string);
proc_handler_call(_ph, "call_request", &cd);
auto ret = (struct obs_websocket_request_response *)calldata_ptr(&cd, "response");
struct obs_websocket_request_response *ret = (struct obs_websocket_request_response *)calldata_ptr(&cd, "response");
calldata_free(&cd);
@ -149,7 +153,7 @@ static inline obs_websocket_vendor obs_websocket_register_vendor(const char *ven
if (!obs_websocket_ensure_ph())
return NULL;
calldata_t cd = {0};
calldata_t cd = {0, 0, 0, 0};
calldata_set_string(&cd, "name", vendor_name);
@ -164,11 +168,9 @@ static inline obs_websocket_vendor obs_websocket_register_vendor(const char *ven
static inline bool obs_websocket_vendor_register_request(obs_websocket_vendor vendor, const char *request_type,
obs_websocket_request_callback_function request_callback, void *priv_data)
{
calldata_t cd = {0};
calldata_t cd = {0, 0, 0, 0};
struct obs_websocket_request_callback cb = {};
cb.callback = request_callback;
cb.priv_data = priv_data;
struct obs_websocket_request_callback cb = {request_callback, priv_data};
calldata_set_string(&cd, "type", request_type);
calldata_set_ptr(&cd, "callback", &cb);
@ -182,7 +184,7 @@ static inline bool obs_websocket_vendor_register_request(obs_websocket_vendor ve
// Unregisters an existing vendor request
static inline bool obs_websocket_vendor_unregister_request(obs_websocket_vendor vendor, const char *request_type)
{
calldata_t cd = {0};
calldata_t cd = {0, 0, 0, 0};
calldata_set_string(&cd, "type", request_type);
@ -196,7 +198,7 @@ static inline bool obs_websocket_vendor_unregister_request(obs_websocket_vendor
// Emits an event under the vendor's name
static inline bool obs_websocket_vendor_emit_event(obs_websocket_vendor vendor, const char *event_name, obs_data_t *event_data)
{
calldata_t cd = {0};
calldata_t cd = {0, 0, 0, 0};
calldata_set_string(&cd, "type", event_name);
calldata_set_ptr(&cd, "data", (void *)event_data);

View File

@ -31,6 +31,7 @@ EventHandler::EventHandler()
signal_handler_connect(coreSignalHandler, "source_destroy", SourceDestroyedMultiHandler, this);
signal_handler_connect(coreSignalHandler, "source_remove", SourceRemovedMultiHandler, this);
signal_handler_connect(coreSignalHandler, "source_rename", SourceRenamedMultiHandler, this);
signal_handler_connect(coreSignalHandler, "source_update", SourceUpdatedMultiHandler, this);
} else {
blog(LOG_ERROR, "[EventHandler::EventHandler] Unable to get libobs signal handler!");
}
@ -50,10 +51,25 @@ EventHandler::~EventHandler()
signal_handler_disconnect(coreSignalHandler, "source_destroy", SourceDestroyedMultiHandler, this);
signal_handler_disconnect(coreSignalHandler, "source_remove", SourceRemovedMultiHandler, this);
signal_handler_disconnect(coreSignalHandler, "source_rename", SourceRenamedMultiHandler, this);
signal_handler_disconnect(coreSignalHandler, "source_update", SourceUpdatedMultiHandler, this);
} else {
blog(LOG_ERROR, "[EventHandler::~EventHandler] Unable to get libobs signal handler!");
}
// Revoke callbacks of all inputs and scenes, in case some still have our callbacks attached
auto enumInputs = [](void *param, obs_source_t *source) {
auto eventHandler = static_cast<EventHandler *>(param);
eventHandler->DisconnectSourceSignals(source);
return true;
};
obs_enum_sources(enumInputs, this);
auto enumScenes = [](void *param, obs_source_t *source) {
auto eventHandler = static_cast<EventHandler *>(param);
eventHandler->DisconnectSourceSignals(source);
return true;
};
obs_enum_scenes(enumScenes, this);
blog_debug("[EventHandler::~EventHandler] Finished.");
}
@ -574,6 +590,26 @@ void EventHandler::SourceRenamedMultiHandler(void *param, calldata_t *data)
}
}
void EventHandler::SourceUpdatedMultiHandler(void *param, calldata_t *data)
{
auto eventHandler = static_cast<EventHandler *>(param);
obs_source_t *source = GetCalldataPointer<obs_source_t>(data, "source");
if (!source)
return;
switch (obs_source_get_type(source)) {
case OBS_SOURCE_TYPE_INPUT:
eventHandler->HandleInputSettingsChanged(source);
break;
case OBS_SOURCE_TYPE_FILTER:
eventHandler->HandleSourceFilterSettingsChanged(source);
break;
default:
break;
}
}
void EventHandler::StreamOutputReconnectHandler(void *param, calldata_t *)
{
auto eventHandler = static_cast<EventHandler *>(param);

View File

@ -69,9 +69,10 @@ private:
static void SourceCreatedMultiHandler(void *param, calldata_t *data);
static void SourceDestroyedMultiHandler(void *param, calldata_t *data);
static void SourceRemovedMultiHandler(void *param, calldata_t *data);
// Signal handler: source
static void SourceRenamedMultiHandler(void *param, calldata_t *data);
static void SourceUpdatedMultiHandler(void *param, calldata_t *data);
// Signal handler: media sources
static void SourceMediaPauseMultiHandler(void *param, calldata_t *data);
static void SourceMediaPlayMultiHandler(void *param, calldata_t *data);
static void SourceMediaRestartMultiHandler(void *param, calldata_t *data);
@ -106,7 +107,7 @@ private:
void HandleInputCreated(obs_source_t *source);
void HandleInputRemoved(obs_source_t *source);
void HandleInputNameChanged(obs_source_t *source, std::string oldInputName, std::string inputName);
void HandleInputVolumeMeters(std::vector<json> inputs); // AudioMeter::Handler callback
void HandleInputSettingsChanged(obs_source_t *source);
static void HandleInputActiveStateChanged(void *param,
calldata_t *data); // Direct callback
static void HandleInputShowStateChanged(void *param,
@ -123,6 +124,7 @@ private:
calldata_t *data); // Direct callback
static void HandleInputAudioMonitorTypeChanged(void *param,
calldata_t *data); // Direct callback
void HandleInputVolumeMeters(std::vector<json> inputs); // AudioMeter::Handler callback
// Transitions
void HandleCurrentSceneTransitionChanged();
@ -145,6 +147,7 @@ private:
void HandleSourceFilterRemoved(obs_source_t *source, obs_source_t *filter);
static void HandleSourceFilterNameChanged(void *param,
calldata_t *data); // Direct callback
void HandleSourceFilterSettingsChanged(obs_source_t *source);
static void HandleSourceFilterEnableStateChanged(void *param, calldata_t *data); // Direct callback
// Outputs

View File

@ -163,6 +163,32 @@ void EventHandler::HandleSourceFilterNameChanged(void *param, calldata_t *data)
eventHandler->BroadcastEvent(EventSubscription::Filters, "SourceFilterNameChanged", eventData);
}
/**
* An source filter's settings have changed (been updated).
*
* @dataField sourceName | String | Name of the source the filter is on
* @dataField filterName | String | Name of the filter
* @dataField filterSettings | Object | New settings object of the filter
*
* @eventType SourceFilterSettingsChanged
* @eventSubscription Filters
* @complexity 3
* @rpcVersion -1
* @initialVersion 5.4.0
* @api events
* @category filters
*/
void EventHandler::HandleSourceFilterSettingsChanged(obs_source_t *source)
{
OBSDataAutoRelease filterSettings = obs_source_get_settings(source);
json eventData;
eventData["sourceName"] = obs_source_get_name(obs_filter_get_parent(source));
eventData["filterName"] = obs_source_get_name(source);
eventData["filterSettings"] = Utils::Json::ObsDataToJson(filterSettings);
BroadcastEvent(EventSubscription::Filters, "SourceFilterSettingsChanged", eventData);
}
/**
* A source filter's enable state has changed.
*

View File

@ -23,6 +23,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
* An input has been created.
*
* @dataField inputName | String | Name of the input
* @dataField inputUuid | String | UUID of the input
* @dataField inputKind | String | The kind of the input
* @dataField unversionedInputKind | String | The unversioned kind of input (aka no `_v2` stuff)
* @dataField inputSettings | Object | The settings configured to the input when it was created
@ -44,6 +45,7 @@ void EventHandler::HandleInputCreated(obs_source_t *source)
json eventData;
eventData["inputName"] = obs_source_get_name(source);
eventData["inputUuid"] = obs_source_get_uuid(source);
eventData["inputKind"] = inputKind;
eventData["unversionedInputKind"] = obs_source_get_unversioned_id(source);
eventData["inputSettings"] = Utils::Json::ObsDataToJson(inputSettings);
@ -55,6 +57,7 @@ void EventHandler::HandleInputCreated(obs_source_t *source)
* An input has been removed.
*
* @dataField inputName | String | Name of the input
* @dataField inputUuid | String | UUID of the input
*
* @eventType InputRemoved
* @eventSubscription Inputs
@ -68,12 +71,14 @@ void EventHandler::HandleInputRemoved(obs_source_t *source)
{
json eventData;
eventData["inputName"] = obs_source_get_name(source);
eventData["inputUuid"] = obs_source_get_uuid(source);
BroadcastEvent(EventSubscription::Inputs, "InputRemoved", eventData);
}
/**
* The name of an input has changed.
*
* @dataField inputUuid | String | UUID of the input
* @dataField oldInputName | String | Old name of the input
* @dataField inputName | String | New name of the input
*
@ -85,20 +90,50 @@ void EventHandler::HandleInputRemoved(obs_source_t *source)
* @api events
* @category inputs
*/
void EventHandler::HandleInputNameChanged(obs_source_t *, std::string oldInputName, std::string inputName)
void EventHandler::HandleInputNameChanged(obs_source_t *source, std::string oldInputName, std::string inputName)
{
json eventData;
eventData["inputUuid"] = obs_source_get_uuid(source);
eventData["oldInputName"] = oldInputName;
eventData["inputName"] = inputName;
BroadcastEvent(EventSubscription::Inputs, "InputNameChanged", eventData);
}
/**
* An input's settings have changed (been updated).
*
* Note: On some inputs, changing values in the properties dialog will cause an immediate update. Pressing the "Cancel" button will revert the settings, resulting in another event being fired.
*
* @dataField inputName | String | Name of the input
* @dataField inputUuid | String | UUID of the input
* @dataField inputSettings | Object | New settings object of the input
*
* @eventType InputSettingsChanged
* @eventSubscription Inputs
* @complexity 3
* @rpcVersion -1
* @initialVersion 5.4.0
* @api events
* @category inputs
*/
void EventHandler::HandleInputSettingsChanged(obs_source_t *source)
{
OBSDataAutoRelease inputSettings = obs_source_get_settings(source);
json eventData;
eventData["inputName"] = obs_source_get_name(source);
eventData["inputUuid"] = obs_source_get_uuid(source);
eventData["inputSettings"] = Utils::Json::ObsDataToJson(inputSettings);
BroadcastEvent(EventSubscription::Inputs, "InputSettingsChanged", eventData);
}
/**
* An input's active state has changed.
*
* When an input is active, it means it's being shown by the program feed.
*
* @dataField inputName | String | Name of the input
* @dataField inputUuid | String | UUID of the input
* @dataField videoActive | Boolean | Whether the input is active
*
* @eventType InputActiveStateChanged
@ -125,6 +160,7 @@ void EventHandler::HandleInputActiveStateChanged(void *param, calldata_t *data)
json eventData;
eventData["inputName"] = obs_source_get_name(source);
eventData["inputUuid"] = obs_source_get_uuid(source);
eventData["videoActive"] = obs_source_active(source);
eventHandler->BroadcastEvent(EventSubscription::InputActiveStateChanged, "InputActiveStateChanged", eventData);
}
@ -135,6 +171,7 @@ void EventHandler::HandleInputActiveStateChanged(void *param, calldata_t *data)
* When an input is showing, it means it's being shown by the preview or a dialog.
*
* @dataField inputName | String | Name of the input
* @dataField inputUuid | String | UUID of the input
* @dataField videoShowing | Boolean | Whether the input is showing
*
* @eventType InputShowStateChanged
@ -161,6 +198,7 @@ void EventHandler::HandleInputShowStateChanged(void *param, calldata_t *data)
json eventData;
eventData["inputName"] = obs_source_get_name(source);
eventData["inputUuid"] = obs_source_get_uuid(source);
eventData["videoShowing"] = obs_source_showing(source);
eventHandler->BroadcastEvent(EventSubscription::InputShowStateChanged, "InputShowStateChanged", eventData);
}
@ -169,6 +207,7 @@ void EventHandler::HandleInputShowStateChanged(void *param, calldata_t *data)
* An input's mute state has changed.
*
* @dataField inputName | String | Name of the input
* @dataField inputUuid | String | UUID of the input
* @dataField inputMuted | Boolean | Whether the input is muted
*
* @eventType InputMuteStateChanged
@ -192,6 +231,7 @@ void EventHandler::HandleInputMuteStateChanged(void *param, calldata_t *data)
json eventData;
eventData["inputName"] = obs_source_get_name(source);
eventData["inputUuid"] = obs_source_get_uuid(source);
eventData["inputMuted"] = obs_source_muted(source);
eventHandler->BroadcastEvent(EventSubscription::Inputs, "InputMuteStateChanged", eventData);
}
@ -200,6 +240,7 @@ void EventHandler::HandleInputMuteStateChanged(void *param, calldata_t *data)
* An input's volume level has changed.
*
* @dataField inputName | String | Name of the input
* @dataField inputUuid | String | UUID of the input
* @dataField inputVolumeMul | Number | New volume level multiplier
* @dataField inputVolumeDb | Number | New volume level in dB
*
@ -231,6 +272,7 @@ void EventHandler::HandleInputVolumeChanged(void *param, calldata_t *data)
json eventData;
eventData["inputName"] = obs_source_get_name(source);
eventData["inputUuid"] = obs_source_get_uuid(source);
eventData["inputVolumeMul"] = inputVolumeMul;
eventData["inputVolumeDb"] = inputVolumeDb;
eventHandler->BroadcastEvent(EventSubscription::Inputs, "InputVolumeChanged", eventData);
@ -239,7 +281,8 @@ void EventHandler::HandleInputVolumeChanged(void *param, calldata_t *data)
/**
* The audio balance value of an input has changed.
*
* @dataField inputName | String | Name of the affected input
* @dataField inputName | String | Name of the input
* @dataField inputUuid | String | UUID of the input
* @dataField inputAudioBalance | Number | New audio balance value of the input
*
* @eventType InputAudioBalanceChanged
@ -265,6 +308,7 @@ void EventHandler::HandleInputAudioBalanceChanged(void *param, calldata_t *data)
json eventData;
eventData["inputName"] = obs_source_get_name(source);
eventData["inputUuid"] = obs_source_get_uuid(source);
eventData["inputAudioBalance"] = inputAudioBalance;
eventHandler->BroadcastEvent(EventSubscription::Inputs, "InputAudioBalanceChanged", eventData);
}
@ -273,6 +317,7 @@ void EventHandler::HandleInputAudioBalanceChanged(void *param, calldata_t *data)
* The sync offset of an input has changed.
*
* @dataField inputName | String | Name of the input
* @dataField inputUuid | String | UUID of the input
* @dataField inputAudioSyncOffset | Number | New sync offset in milliseconds
*
* @eventType InputAudioSyncOffsetChanged
@ -298,6 +343,7 @@ void EventHandler::HandleInputAudioSyncOffsetChanged(void *param, calldata_t *da
json eventData;
eventData["inputName"] = obs_source_get_name(source);
eventData["inputUuid"] = obs_source_get_uuid(source);
eventData["inputAudioSyncOffset"] = inputAudioSyncOffset / 1000000;
eventHandler->BroadcastEvent(EventSubscription::Inputs, "InputAudioSyncOffsetChanged", eventData);
}
@ -306,6 +352,7 @@ void EventHandler::HandleInputAudioSyncOffsetChanged(void *param, calldata_t *da
* The audio tracks of an input have changed.
*
* @dataField inputName | String | Name of the input
* @dataField inputUuid | String | UUID of the input
* @dataField inputAudioTracks | Object | Object of audio tracks along with their associated enable states
*
* @eventType InputAudioTracksChanged
@ -336,6 +383,7 @@ void EventHandler::HandleInputAudioTracksChanged(void *param, calldata_t *data)
json eventData;
eventData["inputName"] = obs_source_get_name(source);
eventData["inputUuid"] = obs_source_get_uuid(source);
eventData["inputAudioTracks"] = inputAudioTracks;
eventHandler->BroadcastEvent(EventSubscription::Inputs, "InputAudioTracksChanged", eventData);
}
@ -350,6 +398,7 @@ void EventHandler::HandleInputAudioTracksChanged(void *param, calldata_t *data)
* - `OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT`
*
* @dataField inputName | String | Name of the input
* @dataField inputUuid | String | UUID of the input
* @dataField monitorType | String | New monitor type of the input
*
* @eventType InputAudioMonitorTypeChanged
@ -375,6 +424,7 @@ void EventHandler::HandleInputAudioMonitorTypeChanged(void *param, calldata_t *d
json eventData;
eventData["inputName"] = obs_source_get_name(source);
eventData["inputUuid"] = obs_source_get_uuid(source);
eventData["monitorType"] = monitorType;
eventHandler->BroadcastEvent(EventSubscription::Inputs, "InputAudioMonitorTypeChanged", eventData);
}

View File

@ -124,6 +124,7 @@ void EventHandler::SourceMediaPreviousMultiHandler(void *param, calldata_t *data
* A media input has started playing.
*
* @dataField inputName | String | Name of the input
* @dataField inputUuid | String | UUID of the input
*
* @eventType MediaInputPlaybackStarted
* @eventSubscription MediaInputs
@ -146,6 +147,7 @@ void EventHandler::HandleMediaInputPlaybackStarted(void *param, calldata_t *data
json eventData;
eventData["inputName"] = obs_source_get_name(source);
eventData["inputUuid"] = obs_source_get_uuid(source);
eventHandler->BroadcastEvent(EventSubscription::MediaInputs, "MediaInputPlaybackStarted", eventData);
}
@ -153,6 +155,7 @@ void EventHandler::HandleMediaInputPlaybackStarted(void *param, calldata_t *data
* A media input has finished playing.
*
* @dataField inputName | String | Name of the input
* @dataField inputUuid | String | UUID of the input
*
* @eventType MediaInputPlaybackEnded
* @eventSubscription MediaInputs
@ -175,6 +178,7 @@ void EventHandler::HandleMediaInputPlaybackEnded(void *param, calldata_t *data)
json eventData;
eventData["inputName"] = obs_source_get_name(source);
eventData["inputUuid"] = obs_source_get_uuid(source);
eventHandler->BroadcastEvent(EventSubscription::MediaInputs, "MediaInputPlaybackEnded", eventData);
}
@ -182,6 +186,7 @@ void EventHandler::HandleMediaInputPlaybackEnded(void *param, calldata_t *data)
* An action has been performed on an input.
*
* @dataField inputName | String | Name of the input
* @dataField inputUuid | String | UUID of the input
* @dataField mediaAction | String | Action performed on the input. See `ObsMediaInputAction` enum
*
* @eventType MediaInputActionTriggered
@ -196,6 +201,7 @@ void EventHandler::HandleMediaInputActionTriggered(obs_source_t *source, ObsMedi
{
json eventData;
eventData["inputName"] = obs_source_get_name(source);
eventData["inputUuid"] = obs_source_get_uuid(source);
eventData["mediaAction"] = GetMediaInputActionString(action);
BroadcastEvent(EventSubscription::MediaInputs, "MediaInputActionTriggered", eventData);
}

View File

@ -23,7 +23,9 @@ with this program. If not, see <https://www.gnu.org/licenses/>
* A scene item has been created.
*
* @dataField sceneName | String | Name of the scene the item was added to
* @dataField sceneUuid | String | UUID of the scene the item was added to
* @dataField sourceName | String | Name of the underlying source (input/scene)
* @dataField sourceUuid | String | UUID of the underlying source (input/scene)
* @dataField sceneItemId | Number | Numeric ID of the scene item
* @dataField sceneItemIndex | Number | Index position of the item
*
@ -49,7 +51,9 @@ void EventHandler::HandleSceneItemCreated(void *param, calldata_t *data)
json eventData;
eventData["sceneName"] = obs_source_get_name(obs_scene_get_source(scene));
eventData["sceneUuid"] = obs_source_get_uuid(obs_scene_get_source(scene));
eventData["sourceName"] = obs_source_get_name(obs_sceneitem_get_source(sceneItem));
eventData["sourceUuid"] = obs_source_get_uuid(obs_sceneitem_get_source(sceneItem));
eventData["sceneItemId"] = obs_sceneitem_get_id(sceneItem);
eventData["sceneItemIndex"] = obs_sceneitem_get_order_position(sceneItem);
eventHandler->BroadcastEvent(EventSubscription::SceneItems, "SceneItemCreated", eventData);
@ -61,7 +65,9 @@ void EventHandler::HandleSceneItemCreated(void *param, calldata_t *data)
* This event is not emitted when the scene the item is in is removed.
*
* @dataField sceneName | String | Name of the scene the item was removed from
* @dataField sceneUuid | String | UUID of the scene the item was removed from
* @dataField sourceName | String | Name of the underlying source (input/scene)
* @dataField sourceUuid | String | UUID of the underlying source (input/scene)
* @dataField sceneItemId | Number | Numeric ID of the scene item
*
* @eventType SceneItemRemoved
@ -86,7 +92,9 @@ void EventHandler::HandleSceneItemRemoved(void *param, calldata_t *data)
json eventData;
eventData["sceneName"] = obs_source_get_name(obs_scene_get_source(scene));
eventData["sceneUuid"] = obs_source_get_uuid(obs_scene_get_source(scene));
eventData["sourceName"] = obs_source_get_name(obs_sceneitem_get_source(sceneItem));
eventData["sourceUuid"] = obs_source_get_uuid(obs_sceneitem_get_source(sceneItem));
eventData["sceneItemId"] = obs_sceneitem_get_id(sceneItem);
eventHandler->BroadcastEvent(EventSubscription::SceneItems, "SceneItemRemoved", eventData);
}
@ -95,6 +103,7 @@ void EventHandler::HandleSceneItemRemoved(void *param, calldata_t *data)
* A scene's item list has been reindexed.
*
* @dataField sceneName | String | Name of the scene
* @dataField sceneUuid | String | UUID of the scene
* @dataField sceneItems | Array<Object> | Array of scene item objects
*
* @eventType SceneItemListReindexed
@ -115,6 +124,7 @@ void EventHandler::HandleSceneItemListReindexed(void *param, calldata_t *data)
json eventData;
eventData["sceneName"] = obs_source_get_name(obs_scene_get_source(scene));
eventData["sceneUuid"] = obs_source_get_uuid(obs_scene_get_source(scene));
eventData["sceneItems"] = Utils::Obs::ArrayHelper::GetSceneItemList(scene, true);
eventHandler->BroadcastEvent(EventSubscription::SceneItems, "SceneItemListReindexed", eventData);
}
@ -123,6 +133,7 @@ void EventHandler::HandleSceneItemListReindexed(void *param, calldata_t *data)
* A scene item's enable state has changed.
*
* @dataField sceneName | String | Name of the scene the item is in
* @dataField sceneUuid | String | UUID of the scene the item is in
* @dataField sceneItemId | Number | Numeric ID of the scene item
* @dataField sceneItemEnabled | Boolean | Whether the scene item is enabled (visible)
*
@ -150,6 +161,7 @@ void EventHandler::HandleSceneItemEnableStateChanged(void *param, calldata_t *da
json eventData;
eventData["sceneName"] = obs_source_get_name(obs_scene_get_source(scene));
eventData["sceneUuid"] = obs_source_get_uuid(obs_scene_get_source(scene));
eventData["sceneItemId"] = obs_sceneitem_get_id(sceneItem);
eventData["sceneItemEnabled"] = sceneItemEnabled;
eventHandler->BroadcastEvent(EventSubscription::SceneItems, "SceneItemEnableStateChanged", eventData);
@ -159,6 +171,7 @@ void EventHandler::HandleSceneItemEnableStateChanged(void *param, calldata_t *da
* A scene item's lock state has changed.
*
* @dataField sceneName | String | Name of the scene the item is in
* @dataField sceneUuid | String | UUID of the scene the item is in
* @dataField sceneItemId | Number | Numeric ID of the scene item
* @dataField sceneItemLocked | Boolean | Whether the scene item is locked
*
@ -186,6 +199,7 @@ void EventHandler::HandleSceneItemLockStateChanged(void *param, calldata_t *data
json eventData;
eventData["sceneName"] = obs_source_get_name(obs_scene_get_source(scene));
eventData["sceneUuid"] = obs_source_get_uuid(obs_scene_get_source(scene));
eventData["sceneItemId"] = obs_sceneitem_get_id(sceneItem);
eventData["sceneItemLocked"] = sceneItemLocked;
eventHandler->BroadcastEvent(EventSubscription::SceneItems, "SceneItemLockStateChanged", eventData);
@ -195,6 +209,7 @@ void EventHandler::HandleSceneItemLockStateChanged(void *param, calldata_t *data
* A scene item has been selected in the Ui.
*
* @dataField sceneName | String | Name of the scene the item is in
* @dataField sceneUuid | String | UUID of the scene the item is in
* @dataField sceneItemId | Number | Numeric ID of the scene item
*
* @eventType SceneItemSelected
@ -219,6 +234,7 @@ void EventHandler::HandleSceneItemSelected(void *param, calldata_t *data)
json eventData;
eventData["sceneName"] = obs_source_get_name(obs_scene_get_source(scene));
eventData["sceneUuid"] = obs_source_get_uuid(obs_scene_get_source(scene));
eventData["sceneItemId"] = obs_sceneitem_get_id(sceneItem);
eventHandler->BroadcastEvent(EventSubscription::SceneItems, "SceneItemSelected", eventData);
}
@ -227,6 +243,7 @@ void EventHandler::HandleSceneItemSelected(void *param, calldata_t *data)
* The transform/crop of a scene item has changed.
*
* @dataField sceneName | String | The name of the scene the item is in
* @dataField sceneUuid | String | The UUID of the scene the item is in
* @dataField sceneItemId | Number | Numeric ID of the scene item
* @dataField sceneItemTransform | Object | New transform/crop info of the scene item
*
@ -255,6 +272,7 @@ void EventHandler::HandleSceneItemTransformChanged(void *param, calldata_t *data
json eventData;
eventData["sceneName"] = obs_source_get_name(obs_scene_get_source(scene));
eventData["sceneUuid"] = obs_source_get_uuid(obs_scene_get_source(scene));
eventData["sceneItemId"] = obs_sceneitem_get_id(sceneItem);
eventData["sceneItemTransform"] = Utils::Obs::ObjectHelper::GetSceneItemTransform(sceneItem);
eventHandler->BroadcastEvent(EventSubscription::SceneItemTransformChanged, "SceneItemTransformChanged", eventData);

View File

@ -23,6 +23,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
* A new scene has been created.
*
* @dataField sceneName | String | Name of the new scene
* @dataField sceneUuid | String | UUID of the new scene
* @dataField isGroup | Boolean | Whether the new scene is a group
*
* @eventType SceneCreated
@ -37,6 +38,7 @@ void EventHandler::HandleSceneCreated(obs_source_t *source)
{
json eventData;
eventData["sceneName"] = obs_source_get_name(source);
eventData["sceneUuid"] = obs_source_get_uuid(source);
eventData["isGroup"] = obs_source_is_group(source);
BroadcastEvent(EventSubscription::Scenes, "SceneCreated", eventData);
}
@ -45,6 +47,7 @@ void EventHandler::HandleSceneCreated(obs_source_t *source)
* A scene has been removed.
*
* @dataField sceneName | String | Name of the removed scene
* @dataField sceneUuid | String | UUID of the removed scene
* @dataField isGroup | Boolean | Whether the scene was a group
*
* @eventType SceneRemoved
@ -59,6 +62,7 @@ void EventHandler::HandleSceneRemoved(obs_source_t *source)
{
json eventData;
eventData["sceneName"] = obs_source_get_name(source);
eventData["sceneUuid"] = obs_source_get_uuid(source);
eventData["isGroup"] = obs_source_is_group(source);
BroadcastEvent(EventSubscription::Scenes, "SceneRemoved", eventData);
}
@ -66,6 +70,7 @@ void EventHandler::HandleSceneRemoved(obs_source_t *source)
/**
* The name of a scene has changed.
*
* @dataField sceneUuid | String | UUID of the scene
* @dataField oldSceneName | String | Old name of the scene
* @dataField sceneName | String | New name of the scene
*
@ -77,9 +82,10 @@ void EventHandler::HandleSceneRemoved(obs_source_t *source)
* @api events
* @category scenes
*/
void EventHandler::HandleSceneNameChanged(obs_source_t *, std::string oldSceneName, std::string sceneName)
void EventHandler::HandleSceneNameChanged(obs_source_t *source, std::string oldSceneName, std::string sceneName)
{
json eventData;
eventData["sceneUuid"] = obs_source_get_uuid(source);
eventData["oldSceneName"] = oldSceneName;
eventData["sceneName"] = sceneName;
BroadcastEvent(EventSubscription::Scenes, "SceneNameChanged", eventData);
@ -89,6 +95,7 @@ void EventHandler::HandleSceneNameChanged(obs_source_t *, std::string oldSceneNa
* The current program scene has changed.
*
* @dataField sceneName | String | Name of the scene that was switched to
* @dataField sceneUuid | String | UUID of the scene that was switched to
*
* @eventType CurrentProgramSceneChanged
* @eventSubscription Scenes
@ -104,6 +111,7 @@ void EventHandler::HandleCurrentProgramSceneChanged()
json eventData;
eventData["sceneName"] = obs_source_get_name(currentScene);
eventData["sceneUuid"] = obs_source_get_uuid(currentScene);
BroadcastEvent(EventSubscription::Scenes, "CurrentProgramSceneChanged", eventData);
}
@ -111,6 +119,7 @@ void EventHandler::HandleCurrentProgramSceneChanged()
* The current preview scene has changed.
*
* @dataField sceneName | String | Name of the scene that was switched to
* @dataField sceneUuid | String | UUID of the scene that was switched to
*
* @eventType CurrentPreviewSceneChanged
* @eventSubscription Scenes
@ -130,6 +139,7 @@ void EventHandler::HandleCurrentPreviewSceneChanged()
json eventData;
eventData["sceneName"] = obs_source_get_name(currentPreviewScene);
eventData["sceneUuid"] = obs_source_get_uuid(currentPreviewScene);
BroadcastEvent(EventSubscription::Scenes, "CurrentPreviewSceneChanged", eventData);
}

View File

@ -23,6 +23,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
* The current scene transition has changed.
*
* @dataField transitionName | String | Name of the new transition
* @dataField transitionUuid | String | UUID of the new transition
*
* @eventType CurrentSceneTransitionChanged
* @eventSubscription Transitions
@ -38,6 +39,7 @@ void EventHandler::HandleCurrentSceneTransitionChanged()
json eventData;
eventData["transitionName"] = obs_source_get_name(transition);
eventData["transitionUuid"] = obs_source_get_uuid(transition);
BroadcastEvent(EventSubscription::Transitions, "CurrentSceneTransitionChanged", eventData);
}
@ -65,6 +67,7 @@ void EventHandler::HandleCurrentSceneTransitionDurationChanged()
* A scene transition has started.
*
* @dataField transitionName | String | Scene transition name
* @dataField transitionUuid | String | Scene transition UUID
*
* @eventType SceneTransitionStarted
* @eventSubscription Transitions
@ -84,6 +87,7 @@ void EventHandler::HandleSceneTransitionStarted(void *param, calldata_t *data)
json eventData;
eventData["transitionName"] = obs_source_get_name(source);
eventData["transitionUuid"] = obs_source_get_uuid(source);
eventHandler->BroadcastEvent(EventSubscription::Transitions, "SceneTransitionStarted", eventData);
}
@ -93,6 +97,7 @@ void EventHandler::HandleSceneTransitionStarted(void *param, calldata_t *data)
* Note: Does not appear to trigger when the transition is interrupted by the user.
*
* @dataField transitionName | String | Scene transition name
* @dataField transitionUuid | String | Scene transition UUID
*
* @eventType SceneTransitionEnded
* @eventSubscription Transitions
@ -112,6 +117,7 @@ void EventHandler::HandleSceneTransitionEnded(void *param, calldata_t *data)
json eventData;
eventData["transitionName"] = obs_source_get_name(source);
eventData["transitionUuid"] = obs_source_get_uuid(source);
eventHandler->BroadcastEvent(EventSubscription::Transitions, "SceneTransitionEnded", eventData);
}
@ -124,6 +130,7 @@ void EventHandler::HandleSceneTransitionEnded(void *param, calldata_t *data)
* Note: Appears to be called by every transition, regardless of relevance.
*
* @dataField transitionName | String | Scene transition name
* @dataField transitionUuid | String | Scene transition UUID
*
* @eventType SceneTransitionVideoEnded
* @eventSubscription Transitions
@ -143,5 +150,6 @@ void EventHandler::HandleSceneTransitionVideoEnded(void *param, calldata_t *data
json eventData;
eventData["transitionName"] = obs_source_get_name(source);
eventData["transitionUuid"] = obs_source_get_uuid(source);
eventHandler->BroadcastEvent(EventSubscription::Transitions, "SceneTransitionVideoEnded", eventData);
}

View File

@ -111,6 +111,7 @@ const std::unordered_map<std::string, RequestMethodHandler> RequestHandler::_han
{"SetTBarPosition", &RequestHandler::SetTBarPosition},
// Filters
{"GetSourceFilterKindList", &RequestHandler::GetSourceFilterKindList},
{"GetSourceFilterList", &RequestHandler::GetSourceFilterList},
{"GetSourceFilterDefaultSettings", &RequestHandler::GetSourceFilterDefaultSettings},
{"CreateSourceFilter", &RequestHandler::CreateSourceFilter},
@ -125,6 +126,7 @@ const std::unordered_map<std::string, RequestMethodHandler> RequestHandler::_han
{"GetSceneItemList", &RequestHandler::GetSceneItemList},
{"GetGroupSceneItemList", &RequestHandler::GetGroupSceneItemList},
{"GetSceneItemId", &RequestHandler::GetSceneItemId},
{"GetSceneItemSource", &RequestHandler::GetSceneItemSource},
{"CreateSceneItem", &RequestHandler::CreateSceneItem},
{"RemoveSceneItem", &RequestHandler::RemoveSceneItem},
{"DuplicateSceneItem", &RequestHandler::DuplicateSceneItem},

View File

@ -130,6 +130,7 @@ private:
RequestResult SetTBarPosition(const Request &);
// Filters
RequestResult GetSourceFilterKindList(const Request &);
RequestResult GetSourceFilterList(const Request &);
RequestResult GetSourceFilterDefaultSettings(const Request &);
RequestResult CreateSourceFilter(const Request &);
@ -144,6 +145,7 @@ private:
RequestResult GetSceneItemList(const Request &);
RequestResult GetGroupSceneItemList(const Request &);
RequestResult GetSceneItemId(const Request &);
RequestResult GetSceneItemSource(const Request &);
RequestResult CreateSceneItem(const Request &);
RequestResult RemoveSceneItem(const Request &);
RequestResult DuplicateSceneItem(const Request &);

View File

@ -198,10 +198,7 @@ RequestResult RequestHandler::CreateSceneCollection(const Request &request)
if (std::find(sceneCollections.begin(), sceneCollections.end(), sceneCollectionName) != sceneCollections.end())
return RequestResult::Error(RequestStatus::ResourceAlreadyExists);
QMainWindow *mainWindow = static_cast<QMainWindow *>(obs_frontend_get_main_window());
bool success = false;
QMetaObject::invokeMethod(mainWindow, "AddSceneCollection", Qt::BlockingQueuedConnection, Q_RETURN_ARG(bool, success),
Q_ARG(bool, true), Q_ARG(QString, QString::fromStdString(sceneCollectionName)));
bool success = obs_frontend_add_scene_collection(sceneCollectionName.c_str());
if (!success)
return RequestResult::Error(RequestStatus::ResourceCreationFailed, "Failed to create the scene collection.");
@ -599,8 +596,8 @@ RequestResult RequestHandler::SetStreamServiceSettings(const Request &request)
obs_service_update(currentStreamService, newStreamServiceSettings);
} else {
// TODO: This leaks memory. I have no idea why.
OBSService newStreamService = obs_service_create(requestedStreamServiceType.c_str(), "obs_websocket_custom_service",
OBSServiceAutoRelease newStreamService = obs_service_create(requestedStreamServiceType.c_str(),
"obs_websocket_custom_service",
requestedStreamServiceSettings, nullptr);
// TODO: Check service type here, instead of relying on service creation to fail.
if (!newStreamService)

View File

@ -19,10 +19,32 @@ with this program. If not, see <https://www.gnu.org/licenses/>
#include "RequestHandler.h"
/**
* Gets an array of all available source filter kinds.
*
* Similar to `GetInputKindList`
*
* @responseField sourceFilterKinds | Array<String> | Array of source filter kinds
*
* @requestType GetSourceFilterKindList
* @complexity 2
* @rpcVersion -1
* @initialVersion 5.4.0
* @api requests
* @category filters
*/
RequestResult RequestHandler::GetSourceFilterKindList(const Request &)
{
json responseData;
responseData["sourceFilterKinds"] = Utils::Obs::ArrayHelper::GetFilterKindList();
return RequestResult::Success(responseData);
}
/**
* Gets an array of all of a source's filters.
*
* @requestField sourceName | String | Name of the source
* @requestField ?sourceName | String | Name of the source
* @requestField ?sourceUuid | String | UUID of the source
*
* @responseField filters | Array<Object> | Array of filters
*
@ -37,7 +59,7 @@ RequestResult RequestHandler::GetSourceFilterList(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
if (!source)
return RequestResult::Error(statusCode, comment);
@ -85,7 +107,8 @@ RequestResult RequestHandler::GetSourceFilterDefaultSettings(const Request &requ
/**
* Creates a new filter, adding it to the specified source.
*
* @requestField sourceName | String | Name of the source to add the filter to
* @requestField ?sourceName | String | Name of the source to add the filter to
* @requestField ?sourceUuid | String | UUID of the source to add the filter to
* @requestField filterName | String | Name of the new filter to be created
* @requestField filterKind | String | The kind of filter to be created
* @requestField ?filterSettings | Object | Settings object to initialize the filter with | Default settings used
@ -102,7 +125,7 @@ RequestResult RequestHandler::CreateSourceFilter(const Request &request)
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
if (!(source && request.ValidateString("filterName", statusCode, comment) &&
request.ValidateString("filterKind", statusCode, comment)))
return RequestResult::Error(statusCode, comment);
@ -138,7 +161,8 @@ RequestResult RequestHandler::CreateSourceFilter(const Request &request)
/**
* Removes a filter from a source.
*
* @requestField sourceName | String | Name of the source the filter is on
* @requestField ?sourceName | String | Name of the source the filter is on
* @requestField ?sourceUuid | String | UUID of the source the filter is on
* @requestField filterName | String | Name of the filter to remove
*
* @requestType RemoveSourceFilter
@ -152,7 +176,7 @@ RequestResult RequestHandler::RemoveSourceFilter(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
FilterPair pair = request.ValidateFilter(statusCode, comment);
if (!pair.filter)
return RequestResult::Error(statusCode, comment);
@ -164,7 +188,8 @@ RequestResult RequestHandler::RemoveSourceFilter(const Request &request)
/**
* Sets the name of a source filter (rename).
*
* @requestField sourceName | String | Name of the source the filter is on
* @requestField ?sourceName | String | Name of the source the filter is on
* @requestField ?sourceUuid | String | UUID of the source the filter is on
* @requestField filterName | String | Current name of the filter
* @requestField newFilterName | String | New name for the filter
*
@ -179,7 +204,7 @@ RequestResult RequestHandler::SetSourceFilterName(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
FilterPair pair = request.ValidateFilter(statusCode, comment);
if (!pair.filter || !request.ValidateString("newFilterName", statusCode, comment))
return RequestResult::Error(statusCode, comment);
@ -197,7 +222,8 @@ RequestResult RequestHandler::SetSourceFilterName(const Request &request)
/**
* Gets the info for a specific source filter.
*
* @requestField sourceName | String | Name of the source
* @requestField ?sourceName | String | Name of the source
* @requestField ?sourceUuid | String | UUID of the source
* @requestField filterName | String | Name of the filter
*
* @responseField filterEnabled | Boolean | Whether the filter is enabled
@ -216,7 +242,7 @@ RequestResult RequestHandler::GetSourceFilter(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
FilterPair pair = request.ValidateFilter(statusCode, comment);
if (!pair.filter)
return RequestResult::Error(statusCode, comment);
@ -236,7 +262,8 @@ RequestResult RequestHandler::GetSourceFilter(const Request &request)
/**
* Sets the index position of a filter on a source.
*
* @requestField sourceName | String | Name of the source the filter is on
* @requestField ?sourceName | String | Name of the source the filter is on
* @requestField ?sourceUuid | String | UUID of the source the filter is on
* @requestField filterName | String | Name of the filter
* @requestField filterIndex | Number | New index position of the filter | >= 0
*
@ -251,7 +278,7 @@ RequestResult RequestHandler::SetSourceFilterIndex(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
FilterPair pair = request.ValidateFilter(statusCode, comment);
if (!(pair.filter && request.ValidateNumber("filterIndex", statusCode, comment, 0, 8192)))
return RequestResult::Error(statusCode, comment);
@ -265,7 +292,8 @@ RequestResult RequestHandler::SetSourceFilterIndex(const Request &request)
/**
* Sets the settings of a source filter.
*
* @requestField sourceName | String | Name of the source the filter is on
* @requestField ?sourceName | String | Name of the source the filter is on
* @requestField ?sourceUuid | String | UUID of the source the filter is on
* @requestField filterName | String | Name of the filter to set the settings of
* @requestField filterSettings | Object | Object of settings to apply
* @requestField ?overlay | Boolean | True == apply the settings on top of existing ones, False == reset the input to its defaults, then apply settings. | true
@ -281,7 +309,7 @@ RequestResult RequestHandler::SetSourceFilterSettings(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
FilterPair pair = request.ValidateFilter(statusCode, comment);
if (!(pair.filter && request.ValidateObject("filterSettings", statusCode, comment, true)))
return RequestResult::Error(statusCode, comment);
@ -313,7 +341,8 @@ RequestResult RequestHandler::SetSourceFilterSettings(const Request &request)
/**
* Sets the enable state of a source filter.
*
* @requestField sourceName | String | Name of the source the filter is on
* @requestField ?sourceName | String | Name of the source the filter is on
* @requestField ?sourceUuid | String | UUID of the source the filter is on
* @requestField filterName | String | Name of the filter
* @requestField filterEnabled | Boolean | New enable state of the filter
*
@ -328,7 +357,7 @@ RequestResult RequestHandler::SetSourceFilterEnabled(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
FilterPair pair = request.ValidateFilter(statusCode, comment);
if (!(pair.filter && request.ValidateBoolean("filterEnabled", statusCode, comment)))
return RequestResult::Error(statusCode, comment);

View File

@ -211,12 +211,14 @@ RequestResult RequestHandler::CallVendorRequest(const Request &request)
}
/**
* Gets an array of all hotkey names in OBS
* Gets an array of all hotkey names in OBS.
*
* Note: Hotkey functionality in obs-websocket comes as-is, and we do not guarantee support if things are broken. In 9/10 usages of hotkey requests, there exists a better, more reliable method via other requests.
*
* @responseField hotkeys | Array<String> | Array of hotkey names
*
* @requestType GetHotkeyList
* @complexity 3
* @complexity 4
* @rpcVersion -1
* @initialVersion 5.0.0
* @category general
@ -230,12 +232,15 @@ RequestResult RequestHandler::GetHotkeyList(const Request &)
}
/**
* Triggers a hotkey using its name. See `GetHotkeyList`
* Triggers a hotkey using its name. See `GetHotkeyList`.
*
* Note: Hotkey functionality in obs-websocket comes as-is, and we do not guarantee support if things are broken. In 9/10 usages of hotkey requests, there exists a better, more reliable method via other requests.
*
* @requestField hotkeyName | String | Name of the hotkey to trigger
* @requestField ?contextName | String | Name of context of the hotkey to trigger
*
* @requestType TriggerHotkeyByName
* @complexity 3
* @complexity 4
* @rpcVersion -1
* @initialVersion 5.0.0
* @category general
@ -248,7 +253,15 @@ RequestResult RequestHandler::TriggerHotkeyByName(const Request &request)
if (!request.ValidateString("hotkeyName", statusCode, comment))
return RequestResult::Error(statusCode, comment);
obs_hotkey_t *hotkey = Utils::Obs::SearchHelper::GetHotkeyByName(request.RequestData["hotkeyName"]);
std::string contextName;
if (request.Contains("contextName")) {
if (!request.ValidateOptionalString("contextName", statusCode, comment))
return RequestResult::Error(statusCode, comment);
contextName = request.RequestData["contextName"];
}
obs_hotkey_t *hotkey = Utils::Obs::SearchHelper::GetHotkeyByName(request.RequestData["hotkeyName"], contextName);
if (!hotkey)
return RequestResult::Error(RequestStatus::ResourceNotFound, "No hotkeys were found by that name.");
@ -260,6 +273,8 @@ RequestResult RequestHandler::TriggerHotkeyByName(const Request &request)
/**
* Triggers a hotkey using a sequence of keys.
*
* Note: Hotkey functionality in obs-websocket comes as-is, and we do not guarantee support if things are broken. In 9/10 usages of hotkey requests, there exists a better, more reliable method via other requests.
*
* @requestField ?keyId | String | The OBS key ID to use. See https://github.com/obsproject/obs-studio/blob/master/libobs/obs-hotkeys.h | Not pressed
* @requestField ?keyModifiers | Object | Object containing key modifiers to apply | Ignored
* @requestField ?keyModifiers.shift | Boolean | Press Shift | Not pressed

View File

@ -123,12 +123,14 @@ RequestResult RequestHandler::GetSpecialInputs(const Request &)
/**
* Creates a new input, adding it as a scene item to the specified scene.
*
* @requestField sceneName | String | Name of the scene to add the input to as a scene item
* @requestField ?sceneName | String | Name of the scene to add the input to as a scene item
* @requestField ?sceneUuid | String | UUID of the scene to add the input to as a scene item
* @requestField inputName | String | Name of the new input to created
* @requestField inputKind | String | The kind of input to be created
* @requestField ?inputSettings | Object | Settings object to initialize the input with | Default settings used
* @requestField ?sceneItemEnabled | Boolean | Whether to set the created scene item to enabled or disabled | True
*
* @responseField inputUuid | String | UUID of the newly created input
* @responseField sceneItemId | Number | ID of the newly created scene item
*
* @requestType CreateInput
@ -142,7 +144,7 @@ RequestResult RequestHandler::CreateInput(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease sceneSource = request.ValidateScene("sceneName", statusCode, comment);
OBSSourceAutoRelease sceneSource = request.ValidateScene(statusCode, comment);
if (!(sceneSource && request.ValidateString("inputName", statusCode, comment) &&
request.ValidateString("inputKind", statusCode, comment)))
return RequestResult::Error(statusCode, comment);
@ -185,6 +187,7 @@ RequestResult RequestHandler::CreateInput(const Request &request)
return RequestResult::Error(RequestStatus::ResourceCreationFailed, "Creation of the input or scene item failed.");
json responseData;
responseData["inputUuid"] = obs_source_get_uuid(obs_sceneitem_get_source(sceneItem));
responseData["sceneItemId"] = obs_sceneitem_get_id(sceneItem);
return RequestResult::Success(responseData);
}
@ -194,7 +197,8 @@ RequestResult RequestHandler::CreateInput(const Request &request)
*
* Note: Will immediately remove all associated scene items.
*
* @requestField inputName | String | Name of the input to remove
* @requestField ?inputName | String | Name of the input to remove
* @requestField ?inputUuid | String | UUID of the input to remove
*
* @requestType RemoveInput
* @complexity 2
@ -207,7 +211,7 @@ RequestResult RequestHandler::RemoveInput(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!input)
return RequestResult::Error(statusCode, comment);
@ -222,7 +226,8 @@ RequestResult RequestHandler::RemoveInput(const Request &request)
/**
* Sets the name of an input (rename).
*
* @requestField inputName | String | Current input name
* @requestField ?inputName | String | Current input name
* @requestField ?inputUuid | String | Current input UUID
* @requestField newInputName | String | New name for the input
*
* @requestType SetInputName
@ -236,7 +241,7 @@ RequestResult RequestHandler::SetInputName(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!(input && request.ValidateString("newInputName", statusCode, comment)))
return RequestResult::Error(statusCode, comment);
@ -292,7 +297,8 @@ RequestResult RequestHandler::GetInputDefaultSettings(const Request &request)
*
* Note: Does not include defaults. To create the entire settings object, overlay `inputSettings` over the `defaultInputSettings` provided by `GetInputDefaultSettings`.
*
* @requestField inputName | String | Name of the input to get the settings of
* @requestField ?inputName | String | Name of the input to get the settings of
* @requestField ?inputUuid | String | UUID of the input to get the settings of
*
* @responseField inputSettings | Object | Object of settings for the input
* @responseField inputKind | String | The kind of the input
@ -308,7 +314,7 @@ RequestResult RequestHandler::GetInputSettings(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!input)
return RequestResult::Error(statusCode, comment);
@ -323,7 +329,8 @@ RequestResult RequestHandler::GetInputSettings(const Request &request)
/**
* Sets the settings of an input.
*
* @requestField inputName | String | Name of the input to set the settings of
* @requestField ?inputName | String | Name of the input to set the settings of
* @requestField ?inputUuid | String | UUID of the input to set the settings of
* @requestField inputSettings | Object | Object of settings to apply
* @requestField ?overlay | Boolean | True == apply the settings on top of existing ones, False == reset the input to its defaults, then apply settings. | true
*
@ -338,7 +345,7 @@ RequestResult RequestHandler::SetInputSettings(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!(input && request.ValidateObject("inputSettings", statusCode, comment, true)))
return RequestResult::Error(statusCode, comment);
@ -373,7 +380,8 @@ RequestResult RequestHandler::SetInputSettings(const Request &request)
/**
* Gets the audio mute state of an input.
*
* @requestField inputName | String | Name of input to get the mute state of
* @requestField ?inputName | String | Name of input to get the mute state of
* @requestField ?inputUuid | String | UUID of input to get the mute state of
*
* @responseField inputMuted | Boolean | Whether the input is muted
*
@ -388,7 +396,7 @@ RequestResult RequestHandler::GetInputMute(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!input)
return RequestResult::Error(statusCode, comment);
@ -403,7 +411,8 @@ RequestResult RequestHandler::GetInputMute(const Request &request)
/**
* Sets the audio mute state of an input.
*
* @requestField inputName | String | Name of the input to set the mute state of
* @requestField ?inputName | String | Name of the input to set the mute state of
* @requestField ?inputUuid | String | UUID of the input to set the mute state of
* @requestField inputMuted | Boolean | Whether to mute the input or not
*
* @requestType SetInputMute
@ -417,7 +426,7 @@ RequestResult RequestHandler::SetInputMute(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!(input && request.ValidateBoolean("inputMuted", statusCode, comment)))
return RequestResult::Error(statusCode, comment);
@ -432,7 +441,8 @@ RequestResult RequestHandler::SetInputMute(const Request &request)
/**
* Toggles the audio mute state of an input.
*
* @requestField inputName | String | Name of the input to toggle the mute state of
* @requestField ?inputName | String | Name of the input to toggle the mute state of
* @requestField ?inputUuid | String | UUID of the input to toggle the mute state of
*
* @responseField inputMuted | Boolean | Whether the input has been muted or unmuted
*
@ -447,7 +457,7 @@ RequestResult RequestHandler::ToggleInputMute(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!input)
return RequestResult::Error(statusCode, comment);
@ -465,7 +475,8 @@ RequestResult RequestHandler::ToggleInputMute(const Request &request)
/**
* Gets the current volume setting of an input.
*
* @requestField inputName | String | Name of the input to get the volume of
* @requestField ?inputName | String | Name of the input to get the volume of
* @requestField ?inputUuid | String | UUID of the input to get the volume of
*
* @responseField inputVolumeMul | Number | Volume setting in mul
* @responseField inputVolumeDb | Number | Volume setting in dB
@ -481,7 +492,7 @@ RequestResult RequestHandler::GetInputVolume(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!input)
return RequestResult::Error(statusCode, comment);
@ -502,7 +513,8 @@ RequestResult RequestHandler::GetInputVolume(const Request &request)
/**
* Sets the volume setting of an input.
*
* @requestField inputName | String | Name of the input to set the volume of
* @requestField ?inputName | String | Name of the input to set the volume of
* @requestField ?inputUuid | String | UUID of the input to set the volume of
* @requestField ?inputVolumeMul | Number | Volume setting in mul | >= 0, <= 20 | `inputVolumeDb` should be specified
* @requestField ?inputVolumeDb | Number | Volume setting in dB | >= -100, <= 26 | `inputVolumeMul` should be specified
*
@ -517,7 +529,7 @@ RequestResult RequestHandler::SetInputVolume(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!input)
return RequestResult::Error(statusCode, comment);
@ -552,7 +564,8 @@ RequestResult RequestHandler::SetInputVolume(const Request &request)
/**
* Gets the audio balance of an input.
*
* @requestField inputName | String | Name of the input to get the audio balance of
* @requestField ?inputName | String | Name of the input to get the audio balance of
* @requestField ?inputUuid | String | UUID of the input to get the audio balance of
*
* @responseField inputAudioBalance | Number | Audio balance value from 0.0-1.0
*
@ -567,7 +580,7 @@ RequestResult RequestHandler::GetInputAudioBalance(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!input)
return RequestResult::Error(statusCode, comment);
@ -583,7 +596,8 @@ RequestResult RequestHandler::GetInputAudioBalance(const Request &request)
/**
* Sets the audio balance of an input.
*
* @requestField inputName | String | Name of the input to set the audio balance of
* @requestField ?inputName | String | Name of the input to set the audio balance of
* @requestField ?inputUuid | String | UUID of the input to set the audio balance of
* @requestField inputAudioBalance | Number | New audio balance value | >= 0.0, <= 1.0
*
* @requestType SetInputAudioBalance
@ -597,7 +611,7 @@ RequestResult RequestHandler::SetInputAudioBalance(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!(input && request.ValidateNumber("inputAudioBalance", statusCode, comment, 0.0, 1.0)))
return RequestResult::Error(statusCode, comment);
@ -615,7 +629,8 @@ RequestResult RequestHandler::SetInputAudioBalance(const Request &request)
*
* Note: The audio sync offset can be negative too!
*
* @requestField inputName | String | Name of the input to get the audio sync offset of
* @requestField ?inputName | String | Name of the input to get the audio sync offset of
* @requestField ?inputUuid | String | UUID of the input to get the audio sync offset of
*
* @responseField inputAudioSyncOffset | Number | Audio sync offset in milliseconds
*
@ -630,7 +645,7 @@ RequestResult RequestHandler::GetInputAudioSyncOffset(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!input)
return RequestResult::Error(statusCode, comment);
@ -647,7 +662,8 @@ RequestResult RequestHandler::GetInputAudioSyncOffset(const Request &request)
/**
* Sets the audio sync offset of an input.
*
* @requestField inputName | String | Name of the input to set the audio sync offset of
* @requestField ?inputName | String | Name of the input to set the audio sync offset of
* @requestField ?inputUuid | String | UUID of the input to set the audio sync offset of
* @requestField inputAudioSyncOffset | Number | New audio sync offset in milliseconds | >= -950, <= 20000
*
* @requestType SetInputAudioSyncOffset
@ -661,7 +677,7 @@ RequestResult RequestHandler::SetInputAudioSyncOffset(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!(input && request.ValidateNumber("inputAudioSyncOffset", statusCode, comment, -950, 20000)))
return RequestResult::Error(statusCode, comment);
@ -683,7 +699,8 @@ RequestResult RequestHandler::SetInputAudioSyncOffset(const Request &request)
* - `OBS_MONITORING_TYPE_MONITOR_ONLY`
* - `OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT`
*
* @requestField inputName | String | Name of the input to get the audio monitor type of
* @requestField ?inputName | String | Name of the input to get the audio monitor type of
* @requestField ?inputUuid | String | UUID of the input to get the audio monitor type of
*
* @responseField monitorType | String | Audio monitor type
*
@ -698,7 +715,7 @@ RequestResult RequestHandler::GetInputAudioMonitorType(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!input)
return RequestResult::Error(statusCode, comment);
@ -714,7 +731,8 @@ RequestResult RequestHandler::GetInputAudioMonitorType(const Request &request)
/**
* Sets the audio monitor type of an input.
*
* @requestField inputName | String | Name of the input to set the audio monitor type of
* @requestField ?inputName | String | Name of the input to set the audio monitor type of
* @requestField ?inputUuid | String | UUID of the input to set the audio monitor type of
* @requestField monitorType | String | Audio monitor type
*
* @requestType SetInputAudioMonitorType
@ -728,7 +746,7 @@ RequestResult RequestHandler::SetInputAudioMonitorType(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!(input && request.ValidateString("monitorType", statusCode, comment)))
return RequestResult::Error(statusCode, comment);
@ -759,7 +777,8 @@ RequestResult RequestHandler::SetInputAudioMonitorType(const Request &request)
/**
* Gets the enable state of all audio tracks of an input.
*
* @requestField inputName | String | Name of the input
* @requestField ?inputName | String | Name of the input
* @requestField ?inputUuid | String | UUID of the input
*
* @responseField inputAudioTracks | Object | Object of audio tracks and associated enable states
*
@ -774,7 +793,7 @@ RequestResult RequestHandler::GetInputAudioTracks(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!input)
return RequestResult::Error(statusCode, comment);
@ -797,7 +816,8 @@ RequestResult RequestHandler::GetInputAudioTracks(const Request &request)
/**
* Sets the enable state of audio tracks of an input.
*
* @requestField inputName | String | Name of the input
* @requestField ?inputName | String | Name of the input
* @requestField ?inputUuid | String | UUID of the input
* @requestField inputAudioTracks | Object | Track settings to apply
*
* @requestType SetInputAudioTracks
@ -811,7 +831,7 @@ RequestResult RequestHandler::SetInputAudioTracks(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!input || !request.ValidateObject("inputAudioTracks", statusCode, comment))
return RequestResult::Error(statusCode, comment);
@ -851,7 +871,8 @@ RequestResult RequestHandler::SetInputAudioTracks(const Request &request)
*
* Note: Use this in cases where an input provides a dynamic, selectable list of items. For example, display capture, where it provides a list of available displays.
*
* @requestField inputName | String | Name of the input
* @requestField ?inputName | String | Name of the input
* @requestField ?inputUuid | String | UUID of the input
* @requestField propertyName | String | Name of the list property to get the items of
*
* @responseField propertyItems | Array<Object> | Array of items in the list property
@ -867,7 +888,7 @@ RequestResult RequestHandler::GetInputPropertiesListPropertyItems(const Request
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!(input && request.ValidateString("propertyName", statusCode, comment)))
return RequestResult::Error(statusCode, comment);
@ -895,7 +916,8 @@ RequestResult RequestHandler::GetInputPropertiesListPropertyItems(const Request
*
* Note: Use this in cases where there is a button in the properties of an input that cannot be accessed in any other way. For example, browser sources, where there is a refresh button.
*
* @requestField inputName | String | Name of the input
* @requestField ?inputName | String | Name of the input
* @requestField ?inputUuid | String | UUID of the input
* @requestField propertyName | String | Name of the button property to press
*
* @requestType PressInputPropertiesButton
@ -909,7 +931,7 @@ RequestResult RequestHandler::PressInputPropertiesButton(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!(input && request.ValidateString("propertyName", statusCode, comment)))
return RequestResult::Error(statusCode, comment);

View File

@ -39,7 +39,8 @@ bool IsMediaTimeValid(obs_source_t *input)
* - `OBS_MEDIA_STATE_ENDED`
* - `OBS_MEDIA_STATE_ERROR`
*
* @requestField inputName | String | Name of the media input
* @requestField ?inputName | String | Name of the media input
* @requestField ?inputUuid | String | UUID of the media input
*
* @responseField mediaState | String | State of the media input
* @responseField mediaDuration | Number | Total duration of the playing media in milliseconds. `null` if not playing
@ -56,7 +57,7 @@ RequestResult RequestHandler::GetMediaInputStatus(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!input)
return RequestResult::Error(statusCode, comment);
@ -80,7 +81,8 @@ RequestResult RequestHandler::GetMediaInputStatus(const Request &request)
*
* This request does not perform bounds checking of the cursor position.
*
* @requestField inputName | String | Name of the media input
* @requestField ?inputName | String | Name of the media input
* @requestField ?inputUuid | String | UUID of the media input
* @requestField mediaCursor | Number | New cursor position to set | >= 0
*
* @requestType SetMediaInputCursor
@ -94,7 +96,7 @@ RequestResult RequestHandler::SetMediaInputCursor(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!(input && request.ValidateNumber("mediaCursor", statusCode, comment, 0)))
return RequestResult::Error(statusCode, comment);
@ -115,7 +117,8 @@ RequestResult RequestHandler::SetMediaInputCursor(const Request &request)
*
* This request does not perform bounds checking of the cursor position.
*
* @requestField inputName | String | Name of the media input
* @requestField ?inputName | String | Name of the media input
* @requestField ?inputUuid | String | UUID of the media input
* @requestField mediaCursorOffset | Number | Value to offset the current cursor position by | None
*
* @requestType OffsetMediaInputCursor
@ -129,7 +132,7 @@ RequestResult RequestHandler::OffsetMediaInputCursor(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!(input && request.ValidateNumber("mediaCursorOffset", statusCode, comment)))
return RequestResult::Error(statusCode, comment);
@ -151,7 +154,8 @@ RequestResult RequestHandler::OffsetMediaInputCursor(const Request &request)
/**
* Triggers an action on a media input.
*
* @requestField inputName | String | Name of the media input
* @requestField ?inputName | String | Name of the media input
* @requestField ?inputUuid | String | UUID of the media input
* @requestField mediaAction | String | Identifier of the `ObsMediaInputAction` enum
*
* @requestType TriggerMediaInputAction
@ -165,7 +169,7 @@ RequestResult RequestHandler::TriggerMediaInputAction(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!(input && request.ValidateString("mediaAction", statusCode, comment)))
return RequestResult::Error(statusCode, comment);

View File

@ -54,6 +54,8 @@ RequestResult RequestHandler::GetRecordStatus(const Request &)
/**
* Toggles the status of the record output.
*
* @responseField outputActive | Boolean | The new active state of the output
*
* @requestType ToggleRecord
* @complexity 1
* @rpcVersion -1

View File

@ -24,7 +24,8 @@ with this program. If not, see <https://www.gnu.org/licenses/>
*
* Scenes only
*
* @requestField sceneName | String | Name of the scene to get the items of
* @requestField ?sceneName | String | Name of the scene to get the items of
* @requestField ?sceneUuid | String | UUID of the scene to get the items of
*
* @responseField sceneItems | Array<Object> | Array of scene items in the scene
*
@ -39,7 +40,7 @@ RequestResult RequestHandler::GetSceneItemList(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease scene = request.ValidateScene("sceneName", statusCode, comment);
OBSSourceAutoRelease scene = request.ValidateScene(statusCode, comment);
if (!scene)
return RequestResult::Error(statusCode, comment);
@ -56,7 +57,8 @@ RequestResult RequestHandler::GetSceneItemList(const Request &request)
*
* Groups only
*
* @requestField sceneName | String | Name of the group to get the items of
* @requestField ?sceneName | String | Name of the group to get the items of
* @requestField ?sceneUuid | String | UUID of the group to get the items of
*
* @responseField sceneItems | Array<Object> | Array of scene items in the group
*
@ -71,7 +73,7 @@ RequestResult RequestHandler::GetGroupSceneItemList(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease scene = request.ValidateScene("sceneName", statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_GROUP_ONLY);
OBSSourceAutoRelease scene = request.ValidateScene(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_GROUP_ONLY);
if (!scene)
return RequestResult::Error(statusCode, comment);
@ -86,7 +88,8 @@ RequestResult RequestHandler::GetGroupSceneItemList(const Request &request)
*
* Scenes and Groups
*
* @requestField sceneName | String | Name of the scene or group to search in
* @requestField ?sceneName | String | Name of the scene or group to search in
* @requestField ?sceneUuid | String | UUID of the scene or group to search in
* @requestField sourceName | String | Name of the source to find
* @requestField ?searchOffset | Number | Number of matches to skip during search. >= 0 means first forward. -1 means last (top) item | >= -1 | 0
*
@ -104,8 +107,8 @@ RequestResult RequestHandler::GetSceneItemId(const Request &request)
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSceneAutoRelease scene =
request.ValidateScene2("sceneName", statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
if (!(scene && request.ValidateString("sourceName", statusCode, comment)))
request.ValidateScene2(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
if (!(scene && request.ValidateString("sourceName", statusCode, comment))) // TODO: Source UUID support
return RequestResult::Error(statusCode, comment);
std::string sourceName = request.RequestData["sourceName"];
@ -128,13 +131,49 @@ RequestResult RequestHandler::GetSceneItemId(const Request &request)
return RequestResult::Success(responseData);
}
/**
* Gets the source associated with a scene item.
*
* @requestField ?sceneName | String | Name of the scene the item is in
* @requestField ?sceneUuid | String | UUID of the scene the item is in
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
*
* @responseField sourceName | String | Name of the source associated with the scene item
* @responseField sourceUuid | String | UUID of the source associated with the scene item
*
* @requestType GetSceneItemSource
* @complexity 3
* @rpcVersion -1
* @initialVersion 5.4.0
* @api requests
* @category scene items
*/
RequestResult RequestHandler::GetSceneItemSource(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment);
if (!sceneItem)
return RequestResult::Error(statusCode, comment);
OBSSource source = obs_sceneitem_get_source(sceneItem);
json responseData;
responseData["sourceName"] = obs_source_get_name(source);
responseData["sourceUuid"] = obs_source_get_uuid(source);
return RequestResult::Success(responseData);
}
/**
* Creates a new scene item using a source.
*
* Scenes only
*
* @requestField sceneName | String | Name of the scene to create the new item in
* @requestField sourceName | String | Name of the source to add to the scene
* @requestField ?sceneName | String | Name of the scene to create the new item in
* @requestField ?sceneUuid | String | UUID of the scene to create the new item in
* @requestField ?sourceName | String | Name of the source to add to the scene
* @requestField ?sourceUuid | String | UUID of the source to add to the scene
* @requestField ?sceneItemEnabled | Boolean | Enable state to apply to the scene item on creation | True
*
* @responseField sceneItemId | Number | Numeric ID of the scene item
@ -150,17 +189,17 @@ RequestResult RequestHandler::CreateSceneItem(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease sceneSource = request.ValidateScene("sceneName", statusCode, comment);
OBSSourceAutoRelease sceneSource = request.ValidateScene(statusCode, comment);
if (!sceneSource)
return RequestResult::Error(statusCode, comment);
OBSScene scene = obs_scene_from_source(sceneSource);
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
if (!source)
return RequestResult::Error(statusCode, comment);
if (request.RequestData["sceneName"] == request.RequestData["sourceName"])
if (sceneSource == source)
return RequestResult::Error(RequestStatus::CannotAct, "You cannot create scene item of a scene within itself.");
bool sceneItemEnabled = true;
@ -185,7 +224,8 @@ RequestResult RequestHandler::CreateSceneItem(const Request &request)
*
* Scenes only
*
* @requestField sceneName | String | Name of the scene the item is in
* @requestField ?sceneName | String | Name of the scene the item is in
* @requestField ?sceneUuid | String | UUID of the scene the item is in
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
*
* @requestType RemoveSceneItem
@ -199,7 +239,7 @@ RequestResult RequestHandler::RemoveSceneItem(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment);
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment);
if (!sceneItem)
return RequestResult::Error(statusCode, comment);
@ -214,9 +254,11 @@ RequestResult RequestHandler::RemoveSceneItem(const Request &request)
*
* Scenes only
*
* @requestField sceneName | String | Name of the scene the item is in
* @requestField ?sceneName | String | Name of the scene the item is in
* @requestField ?sceneUuid | String | UUID of the scene the item is in
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
* @requestField ?destinationSceneName | String | Name of the scene to create the duplicated item in | `sceneName` is assumed
* @requestField ?destinationSceneName | String | Name of the scene to create the duplicated item in | From scene is assumed
* @requestField ?destinationSceneUuid | String | UUID of the scene to create the duplicated item in | From scene is assumed
*
* @responseField sceneItemId | Number | Numeric ID of the duplicated scene item
*
@ -231,16 +273,24 @@ RequestResult RequestHandler::DuplicateSceneItem(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment);
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment);
if (!sceneItem)
return RequestResult::Error(statusCode, comment);
// Get destination scene
obs_scene_t *destinationScene;
if (request.Contains("destinationSceneName")) {
destinationScene = request.ValidateScene2("destinationSceneName", statusCode, comment);
if (!destinationScene)
OBSSourceAutoRelease destinationSceneSource = request.ValidateSource("destinationSceneName", "destinationSceneUuid", statusCode, comment);
if (!destinationSceneSource)
return RequestResult::Error(statusCode, comment);
// Reimplementation of ValidateScene2
if (obs_source_get_type(destinationSceneSource) != OBS_SOURCE_TYPE_SCENE)
return RequestResult::Error(RequestStatus::InvalidResourceType, "The specified source is not a scene.");
if (obs_source_is_group(destinationSceneSource))
return RequestResult::Error(RequestStatus::InvalidResourceType, "The specified source is not a scene. (Is group)");
destinationScene = obs_scene_get_ref(obs_scene_from_source(destinationSceneSource));
} else {
destinationScene = obs_scene_get_ref(obs_sceneitem_get_scene(sceneItem));
if (!destinationScene)
@ -279,7 +329,8 @@ RequestResult RequestHandler::DuplicateSceneItem(const Request &request)
*
* Scenes and Groups
*
* @requestField sceneName | String | Name of the scene the item is in
* @requestField ?sceneName | String | Name of the scene the item is in
* @requestField ?sceneUuid | String | UUID of the scene the item is in
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
*
* @responseField sceneItemTransform | Object | Object containing scene item transform info
@ -295,8 +346,7 @@ RequestResult RequestHandler::GetSceneItemTransform(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
if (!sceneItem)
return RequestResult::Error(statusCode, comment);
@ -309,7 +359,8 @@ RequestResult RequestHandler::GetSceneItemTransform(const Request &request)
/**
* Sets the transform and crop info of a scene item.
*
* @requestField sceneName | String | Name of the scene the item is in
* @requestField ?sceneName | String | Name of the scene the item is in
* @requestField ?sceneUuid | String | UUID of the scene the item is in
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
* @requestField sceneItemTransform | Object | Object containing scene item transform info to update
*
@ -324,8 +375,7 @@ RequestResult RequestHandler::SetSceneItemTransform(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
if (!(sceneItem && request.ValidateObject("sceneItemTransform", statusCode, comment)))
return RequestResult::Error(statusCode, comment);
@ -466,7 +516,8 @@ RequestResult RequestHandler::SetSceneItemTransform(const Request &request)
*
* Scenes and Groups
*
* @requestField sceneName | String | Name of the scene the item is in
* @requestField ?sceneName | String | Name of the scene the item is in
* @requestField ?sceneUuid | String | UUID of the scene the item is in
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
*
* @responseField sceneItemEnabled | Boolean | Whether the scene item is enabled. `true` for enabled, `false` for disabled
@ -482,8 +533,7 @@ RequestResult RequestHandler::GetSceneItemEnabled(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
if (!sceneItem)
return RequestResult::Error(statusCode, comment);
@ -498,7 +548,8 @@ RequestResult RequestHandler::GetSceneItemEnabled(const Request &request)
*
* Scenes and Groups
*
* @requestField sceneName | String | Name of the scene the item is in
* @requestField ?sceneName | String | Name of the scene the item is in
* @requestField ?sceneUuid | String | UUID of the scene the item is in
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
* @requestField sceneItemEnabled | Boolean | New enable state of the scene item
*
@ -513,8 +564,7 @@ RequestResult RequestHandler::SetSceneItemEnabled(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
if (!(sceneItem && request.ValidateBoolean("sceneItemEnabled", statusCode, comment)))
return RequestResult::Error(statusCode, comment);
@ -530,7 +580,8 @@ RequestResult RequestHandler::SetSceneItemEnabled(const Request &request)
*
* Scenes and Groups
*
* @requestField sceneName | String | Name of the scene the item is in
* @requestField ?sceneName | String | Name of the scene the item is in
* @requestField ?sceneUuid | String | UUID of the scene the item is in
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
*
* @responseField sceneItemLocked | Boolean | Whether the scene item is locked. `true` for locked, `false` for unlocked
@ -546,8 +597,7 @@ RequestResult RequestHandler::GetSceneItemLocked(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
if (!sceneItem)
return RequestResult::Error(statusCode, comment);
@ -562,7 +612,8 @@ RequestResult RequestHandler::GetSceneItemLocked(const Request &request)
*
* Scenes and Group
*
* @requestField sceneName | String | Name of the scene the item is in
* @requestField ?sceneName | String | Name of the scene the item is in
* @requestField ?sceneUuid | String | UUID of the scene the item is in
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
* @requestField sceneItemLocked | Boolean | New lock state of the scene item
*
@ -577,8 +628,7 @@ RequestResult RequestHandler::SetSceneItemLocked(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
if (!(sceneItem && request.ValidateBoolean("sceneItemLocked", statusCode, comment)))
return RequestResult::Error(statusCode, comment);
@ -596,7 +646,8 @@ RequestResult RequestHandler::SetSceneItemLocked(const Request &request)
*
* Scenes and Groups
*
* @requestField sceneName | String | Name of the scene the item is in
* @requestField ?sceneName | String | Name of the scene the item is in
* @requestField ?sceneUuid | String | UUID of the scene the item is in
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
*
* @responseField sceneItemIndex | Number | Index position of the scene item
@ -612,8 +663,7 @@ RequestResult RequestHandler::GetSceneItemIndex(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
if (!sceneItem)
return RequestResult::Error(statusCode, comment);
@ -628,7 +678,8 @@ RequestResult RequestHandler::GetSceneItemIndex(const Request &request)
*
* Scenes and Groups
*
* @requestField sceneName | String | Name of the scene the item is in
* @requestField ?sceneName | String | Name of the scene the item is in
* @requestField ?sceneUuid | String | UUID of the scene the item is in
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
* @requestField sceneItemIndex | Number | New index position of the scene item | >= 0
*
@ -643,8 +694,7 @@ RequestResult RequestHandler::SetSceneItemIndex(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
if (!(sceneItem && request.ValidateNumber("sceneItemIndex", statusCode, comment, 0, 8192)))
return RequestResult::Error(statusCode, comment);
@ -670,7 +720,8 @@ RequestResult RequestHandler::SetSceneItemIndex(const Request &request)
*
* Scenes and Groups
*
* @requestField sceneName | String | Name of the scene the item is in
* @requestField ?sceneName | String | Name of the scene the item is in
* @requestField ?sceneUuid | String | UUID of the scene the item is in
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
*
* @responseField sceneItemBlendMode | String | Current blend mode
@ -686,8 +737,7 @@ RequestResult RequestHandler::GetSceneItemBlendMode(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
if (!sceneItem)
return RequestResult::Error(statusCode, comment);
@ -704,7 +754,8 @@ RequestResult RequestHandler::GetSceneItemBlendMode(const Request &request)
*
* Scenes and Groups
*
* @requestField sceneName | String | Name of the scene the item is in
* @requestField ?sceneName | String | Name of the scene the item is in
* @requestField ?sceneUuid | String | UUID of the scene the item is in
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
* @requestField sceneItemBlendMode | String | New blend mode
*
@ -719,8 +770,7 @@ RequestResult RequestHandler::SetSceneItemBlendMode(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
if (!(sceneItem && request.ValidateString("sceneItemBlendMode", statusCode, comment)))
return RequestResult::Error(statusCode, comment);
@ -739,8 +789,7 @@ RequestResult RequestHandler::GetSceneItemPrivateSettings(const Request &request
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
if (!sceneItem)
return RequestResult::Error(statusCode, comment);
@ -757,8 +806,7 @@ RequestResult RequestHandler::SetSceneItemPrivateSettings(const Request &request
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
if (!sceneItem || !request.ValidateObject("sceneItemSettings", statusCode, comment, true))
return RequestResult::Error(statusCode, comment);

View File

@ -22,8 +22,10 @@ with this program. If not, see <https://www.gnu.org/licenses/>
/**
* Gets an array of all scenes in OBS.
*
* @responseField currentProgramSceneName | String | Current program scene
* @responseField currentPreviewSceneName | String | Current preview scene. `null` if not in studio mode
* @responseField currentProgramSceneName | String | Current program scene name. Can be `null` if internal state desync
* @responseField currentProgramSceneUuid | String | Current program scene UUID. Can be `null` if internal state desync
* @responseField currentPreviewSceneName | String | Current preview scene name. `null` if not in studio mode
* @responseField currentPreviewSceneUuid | String | Current preview scene UUID. `null` if not in studio mode
* @responseField scenes | Array<Object> | Array of scenes
*
* @requestType GetSceneList
@ -38,16 +40,22 @@ RequestResult RequestHandler::GetSceneList(const Request &)
json responseData;
OBSSourceAutoRelease currentProgramScene = obs_frontend_get_current_scene();
if (currentProgramScene)
if (currentProgramScene) {
responseData["currentProgramSceneName"] = obs_source_get_name(currentProgramScene);
else
responseData["currentProgramSceneUuid"] = obs_source_get_uuid(currentProgramScene);
} else {
responseData["currentProgramSceneName"] = nullptr;
responseData["currentProgramSceneUuid"] = nullptr;
}
OBSSourceAutoRelease currentPreviewScene = obs_frontend_get_current_preview_scene();
if (currentPreviewScene)
if (currentPreviewScene) {
responseData["currentPreviewSceneName"] = obs_source_get_name(currentPreviewScene);
else
responseData["currentPreviewSceneUuid"] = obs_source_get_uuid(currentPreviewScene);
} else {
responseData["currentPreviewSceneName"] = nullptr;
responseData["currentPreviewSceneUuid"] = nullptr;
}
responseData["scenes"] = Utils::Obs::ArrayHelper::GetSceneList();
@ -80,7 +88,12 @@ RequestResult RequestHandler::GetGroupList(const Request &)
/**
* Gets the current program scene.
*
* @responseField currentProgramSceneName | String | Current program scene
* Note: This request is slated to have the `currentProgram`-prefixed fields removed from in an upcoming RPC version.
*
* @responseField sceneName | String | Current program scene name
* @responseField sceneUuid | String | Current program scene UUID
* @responseField currentProgramSceneName | String | Current program scene name (Deprecated)
* @responseField currentProgramSceneUuid | String | Current program scene UUID (Deprecated)
*
* @requestType GetCurrentProgramScene
* @complexity 1
@ -93,7 +106,8 @@ RequestResult RequestHandler::GetCurrentProgramScene(const Request &)
{
json responseData;
OBSSourceAutoRelease currentProgramScene = obs_frontend_get_current_scene();
responseData["currentProgramSceneName"] = obs_source_get_name(currentProgramScene);
responseData["sceneName"] = responseData["currentProgramSceneName"] = obs_source_get_name(currentProgramScene);
responseData["sceneUuid"] = responseData["currentProgramSceneUuid"] = obs_source_get_uuid(currentProgramScene);
return RequestResult::Success(responseData);
}
@ -101,7 +115,8 @@ RequestResult RequestHandler::GetCurrentProgramScene(const Request &)
/**
* Sets the current program scene.
*
* @requestField sceneName | String | Scene to set as the current program scene
* @requestField ?sceneName | String | Scene name to set as the current program scene
* @requestField ?sceneUuid | String | Scene UUID to set as the current program scene
*
* @requestType SetCurrentProgramScene
* @complexity 1
@ -114,7 +129,7 @@ RequestResult RequestHandler::SetCurrentProgramScene(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease scene = request.ValidateScene("sceneName", statusCode, comment);
OBSSourceAutoRelease scene = request.ValidateScene(statusCode, comment);
if (!scene)
return RequestResult::Error(statusCode, comment);
@ -128,7 +143,12 @@ RequestResult RequestHandler::SetCurrentProgramScene(const Request &request)
*
* Only available when studio mode is enabled.
*
* @responseField currentPreviewSceneName | String | Current preview scene
* Note: This request is slated to have the `currentPreview`-prefixed fields removed from in an upcoming RPC version.
*
* @responseField sceneName | String | Current preview scene name
* @responseField sceneUuid | String | Current preview scene UUID
* @responseField currentPreviewSceneName | String | Current preview scene name
* @responseField currentPreviewSceneUuid | String | Current preview scene UUID
*
* @requestType GetCurrentPreviewScene
* @complexity 1
@ -145,7 +165,8 @@ RequestResult RequestHandler::GetCurrentPreviewScene(const Request &)
OBSSourceAutoRelease currentPreviewScene = obs_frontend_get_current_preview_scene();
json responseData;
responseData["currentPreviewSceneName"] = obs_source_get_name(currentPreviewScene);
responseData["sceneName"] = responseData["currentPreviewSceneName"] = obs_source_get_name(currentPreviewScene);
responseData["sceneUuid"] = responseData["currentPreviewSceneUuid"] = obs_source_get_uuid(currentPreviewScene);
return RequestResult::Success(responseData);
}
@ -155,7 +176,8 @@ RequestResult RequestHandler::GetCurrentPreviewScene(const Request &)
*
* Only available when studio mode is enabled.
*
* @requestField sceneName | String | Scene to set as the current preview scene
* @requestField ?sceneName | String | Scene name to set as the current preview scene
* @requestField ?sceneUuid | String | Scene UUID to set as the current preview scene
*
* @requestType SetCurrentPreviewScene
* @complexity 1
@ -171,7 +193,7 @@ RequestResult RequestHandler::SetCurrentPreviewScene(const Request &request)
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease scene = request.ValidateScene("sceneName", statusCode, comment);
OBSSourceAutoRelease scene = request.ValidateScene(statusCode, comment);
if (!scene)
return RequestResult::Error(statusCode, comment);
@ -185,6 +207,8 @@ RequestResult RequestHandler::SetCurrentPreviewScene(const Request &request)
*
* @requestField sceneName | String | Name for the new scene
*
* @responseField sceneUuid | String | UUID of the created scene
*
* @requestType CreateScene
* @complexity 2
* @rpcVersion -1
@ -205,19 +229,21 @@ RequestResult RequestHandler::CreateScene(const Request &request)
if (scene)
return RequestResult::Error(RequestStatus::ResourceAlreadyExists, "A source already exists by that scene name.");
obs_scene_t *createdScene = obs_scene_create(sceneName.c_str());
OBSSceneAutoRelease createdScene = obs_scene_create(sceneName.c_str());
if (!createdScene)
return RequestResult::Error(RequestStatus::ResourceCreationFailed, "Failed to create the scene.");
obs_scene_release(createdScene);
json responseData;
responseData["sceneUuid"] = obs_source_get_uuid(obs_scene_get_source(createdScene));
return RequestResult::Success();
return RequestResult::Success(responseData);
}
/**
* Removes a scene from OBS.
*
* @requestField sceneName | String | Name of the scene to remove
* @requestField ?sceneName | String | Name of the scene to remove
* @requestField ?sceneUuid | String | UUID of the scene to remove
*
* @requestType RemoveScene
* @complexity 2
@ -230,7 +256,7 @@ RequestResult RequestHandler::RemoveScene(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease scene = request.ValidateScene("sceneName", statusCode, comment);
OBSSourceAutoRelease scene = request.ValidateScene(statusCode, comment);
if (!scene)
return RequestResult::Error(statusCode, comment);
@ -246,7 +272,8 @@ RequestResult RequestHandler::RemoveScene(const Request &request)
/**
* Sets the name of a scene (rename).
*
* @requestField sceneName | String | Name of the scene to be renamed
* @requestField ?sceneName | String | Name of the scene to be renamed
* @requestField ?sceneUuid | String | UUID of the scene to be renamed
* @requestField newSceneName | String | New name for the scene
*
* @requestType SetSceneName
@ -260,7 +287,7 @@ RequestResult RequestHandler::SetSceneName(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease scene = request.ValidateScene("sceneName", statusCode, comment);
OBSSourceAutoRelease scene = request.ValidateScene(statusCode, comment);
if (!(scene && request.ValidateString("newSceneName", statusCode, comment)))
return RequestResult::Error(statusCode, comment);
@ -279,7 +306,10 @@ RequestResult RequestHandler::SetSceneName(const Request &request)
/**
* Gets the scene transition overridden for a scene.
*
* @requestField sceneName | String | Name of the scene
* Note: A transition UUID response field is not currently able to be implemented as of 2024-1-18.
*
* @requestField ?sceneName | String | Name of the scene
* @requestField ?sceneUuid | String | UUID of the scene
*
* @responseField transitionName | String | Name of the overridden scene transition, else `null`
* @responseField transitionDuration | Number | Duration of the overridden scene transition, else `null`
@ -295,7 +325,7 @@ RequestResult RequestHandler::GetSceneSceneTransitionOverride(const Request &req
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease scene = request.ValidateScene("sceneName", statusCode, comment);
OBSSourceAutoRelease scene = request.ValidateScene(statusCode, comment);
if (!scene)
return RequestResult::Error(statusCode, comment);
@ -319,7 +349,8 @@ RequestResult RequestHandler::GetSceneSceneTransitionOverride(const Request &req
/**
* Sets the scene transition overridden for a scene.
*
* @requestField sceneName | String | Name of the scene
* @requestField ?sceneName | String | Name of the scene
* @requestField ?sceneUuid | String | UUID of the scene
* @requestField ?transitionName | String | Name of the scene transition to use as override. Specify `null` to remove | Unchanged
* @requestField ?transitionDuration | Number | Duration to use for any overridden transition. Specify `null` to remove | >= 50, <= 20000 | Unchanged
*
@ -334,7 +365,7 @@ RequestResult RequestHandler::SetSceneSceneTransitionOverride(const Request &req
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease scene = request.ValidateScene("sceneName", statusCode, comment);
OBSSourceAutoRelease scene = request.ValidateScene(statusCode, comment);
if (!scene)
return RequestResult::Error(statusCode, comment);

View File

@ -114,7 +114,8 @@ bool IsImageFormatValid(std::string format)
*
* **Compatible with inputs and scenes.**
*
* @requestField sourceName | String | Name of the source to get the active state of
* @requestField ?sourceName | String | Name of the source to get the active state of
* @requestField ?sourceUuid | String | UUID of the source to get the active state of
*
* @responseField videoActive | Boolean | Whether the source is showing in Program
* @responseField videoShowing | Boolean | Whether the source is showing in the UI (Preview, Projector, Properties)
@ -130,7 +131,7 @@ RequestResult RequestHandler::GetSourceActive(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
if (!source)
return RequestResult::Error(statusCode, comment);
@ -151,7 +152,8 @@ RequestResult RequestHandler::GetSourceActive(const Request &request)
*
* **Compatible with inputs and scenes.**
*
* @requestField sourceName | String | Name of the source to take a screenshot of
* @requestField ?sourceName | String | Name of the source to take a screenshot of
* @requestField ?sourceUuid | String | UUID of the source to take a screenshot of
* @requestField imageFormat | String | Image compression format to use. Use `GetVersion` to get compatible image formats
* @requestField ?imageWidth | Number | Width to scale the screenshot to | >= 8, <= 4096 | Source value is used
* @requestField ?imageHeight | Number | Height to scale the screenshot to | >= 8, <= 4096 | Source value is used
@ -170,7 +172,7 @@ RequestResult RequestHandler::GetSourceScreenshot(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
if (!(source && request.ValidateString("imageFormat", statusCode, comment)))
return RequestResult::Error(statusCode, comment);
@ -238,15 +240,14 @@ RequestResult RequestHandler::GetSourceScreenshot(const Request &request)
*
* **Compatible with inputs and scenes.**
*
* @requestField sourceName | String | Name of the source to take a screenshot of
* @requestField ?sourceName | String | Name of the source to take a screenshot of
* @requestField ?sourceUuid | String | UUID of the source to take a screenshot of
* @requestField imageFormat | String | Image compression format to use. Use `GetVersion` to get compatible image formats
* @requestField imageFilePath | String | Path to save the screenshot file to. Eg. `C:\Users\user\Desktop\screenshot.png`
* @requestField ?imageWidth | Number | Width to scale the screenshot to | >= 8, <= 4096 | Source value is used
* @requestField ?imageHeight | Number | Height to scale the screenshot to | >= 8, <= 4096 | Source value is used
* @requestField ?imageCompressionQuality | Number | Compression quality to use. 0 for high compression, 100 for uncompressed. -1 to use "default" (whatever that means, idk) | >= -1, <= 100 | -1
*
* @responseField imageData | String | Base64-encoded screenshot
*
* @requestType SaveSourceScreenshot
* @complexity 3
* @rpcVersion -1
@ -258,7 +259,7 @@ RequestResult RequestHandler::SaveSourceScreenshot(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
if (!(source && request.ValidateString("imageFormat", statusCode, comment) &&
request.ValidateString("imageFilePath", statusCode, comment)))
return RequestResult::Error(statusCode, comment);
@ -321,7 +322,7 @@ RequestResult RequestHandler::GetSourcePrivateSettings(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
if (!source)
return RequestResult::Error(statusCode, comment);
@ -338,7 +339,7 @@ RequestResult RequestHandler::SetSourcePrivateSettings(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
if (!source || !request.ValidateObject("sourceSettings", statusCode, comment, true))
return RequestResult::Error(statusCode, comment);

View File

@ -44,12 +44,16 @@ RequestResult RequestHandler::GetStreamStatus(const Request &)
uint64_t outputDuration = Utils::Obs::NumberHelper::GetOutputDuration(streamOutput);
float outputCongestion = obs_output_get_congestion(streamOutput);
if (std::isnan(outputCongestion)) // libobs does not handle NaN, so we're handling it here
outputCongestion = 0.0f;
json responseData;
responseData["outputActive"] = obs_output_active(streamOutput);
responseData["outputReconnecting"] = obs_output_reconnecting(streamOutput);
responseData["outputTimecode"] = Utils::Obs::StringHelper::DurationToTimecode(outputDuration);
responseData["outputDuration"] = outputDuration;
responseData["outputCongestion"] = obs_output_get_congestion(streamOutput);
responseData["outputCongestion"] = outputCongestion;
responseData["outputBytes"] = (uint64_t)obs_output_get_total_bytes(streamOutput);
responseData["outputSkippedFrames"] = obs_output_get_frames_dropped(streamOutput);
responseData["outputTotalFrames"] = obs_output_get_total_frames(streamOutput);

View File

@ -46,6 +46,7 @@ RequestResult RequestHandler::GetTransitionKindList(const Request &)
* Gets an array of all scene transitions in OBS.
*
* @responseField currentSceneTransitionName | String | Name of the current scene transition. Can be null
* @responseField currentSceneTransitionUuid | String | UUID of the current scene transition. Can be null
* @responseField currentSceneTransitionKind | String | Kind of the current scene transition. Can be null
* @responseField transitions | Array<Object> | Array of transitions
*
@ -63,9 +64,11 @@ RequestResult RequestHandler::GetSceneTransitionList(const Request &)
OBSSourceAutoRelease transition = obs_frontend_get_current_transition();
if (transition) {
responseData["currentSceneTransitionName"] = obs_source_get_name(transition);
responseData["currentSceneTransitionUuid"] = obs_source_get_uuid(transition);
responseData["currentSceneTransitionKind"] = obs_source_get_id(transition);
} else {
responseData["currentSceneTransitionName"] = nullptr;
responseData["currentSceneTransitionUuid"] = nullptr;
responseData["currentSceneTransitionKind"] = nullptr;
}
@ -78,6 +81,7 @@ RequestResult RequestHandler::GetSceneTransitionList(const Request &)
* Gets information about the current scene transition.
*
* @responseField transitionName | String | Name of the transition
* @responseField transitionUuid | String | UUID of the transition
* @responseField transitionKind | String | Kind of the transition
* @responseField transitionFixed | Boolean | Whether the transition uses a fixed (unconfigurable) duration
* @responseField transitionDuration | Number | Configured transition duration in milliseconds. `null` if transition is fixed
@ -100,6 +104,7 @@ RequestResult RequestHandler::GetCurrentSceneTransition(const Request &)
json responseData;
responseData["transitionName"] = obs_source_get_name(transition);
responseData["transitionUuid"] = obs_source_get_uuid(transition);
responseData["transitionKind"] = obs_source_get_id(transition);
if (obs_transition_fixed(transition)) {

View File

@ -82,7 +82,8 @@ RequestResult RequestHandler::SetStudioModeEnabled(const Request &request)
/**
* Opens the properties dialog of an input.
*
* @requestField inputName | String | Name of the input to open the dialog of
* @requestField ?inputName | String | Name of the input to open the dialog of
* @requestField ?inputUuid | String | UUID of the input to open the dialog of
*
* @requestType OpenInputPropertiesDialog
* @complexity 1
@ -95,7 +96,7 @@ RequestResult RequestHandler::OpenInputPropertiesDialog(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!input)
return RequestResult::Error(statusCode, comment);
@ -107,7 +108,8 @@ RequestResult RequestHandler::OpenInputPropertiesDialog(const Request &request)
/**
* Opens the filters dialog of an input.
*
* @requestField inputName | String | Name of the input to open the dialog of
* @requestField ?inputName | String | Name of the input to open the dialog of
* @requestField ?inputUuid | String | UUID of the input to open the dialog of
*
* @requestType OpenInputFiltersDialog
* @complexity 1
@ -120,7 +122,7 @@ RequestResult RequestHandler::OpenInputFiltersDialog(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!input)
return RequestResult::Error(statusCode, comment);
@ -132,7 +134,8 @@ RequestResult RequestHandler::OpenInputFiltersDialog(const Request &request)
/**
* Opens the interact dialog of an input.
*
* @requestField inputName | String | Name of the input to open the dialog of
* @requestField ?inputName | String | Name of the input to open the dialog of
* @requestField ?inputUuid | String | UUID of the input to open the dialog of
*
* @requestType OpenInputInteractDialog
* @complexity 1
@ -145,7 +148,7 @@ RequestResult RequestHandler::OpenInputInteractDialog(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
if (!input)
return RequestResult::Error(statusCode, comment);
@ -262,7 +265,8 @@ RequestResult RequestHandler::OpenVideoMixProjector(const Request &request)
*
* Note: This request serves to provide feature parity with 4.x. It is very likely to be changed/deprecated in a future release.
*
* @requestField sourceName | String | Name of the source to open a projector for
* @requestField ?sourceName | String | Name of the source to open a projector for
* @requestField ?sourceUuid | String | UUID of the source to open a projector for
* @requestField ?monitorIndex | Number | Monitor index, use `GetMonitorList` to obtain index | None | -1: Opens projector in windowed mode
* @requestField ?projectorGeometry | String | Size/Position data for a windowed projector, in Qt Base64 encoded format. Mutually exclusive with `monitorIndex` | N/A
*
@ -277,7 +281,7 @@ RequestResult RequestHandler::OpenSourceProjector(const Request &request)
{
RequestStatus::RequestStatus statusCode;
std::string comment;
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
if (!source)
return RequestResult::Error(statusCode, comment);

View File

@ -211,28 +211,39 @@ bool Request::ValidateArray(const std::string &keyName, RequestStatus::RequestSt
return true;
}
obs_source_t *Request::ValidateSource(const std::string &keyName, RequestStatus::RequestStatus &statusCode,
obs_source_t *Request::ValidateSource(const std::string &nameKeyName, const std::string &uuidKeyName, RequestStatus::RequestStatus &statusCode,
std::string &comment) const
{
if (!ValidateString(keyName, statusCode, comment))
return nullptr;
std::string sourceName = RequestData[keyName];
if (ValidateString(nameKeyName, statusCode, comment)) {
std::string sourceName = RequestData[nameKeyName];
obs_source_t *ret = obs_get_source_by_name(sourceName.c_str());
if (!ret) {
statusCode = RequestStatus::ResourceNotFound;
comment = std::string("No source was found by the name of `") + sourceName + "`.";
return nullptr;
}
return ret;
}
obs_source_t *Request::ValidateScene(const std::string &keyName, RequestStatus::RequestStatus &statusCode, std::string &comment,
const ObsWebSocketSceneFilter filter) const
if (ValidateString(uuidKeyName, statusCode, comment)) {
std::string sourceUuid = RequestData[uuidKeyName];
obs_source_t *ret = obs_get_source_by_uuid(sourceUuid.c_str());
if (!ret) {
statusCode = RequestStatus::ResourceNotFound;
comment = std::string("No source was found by the UUID of `") + sourceUuid + "`.";
return nullptr;
}
return ret;
}
statusCode = RequestStatus::MissingRequestField;
comment = std::string("Your request must contain at least one of the following fields: `") + nameKeyName + "` or `" + uuidKeyName + "`.";
return nullptr;
}
obs_source_t *Request::ValidateScene(RequestStatus::RequestStatus &statusCode, std::string &comment, const ObsWebSocketSceneFilter filter) const
{
obs_source_t *ret = ValidateSource(keyName, statusCode, comment);
obs_source_t *ret = ValidateSource("sceneName", "sceneUuid", statusCode, comment);
if (!ret)
return nullptr;
@ -259,10 +270,9 @@ obs_source_t *Request::ValidateScene(const std::string &keyName, RequestStatus::
return ret;
}
obs_scene_t *Request::ValidateScene2(const std::string &keyName, RequestStatus::RequestStatus &statusCode, std::string &comment,
const ObsWebSocketSceneFilter filter) const
obs_scene_t *Request::ValidateScene2(RequestStatus::RequestStatus &statusCode, std::string &comment, const ObsWebSocketSceneFilter filter) const
{
OBSSourceAutoRelease sceneSource = ValidateSource(keyName, statusCode, comment);
OBSSourceAutoRelease sceneSource = ValidateSource("sceneName", "sceneUuid", statusCode, comment);
if (!sceneSource)
return nullptr;
@ -290,10 +300,9 @@ obs_scene_t *Request::ValidateScene2(const std::string &keyName, RequestStatus::
}
}
obs_source_t *Request::ValidateInput(const std::string &keyName, RequestStatus::RequestStatus &statusCode,
std::string &comment) const
obs_source_t *Request::ValidateInput(RequestStatus::RequestStatus &statusCode, std::string &comment) const
{
obs_source_t *ret = ValidateSource(keyName, statusCode, comment);
obs_source_t *ret = ValidateSource("inputName", "inputUuid", statusCode, comment);
if (!ret)
return nullptr;
@ -307,47 +316,44 @@ obs_source_t *Request::ValidateInput(const std::string &keyName, RequestStatus::
return ret;
}
FilterPair Request::ValidateFilter(const std::string &sourceKeyName, const std::string &filterKeyName,
RequestStatus::RequestStatus &statusCode, std::string &comment) const
FilterPair Request::ValidateFilter(RequestStatus::RequestStatus &statusCode, std::string &comment) const
{
obs_source_t *source = ValidateSource(sourceKeyName, statusCode, comment);
obs_source_t *source = ValidateSource("sourceName", "sourceUuid", statusCode, comment);
if (!source)
return FilterPair{source, nullptr};
if (!ValidateString(filterKeyName, statusCode, comment))
if (!ValidateString("filterName", statusCode, comment))
return FilterPair{source, nullptr};
std::string filterName = RequestData[filterKeyName];
std::string filterName = RequestData["filterName"];
obs_source_t *filter = obs_source_get_filter_by_name(source, filterName.c_str());
if (!filter) {
std::string sourceName = obs_source_get_name(source);
statusCode = RequestStatus::ResourceNotFound;
comment = std::string("No filter was found in the source `") + RequestData[sourceKeyName].get<std::string>() +
"` with the name `" + filterName + "`.";
comment = std::string("No filter was found in the source `") + sourceName + "` with the name `" + filterName + "`.";
return FilterPair{source, nullptr};
}
return FilterPair{source, filter};
}
obs_sceneitem_t *Request::ValidateSceneItem(const std::string &sceneKeyName, const std::string &sceneItemIdKeyName,
RequestStatus::RequestStatus &statusCode, std::string &comment,
const ObsWebSocketSceneFilter filter) const
obs_sceneitem_t *Request::ValidateSceneItem(RequestStatus::RequestStatus &statusCode, std::string &comment, const ObsWebSocketSceneFilter filter) const
{
OBSSceneAutoRelease scene = ValidateScene2(sceneKeyName, statusCode, comment, filter);
OBSSceneAutoRelease scene = ValidateScene2(statusCode, comment, filter);
if (!scene)
return nullptr;
if (!ValidateNumber(sceneItemIdKeyName, statusCode, comment, 0))
if (!ValidateNumber("sceneItemId", statusCode, comment, 0))
return nullptr;
int64_t sceneItemId = RequestData[sceneItemIdKeyName];
int64_t sceneItemId = RequestData["sceneItemId"];
OBSSceneItem sceneItem = obs_scene_find_sceneitem_by_id(scene, sceneItemId);
if (!sceneItem) {
std::string sceneName = obs_source_get_name(obs_scene_get_source(scene));
statusCode = RequestStatus::ResourceNotFound;
comment = std::string("No scene items were found in scene `") + RequestData[sceneKeyName].get<std::string>() +
"` with the ID `" + std::to_string(sceneItemId) + "`.";
comment = std::string("No scene items were found in scene `") + sceneName + "` with the ID `" + std::to_string(sceneItemId) + "`.";
return nullptr;
}

View File

@ -64,21 +64,13 @@ struct Request {
const bool allowEmpty = false) const;
// All return values have incremented refcounts
obs_source_t *ValidateSource(const std::string &keyName, RequestStatus::RequestStatus &statusCode,
std::string &comment) const;
obs_source_t *ValidateScene(const std::string &keyName, RequestStatus::RequestStatus &statusCode, std::string &comment,
const ObsWebSocketSceneFilter filter = OBS_WEBSOCKET_SCENE_FILTER_SCENE_ONLY) const;
obs_scene_t *ValidateScene2(const std::string &keyName, RequestStatus::RequestStatus &statusCode, std::string &comment,
const ObsWebSocketSceneFilter filter = OBS_WEBSOCKET_SCENE_FILTER_SCENE_ONLY) const;
obs_source_t *ValidateInput(const std::string &keyName, RequestStatus::RequestStatus &statusCode,
std::string &comment) const;
FilterPair ValidateFilter(const std::string &sourceKeyName, const std::string &filterKeyName,
RequestStatus::RequestStatus &statusCode, std::string &comment) const;
obs_sceneitem_t *ValidateSceneItem(const std::string &sceneKeyName, const std::string &sceneItemIdKeyName,
RequestStatus::RequestStatus &statusCode, std::string &comment,
const ObsWebSocketSceneFilter filter = OBS_WEBSOCKET_SCENE_FILTER_SCENE_ONLY) const;
obs_output_t *ValidateOutput(const std::string &keyName, RequestStatus::RequestStatus &statusCode,
std::string &comment) const;
obs_source_t *ValidateSource(const std::string &nameKeyName, const std::string &uuidKeyName, RequestStatus::RequestStatus &statusCode, std::string &comment) const;
obs_source_t *ValidateScene(RequestStatus::RequestStatus &statusCode, std::string &comment, const ObsWebSocketSceneFilter filter = OBS_WEBSOCKET_SCENE_FILTER_SCENE_ONLY) const;
obs_scene_t *ValidateScene2(RequestStatus::RequestStatus &statusCode, std::string &comment, const ObsWebSocketSceneFilter filter = OBS_WEBSOCKET_SCENE_FILTER_SCENE_ONLY) const;
obs_source_t *ValidateInput(RequestStatus::RequestStatus &statusCode, std::string &comment) const;
FilterPair ValidateFilter(RequestStatus::RequestStatus &statusCode, std::string &comment) const;
obs_sceneitem_t *ValidateSceneItem(RequestStatus::RequestStatus &statusCode, std::string &comment, const ObsWebSocketSceneFilter filter = OBS_WEBSOCKET_SCENE_FILTER_SCENE_ONLY) const;
obs_output_t *ValidateOutput(const std::string &keyName, RequestStatus::RequestStatus &statusCode, std::string &comment) const;
std::string RequestType;
bool HasRequestData;

View File

@ -297,7 +297,7 @@ namespace Utils {
}
namespace SearchHelper {
obs_hotkey_t *GetHotkeyByName(std::string name);
obs_hotkey_t *GetHotkeyByName(std::string name, std::string context);
obs_source_t *GetSceneTransitionByName(std::string name); // Increments source ref. Use OBSSourceAutoRelease
obs_sceneitem_t *GetSceneItemByName(obs_scene_t *scene, std::string name,
int offset = 0); // Increments ref. Use OBSSceneItemAutoRelease

View File

@ -96,6 +96,7 @@ std::vector<json> Utils::Obs::ArrayHelper::GetSceneList()
json sceneJson;
sceneJson["sceneName"] = obs_source_get_name(scene);
sceneJson["sceneUuid"] = obs_source_get_uuid(scene);
sceneJson["sceneIndex"] = sceneList.sources.num - i - 1;
ret.push_back(sceneJson);
@ -150,6 +151,7 @@ std::vector<json> Utils::Obs::ArrayHelper::GetSceneItemList(obs_scene_t *scene,
item["sceneItemBlendMode"] = obs_sceneitem_get_blending_mode(sceneItem);
OBSSource itemSource = obs_sceneitem_get_source(sceneItem);
item["sourceName"] = obs_source_get_name(itemSource);
item["sourceUuid"] = obs_source_get_uuid(itemSource);
item["sourceType"] = obs_source_get_type(itemSource);
if (obs_source_get_type(itemSource) == OBS_SOURCE_TYPE_INPUT)
item["inputKind"] = obs_source_get_id(itemSource);
@ -195,6 +197,7 @@ std::vector<json> Utils::Obs::ArrayHelper::GetInputList(std::string inputKind)
json inputJson;
inputJson["inputName"] = obs_source_get_name(input);
inputJson["inputUuid"] = obs_source_get_uuid(input);
inputJson["inputKind"] = inputKind;
inputJson["unversionedInputKind"] = obs_source_get_unversioned_id(input);
@ -281,6 +284,7 @@ std::vector<json> Utils::Obs::ArrayHelper::GetSceneTransitionList()
obs_source_t *transition = transitionList.sources.array[i];
json transitionJson;
transitionJson["transitionName"] = obs_source_get_name(transition);
transitionJson["transitionUuid"] = obs_source_get_uuid(transition);
transitionJson["transitionKind"] = obs_source_get_id(transition);
transitionJson["transitionFixed"] = obs_transition_fixed(transition);
transitionJson["transitionConfigurable"] = obs_source_configurable(transition);

View File

@ -19,7 +19,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
#include "Obs.h"
#include "plugin-macros.generated.h"
obs_hotkey_t *Utils::Obs::SearchHelper::GetHotkeyByName(std::string name)
obs_hotkey_t *Utils::Obs::SearchHelper::GetHotkeyByName(std::string name, std::string context)
{
if (name.empty())
return nullptr;
@ -27,7 +27,46 @@ obs_hotkey_t *Utils::Obs::SearchHelper::GetHotkeyByName(std::string name)
auto hotkeys = ArrayHelper::GetHotkeyList();
for (auto hotkey : hotkeys) {
if (obs_hotkey_get_name(hotkey) == name)
if (obs_hotkey_get_name(hotkey) != name)
continue;
if (context.empty())
return hotkey;
auto type = obs_hotkey_get_registerer_type(hotkey);
if (type == OBS_HOTKEY_REGISTERER_SOURCE) {
OBSSourceAutoRelease source = obs_weak_source_get_source((obs_weak_source_t *)obs_hotkey_get_registerer(hotkey));
if (!source)
continue;
if (context != obs_source_get_name(source))
continue;
} else if (type == OBS_HOTKEY_REGISTERER_OUTPUT) {
OBSOutputAutoRelease output = obs_weak_output_get_output((obs_weak_output_t *)obs_hotkey_get_registerer(hotkey));
if (!output)
continue;
if (context != obs_output_get_name(output))
continue;
} else if (type == OBS_HOTKEY_REGISTERER_ENCODER) {
OBSEncoderAutoRelease encoder = obs_weak_encoder_get_encoder((obs_weak_encoder_t *)obs_hotkey_get_registerer(hotkey));
if (!encoder)
continue;
if (context != obs_encoder_get_name(encoder))
continue;
} else if (type == OBS_HOTKEY_REGISTERER_SERVICE) {
OBSServiceAutoRelease service = obs_weak_service_get_service((obs_weak_service_t *)obs_hotkey_get_registerer(hotkey));
if (!service)
continue;
if (context != obs_service_get_name(service))
continue;
}
return hotkey;
}

View File

@ -20,6 +20,8 @@ with this program. If not, see <https://www.gnu.org/licenses/>
#include <inttypes.h>
#include <QString>
#include <util/util.hpp>
#include "Obs.h"
#include "plugin-macros.generated.h"
@ -42,33 +44,29 @@ std::string Utils::Obs::StringHelper::GetObsVersion()
std::string Utils::Obs::StringHelper::GetCurrentSceneCollection()
{
char *sceneCollectionName = obs_frontend_get_current_scene_collection();
std::string ret = sceneCollectionName;
bfree(sceneCollectionName);
BPtr<char> sceneCollectionName = obs_frontend_get_current_scene_collection();
std::string ret = sceneCollectionName.Get();
return ret;
}
std::string Utils::Obs::StringHelper::GetCurrentProfile()
{
char *profileName = obs_frontend_get_current_profile();
std::string ret = profileName;
bfree(profileName);
BPtr<char> profileName = obs_frontend_get_current_profile();
std::string ret = profileName.Get();
return ret;
}
std::string Utils::Obs::StringHelper::GetCurrentProfilePath()
{
char *profilePath = obs_frontend_get_current_profile_path();
std::string ret = profilePath;
bfree(profilePath);
BPtr<char> profilePath = obs_frontend_get_current_profile_path();
std::string ret = profilePath.Get();
return ret;
}
std::string Utils::Obs::StringHelper::GetCurrentRecordOutputPath()
{
char *recordOutputPath = obs_frontend_get_current_record_output_path();
std::string ret = recordOutputPath;
bfree(recordOutputPath);
BPtr<char> recordOutputPath = obs_frontend_get_current_record_output_path();
std::string ret = recordOutputPath.Get();
return ret;
}
@ -94,17 +92,15 @@ std::string Utils::Obs::StringHelper::GetLastRecordFileName()
std::string Utils::Obs::StringHelper::GetLastReplayBufferFileName()
{
char *replayBufferPath = obs_frontend_get_last_replay();
std::string ret = replayBufferPath;
bfree(replayBufferPath);
BPtr<char> replayBufferPath = obs_frontend_get_last_replay();
std::string ret = replayBufferPath.Get();
return ret;
}
std::string Utils::Obs::StringHelper::GetLastScreenshotFileName()
{
char *screenshotPath = obs_frontend_get_last_screenshot();
std::string ret = screenshotPath;
bfree(screenshotPath);
BPtr<char> screenshotPath = obs_frontend_get_last_screenshot();
std::string ret = screenshotPath.Get();
return ret;
}

View File

@ -93,6 +93,7 @@ json Utils::Obs::VolumeMeter::Meter::GetMeterData()
l.unlock();
ret["inputName"] = obs_source_get_name(input);
ret["inputUuid"] = obs_source_get_uuid(input);
ret["inputLevelsMul"] = levels;
return ret;

View File

@ -116,11 +116,12 @@ void Utils::Platform::SendTrayNotification(QSystemTrayIcon::MessageIcon icon, QS
obs_queue_task(
OBS_TASK_UI,
[](void *param) {
void *systemTrayPtr = obs_frontend_get_system_tray();
auto systemTray = static_cast<QSystemTrayIcon *>(systemTrayPtr);
auto notification = static_cast<SystemTrayNotification *>(param);
void *systemTrayPtr = obs_frontend_get_system_tray();
if (systemTrayPtr) {
auto systemTray = static_cast<QSystemTrayIcon *>(systemTrayPtr);
systemTray->showMessage(notification->title, notification->body, notification->icon);
}
delete notification;
},
(void *)notification, false);

View File

@ -49,14 +49,21 @@ WebSocketServer::WebSocketServer() : QObject(nullptr)
websocketpp::lib::placeholders::_2));
auto eventHandler = GetEventHandler();
if (eventHandler) {
eventHandler->SetBroadcastCallback(std::bind(&WebSocketServer::BroadcastEvent, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
eventHandler->SetObsReadyCallback(std::bind(&WebSocketServer::onObsReady, this, std::placeholders::_1));
}
}
WebSocketServer::~WebSocketServer()
{
auto eventHandler = GetEventHandler();
if (eventHandler) {
eventHandler->SetObsReadyCallback(nullptr);
eventHandler->SetBroadcastCallback(nullptr);
}
if (_server.is_listening())
Stop();
}