mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
New request type GetMute + request handler refactor
This commit is contained in:
parent
6bca8194cb
commit
cebe325e81
60
PROTOCOL.md
60
PROTOCOL.md
@ -13,7 +13,7 @@ The protocol in general is based on the OBS Remote protocol created by Bill Hami
|
||||
- **Scenes**
|
||||
- ["SwitchScenes"](#switchscenes)
|
||||
- ["ScenesChanged"](#sceneschanged)
|
||||
- **Sources / Scene Items**
|
||||
- **Scene Items**
|
||||
- ["SourceOrderChanged"](#sourceorderchanged)
|
||||
- ["SceneItemAdded"](#sceneitemadded)
|
||||
- ["SceneItemRemoved"](#sceneitemremoved)
|
||||
@ -85,8 +85,10 @@ The protocol in general is based on the OBS Remote protocol created by Bill Hami
|
||||
- ["SetVolume"](#setvolume)
|
||||
- ["GetVolume"](#getvolume)
|
||||
- ["SetMute"](#setmute)
|
||||
- ["GetMute"](#getmute)
|
||||
- ["ToggleMute"](#togglemute)
|
||||
- ["SetSourceRender"](#setsourcerender)
|
||||
- **Scene Items**
|
||||
- ["SetSceneItemRender"](#setsourcerender) (a.k.a `SetSourceRender`)
|
||||
- ["SetSceneItemPosition"](#setsceneitemposition)
|
||||
- ["SetSceneItemTransform"](#setsceneitemtransform)
|
||||
- ["SetSceneItemCrop"](#setsceneitemcrop)
|
||||
@ -246,7 +248,6 @@ A request to start streaming has been issued.
|
||||
|
||||
#### "StreamStarted"
|
||||
Streaming started successfully.
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
@ -258,31 +259,26 @@ A request to stop streaming has been issued.
|
||||
|
||||
#### "StreamStopped"
|
||||
Streaming stopped successfully.
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
#### "RecordingStarting"
|
||||
A request to start recording has been issued.
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
#### "RecordingStarted"
|
||||
Recording started successfully.
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
#### "RecordingStopping"
|
||||
A request to stop streaming has been issued.
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
#### "RecordingStopped"
|
||||
Recording stopped successfully.
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
@ -302,8 +298,7 @@ Sent every 2 seconds with the following information :
|
||||
---
|
||||
|
||||
#### "Exiting"
|
||||
OBS is exiting.
|
||||
*New in OBS Studio*
|
||||
OBS is exiting.
|
||||
|
||||
---
|
||||
|
||||
@ -488,7 +483,6 @@ Toggles recording on or off.
|
||||
|
||||
__Request fields__ : none
|
||||
__Response__ : always OK. No additional fields.
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
@ -497,7 +491,6 @@ Start streaming.
|
||||
|
||||
__Request fields__ : none
|
||||
__Response__ : always OK. No additional fields.
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
@ -506,7 +499,6 @@ Stop streaming.
|
||||
|
||||
__Request fields__ : none
|
||||
__Response__ : always OK. No additional fields.
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
@ -515,7 +507,6 @@ Start recording.
|
||||
|
||||
__Request fields__ : none
|
||||
__Response__ : always OK. No additional fields.
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
@ -524,7 +515,6 @@ Stop recording.
|
||||
|
||||
__Request fields__ : none
|
||||
__Response__ : always OK. No additional fields.
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
@ -552,8 +542,6 @@ __Response__ : always OK, with these additional fields :
|
||||
Objects in the "transitions" array have only one field :
|
||||
- **"name"** (string) : name of the transition
|
||||
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
#### "GetCurrentTransition"
|
||||
@ -564,17 +552,13 @@ __Response__ : always OK, with these additional fields :
|
||||
- **"name"** (string) : name of the selected transition
|
||||
- **"duration"** (integer, only if transition supports this) : transition duration
|
||||
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
#### "SetCurrentTransition"
|
||||
__Request fields__ :
|
||||
- **"transition-name"** (string) : The name of the transition.
|
||||
|
||||
__Response__ : OK if specified transition exists, error otherwise.
|
||||
|
||||
*New in OBS Studio*
|
||||
__Response__ : OK if specified transition exists, error otherwise.
|
||||
|
||||
---
|
||||
|
||||
@ -586,8 +570,6 @@ __Request fields__ :
|
||||
|
||||
__Response__ : always OK.
|
||||
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
#### "GetTransitionDuration"
|
||||
@ -597,8 +579,6 @@ __Request fields__ : none
|
||||
__Response__ : always OK, with these additional fields :
|
||||
- **"transition-duration"** (integer) : current transition duration, in milliseconds
|
||||
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
#### "SetVolume"
|
||||
@ -610,8 +590,6 @@ __Request fields__ :
|
||||
|
||||
__Response__ : OK if specified source exists, error otherwise.
|
||||
|
||||
*Updated for OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
#### "GetVolume"
|
||||
@ -621,11 +599,9 @@ __Request fields__ :
|
||||
- **"source"** (string) : name of the source
|
||||
|
||||
__Response__ : OK if source exists, with these additional fields :
|
||||
- **"name"** (string) : name of the requested source
|
||||
- **"volume"** (double) : volume of the requested source, on a linear scale (0.0 to 1.0)
|
||||
- **"muted"** (bool) : mute status of the requested source
|
||||
|
||||
*Updated for OBS Studio*
|
||||
- **"name"** (string) : source name
|
||||
- **"volume"** (double) : source volume, on a linear scale (0.0 to 1.0)
|
||||
- **"muted"** (bool) : source mute status
|
||||
|
||||
---
|
||||
|
||||
@ -638,7 +614,17 @@ __Request fields__ :
|
||||
|
||||
__Response__ : OK if specified source exists, error otherwise.
|
||||
|
||||
*Updated for OBS Studio*
|
||||
---
|
||||
|
||||
#### "GetMute"
|
||||
Get mute status of a specific source.
|
||||
|
||||
__Request fields__ :
|
||||
- **"source"** (string) : the name of the source
|
||||
|
||||
__Response__ : OK if source exists, with these additional fields :
|
||||
- **"name"** (string) : source name
|
||||
- **"muted"** (bool) : source mute status
|
||||
|
||||
---
|
||||
|
||||
@ -650,8 +636,6 @@ __Request fields__ :
|
||||
|
||||
__Response__ : OK if specified source exists, error otherwise.
|
||||
|
||||
*Updated for OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
#### "SetSceneItemPosition"
|
||||
@ -663,8 +647,6 @@ __Request fields__ :
|
||||
|
||||
__Response__ : OK if specified item exists, error otherwise.
|
||||
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
#### "SetSceneItemTransform"
|
||||
@ -677,8 +659,6 @@ __Request fields__ :
|
||||
|
||||
__Response__ : OK if specified item exists, error otherwise.
|
||||
|
||||
*New in OBS Studio*
|
||||
|
||||
---
|
||||
|
||||
#### "SetSceneItemCrop"
|
||||
|
@ -9,7 +9,11 @@ Follow the project on Twitter for news & updates : [@obswebsocket](https://twitt
|
||||
## Downloads
|
||||
Binaries for Windows and Linux are available in the [Releases](https://github.com/Palakis/obs-websocket/releases) section.
|
||||
|
||||
## Sponsors
|
||||
## Supporters
|
||||
[Support Class](http://supportclass.net) designs and develops professional livestreams, with services ranging from broadcast graphics design and integration to event organization, along many other skills.
|
||||
|
||||
They have contributed financially to the project and made possible the addition of several features into obs-websocket. Many thanks to them!
|
||||
|
||||
[](http://supportclass.net)
|
||||
|
||||
## Using obs-websocket
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -32,69 +32,69 @@ class WSRequestHandler : public QObject
|
||||
explicit WSRequestHandler(QWebSocket *client);
|
||||
~WSRequestHandler();
|
||||
void processIncomingMessage(QString textMessage);
|
||||
bool hasField(const char* name);
|
||||
|
||||
private:
|
||||
QWebSocket *_client;
|
||||
const char *_messageId;
|
||||
const char *_requestType;
|
||||
obs_data_t *_requestData;
|
||||
obs_data_t *data;
|
||||
|
||||
QMap<QString, void(*)(WSRequestHandler*)> messageMap;
|
||||
QSet<QString> authNotRequired;
|
||||
|
||||
void SendOKResponse(obs_data_t *additionalFields = NULL);
|
||||
void SendErrorResponse(const char *errorMessage);
|
||||
static void ErrNotImplemented(WSRequestHandler *owner);
|
||||
|
||||
static void HandleGetVersion(WSRequestHandler *owner);
|
||||
static void HandleGetAuthRequired(WSRequestHandler *owner);
|
||||
static void HandleAuthenticate(WSRequestHandler *owner);
|
||||
static void HandleGetVersion(WSRequestHandler *req);
|
||||
static void HandleGetAuthRequired(WSRequestHandler *req);
|
||||
static void HandleAuthenticate(WSRequestHandler *req);
|
||||
|
||||
static void HandleSetCurrentScene(WSRequestHandler *owner);
|
||||
static void HandleGetCurrentScene(WSRequestHandler *owner);
|
||||
static void HandleGetSceneList(WSRequestHandler *owner);
|
||||
static void HandleSetCurrentScene(WSRequestHandler *req);
|
||||
static void HandleGetCurrentScene(WSRequestHandler *req);
|
||||
static void HandleGetSceneList(WSRequestHandler *req);
|
||||
|
||||
static void HandleSetSceneItemRender(WSRequestHandler *owner);
|
||||
static void HandleSetSceneItemPosition(WSRequestHandler *owner);
|
||||
static void HandleSetSceneItemTransform(WSRequestHandler *owner);
|
||||
static void HandleSetSceneItemCrop(WSRequestHandler *owner);
|
||||
static void HandleSetSceneItemRender(WSRequestHandler *req);
|
||||
static void HandleSetSceneItemPosition(WSRequestHandler *req);
|
||||
static void HandleSetSceneItemTransform(WSRequestHandler *req);
|
||||
static void HandleSetSceneItemCrop(WSRequestHandler *req);
|
||||
|
||||
static void HandleGetStreamingStatus(WSRequestHandler *owner);
|
||||
static void HandleStartStopStreaming(WSRequestHandler *owner);
|
||||
static void HandleStartStopRecording(WSRequestHandler *owner);
|
||||
static void HandleStartStreaming(WSRequestHandler *owner);
|
||||
static void HandleStopStreaming(WSRequestHandler *owner);
|
||||
static void HandleStartRecording(WSRequestHandler *owner);
|
||||
static void HandleStopRecording(WSRequestHandler *owner);
|
||||
static void HandleGetStreamingStatus(WSRequestHandler *req);
|
||||
static void HandleStartStopStreaming(WSRequestHandler *req);
|
||||
static void HandleStartStopRecording(WSRequestHandler *req);
|
||||
static void HandleStartStreaming(WSRequestHandler *req);
|
||||
static void HandleStopStreaming(WSRequestHandler *req);
|
||||
static void HandleStartRecording(WSRequestHandler *req);
|
||||
static void HandleStopRecording(WSRequestHandler *req);
|
||||
|
||||
static void HandleGetTransitionList(WSRequestHandler *owner);
|
||||
static void HandleGetCurrentTransition(WSRequestHandler *owner);
|
||||
static void HandleSetCurrentTransition(WSRequestHandler *owner);
|
||||
static void HandleGetTransitionList(WSRequestHandler *req);
|
||||
static void HandleGetCurrentTransition(WSRequestHandler *req);
|
||||
static void HandleSetCurrentTransition(WSRequestHandler *req);
|
||||
|
||||
static void HandleSetVolume(WSRequestHandler *owner);
|
||||
static void HandleGetVolume(WSRequestHandler *owner);
|
||||
static void HandleToggleMute(WSRequestHandler *owner);
|
||||
static void HandleSetMute(WSRequestHandler *owner);
|
||||
// TODO : GetMute
|
||||
static void HandleSetVolume(WSRequestHandler *req);
|
||||
static void HandleGetVolume(WSRequestHandler *req);
|
||||
static void HandleToggleMute(WSRequestHandler *req);
|
||||
static void HandleSetMute(WSRequestHandler *req);
|
||||
static void HandleGetMute(WSRequestHandler *req);
|
||||
|
||||
static void HandleSetCurrentSceneCollection(WSRequestHandler *owner);
|
||||
static void HandleGetCurrentSceneCollection(WSRequestHandler *owner);
|
||||
static void HandleListSceneCollections(WSRequestHandler *owner);
|
||||
static void HandleSetCurrentSceneCollection(WSRequestHandler *req);
|
||||
static void HandleGetCurrentSceneCollection(WSRequestHandler *req);
|
||||
static void HandleListSceneCollections(WSRequestHandler *req);
|
||||
|
||||
static void HandleSetCurrentProfile(WSRequestHandler *owner);
|
||||
static void HandleGetCurrentProfile(WSRequestHandler *owner);
|
||||
static void HandleListProfiles(WSRequestHandler *owner);
|
||||
static void HandleSetCurrentProfile(WSRequestHandler *req);
|
||||
static void HandleGetCurrentProfile(WSRequestHandler *req);
|
||||
static void HandleListProfiles(WSRequestHandler *req);
|
||||
|
||||
static void HandleSetTransitionDuration(WSRequestHandler *owner);
|
||||
static void HandleGetTransitionDuration(WSRequestHandler *owner);
|
||||
static void HandleSetTransitionDuration(WSRequestHandler *req);
|
||||
static void HandleGetTransitionDuration(WSRequestHandler *req);
|
||||
|
||||
static void HandleGetStudioModeStatus(WSRequestHandler *owner);
|
||||
static void HandleGetPreviewScene(WSRequestHandler *owner);
|
||||
static void HandleSetPreviewScene(WSRequestHandler *owner);
|
||||
static void HandleTransitionToProgram(WSRequestHandler *owner);
|
||||
static void HandleEnableStudioMode(WSRequestHandler *owner);
|
||||
static void HandleDisableStudioMode(WSRequestHandler *owner);
|
||||
static void HandleToggleStudioMode(WSRequestHandler *owner);
|
||||
static void HandleGetStudioModeStatus(WSRequestHandler *req);
|
||||
static void HandleGetPreviewScene(WSRequestHandler *req);
|
||||
static void HandleSetPreviewScene(WSRequestHandler *req);
|
||||
static void HandleTransitionToProgram(WSRequestHandler *req);
|
||||
static void HandleEnableStudioMode(WSRequestHandler *req);
|
||||
static void HandleDisableStudioMode(WSRequestHandler *req);
|
||||
static void HandleToggleStudioMode(WSRequestHandler *req);
|
||||
};
|
||||
|
||||
#endif // WSPROTOCOL_H
|
||||
|
@ -21,6 +21,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
|
||||
#define PROP_AUTHENTICATED "wsclient_authenticated"
|
||||
#define OBS_WEBSOCKET_VERSION "4.1.0"
|
||||
#define API_VERSION 1.3
|
||||
|
||||
#define blog(level, msg, ...) blog(level, "[obs-websocket] " msg, ##__VA_ARGS__)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user