mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Compare commits
1 Commits
5.4.2
...
experiment
Author | SHA1 | Date | |
---|---|---|---|
896bacf550 |
2
.github/workflows/crowdin_upload.yml
vendored
2
.github/workflows/crowdin_upload.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
||||
if: github.repository_owner == 'obsproject'
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 100
|
||||
- name: Upload US English Language Files 🇺🇸
|
||||
|
2
.github/workflows/generate_docs.yml
vendored
2
.github/workflows/generate_docs.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
||||
IS_CI: "true"
|
||||
steps:
|
||||
- name: 'Checkout'
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: ${{ github.workspace }}/obs-websocket
|
||||
- name: 'Generate docs'
|
||||
|
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
if: contains(github.event.head_commit.message, '[skip ci]') != true
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
- name: Generate docs
|
||||
run: cd docs && ./build_docs.sh
|
||||
- name: Run markdownlint-cli
|
||||
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16...3.25)
|
||||
|
||||
legacy_check()
|
||||
|
||||
set(obs-websocket_VERSION 5.4.2)
|
||||
set(obs-websocket_VERSION 5.3.5)
|
||||
set(OBS_WEBSOCKET_RPC_VERSION 1)
|
||||
|
||||
option(ENABLE_WEBSOCKET "Enable building OBS with websocket plugin" ON)
|
||||
|
@ -41,8 +41,6 @@ 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)
|
||||
|
||||
@ -51,7 +49,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 4.0.x: [obs-websocket-gd](https://github.com/you-win/obs-websocket-gd) by you-win
|
||||
- Godot 3.4.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
|
||||
|
@ -1,4 +1,4 @@
|
||||
project(obs-websocket VERSION 5.4.2)
|
||||
project(obs-websocket VERSION 5.3.5)
|
||||
set(OBS_WEBSOCKET_RPC_VERSION 1)
|
||||
|
||||
option(ENABLE_WEBSOCKET "Enable building OBS with websocket plugin" ON)
|
||||
|
@ -1,5 +1,4 @@
|
||||
OBSWebSocket.Plugin.Description="Fjernstyring af OBS Studio via WebSocket"
|
||||
OBSWebSocket.Settings.DialogTitle="WebSocket-serverindstillinger"
|
||||
OBSWebSocket.Settings.PluginSettingsTitle="Plugin-indstillinger"
|
||||
OBSWebSocket.Settings.ServerEnable="Aktivér WebSocket-server"
|
||||
OBSWebSocket.Settings.AlertsEnable="Aktivér Systembakke Alarmer"
|
||||
|
@ -8,7 +8,7 @@ OBSWebSocket.Settings.DebugEnableHoverText="Aktifkan pencatatan awakutu untuk pe
|
||||
OBSWebSocket.Settings.ServerSettingsTitle="Pengaturan Server"
|
||||
OBSWebSocket.Settings.AuthRequired="Aktifkan Autentikasi"
|
||||
OBSWebSocket.Settings.Password="Kata Sandi Server"
|
||||
OBSWebSocket.Settings.GeneratePassword="Buat Kata Sandi"
|
||||
OBSWebSocket.Settings.GeneratePassword="Ciptakan Kata Sandi"
|
||||
OBSWebSocket.Settings.ServerPort="Port Server"
|
||||
OBSWebSocket.Settings.ShowConnectInfo="Tampilkan Informasi Koneksi"
|
||||
OBSWebSocket.Settings.ShowConnectInfoWarningTitle="Peringatan: Saat Ini Siaran Langsung"
|
||||
@ -16,7 +16,7 @@ OBSWebSocket.Settings.ShowConnectInfoWarningMessage="Sepertinya sebuah output (s
|
||||
OBSWebSocket.Settings.ShowConnectInfoWarningInfoText="Anda yakin ingin melihat informasi koneksi Anda?"
|
||||
OBSWebSocket.Settings.Save.UserPasswordWarningTitle="Peringatan: Potensi Masalah Keamanan"
|
||||
OBSWebSocket.Settings.Save.UserPasswordWarningMessage="obs-websocket menyimpan kata sandi server sebagai teks biasa. Sangat disarankan untuk menggunakan kata sandi yang diciptakan oleh obs-websocket."
|
||||
OBSWebSocket.Settings.Save.UserPasswordWarningInfoText="Apakah Anda yakin ingin menggunakan kata sandi sendiri?"
|
||||
OBSWebSocket.Settings.Save.UserPasswordWarningInfoText="Anda yakin ingin menggunakan kata sandi Anda sendiri?"
|
||||
OBSWebSocket.Settings.Save.PasswordInvalidErrorTitle="Galat: Konfigurasi Tidak Berlaku"
|
||||
OBSWebSocket.Settings.Save.PasswordInvalidErrorMessage="Anda harus menggunakan kata sandi yang minimal 6 karakter atau lebih."
|
||||
OBSWebSocket.SessionTable.Title="Sesi WebSocket yang Terhubung"
|
||||
|
@ -1,2 +0,0 @@
|
||||
OBSWebSocket.Settings.GeneratePassword="ئىم ھاسىللا"
|
||||
OBSWebSocket.ConnectInfo.CopyText="كۆچۈر"
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -44,7 +44,7 @@ struct obs_websocket_request_callback {
|
||||
void *priv_data;
|
||||
};
|
||||
|
||||
static proc_handler_t *_ph;
|
||||
inline 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, 0, 0, 0};
|
||||
calldata_t cd = {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, 0, 0, 0};
|
||||
calldata_t cd = {0};
|
||||
|
||||
if (!proc_handler_call(_ph, "get_api_version", &cd))
|
||||
return 1; // API v1 does not include get_api_version
|
||||
@ -104,11 +104,7 @@ 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 struct obs_websocket_request_response *obs_websocket_call_request(const char *request_type, obs_data_t *request_data
|
||||
#ifdef __cplusplus
|
||||
= NULL
|
||||
#endif
|
||||
)
|
||||
static inline obs_websocket_request_response *obs_websocket_call_request(const char *request_type, obs_data_t *request_data = NULL)
|
||||
{
|
||||
if (!obs_websocket_ensure_ph())
|
||||
return NULL;
|
||||
@ -117,14 +113,14 @@ static inline struct obs_websocket_request_response *obs_websocket_call_request(
|
||||
if (request_data)
|
||||
request_data_string = obs_data_get_json(request_data);
|
||||
|
||||
calldata_t cd = {0, 0, 0, 0};
|
||||
calldata_t cd = {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);
|
||||
|
||||
struct obs_websocket_request_response *ret = (struct obs_websocket_request_response *)calldata_ptr(&cd, "response");
|
||||
auto ret = (struct obs_websocket_request_response *)calldata_ptr(&cd, "response");
|
||||
|
||||
calldata_free(&cd);
|
||||
|
||||
@ -153,7 +149,7 @@ static inline obs_websocket_vendor obs_websocket_register_vendor(const char *ven
|
||||
if (!obs_websocket_ensure_ph())
|
||||
return NULL;
|
||||
|
||||
calldata_t cd = {0, 0, 0, 0};
|
||||
calldata_t cd = {0};
|
||||
|
||||
calldata_set_string(&cd, "name", vendor_name);
|
||||
|
||||
@ -168,9 +164,11 @@ 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, 0, 0, 0};
|
||||
calldata_t cd = {0};
|
||||
|
||||
struct obs_websocket_request_callback cb = {request_callback, priv_data};
|
||||
struct obs_websocket_request_callback cb = {};
|
||||
cb.callback = request_callback;
|
||||
cb.priv_data = priv_data;
|
||||
|
||||
calldata_set_string(&cd, "type", request_type);
|
||||
calldata_set_ptr(&cd, "callback", &cb);
|
||||
@ -184,7 +182,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, 0, 0, 0};
|
||||
calldata_t cd = {0};
|
||||
|
||||
calldata_set_string(&cd, "type", request_type);
|
||||
|
||||
@ -198,7 +196,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, 0, 0, 0};
|
||||
calldata_t cd = {0};
|
||||
|
||||
calldata_set_string(&cd, "type", event_name);
|
||||
calldata_set_ptr(&cd, "data", (void *)event_data);
|
||||
|
@ -602,9 +602,6 @@ void EventHandler::SourceUpdatedMultiHandler(void *param, calldata_t *data)
|
||||
case OBS_SOURCE_TYPE_INPUT:
|
||||
eventHandler->HandleInputSettingsChanged(source);
|
||||
break;
|
||||
case OBS_SOURCE_TYPE_FILTER:
|
||||
eventHandler->HandleSourceFilterSettingsChanged(source);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -147,7 +147,6 @@ 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
|
||||
|
@ -163,32 +163,6 @@ 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.
|
||||
*
|
||||
|
@ -23,7 +23,6 @@ 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
|
||||
@ -45,7 +44,6 @@ 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);
|
||||
@ -57,7 +55,6 @@ 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
|
||||
@ -71,14 +68,12 @@ 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
|
||||
*
|
||||
@ -90,10 +85,9 @@ void EventHandler::HandleInputRemoved(obs_source_t *source)
|
||||
* @api events
|
||||
* @category inputs
|
||||
*/
|
||||
void EventHandler::HandleInputNameChanged(obs_source_t *source, std::string oldInputName, std::string inputName)
|
||||
void EventHandler::HandleInputNameChanged(obs_source_t *, 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);
|
||||
@ -105,7 +99,6 @@ void EventHandler::HandleInputNameChanged(obs_source_t *source, std::string oldI
|
||||
* 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
|
||||
@ -122,7 +115,6 @@ void EventHandler::HandleInputSettingsChanged(obs_source_t *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);
|
||||
}
|
||||
@ -133,7 +125,6 @@ void EventHandler::HandleInputSettingsChanged(obs_source_t *source)
|
||||
* 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
|
||||
@ -160,7 +151,6 @@ 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);
|
||||
}
|
||||
@ -171,7 +161,6 @@ 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
|
||||
@ -198,7 +187,6 @@ 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);
|
||||
}
|
||||
@ -207,7 +195,6 @@ 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
|
||||
@ -231,7 +218,6 @@ 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);
|
||||
}
|
||||
@ -240,7 +226,6 @@ 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
|
||||
*
|
||||
@ -272,7 +257,6 @@ 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);
|
||||
@ -281,8 +265,7 @@ void EventHandler::HandleInputVolumeChanged(void *param, calldata_t *data)
|
||||
/**
|
||||
* The audio balance value of an input has changed.
|
||||
*
|
||||
* @dataField inputName | String | Name of the input
|
||||
* @dataField inputUuid | String | UUID of the input
|
||||
* @dataField inputName | String | Name of the affected input
|
||||
* @dataField inputAudioBalance | Number | New audio balance value of the input
|
||||
*
|
||||
* @eventType InputAudioBalanceChanged
|
||||
@ -308,7 +291,6 @@ 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);
|
||||
}
|
||||
@ -317,7 +299,6 @@ 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
|
||||
@ -343,7 +324,6 @@ 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);
|
||||
}
|
||||
@ -352,7 +332,6 @@ 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
|
||||
@ -383,7 +362,6 @@ 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);
|
||||
}
|
||||
@ -398,7 +376,6 @@ 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
|
||||
@ -424,7 +401,6 @@ 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);
|
||||
}
|
||||
|
@ -124,7 +124,6 @@ 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
|
||||
@ -147,7 +146,6 @@ 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);
|
||||
}
|
||||
|
||||
@ -155,7 +153,6 @@ 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
|
||||
@ -178,7 +175,6 @@ 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);
|
||||
}
|
||||
|
||||
@ -186,7 +182,6 @@ 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
|
||||
@ -201,7 +196,6 @@ 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);
|
||||
}
|
||||
|
@ -23,9 +23,7 @@ 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
|
||||
*
|
||||
@ -51,9 +49,7 @@ 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);
|
||||
@ -65,9 +61,7 @@ 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
|
||||
@ -92,9 +86,7 @@ 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);
|
||||
}
|
||||
@ -103,7 +95,6 @@ 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
|
||||
@ -124,7 +115,6 @@ 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);
|
||||
}
|
||||
@ -133,7 +123,6 @@ 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)
|
||||
*
|
||||
@ -161,7 +150,6 @@ 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);
|
||||
@ -171,7 +159,6 @@ 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
|
||||
*
|
||||
@ -199,7 +186,6 @@ 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);
|
||||
@ -209,7 +195,6 @@ 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
|
||||
@ -234,7 +219,6 @@ 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);
|
||||
}
|
||||
@ -243,7 +227,6 @@ 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
|
||||
*
|
||||
@ -272,7 +255,6 @@ 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);
|
||||
|
@ -23,7 +23,6 @@ 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
|
||||
@ -38,7 +37,6 @@ 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);
|
||||
}
|
||||
@ -47,7 +45,6 @@ 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
|
||||
@ -62,7 +59,6 @@ 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);
|
||||
}
|
||||
@ -70,7 +66,6 @@ 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
|
||||
*
|
||||
@ -82,10 +77,9 @@ void EventHandler::HandleSceneRemoved(obs_source_t *source)
|
||||
* @api events
|
||||
* @category scenes
|
||||
*/
|
||||
void EventHandler::HandleSceneNameChanged(obs_source_t *source, std::string oldSceneName, std::string sceneName)
|
||||
void EventHandler::HandleSceneNameChanged(obs_source_t *, 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);
|
||||
@ -95,7 +89,6 @@ void EventHandler::HandleSceneNameChanged(obs_source_t *source, std::string oldS
|
||||
* 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
|
||||
@ -111,7 +104,6 @@ void EventHandler::HandleCurrentProgramSceneChanged()
|
||||
|
||||
json eventData;
|
||||
eventData["sceneName"] = obs_source_get_name(currentScene);
|
||||
eventData["sceneUuid"] = obs_source_get_uuid(currentScene);
|
||||
BroadcastEvent(EventSubscription::Scenes, "CurrentProgramSceneChanged", eventData);
|
||||
}
|
||||
|
||||
@ -119,7 +111,6 @@ 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
|
||||
@ -139,7 +130,6 @@ void EventHandler::HandleCurrentPreviewSceneChanged()
|
||||
|
||||
json eventData;
|
||||
eventData["sceneName"] = obs_source_get_name(currentPreviewScene);
|
||||
eventData["sceneUuid"] = obs_source_get_uuid(currentPreviewScene);
|
||||
BroadcastEvent(EventSubscription::Scenes, "CurrentPreviewSceneChanged", eventData);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@ 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
|
||||
@ -39,7 +38,6 @@ void EventHandler::HandleCurrentSceneTransitionChanged()
|
||||
|
||||
json eventData;
|
||||
eventData["transitionName"] = obs_source_get_name(transition);
|
||||
eventData["transitionUuid"] = obs_source_get_uuid(transition);
|
||||
BroadcastEvent(EventSubscription::Transitions, "CurrentSceneTransitionChanged", eventData);
|
||||
}
|
||||
|
||||
@ -67,7 +65,6 @@ void EventHandler::HandleCurrentSceneTransitionDurationChanged()
|
||||
* A scene transition has started.
|
||||
*
|
||||
* @dataField transitionName | String | Scene transition name
|
||||
* @dataField transitionUuid | String | Scene transition UUID
|
||||
*
|
||||
* @eventType SceneTransitionStarted
|
||||
* @eventSubscription Transitions
|
||||
@ -87,7 +84,6 @@ 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);
|
||||
}
|
||||
|
||||
@ -97,7 +93,6 @@ 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
|
||||
@ -117,7 +112,6 @@ 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);
|
||||
}
|
||||
|
||||
@ -130,7 +124,6 @@ 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
|
||||
@ -150,6 +143,5 @@ 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);
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ const std::unordered_map<std::string, RequestMethodHandler> RequestHandler::_han
|
||||
{"TriggerHotkeyByName", &RequestHandler::TriggerHotkeyByName},
|
||||
{"TriggerHotkeyByKeySequence", &RequestHandler::TriggerHotkeyByKeySequence},
|
||||
{"Sleep", &RequestHandler::Sleep},
|
||||
{"Compare", &RequestHandler::Compare},
|
||||
{"Assert", &RequestHandler::Assert},
|
||||
|
||||
// Config
|
||||
{"GetPersistentData", &RequestHandler::GetPersistentData},
|
||||
@ -126,7 +128,6 @@ 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},
|
||||
|
@ -52,6 +52,8 @@ private:
|
||||
RequestResult TriggerHotkeyByName(const Request &);
|
||||
RequestResult TriggerHotkeyByKeySequence(const Request &);
|
||||
RequestResult Sleep(const Request &);
|
||||
RequestResult Compare(const Request &);
|
||||
RequestResult Assert(const Request &);
|
||||
|
||||
// Config
|
||||
RequestResult GetPersistentData(const Request &);
|
||||
@ -145,7 +147,6 @@ 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 &);
|
||||
|
@ -198,7 +198,10 @@ RequestResult RequestHandler::CreateSceneCollection(const Request &request)
|
||||
if (std::find(sceneCollections.begin(), sceneCollections.end(), sceneCollectionName) != sceneCollections.end())
|
||||
return RequestResult::Error(RequestStatus::ResourceAlreadyExists);
|
||||
|
||||
bool success = obs_frontend_add_scene_collection(sceneCollectionName.c_str());
|
||||
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)));
|
||||
if (!success)
|
||||
return RequestResult::Error(RequestStatus::ResourceCreationFailed, "Failed to create the scene collection.");
|
||||
|
||||
@ -596,9 +599,9 @@ RequestResult RequestHandler::SetStreamServiceSettings(const Request &request)
|
||||
|
||||
obs_service_update(currentStreamService, newStreamServiceSettings);
|
||||
} else {
|
||||
OBSServiceAutoRelease newStreamService = obs_service_create(requestedStreamServiceType.c_str(),
|
||||
"obs_websocket_custom_service",
|
||||
requestedStreamServiceSettings, nullptr);
|
||||
// TODO: This leaks memory. I have no idea why.
|
||||
OBSService 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)
|
||||
return RequestResult::Error(
|
||||
|
@ -43,8 +43,7 @@ RequestResult RequestHandler::GetSourceFilterKindList(const Request &)
|
||||
/**
|
||||
* Gets an array of all of a source's filters.
|
||||
*
|
||||
* @requestField ?sourceName | String | Name of the source
|
||||
* @requestField ?sourceUuid | String | UUID of the source
|
||||
* @requestField sourceName | String | Name of the source
|
||||
*
|
||||
* @responseField filters | Array<Object> | Array of filters
|
||||
*
|
||||
@ -59,7 +58,7 @@ RequestResult RequestHandler::GetSourceFilterList(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
|
||||
if (!source)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -107,8 +106,7 @@ 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 ?sourceUuid | String | UUID of the source to add the filter to
|
||||
* @requestField sourceName | String | Name 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
|
||||
@ -125,7 +123,7 @@ RequestResult RequestHandler::CreateSourceFilter(const Request &request)
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
|
||||
if (!(source && request.ValidateString("filterName", statusCode, comment) &&
|
||||
request.ValidateString("filterKind", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
@ -161,9 +159,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 ?sourceUuid | String | UUID of the source the filter is on
|
||||
* @requestField filterName | String | Name of the filter to remove
|
||||
* @requestField sourceName | String | Name of the source the filter is on
|
||||
* @requestField filterName | String | Name of the filter to remove
|
||||
*
|
||||
* @requestType RemoveSourceFilter
|
||||
* @complexity 2
|
||||
@ -176,7 +173,7 @@ RequestResult RequestHandler::RemoveSourceFilter(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
FilterPair pair = request.ValidateFilter(statusCode, comment);
|
||||
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
|
||||
if (!pair.filter)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -188,8 +185,7 @@ 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 ?sourceUuid | String | UUID of the source the filter is on
|
||||
* @requestField sourceName | String | Name of the source the filter is on
|
||||
* @requestField filterName | String | Current name of the filter
|
||||
* @requestField newFilterName | String | New name for the filter
|
||||
*
|
||||
@ -204,7 +200,7 @@ RequestResult RequestHandler::SetSourceFilterName(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
FilterPair pair = request.ValidateFilter(statusCode, comment);
|
||||
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
|
||||
if (!pair.filter || !request.ValidateString("newFilterName", statusCode, comment))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -222,9 +218,8 @@ RequestResult RequestHandler::SetSourceFilterName(const Request &request)
|
||||
/**
|
||||
* Gets the info for a specific source filter.
|
||||
*
|
||||
* @requestField ?sourceName | String | Name of the source
|
||||
* @requestField ?sourceUuid | String | UUID of the source
|
||||
* @requestField filterName | String | Name of the filter
|
||||
* @requestField sourceName | String | Name of the source
|
||||
* @requestField filterName | String | Name of the filter
|
||||
*
|
||||
* @responseField filterEnabled | Boolean | Whether the filter is enabled
|
||||
* @responseField filterIndex | Number | Index of the filter in the list, beginning at 0
|
||||
@ -242,7 +237,7 @@ RequestResult RequestHandler::GetSourceFilter(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
FilterPair pair = request.ValidateFilter(statusCode, comment);
|
||||
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
|
||||
if (!pair.filter)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -262,8 +257,7 @@ 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 ?sourceUuid | String | UUID of the source the filter is on
|
||||
* @requestField sourceName | String | Name of the source the filter is on
|
||||
* @requestField filterName | String | Name of the filter
|
||||
* @requestField filterIndex | Number | New index position of the filter | >= 0
|
||||
*
|
||||
@ -278,7 +272,7 @@ RequestResult RequestHandler::SetSourceFilterIndex(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
FilterPair pair = request.ValidateFilter(statusCode, comment);
|
||||
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
|
||||
if (!(pair.filter && request.ValidateNumber("filterIndex", statusCode, comment, 0, 8192)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -292,8 +286,7 @@ 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 ?sourceUuid | String | UUID of the source the filter is on
|
||||
* @requestField sourceName | String | Name 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
|
||||
@ -309,7 +302,7 @@ RequestResult RequestHandler::SetSourceFilterSettings(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
FilterPair pair = request.ValidateFilter(statusCode, comment);
|
||||
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
|
||||
if (!(pair.filter && request.ValidateObject("filterSettings", statusCode, comment, true)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -341,8 +334,7 @@ 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 ?sourceUuid | String | UUID of the source the filter is on
|
||||
* @requestField sourceName | String | Name of the source the filter is on
|
||||
* @requestField filterName | String | Name of the filter
|
||||
* @requestField filterEnabled | Boolean | New enable state of the filter
|
||||
*
|
||||
@ -357,7 +349,7 @@ RequestResult RequestHandler::SetSourceFilterEnabled(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
FilterPair pair = request.ValidateFilter(statusCode, comment);
|
||||
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
|
||||
if (!(pair.filter && request.ValidateBoolean("filterEnabled", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
|
@ -211,14 +211,12 @@ RequestResult RequestHandler::CallVendorRequest(const Request &request)
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Gets an array of all hotkey names in OBS
|
||||
*
|
||||
* @responseField hotkeys | Array<String> | Array of hotkey names
|
||||
*
|
||||
* @requestType GetHotkeyList
|
||||
* @complexity 4
|
||||
* @complexity 3
|
||||
* @rpcVersion -1
|
||||
* @initialVersion 5.0.0
|
||||
* @category general
|
||||
@ -232,15 +230,13 @@ RequestResult RequestHandler::GetHotkeyList(const Request &)
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Triggers a hotkey using its name. See `GetHotkeyList`
|
||||
*
|
||||
* @requestField hotkeyName | String | Name of the hotkey to trigger
|
||||
* @requestField ?contextName | String | Name of context of the hotkey to trigger
|
||||
*
|
||||
* @requestType TriggerHotkeyByName
|
||||
* @complexity 4
|
||||
* @complexity 3
|
||||
* @rpcVersion -1
|
||||
* @initialVersion 5.0.0
|
||||
* @category general
|
||||
@ -273,8 +269,6 @@ 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
|
||||
@ -338,7 +332,9 @@ RequestResult RequestHandler::TriggerHotkeyByKeySequence(const Request &request)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sleeps for a time duration or number of frames. Only available in request batches with types `SERIAL_REALTIME` or `SERIAL_FRAME`.
|
||||
* Sleeps for a time duration or number of frames.
|
||||
*
|
||||
* Note: Only available in request batches with types `SERIAL_REALTIME` or `SERIAL_FRAME`.
|
||||
*
|
||||
* @requestField ?sleepMillis | Number | Number of milliseconds to sleep for (if `SERIAL_REALTIME` mode) | >= 0, <= 50000
|
||||
* @requestField ?sleepFrames | Number | Number of frames to sleep for (if `SERIAL_FRAME` mode) | >= 0, <= 10000
|
||||
@ -371,3 +367,63 @@ RequestResult RequestHandler::Sleep(const Request &request)
|
||||
return RequestResult::Error(RequestStatus::UnsupportedRequestBatchExecutionType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares the values of the two request fields, `left` and `right`.
|
||||
*
|
||||
* Note: Only available in request batches with types `SERIAL_REALTIME` or `SERIAL_FRAME`.
|
||||
*
|
||||
* @requestField left | Any | First request batch variable in comparison
|
||||
* @requestField right | Any | Second request batch variable in comparison
|
||||
*
|
||||
* @responseField result | Boolean | Whether the comparison is equal
|
||||
*
|
||||
* @requestType Compare
|
||||
* @complexity 4
|
||||
* @rpcVersion -1
|
||||
* @initialVersion 5.4.0
|
||||
* @category general
|
||||
* @api requests
|
||||
*/
|
||||
RequestResult RequestHandler::Compare(const Request &request)
|
||||
{
|
||||
if (!request.RequestData.contains("left") || !request.RequestData.contains("right"))
|
||||
return RequestResult::Error(RequestStatus::MissingRequestField, "One or more sides of the comparison are missing.");
|
||||
|
||||
bool result = request.RequestData["left"] == request.RequestData["right"];
|
||||
|
||||
json responseData;
|
||||
responseData["result"] = result;
|
||||
return RequestResult::Success(responseData);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an error if the value of `check` is not `true`.
|
||||
*
|
||||
* This can be useful to interrupt a request batch from proceeding if an assumed state does not match real-world state.
|
||||
*
|
||||
* Note: Only available in request batches with types `SERIAL_REALTIME` or `SERIAL_FRAME`.
|
||||
*
|
||||
* @requestField check | Boolean | Value to assert to be true
|
||||
*
|
||||
* @requestType Assert
|
||||
* @complexity 4
|
||||
* @rpcVersion -1
|
||||
* @initialVersion 5.4.0
|
||||
* @category general
|
||||
* @api requests
|
||||
*/
|
||||
RequestResult RequestHandler::Assert(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
if (!request.ValidateBoolean("check", statusCode, comment))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
bool check = request.RequestData["check"];
|
||||
if (!check)
|
||||
return RequestResult::Error(RequestStatus::AssertFailed, "Assertion failed.");
|
||||
|
||||
return RequestResult::Success();
|
||||
}
|
||||
|
@ -123,14 +123,12 @@ 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 ?sceneUuid | String | UUID 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 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
|
||||
@ -144,7 +142,7 @@ RequestResult RequestHandler::CreateInput(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease sceneSource = request.ValidateScene(statusCode, comment);
|
||||
OBSSourceAutoRelease sceneSource = request.ValidateScene("sceneName", statusCode, comment);
|
||||
if (!(sceneSource && request.ValidateString("inputName", statusCode, comment) &&
|
||||
request.ValidateString("inputKind", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
@ -187,7 +185,6 @@ 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);
|
||||
}
|
||||
@ -197,8 +194,7 @@ RequestResult RequestHandler::CreateInput(const Request &request)
|
||||
*
|
||||
* Note: Will immediately remove all associated scene items.
|
||||
*
|
||||
* @requestField ?inputName | String | Name of the input to remove
|
||||
* @requestField ?inputUuid | String | UUID of the input to remove
|
||||
* @requestField inputName | String | Name of the input to remove
|
||||
*
|
||||
* @requestType RemoveInput
|
||||
* @complexity 2
|
||||
@ -211,7 +207,7 @@ RequestResult RequestHandler::RemoveInput(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!input)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -226,8 +222,7 @@ RequestResult RequestHandler::RemoveInput(const Request &request)
|
||||
/**
|
||||
* Sets the name of an input (rename).
|
||||
*
|
||||
* @requestField ?inputName | String | Current input name
|
||||
* @requestField ?inputUuid | String | Current input UUID
|
||||
* @requestField inputName | String | Current input name
|
||||
* @requestField newInputName | String | New name for the input
|
||||
*
|
||||
* @requestType SetInputName
|
||||
@ -241,7 +236,7 @@ RequestResult RequestHandler::SetInputName(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!(input && request.ValidateString("newInputName", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -297,8 +292,7 @@ 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 ?inputUuid | String | UUID of the input to get the settings of
|
||||
* @requestField inputName | String | Name 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
|
||||
@ -314,7 +308,7 @@ RequestResult RequestHandler::GetInputSettings(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!input)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -329,8 +323,7 @@ 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 ?inputUuid | String | UUID of the input to set the settings of
|
||||
* @requestField inputName | String | Name 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
|
||||
*
|
||||
@ -345,7 +338,7 @@ RequestResult RequestHandler::SetInputSettings(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!(input && request.ValidateObject("inputSettings", statusCode, comment, true)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -380,8 +373,7 @@ 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 ?inputUuid | String | UUID of input to get the mute state of
|
||||
* @requestField inputName | String | Name of input to get the mute state of
|
||||
*
|
||||
* @responseField inputMuted | Boolean | Whether the input is muted
|
||||
*
|
||||
@ -396,7 +388,7 @@ RequestResult RequestHandler::GetInputMute(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!input)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -411,8 +403,7 @@ 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 ?inputUuid | String | UUID of the input to set the mute state of
|
||||
* @requestField inputName | String | Name of the input to set the mute state of
|
||||
* @requestField inputMuted | Boolean | Whether to mute the input or not
|
||||
*
|
||||
* @requestType SetInputMute
|
||||
@ -426,7 +417,7 @@ RequestResult RequestHandler::SetInputMute(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!(input && request.ValidateBoolean("inputMuted", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -441,8 +432,7 @@ 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 ?inputUuid | String | UUID of the input to toggle the mute state of
|
||||
* @requestField inputName | String | Name of the input to toggle the mute state of
|
||||
*
|
||||
* @responseField inputMuted | Boolean | Whether the input has been muted or unmuted
|
||||
*
|
||||
@ -457,7 +447,7 @@ RequestResult RequestHandler::ToggleInputMute(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!input)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -475,8 +465,7 @@ 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 ?inputUuid | String | UUID of the input to get the volume of
|
||||
* @requestField inputName | String | Name of the input to get the volume of
|
||||
*
|
||||
* @responseField inputVolumeMul | Number | Volume setting in mul
|
||||
* @responseField inputVolumeDb | Number | Volume setting in dB
|
||||
@ -492,7 +481,7 @@ RequestResult RequestHandler::GetInputVolume(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!input)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -513,8 +502,7 @@ 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 ?inputUuid | String | UUID of the input to set the volume of
|
||||
* @requestField inputName | String | Name 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
|
||||
*
|
||||
@ -529,7 +517,7 @@ RequestResult RequestHandler::SetInputVolume(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!input)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -564,8 +552,7 @@ 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 ?inputUuid | String | UUID of the input to get the audio balance of
|
||||
* @requestField inputName | String | Name of the input to get the audio balance of
|
||||
*
|
||||
* @responseField inputAudioBalance | Number | Audio balance value from 0.0-1.0
|
||||
*
|
||||
@ -580,7 +567,7 @@ RequestResult RequestHandler::GetInputAudioBalance(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!input)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -596,8 +583,7 @@ 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 ?inputUuid | String | UUID of the input to set the audio balance of
|
||||
* @requestField inputName | String | Name of the input to set the audio balance of
|
||||
* @requestField inputAudioBalance | Number | New audio balance value | >= 0.0, <= 1.0
|
||||
*
|
||||
* @requestType SetInputAudioBalance
|
||||
@ -611,7 +597,7 @@ RequestResult RequestHandler::SetInputAudioBalance(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!(input && request.ValidateNumber("inputAudioBalance", statusCode, comment, 0.0, 1.0)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -629,8 +615,7 @@ 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 ?inputUuid | String | UUID of the input to get the audio sync offset of
|
||||
* @requestField inputName | String | Name of the input to get the audio sync offset of
|
||||
*
|
||||
* @responseField inputAudioSyncOffset | Number | Audio sync offset in milliseconds
|
||||
*
|
||||
@ -645,7 +630,7 @@ RequestResult RequestHandler::GetInputAudioSyncOffset(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!input)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -662,8 +647,7 @@ 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 ?inputUuid | String | UUID 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 inputAudioSyncOffset | Number | New audio sync offset in milliseconds | >= -950, <= 20000
|
||||
*
|
||||
* @requestType SetInputAudioSyncOffset
|
||||
@ -677,7 +661,7 @@ RequestResult RequestHandler::SetInputAudioSyncOffset(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!(input && request.ValidateNumber("inputAudioSyncOffset", statusCode, comment, -950, 20000)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -699,8 +683,7 @@ 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 ?inputUuid | String | UUID of the input to get the audio monitor type of
|
||||
* @requestField inputName | String | Name of the input to get the audio monitor type of
|
||||
*
|
||||
* @responseField monitorType | String | Audio monitor type
|
||||
*
|
||||
@ -715,7 +698,7 @@ RequestResult RequestHandler::GetInputAudioMonitorType(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!input)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -731,8 +714,7 @@ 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 ?inputUuid | String | UUID 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 monitorType | String | Audio monitor type
|
||||
*
|
||||
* @requestType SetInputAudioMonitorType
|
||||
@ -746,7 +728,7 @@ RequestResult RequestHandler::SetInputAudioMonitorType(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!(input && request.ValidateString("monitorType", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -777,8 +759,7 @@ 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 ?inputUuid | String | UUID of the input
|
||||
* @requestField inputName | String | Name of the input
|
||||
*
|
||||
* @responseField inputAudioTracks | Object | Object of audio tracks and associated enable states
|
||||
*
|
||||
@ -793,7 +774,7 @@ RequestResult RequestHandler::GetInputAudioTracks(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!input)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -816,8 +797,7 @@ RequestResult RequestHandler::GetInputAudioTracks(const Request &request)
|
||||
/**
|
||||
* Sets the enable state of audio tracks of an input.
|
||||
*
|
||||
* @requestField ?inputName | String | Name of the input
|
||||
* @requestField ?inputUuid | String | UUID of the input
|
||||
* @requestField inputName | String | Name of the input
|
||||
* @requestField inputAudioTracks | Object | Track settings to apply
|
||||
*
|
||||
* @requestType SetInputAudioTracks
|
||||
@ -831,7 +811,7 @@ RequestResult RequestHandler::SetInputAudioTracks(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!input || !request.ValidateObject("inputAudioTracks", statusCode, comment))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -871,8 +851,7 @@ 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 ?inputUuid | String | UUID of the input
|
||||
* @requestField inputName | String | Name 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
|
||||
@ -888,7 +867,7 @@ RequestResult RequestHandler::GetInputPropertiesListPropertyItems(const Request
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!(input && request.ValidateString("propertyName", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -916,8 +895,7 @@ 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 ?inputUuid | String | UUID of the input
|
||||
* @requestField inputName | String | Name of the input
|
||||
* @requestField propertyName | String | Name of the button property to press
|
||||
*
|
||||
* @requestType PressInputPropertiesButton
|
||||
@ -931,7 +909,7 @@ RequestResult RequestHandler::PressInputPropertiesButton(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!(input && request.ValidateString("propertyName", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
|
@ -39,8 +39,7 @@ bool IsMediaTimeValid(obs_source_t *input)
|
||||
* - `OBS_MEDIA_STATE_ENDED`
|
||||
* - `OBS_MEDIA_STATE_ERROR`
|
||||
*
|
||||
* @requestField ?inputName | String | Name of the media input
|
||||
* @requestField ?inputUuid | String | UUID of the media input
|
||||
* @requestField inputName | String | Name 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
|
||||
@ -57,7 +56,7 @@ RequestResult RequestHandler::GetMediaInputStatus(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!input)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -81,8 +80,7 @@ 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 ?inputUuid | String | UUID of the media input
|
||||
* @requestField inputName | String | Name of the media input
|
||||
* @requestField mediaCursor | Number | New cursor position to set | >= 0
|
||||
*
|
||||
* @requestType SetMediaInputCursor
|
||||
@ -96,7 +94,7 @@ RequestResult RequestHandler::SetMediaInputCursor(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!(input && request.ValidateNumber("mediaCursor", statusCode, comment, 0)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -117,8 +115,7 @@ 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 ?inputUuid | String | UUID of the media input
|
||||
* @requestField inputName | String | Name of the media input
|
||||
* @requestField mediaCursorOffset | Number | Value to offset the current cursor position by | None
|
||||
*
|
||||
* @requestType OffsetMediaInputCursor
|
||||
@ -132,7 +129,7 @@ RequestResult RequestHandler::OffsetMediaInputCursor(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!(input && request.ValidateNumber("mediaCursorOffset", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -154,8 +151,7 @@ RequestResult RequestHandler::OffsetMediaInputCursor(const Request &request)
|
||||
/**
|
||||
* Triggers an action on a media input.
|
||||
*
|
||||
* @requestField ?inputName | String | Name of the media input
|
||||
* @requestField ?inputUuid | String | UUID of the media input
|
||||
* @requestField inputName | String | Name of the media input
|
||||
* @requestField mediaAction | String | Identifier of the `ObsMediaInputAction` enum
|
||||
*
|
||||
* @requestType TriggerMediaInputAction
|
||||
@ -169,7 +165,7 @@ RequestResult RequestHandler::TriggerMediaInputAction(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!(input && request.ValidateString("mediaAction", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
|
@ -24,8 +24,7 @@ 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 ?sceneUuid | String | UUID of the scene to get the items of
|
||||
* @requestField sceneName | String | Name of the scene to get the items of
|
||||
*
|
||||
* @responseField sceneItems | Array<Object> | Array of scene items in the scene
|
||||
*
|
||||
@ -40,7 +39,7 @@ RequestResult RequestHandler::GetSceneItemList(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease scene = request.ValidateScene(statusCode, comment);
|
||||
OBSSourceAutoRelease scene = request.ValidateScene("sceneName", statusCode, comment);
|
||||
if (!scene)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -57,8 +56,7 @@ RequestResult RequestHandler::GetSceneItemList(const Request &request)
|
||||
*
|
||||
* Groups only
|
||||
*
|
||||
* @requestField ?sceneName | String | Name of the group to get the items of
|
||||
* @requestField ?sceneUuid | String | UUID of the group to get the items of
|
||||
* @requestField sceneName | String | Name of the group to get the items of
|
||||
*
|
||||
* @responseField sceneItems | Array<Object> | Array of scene items in the group
|
||||
*
|
||||
@ -73,7 +71,7 @@ RequestResult RequestHandler::GetGroupSceneItemList(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease scene = request.ValidateScene(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_GROUP_ONLY);
|
||||
OBSSourceAutoRelease scene = request.ValidateScene("sceneName", statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_GROUP_ONLY);
|
||||
if (!scene)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -88,8 +86,7 @@ RequestResult RequestHandler::GetGroupSceneItemList(const Request &request)
|
||||
*
|
||||
* Scenes and Groups
|
||||
*
|
||||
* @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 sceneName | String | Name 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
|
||||
*
|
||||
@ -107,8 +104,8 @@ RequestResult RequestHandler::GetSceneItemId(const Request &request)
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSceneAutoRelease scene =
|
||||
request.ValidateScene2(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
if (!(scene && request.ValidateString("sourceName", statusCode, comment))) // TODO: Source UUID support
|
||||
request.ValidateScene2("sceneName", statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
if (!(scene && request.ValidateString("sourceName", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
std::string sourceName = request.RequestData["sourceName"];
|
||||
@ -131,49 +128,13 @@ 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 ?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 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 ?sceneItemEnabled | Boolean | Enable state to apply to the scene item on creation | True
|
||||
*
|
||||
* @responseField sceneItemId | Number | Numeric ID of the scene item
|
||||
@ -189,17 +150,17 @@ RequestResult RequestHandler::CreateSceneItem(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease sceneSource = request.ValidateScene(statusCode, comment);
|
||||
OBSSourceAutoRelease sceneSource = request.ValidateScene("sceneName", statusCode, comment);
|
||||
if (!sceneSource)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
OBSScene scene = obs_scene_from_source(sceneSource);
|
||||
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
|
||||
if (!source)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
if (sceneSource == source)
|
||||
if (request.RequestData["sceneName"] == request.RequestData["sourceName"])
|
||||
return RequestResult::Error(RequestStatus::CannotAct, "You cannot create scene item of a scene within itself.");
|
||||
|
||||
bool sceneItemEnabled = true;
|
||||
@ -224,8 +185,7 @@ RequestResult RequestHandler::CreateSceneItem(const Request &request)
|
||||
*
|
||||
* Scenes only
|
||||
*
|
||||
* @requestField ?sceneName | String | Name of the scene the item is in
|
||||
* @requestField ?sceneUuid | String | UUID of the scene the item is in
|
||||
* @requestField sceneName | String | Name of the scene the item is in
|
||||
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
|
||||
*
|
||||
* @requestType RemoveSceneItem
|
||||
@ -239,7 +199,7 @@ RequestResult RequestHandler::RemoveSceneItem(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment);
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment);
|
||||
if (!sceneItem)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -254,11 +214,9 @@ RequestResult RequestHandler::RemoveSceneItem(const Request &request)
|
||||
*
|
||||
* Scenes only
|
||||
*
|
||||
* @requestField ?sceneName | String | Name of the scene the item is in
|
||||
* @requestField ?sceneUuid | String | UUID of the scene the item is in
|
||||
* @requestField sceneName | String | Name 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 | From scene is assumed
|
||||
* @requestField ?destinationSceneUuid | String | UUID of the scene to create the duplicated item in | From scene is assumed
|
||||
* @requestField ?destinationSceneName | String | Name of the scene to create the duplicated item in | `sceneName` is assumed
|
||||
*
|
||||
* @responseField sceneItemId | Number | Numeric ID of the duplicated scene item
|
||||
*
|
||||
@ -273,24 +231,16 @@ RequestResult RequestHandler::DuplicateSceneItem(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment);
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment);
|
||||
if (!sceneItem)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
// Get destination scene
|
||||
obs_scene_t *destinationScene;
|
||||
if (request.Contains("destinationSceneName")) {
|
||||
OBSSourceAutoRelease destinationSceneSource = request.ValidateSource("destinationSceneName", "destinationSceneUuid", statusCode, comment);
|
||||
if (!destinationSceneSource)
|
||||
destinationScene = request.ValidateScene2("destinationSceneName", statusCode, comment);
|
||||
if (!destinationScene)
|
||||
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)
|
||||
@ -308,7 +258,7 @@ RequestResult RequestHandler::DuplicateSceneItem(const Request &request)
|
||||
bool sceneItemEnabled = obs_sceneitem_visible(sceneItem);
|
||||
obs_transform_info sceneItemTransform;
|
||||
obs_sceneitem_crop sceneItemCrop;
|
||||
obs_sceneitem_get_info2(sceneItem, &sceneItemTransform);
|
||||
obs_sceneitem_get_info(sceneItem, &sceneItemTransform);
|
||||
obs_sceneitem_get_crop(sceneItem, &sceneItemCrop);
|
||||
|
||||
// Create the new item
|
||||
@ -329,8 +279,7 @@ RequestResult RequestHandler::DuplicateSceneItem(const Request &request)
|
||||
*
|
||||
* Scenes and Groups
|
||||
*
|
||||
* @requestField ?sceneName | String | Name of the scene the item is in
|
||||
* @requestField ?sceneUuid | String | UUID of the scene the item is in
|
||||
* @requestField sceneName | String | Name 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
|
||||
@ -346,7 +295,8 @@ RequestResult RequestHandler::GetSceneItemTransform(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
|
||||
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
if (!sceneItem)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -359,8 +309,7 @@ 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 ?sceneUuid | String | UUID of the scene the item is in
|
||||
* @requestField sceneName | String | Name 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
|
||||
*
|
||||
@ -375,7 +324,8 @@ RequestResult RequestHandler::SetSceneItemTransform(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
|
||||
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
if (!(sceneItem && request.ValidateObject("sceneItemTransform", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -386,7 +336,7 @@ RequestResult RequestHandler::SetSceneItemTransform(const Request &request)
|
||||
bool cropChanged = false;
|
||||
obs_transform_info sceneItemTransform;
|
||||
obs_sceneitem_crop sceneItemCrop;
|
||||
obs_sceneitem_get_info2(sceneItem, &sceneItemTransform);
|
||||
obs_sceneitem_get_info(sceneItem, &sceneItemTransform);
|
||||
obs_sceneitem_get_crop(sceneItem, &sceneItemCrop);
|
||||
|
||||
OBSSource source = obs_sceneitem_get_source(sceneItem);
|
||||
@ -503,7 +453,7 @@ RequestResult RequestHandler::SetSceneItemTransform(const Request &request)
|
||||
return RequestResult::Error(RequestStatus::CannotAct, "You have not provided any valid transform changes.");
|
||||
|
||||
if (transformChanged)
|
||||
obs_sceneitem_set_info2(sceneItem, &sceneItemTransform);
|
||||
obs_sceneitem_set_info(sceneItem, &sceneItemTransform);
|
||||
|
||||
if (cropChanged)
|
||||
obs_sceneitem_set_crop(sceneItem, &sceneItemCrop);
|
||||
@ -516,8 +466,7 @@ RequestResult RequestHandler::SetSceneItemTransform(const Request &request)
|
||||
*
|
||||
* Scenes and Groups
|
||||
*
|
||||
* @requestField ?sceneName | String | Name of the scene the item is in
|
||||
* @requestField ?sceneUuid | String | UUID of the scene the item is in
|
||||
* @requestField sceneName | String | Name 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
|
||||
@ -533,7 +482,8 @@ RequestResult RequestHandler::GetSceneItemEnabled(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
|
||||
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
if (!sceneItem)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -548,8 +498,7 @@ RequestResult RequestHandler::GetSceneItemEnabled(const Request &request)
|
||||
*
|
||||
* Scenes and Groups
|
||||
*
|
||||
* @requestField ?sceneName | String | Name of the scene the item is in
|
||||
* @requestField ?sceneUuid | String | UUID of the scene the item is in
|
||||
* @requestField sceneName | String | Name 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
|
||||
*
|
||||
@ -564,7 +513,8 @@ RequestResult RequestHandler::SetSceneItemEnabled(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
|
||||
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
if (!(sceneItem && request.ValidateBoolean("sceneItemEnabled", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -580,8 +530,7 @@ RequestResult RequestHandler::SetSceneItemEnabled(const Request &request)
|
||||
*
|
||||
* Scenes and Groups
|
||||
*
|
||||
* @requestField ?sceneName | String | Name of the scene the item is in
|
||||
* @requestField ?sceneUuid | String | UUID of the scene the item is in
|
||||
* @requestField sceneName | String | Name 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
|
||||
@ -597,7 +546,8 @@ RequestResult RequestHandler::GetSceneItemLocked(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
|
||||
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
if (!sceneItem)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -612,9 +562,8 @@ RequestResult RequestHandler::GetSceneItemLocked(const Request &request)
|
||||
*
|
||||
* Scenes and Group
|
||||
*
|
||||
* @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 sceneName | String | Name 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
|
||||
*
|
||||
* @requestType SetSceneItemLocked
|
||||
@ -628,7 +577,8 @@ RequestResult RequestHandler::SetSceneItemLocked(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
|
||||
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
if (!(sceneItem && request.ValidateBoolean("sceneItemLocked", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -646,8 +596,7 @@ RequestResult RequestHandler::SetSceneItemLocked(const Request &request)
|
||||
*
|
||||
* Scenes and Groups
|
||||
*
|
||||
* @requestField ?sceneName | String | Name of the scene the item is in
|
||||
* @requestField ?sceneUuid | String | UUID of the scene the item is in
|
||||
* @requestField sceneName | String | Name 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
|
||||
@ -663,7 +612,8 @@ RequestResult RequestHandler::GetSceneItemIndex(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
|
||||
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
if (!sceneItem)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -678,8 +628,7 @@ RequestResult RequestHandler::GetSceneItemIndex(const Request &request)
|
||||
*
|
||||
* Scenes and Groups
|
||||
*
|
||||
* @requestField ?sceneName | String | Name of the scene the item is in
|
||||
* @requestField ?sceneUuid | String | UUID of the scene the item is in
|
||||
* @requestField sceneName | String | Name 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
|
||||
*
|
||||
@ -694,7 +643,8 @@ RequestResult RequestHandler::SetSceneItemIndex(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
|
||||
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
if (!(sceneItem && request.ValidateNumber("sceneItemIndex", statusCode, comment, 0, 8192)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -720,8 +670,7 @@ RequestResult RequestHandler::SetSceneItemIndex(const Request &request)
|
||||
*
|
||||
* Scenes and Groups
|
||||
*
|
||||
* @requestField ?sceneName | String | Name of the scene the item is in
|
||||
* @requestField ?sceneUuid | String | UUID of the scene the item is in
|
||||
* @requestField sceneName | String | Name of the scene the item is in
|
||||
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
|
||||
*
|
||||
* @responseField sceneItemBlendMode | String | Current blend mode
|
||||
@ -737,7 +686,8 @@ RequestResult RequestHandler::GetSceneItemBlendMode(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
|
||||
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
if (!sceneItem)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -754,8 +704,7 @@ RequestResult RequestHandler::GetSceneItemBlendMode(const Request &request)
|
||||
*
|
||||
* Scenes and Groups
|
||||
*
|
||||
* @requestField ?sceneName | String | Name of the scene the item is in
|
||||
* @requestField ?sceneUuid | String | UUID of the scene the item is in
|
||||
* @requestField sceneName | String | Name of the scene the item is in
|
||||
* @requestField sceneItemId | Number | Numeric ID of the scene item | >= 0
|
||||
* @requestField sceneItemBlendMode | String | New blend mode
|
||||
*
|
||||
@ -770,7 +719,8 @@ RequestResult RequestHandler::SetSceneItemBlendMode(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
|
||||
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
if (!(sceneItem && request.ValidateString("sceneItemBlendMode", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -789,7 +739,8 @@ RequestResult RequestHandler::GetSceneItemPrivateSettings(const Request &request
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
|
||||
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
if (!sceneItem)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -806,7 +757,8 @@ RequestResult RequestHandler::SetSceneItemPrivateSettings(const Request &request
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem(statusCode, comment, OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
OBSSceneItemAutoRelease sceneItem = request.ValidateSceneItem("sceneName", "sceneItemId", statusCode, comment,
|
||||
OBS_WEBSOCKET_SCENE_FILTER_SCENE_OR_GROUP);
|
||||
if (!sceneItem || !request.ValidateObject("sceneItemSettings", statusCode, comment, true))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
|
@ -22,10 +22,8 @@ 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 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 currentProgramSceneName | String | Current program scene
|
||||
* @responseField currentPreviewSceneName | String | Current preview scene. `null` if not in studio mode
|
||||
* @responseField scenes | Array<Object> | Array of scenes
|
||||
*
|
||||
* @requestType GetSceneList
|
||||
@ -40,22 +38,16 @@ 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);
|
||||
responseData["currentProgramSceneUuid"] = obs_source_get_uuid(currentProgramScene);
|
||||
} else {
|
||||
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);
|
||||
responseData["currentPreviewSceneUuid"] = obs_source_get_uuid(currentPreviewScene);
|
||||
} else {
|
||||
else
|
||||
responseData["currentPreviewSceneName"] = nullptr;
|
||||
responseData["currentPreviewSceneUuid"] = nullptr;
|
||||
}
|
||||
|
||||
responseData["scenes"] = Utils::Obs::ArrayHelper::GetSceneList();
|
||||
|
||||
@ -88,12 +80,7 @@ RequestResult RequestHandler::GetGroupList(const Request &)
|
||||
/**
|
||||
* Gets the 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)
|
||||
* @responseField currentProgramSceneName | String | Current program scene
|
||||
*
|
||||
* @requestType GetCurrentProgramScene
|
||||
* @complexity 1
|
||||
@ -106,8 +93,7 @@ RequestResult RequestHandler::GetCurrentProgramScene(const Request &)
|
||||
{
|
||||
json responseData;
|
||||
OBSSourceAutoRelease currentProgramScene = obs_frontend_get_current_scene();
|
||||
responseData["sceneName"] = responseData["currentProgramSceneName"] = obs_source_get_name(currentProgramScene);
|
||||
responseData["sceneUuid"] = responseData["currentProgramSceneUuid"] = obs_source_get_uuid(currentProgramScene);
|
||||
responseData["currentProgramSceneName"] = obs_source_get_name(currentProgramScene);
|
||||
|
||||
return RequestResult::Success(responseData);
|
||||
}
|
||||
@ -115,8 +101,7 @@ RequestResult RequestHandler::GetCurrentProgramScene(const Request &)
|
||||
/**
|
||||
* Sets 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
|
||||
* @requestField sceneName | String | Scene to set as the current program scene
|
||||
*
|
||||
* @requestType SetCurrentProgramScene
|
||||
* @complexity 1
|
||||
@ -129,7 +114,7 @@ RequestResult RequestHandler::SetCurrentProgramScene(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease scene = request.ValidateScene(statusCode, comment);
|
||||
OBSSourceAutoRelease scene = request.ValidateScene("sceneName", statusCode, comment);
|
||||
if (!scene)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -143,12 +128,7 @@ RequestResult RequestHandler::SetCurrentProgramScene(const Request &request)
|
||||
*
|
||||
* Only available when studio mode is enabled.
|
||||
*
|
||||
* 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
|
||||
* @responseField currentPreviewSceneName | String | Current preview scene
|
||||
*
|
||||
* @requestType GetCurrentPreviewScene
|
||||
* @complexity 1
|
||||
@ -165,8 +145,7 @@ RequestResult RequestHandler::GetCurrentPreviewScene(const Request &)
|
||||
OBSSourceAutoRelease currentPreviewScene = obs_frontend_get_current_preview_scene();
|
||||
|
||||
json responseData;
|
||||
responseData["sceneName"] = responseData["currentPreviewSceneName"] = obs_source_get_name(currentPreviewScene);
|
||||
responseData["sceneUuid"] = responseData["currentPreviewSceneUuid"] = obs_source_get_uuid(currentPreviewScene);
|
||||
responseData["currentPreviewSceneName"] = obs_source_get_name(currentPreviewScene);
|
||||
|
||||
return RequestResult::Success(responseData);
|
||||
}
|
||||
@ -176,8 +155,7 @@ RequestResult RequestHandler::GetCurrentPreviewScene(const Request &)
|
||||
*
|
||||
* Only available when studio mode is enabled.
|
||||
*
|
||||
* @requestField ?sceneName | String | Scene name to set as the current preview scene
|
||||
* @requestField ?sceneUuid | String | Scene UUID to set as the current preview scene
|
||||
* @requestField sceneName | String | Scene to set as the current preview scene
|
||||
*
|
||||
* @requestType SetCurrentPreviewScene
|
||||
* @complexity 1
|
||||
@ -193,7 +171,7 @@ RequestResult RequestHandler::SetCurrentPreviewScene(const Request &request)
|
||||
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease scene = request.ValidateScene(statusCode, comment);
|
||||
OBSSourceAutoRelease scene = request.ValidateScene("sceneName", statusCode, comment);
|
||||
if (!scene)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -207,8 +185,6 @@ 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
|
||||
@ -229,21 +205,19 @@ RequestResult RequestHandler::CreateScene(const Request &request)
|
||||
if (scene)
|
||||
return RequestResult::Error(RequestStatus::ResourceAlreadyExists, "A source already exists by that scene name.");
|
||||
|
||||
OBSSceneAutoRelease createdScene = obs_scene_create(sceneName.c_str());
|
||||
obs_scene_t *createdScene = obs_scene_create(sceneName.c_str());
|
||||
if (!createdScene)
|
||||
return RequestResult::Error(RequestStatus::ResourceCreationFailed, "Failed to create the scene.");
|
||||
|
||||
json responseData;
|
||||
responseData["sceneUuid"] = obs_source_get_uuid(obs_scene_get_source(createdScene));
|
||||
obs_scene_release(createdScene);
|
||||
|
||||
return RequestResult::Success(responseData);
|
||||
return RequestResult::Success();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a scene from OBS.
|
||||
*
|
||||
* @requestField ?sceneName | String | Name of the scene to remove
|
||||
* @requestField ?sceneUuid | String | UUID of the scene to remove
|
||||
* @requestField sceneName | String | Name of the scene to remove
|
||||
*
|
||||
* @requestType RemoveScene
|
||||
* @complexity 2
|
||||
@ -256,7 +230,7 @@ RequestResult RequestHandler::RemoveScene(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease scene = request.ValidateScene(statusCode, comment);
|
||||
OBSSourceAutoRelease scene = request.ValidateScene("sceneName", statusCode, comment);
|
||||
if (!scene)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -272,8 +246,7 @@ RequestResult RequestHandler::RemoveScene(const Request &request)
|
||||
/**
|
||||
* Sets the name of a scene (rename).
|
||||
*
|
||||
* @requestField ?sceneName | String | Name of the scene to be renamed
|
||||
* @requestField ?sceneUuid | String | UUID of the scene to be renamed
|
||||
* @requestField sceneName | String | Name of the scene to be renamed
|
||||
* @requestField newSceneName | String | New name for the scene
|
||||
*
|
||||
* @requestType SetSceneName
|
||||
@ -287,7 +260,7 @@ RequestResult RequestHandler::SetSceneName(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease scene = request.ValidateScene(statusCode, comment);
|
||||
OBSSourceAutoRelease scene = request.ValidateScene("sceneName", statusCode, comment);
|
||||
if (!(scene && request.ValidateString("newSceneName", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -306,10 +279,7 @@ RequestResult RequestHandler::SetSceneName(const Request &request)
|
||||
/**
|
||||
* Gets the scene transition overridden for a 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
|
||||
* @requestField sceneName | String | Name 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`
|
||||
@ -325,7 +295,7 @@ RequestResult RequestHandler::GetSceneSceneTransitionOverride(const Request &req
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease scene = request.ValidateScene(statusCode, comment);
|
||||
OBSSourceAutoRelease scene = request.ValidateScene("sceneName", statusCode, comment);
|
||||
if (!scene)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -349,8 +319,7 @@ RequestResult RequestHandler::GetSceneSceneTransitionOverride(const Request &req
|
||||
/**
|
||||
* Sets the scene transition overridden for a scene.
|
||||
*
|
||||
* @requestField ?sceneName | String | Name of the scene
|
||||
* @requestField ?sceneUuid | String | UUID of the scene
|
||||
* @requestField sceneName | String | Name 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
|
||||
*
|
||||
@ -365,7 +334,7 @@ RequestResult RequestHandler::SetSceneSceneTransitionOverride(const Request &req
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease scene = request.ValidateScene(statusCode, comment);
|
||||
OBSSourceAutoRelease scene = request.ValidateScene("sceneName", statusCode, comment);
|
||||
if (!scene)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
|
@ -114,8 +114,7 @@ bool IsImageFormatValid(std::string format)
|
||||
*
|
||||
* **Compatible with inputs and scenes.**
|
||||
*
|
||||
* @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
|
||||
* @requestField sourceName | String | Name 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)
|
||||
@ -131,7 +130,7 @@ RequestResult RequestHandler::GetSourceActive(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
|
||||
if (!source)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -152,8 +151,7 @@ RequestResult RequestHandler::GetSourceActive(const Request &request)
|
||||
*
|
||||
* **Compatible with inputs and scenes.**
|
||||
*
|
||||
* @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 sourceName | String | Name 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
|
||||
@ -172,7 +170,7 @@ RequestResult RequestHandler::GetSourceScreenshot(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
|
||||
if (!(source && request.ValidateString("imageFormat", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -240,14 +238,15 @@ RequestResult RequestHandler::GetSourceScreenshot(const Request &request)
|
||||
*
|
||||
* **Compatible with inputs and scenes.**
|
||||
*
|
||||
* @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 sourceName | String | Name 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
|
||||
@ -259,7 +258,7 @@ RequestResult RequestHandler::SaveSourceScreenshot(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
|
||||
if (!(source && request.ValidateString("imageFormat", statusCode, comment) &&
|
||||
request.ValidateString("imageFilePath", statusCode, comment)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
@ -322,7 +321,7 @@ RequestResult RequestHandler::GetSourcePrivateSettings(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
|
||||
if (!source)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -339,7 +338,7 @@ RequestResult RequestHandler::SetSourcePrivateSettings(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
|
||||
if (!source || !request.ValidateObject("sourceSettings", statusCode, comment, true))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
|
@ -46,7 +46,6 @@ 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
|
||||
*
|
||||
@ -64,11 +63,9 @@ 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;
|
||||
}
|
||||
|
||||
@ -81,7 +78,6 @@ 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
|
||||
@ -104,7 +100,6 @@ 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)) {
|
||||
|
@ -82,8 +82,7 @@ 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 ?inputUuid | String | UUID of the input to open the dialog of
|
||||
* @requestField inputName | String | Name of the input to open the dialog of
|
||||
*
|
||||
* @requestType OpenInputPropertiesDialog
|
||||
* @complexity 1
|
||||
@ -96,7 +95,7 @@ RequestResult RequestHandler::OpenInputPropertiesDialog(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!input)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -108,8 +107,7 @@ 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 ?inputUuid | String | UUID of the input to open the dialog of
|
||||
* @requestField inputName | String | Name of the input to open the dialog of
|
||||
*
|
||||
* @requestType OpenInputFiltersDialog
|
||||
* @complexity 1
|
||||
@ -122,7 +120,7 @@ RequestResult RequestHandler::OpenInputFiltersDialog(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!input)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -134,8 +132,7 @@ 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 ?inputUuid | String | UUID of the input to open the dialog of
|
||||
* @requestField inputName | String | Name of the input to open the dialog of
|
||||
*
|
||||
* @requestType OpenInputInteractDialog
|
||||
* @complexity 1
|
||||
@ -148,7 +145,7 @@ RequestResult RequestHandler::OpenInputInteractDialog(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease input = request.ValidateInput(statusCode, comment);
|
||||
OBSSourceAutoRelease input = request.ValidateInput("inputName", statusCode, comment);
|
||||
if (!input)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
@ -265,8 +262,7 @@ 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 ?sourceUuid | String | UUID of the source to open a projector for
|
||||
* @requestField sourceName | String | Name 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
|
||||
*
|
||||
@ -281,7 +277,7 @@ RequestResult RequestHandler::OpenSourceProjector(const Request &request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
|
||||
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
|
||||
if (!source)
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
|
@ -211,39 +211,28 @@ bool Request::ValidateArray(const std::string &keyName, RequestStatus::RequestSt
|
||||
return true;
|
||||
}
|
||||
|
||||
obs_source_t *Request::ValidateSource(const std::string &nameKeyName, const std::string &uuidKeyName, RequestStatus::RequestStatus &statusCode,
|
||||
obs_source_t *Request::ValidateSource(const std::string &keyName, RequestStatus::RequestStatus &statusCode,
|
||||
std::string &comment) const
|
||||
{
|
||||
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;
|
||||
if (!ValidateString(keyName, statusCode, comment))
|
||||
return nullptr;
|
||||
|
||||
std::string sourceName = RequestData[keyName];
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
return ret;
|
||||
}
|
||||
|
||||
obs_source_t *Request::ValidateScene(RequestStatus::RequestStatus &statusCode, std::string &comment, const ObsWebSocketSceneFilter filter) const
|
||||
obs_source_t *Request::ValidateScene(const std::string &keyName, RequestStatus::RequestStatus &statusCode, std::string &comment,
|
||||
const ObsWebSocketSceneFilter filter) const
|
||||
{
|
||||
obs_source_t *ret = ValidateSource("sceneName", "sceneUuid", statusCode, comment);
|
||||
obs_source_t *ret = ValidateSource(keyName, statusCode, comment);
|
||||
if (!ret)
|
||||
return nullptr;
|
||||
|
||||
@ -270,9 +259,10 @@ obs_source_t *Request::ValidateScene(RequestStatus::RequestStatus &statusCode, s
|
||||
return ret;
|
||||
}
|
||||
|
||||
obs_scene_t *Request::ValidateScene2(RequestStatus::RequestStatus &statusCode, std::string &comment, const ObsWebSocketSceneFilter filter) const
|
||||
obs_scene_t *Request::ValidateScene2(const std::string &keyName, RequestStatus::RequestStatus &statusCode, std::string &comment,
|
||||
const ObsWebSocketSceneFilter filter) const
|
||||
{
|
||||
OBSSourceAutoRelease sceneSource = ValidateSource("sceneName", "sceneUuid", statusCode, comment);
|
||||
OBSSourceAutoRelease sceneSource = ValidateSource(keyName, statusCode, comment);
|
||||
if (!sceneSource)
|
||||
return nullptr;
|
||||
|
||||
@ -300,9 +290,10 @@ obs_scene_t *Request::ValidateScene2(RequestStatus::RequestStatus &statusCode, s
|
||||
}
|
||||
}
|
||||
|
||||
obs_source_t *Request::ValidateInput(RequestStatus::RequestStatus &statusCode, std::string &comment) const
|
||||
obs_source_t *Request::ValidateInput(const std::string &keyName, RequestStatus::RequestStatus &statusCode,
|
||||
std::string &comment) const
|
||||
{
|
||||
obs_source_t *ret = ValidateSource("inputName", "inputUuid", statusCode, comment);
|
||||
obs_source_t *ret = ValidateSource(keyName, statusCode, comment);
|
||||
if (!ret)
|
||||
return nullptr;
|
||||
|
||||
@ -316,44 +307,47 @@ obs_source_t *Request::ValidateInput(RequestStatus::RequestStatus &statusCode, s
|
||||
return ret;
|
||||
}
|
||||
|
||||
FilterPair Request::ValidateFilter(RequestStatus::RequestStatus &statusCode, std::string &comment) const
|
||||
FilterPair Request::ValidateFilter(const std::string &sourceKeyName, const std::string &filterKeyName,
|
||||
RequestStatus::RequestStatus &statusCode, std::string &comment) const
|
||||
{
|
||||
obs_source_t *source = ValidateSource("sourceName", "sourceUuid", statusCode, comment);
|
||||
obs_source_t *source = ValidateSource(sourceKeyName, statusCode, comment);
|
||||
if (!source)
|
||||
return FilterPair{source, nullptr};
|
||||
|
||||
if (!ValidateString("filterName", statusCode, comment))
|
||||
if (!ValidateString(filterKeyName, statusCode, comment))
|
||||
return FilterPair{source, nullptr};
|
||||
|
||||
std::string filterName = RequestData["filterName"];
|
||||
std::string filterName = RequestData[filterKeyName];
|
||||
|
||||
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 `") + sourceName + "` with the name `" + filterName + "`.";
|
||||
comment = std::string("No filter was found in the source `") + RequestData[sourceKeyName].get<std::string>() +
|
||||
"` with the name `" + filterName + "`.";
|
||||
return FilterPair{source, nullptr};
|
||||
}
|
||||
|
||||
return FilterPair{source, filter};
|
||||
}
|
||||
|
||||
obs_sceneitem_t *Request::ValidateSceneItem(RequestStatus::RequestStatus &statusCode, std::string &comment, const ObsWebSocketSceneFilter filter) const
|
||||
obs_sceneitem_t *Request::ValidateSceneItem(const std::string &sceneKeyName, const std::string &sceneItemIdKeyName,
|
||||
RequestStatus::RequestStatus &statusCode, std::string &comment,
|
||||
const ObsWebSocketSceneFilter filter) const
|
||||
{
|
||||
OBSSceneAutoRelease scene = ValidateScene2(statusCode, comment, filter);
|
||||
OBSSceneAutoRelease scene = ValidateScene2(sceneKeyName, statusCode, comment, filter);
|
||||
if (!scene)
|
||||
return nullptr;
|
||||
|
||||
if (!ValidateNumber("sceneItemId", statusCode, comment, 0))
|
||||
if (!ValidateNumber(sceneItemIdKeyName, statusCode, comment, 0))
|
||||
return nullptr;
|
||||
|
||||
int64_t sceneItemId = RequestData["sceneItemId"];
|
||||
int64_t sceneItemId = RequestData[sceneItemIdKeyName];
|
||||
|
||||
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 `") + sceneName + "` with the ID `" + std::to_string(sceneItemId) + "`.";
|
||||
comment = std::string("No scene items were found in scene `") + RequestData[sceneKeyName].get<std::string>() +
|
||||
"` with the ID `" + std::to_string(sceneItemId) + "`.";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -64,13 +64,21 @@ struct Request {
|
||||
const bool allowEmpty = false) const;
|
||||
|
||||
// All return values have incremented refcounts
|
||||
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;
|
||||
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;
|
||||
|
||||
std::string RequestType;
|
||||
bool HasRequestData;
|
||||
|
@ -415,5 +415,16 @@ namespace RequestStatus {
|
||||
* @api enums
|
||||
*/
|
||||
CannotAct = 703,
|
||||
/**
|
||||
* Assertion failed.
|
||||
*
|
||||
* @enumIdentifier AssertFailed
|
||||
* @enumValue 704
|
||||
* @enumType RequestStatus
|
||||
* @rpcVersion -1
|
||||
* @initialVersion 5.4.0
|
||||
* @api enums
|
||||
*/
|
||||
AssertFailed = 704,
|
||||
};
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ static void CreateSceneItemHelper(void *_data, obs_scene_t *scene)
|
||||
data->sceneItem = obs_scene_add(scene, data->source);
|
||||
|
||||
if (data->sceneItemTransform)
|
||||
obs_sceneitem_set_info2(data->sceneItem, data->sceneItemTransform);
|
||||
obs_sceneitem_set_info(data->sceneItem, data->sceneItemTransform);
|
||||
|
||||
if (data->sceneItemCrop)
|
||||
obs_sceneitem_set_crop(data->sceneItem, data->sceneItemCrop);
|
||||
|
@ -96,7 +96,6 @@ 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);
|
||||
@ -151,7 +150,6 @@ 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);
|
||||
@ -197,7 +195,6 @@ 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);
|
||||
|
||||
@ -284,7 +281,6 @@ 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);
|
||||
|
@ -50,7 +50,7 @@ json Utils::Obs::ObjectHelper::GetSceneItemTransform(obs_sceneitem_t *item)
|
||||
|
||||
obs_transform_info osi;
|
||||
obs_sceneitem_crop crop;
|
||||
obs_sceneitem_get_info2(item, &osi);
|
||||
obs_sceneitem_get_info(item, &osi);
|
||||
obs_sceneitem_get_crop(item, &crop);
|
||||
|
||||
OBSSource source = obs_sceneitem_get_source(item);
|
||||
|
@ -20,8 +20,6 @@ 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"
|
||||
|
||||
@ -44,29 +42,33 @@ std::string Utils::Obs::StringHelper::GetObsVersion()
|
||||
|
||||
std::string Utils::Obs::StringHelper::GetCurrentSceneCollection()
|
||||
{
|
||||
BPtr<char> sceneCollectionName = obs_frontend_get_current_scene_collection();
|
||||
std::string ret = sceneCollectionName.Get();
|
||||
char *sceneCollectionName = obs_frontend_get_current_scene_collection();
|
||||
std::string ret = sceneCollectionName;
|
||||
bfree(sceneCollectionName);
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string Utils::Obs::StringHelper::GetCurrentProfile()
|
||||
{
|
||||
BPtr<char> profileName = obs_frontend_get_current_profile();
|
||||
std::string ret = profileName.Get();
|
||||
char *profileName = obs_frontend_get_current_profile();
|
||||
std::string ret = profileName;
|
||||
bfree(profileName);
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string Utils::Obs::StringHelper::GetCurrentProfilePath()
|
||||
{
|
||||
BPtr<char> profilePath = obs_frontend_get_current_profile_path();
|
||||
std::string ret = profilePath.Get();
|
||||
char *profilePath = obs_frontend_get_current_profile_path();
|
||||
std::string ret = profilePath;
|
||||
bfree(profilePath);
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string Utils::Obs::StringHelper::GetCurrentRecordOutputPath()
|
||||
{
|
||||
BPtr<char> recordOutputPath = obs_frontend_get_current_record_output_path();
|
||||
std::string ret = recordOutputPath.Get();
|
||||
char *recordOutputPath = obs_frontend_get_current_record_output_path();
|
||||
std::string ret = recordOutputPath;
|
||||
bfree(recordOutputPath);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -92,15 +94,17 @@ std::string Utils::Obs::StringHelper::GetLastRecordFileName()
|
||||
|
||||
std::string Utils::Obs::StringHelper::GetLastReplayBufferFileName()
|
||||
{
|
||||
BPtr<char> replayBufferPath = obs_frontend_get_last_replay();
|
||||
std::string ret = replayBufferPath.Get();
|
||||
char *replayBufferPath = obs_frontend_get_last_replay();
|
||||
std::string ret = replayBufferPath;
|
||||
bfree(replayBufferPath);
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string Utils::Obs::StringHelper::GetLastScreenshotFileName()
|
||||
{
|
||||
BPtr<char> screenshotPath = obs_frontend_get_last_screenshot();
|
||||
std::string ret = screenshotPath.Get();
|
||||
char *screenshotPath = obs_frontend_get_last_screenshot();
|
||||
std::string ret = screenshotPath;
|
||||
bfree(screenshotPath);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,6 @@ 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;
|
||||
|
Reference in New Issue
Block a user