Skip to content

Commit 7adfb58

Browse files
committed
requesthandler: Implement input, scene, and transition UUID support
Transition UUID support is partial due to the current state of the OBS frontend API. Most requests which accepted things like `sourceName` now allow `sourceUuid` (or equivalent) to be specified instead. While both fields on the various requests may be marked as optional, at least one field will still be required.
1 parent f18f465 commit 7adfb58

10 files changed

+306
-214
lines changed

src/requesthandler/RequestHandler_Filters.cpp

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ RequestResult RequestHandler::GetSourceFilterKindList(const Request &)
4343
/**
4444
* Gets an array of all of a source's filters.
4545
*
46-
* @requestField sourceName | String | Name of the source
46+
* @requestField ?sourceName | String | Name of the source
47+
* @requestField ?sourceUuid | String | UUID of the source
4748
*
4849
* @responseField filters | Array<Object> | Array of filters
4950
*
@@ -58,7 +59,7 @@ RequestResult RequestHandler::GetSourceFilterList(const Request &request)
5859
{
5960
RequestStatus::RequestStatus statusCode;
6061
std::string comment;
61-
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
62+
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
6263
if (!source)
6364
return RequestResult::Error(statusCode, comment);
6465

@@ -106,7 +107,8 @@ RequestResult RequestHandler::GetSourceFilterDefaultSettings(const Request &requ
106107
/**
107108
* Creates a new filter, adding it to the specified source.
108109
*
109-
* @requestField sourceName | String | Name of the source to add the filter to
110+
* @requestField ?sourceName | String | Name of the source to add the filter to
111+
* @requestField ?sourceUuid | String | UUID of the source to add the filter to
110112
* @requestField filterName | String | Name of the new filter to be created
111113
* @requestField filterKind | String | The kind of filter to be created
112114
* @requestField ?filterSettings | Object | Settings object to initialize the filter with | Default settings used
@@ -123,7 +125,7 @@ RequestResult RequestHandler::CreateSourceFilter(const Request &request)
123125
RequestStatus::RequestStatus statusCode;
124126
std::string comment;
125127

126-
OBSSourceAutoRelease source = request.ValidateSource("sourceName", statusCode, comment);
128+
OBSSourceAutoRelease source = request.ValidateSource("sourceName", "sourceUuid", statusCode, comment);
127129
if (!(source && request.ValidateString("filterName", statusCode, comment) &&
128130
request.ValidateString("filterKind", statusCode, comment)))
129131
return RequestResult::Error(statusCode, comment);
@@ -159,8 +161,9 @@ RequestResult RequestHandler::CreateSourceFilter(const Request &request)
159161
/**
160162
* Removes a filter from a source.
161163
*
162-
* @requestField sourceName | String | Name of the source the filter is on
163-
* @requestField filterName | String | Name of the filter to remove
164+
* @requestField ?sourceName | String | Name of the source the filter is on
165+
* @requestField ?sourceUuid | String | UUID of the source the filter is on
166+
* @requestField filterName | String | Name of the filter to remove
164167
*
165168
* @requestType RemoveSourceFilter
166169
* @complexity 2
@@ -173,7 +176,7 @@ RequestResult RequestHandler::RemoveSourceFilter(const Request &request)
173176
{
174177
RequestStatus::RequestStatus statusCode;
175178
std::string comment;
176-
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
179+
FilterPair pair = request.ValidateFilter(statusCode, comment);
177180
if (!pair.filter)
178181
return RequestResult::Error(statusCode, comment);
179182

@@ -185,7 +188,8 @@ RequestResult RequestHandler::RemoveSourceFilter(const Request &request)
185188
/**
186189
* Sets the name of a source filter (rename).
187190
*
188-
* @requestField sourceName | String | Name of the source the filter is on
191+
* @requestField ?sourceName | String | Name of the source the filter is on
192+
* @requestField ?sourceUuid | String | UUID of the source the filter is on
189193
* @requestField filterName | String | Current name of the filter
190194
* @requestField newFilterName | String | New name for the filter
191195
*
@@ -200,7 +204,7 @@ RequestResult RequestHandler::SetSourceFilterName(const Request &request)
200204
{
201205
RequestStatus::RequestStatus statusCode;
202206
std::string comment;
203-
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
207+
FilterPair pair = request.ValidateFilter(statusCode, comment);
204208
if (!pair.filter || !request.ValidateString("newFilterName", statusCode, comment))
205209
return RequestResult::Error(statusCode, comment);
206210

@@ -218,8 +222,9 @@ RequestResult RequestHandler::SetSourceFilterName(const Request &request)
218222
/**
219223
* Gets the info for a specific source filter.
220224
*
221-
* @requestField sourceName | String | Name of the source
222-
* @requestField filterName | String | Name of the filter
225+
* @requestField ?sourceName | String | Name of the source
226+
* @requestField ?sourceUuid | String | UUID of the source
227+
* @requestField filterName | String | Name of the filter
223228
*
224229
* @responseField filterEnabled | Boolean | Whether the filter is enabled
225230
* @responseField filterIndex | Number | Index of the filter in the list, beginning at 0
@@ -237,7 +242,7 @@ RequestResult RequestHandler::GetSourceFilter(const Request &request)
237242
{
238243
RequestStatus::RequestStatus statusCode;
239244
std::string comment;
240-
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
245+
FilterPair pair = request.ValidateFilter(statusCode, comment);
241246
if (!pair.filter)
242247
return RequestResult::Error(statusCode, comment);
243248

@@ -257,7 +262,8 @@ RequestResult RequestHandler::GetSourceFilter(const Request &request)
257262
/**
258263
* Sets the index position of a filter on a source.
259264
*
260-
* @requestField sourceName | String | Name of the source the filter is on
265+
* @requestField ?sourceName | String | Name of the source the filter is on
266+
* @requestField ?sourceUuid | String | UUID of the source the filter is on
261267
* @requestField filterName | String | Name of the filter
262268
* @requestField filterIndex | Number | New index position of the filter | >= 0
263269
*
@@ -272,7 +278,7 @@ RequestResult RequestHandler::SetSourceFilterIndex(const Request &request)
272278
{
273279
RequestStatus::RequestStatus statusCode;
274280
std::string comment;
275-
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
281+
FilterPair pair = request.ValidateFilter(statusCode, comment);
276282
if (!(pair.filter && request.ValidateNumber("filterIndex", statusCode, comment, 0, 8192)))
277283
return RequestResult::Error(statusCode, comment);
278284

@@ -286,7 +292,8 @@ RequestResult RequestHandler::SetSourceFilterIndex(const Request &request)
286292
/**
287293
* Sets the settings of a source filter.
288294
*
289-
* @requestField sourceName | String | Name of the source the filter is on
295+
* @requestField ?sourceName | String | Name of the source the filter is on
296+
* @requestField ?sourceUuid | String | UUID of the source the filter is on
290297
* @requestField filterName | String | Name of the filter to set the settings of
291298
* @requestField filterSettings | Object | Object of settings to apply
292299
* @requestField ?overlay | Boolean | True == apply the settings on top of existing ones, False == reset the input to its defaults, then apply settings. | true
@@ -302,7 +309,7 @@ RequestResult RequestHandler::SetSourceFilterSettings(const Request &request)
302309
{
303310
RequestStatus::RequestStatus statusCode;
304311
std::string comment;
305-
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
312+
FilterPair pair = request.ValidateFilter(statusCode, comment);
306313
if (!(pair.filter && request.ValidateObject("filterSettings", statusCode, comment, true)))
307314
return RequestResult::Error(statusCode, comment);
308315

@@ -334,7 +341,8 @@ RequestResult RequestHandler::SetSourceFilterSettings(const Request &request)
334341
/**
335342
* Sets the enable state of a source filter.
336343
*
337-
* @requestField sourceName | String | Name of the source the filter is on
344+
* @requestField ?sourceName | String | Name of the source the filter is on
345+
* @requestField ?sourceUuid | String | UUID of the source the filter is on
338346
* @requestField filterName | String | Name of the filter
339347
* @requestField filterEnabled | Boolean | New enable state of the filter
340348
*
@@ -349,7 +357,7 @@ RequestResult RequestHandler::SetSourceFilterEnabled(const Request &request)
349357
{
350358
RequestStatus::RequestStatus statusCode;
351359
std::string comment;
352-
FilterPair pair = request.ValidateFilter("sourceName", "filterName", statusCode, comment);
360+
FilterPair pair = request.ValidateFilter(statusCode, comment);
353361
if (!(pair.filter && request.ValidateBoolean("filterEnabled", statusCode, comment)))
354362
return RequestResult::Error(statusCode, comment);
355363

0 commit comments

Comments
 (0)