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