Commit Graph

70 Commits

Author SHA1 Message Date
tytan652
8bf8995ad8 base: Suppress C4996 warning 2022-07-28 12:15:38 -07:00
tytan652
2b8dd47a6c Revert "base: Set the correct Windows preprocessor var for asio"
This reverts commit 420e600864.
2022-07-28 12:15:38 -07:00
tt2468
268a45e8dd base: Format CMakeLists.txt (again) 2022-07-28 11:46:32 -07:00
tytan652
e52d5402cf base: Add and use find_qt to support Qt5 and Qt6 2022-07-28 11:40:27 -07:00
tytan652
0db223b148 base: Suppress deps warnings
/wd4267 is required by websocketpp
-Wno-error=format-overflow is required by asio

-Wno-error=null-pointer-subtraction is required by json on macOS

-Wno-error=deprecated-declarations is required on macOS because Xcode 14
deprecates sprintf()
2022-07-28 11:40:27 -07:00
tytan652
420e600864 base: Set the correct Windows preprocessor var for asio
Fix C4996 warning

Co-authored-by: PatTheMav <PatTheMav@users.noreply.github.com>
2022-07-28 11:40:27 -07:00
tt2468
1902d7e1a3 base: Update version to 5.0.1 2022-07-25 08:30:34 -07:00
tt2468
de40b53d77 base: Format CMakeLists.txt using OBS formatter 2022-07-25 07:48:06 -07:00
tt2468
22fee0312d utils: Move from explicit enum converters to nlohmann macros 2022-06-08 00:33:41 -07:00
tt2468
7b238793d0 cmakelists: Various fixes 2022-05-13 20:40:01 -07:00
tt2468
7a09f38a64 base: Remove actions building and refactor CMake for submodule 2022-05-13 20:23:03 -07:00
tt2468
ae906bb283 RequestHandler: Add VirtualCam requests 2022-01-18 19:23:06 -08:00
tt2468
732d5af50c EventHandler: Add Ui category 2021-12-29 00:34:25 -08:00
tt2468
86506778ad RequestHandler: Add Ui category
Creates a new category specific to requests controlling the OBS UI.
2021-12-28 16:58:28 -08:00
tt2468
ad347c4823 RequestHandler: Add files for Transitions and Filters 2021-12-22 15:57:57 -08:00
tt2468
a898bacd79 Utils: Rename VolumeMeter utils for consistency 2021-12-21 03:09:45 -08:00
tt2468
1e6a60f545 Utils: Rename ListHelper to ArrayHelper 2021-12-21 01:32:12 -08:00
tt2468
5cd1af426a Utils: Rename DataHelper to ObjectHelper 2021-12-21 01:32:12 -08:00
tt2468
f66080a031 Utils: Split Obs utils into individual files 2021-12-21 01:32:12 -08:00
tt2468
b490e4409b CMakeLists: Add runtime tests flag 2021-12-15 02:06:31 -08:00
tt2468
eb8d69dca5 Base: Move request batch processing to requesthandler directory
Request batch processing had less to do with the protocol/server and
more to do with the actual request handler, so it felt better to move
it.
2021-12-13 19:10:08 -08:00
tt2468
fcbe11616d
docs: Overhaul documentation (#863)
More docs-related commits will follow, but this needs to be merged in order to continue with other development.

* Docs: Overhaul docs generator (beginning)

* docs: Rename comments file

* docs: Move comments gitignore

* docs: Initial request documentation

* docs: Improvements to comment processing

* docs: More improvements

* docs: Add enum functionality for protocol.json

* WebSocketServer: Document enums

* RequestHandler: Document RequestStatus enum

* Base: Move ObsWebSocketRequestBatchExecutionType to its own file

Moves it to its own file, renaming it to `RequestBatchExecutionType`.
Changes the RPC to use integer values for selecting execution type
instead of strings.

* docs: Update introduction header

Removes the enum section, and documents RequestBatchExecutionType.

* WebSocketCloseCode: Shuffle a bit

* Base: Use `field` instead of `key` or `parameter` in most places

* RequestStatus: Mild shuffle

It was really bothering me that OutputPaused and OutputNotPaused
had to be separated, so we're breaking it while we're breaking
other stuff.

* docs: Delete old files

They may be added back in some form, but for now I'm getting them
out of the way.

* docs: Add enum identifier value

Forgot to add this before, oops

* docs: Document more enums

* docs: Add basic protocol.md generator

* docs: More work on MD generator

* docs: MD generator should be finished now

* docs: More fixes

* docs: More fixes

* docs: More tweaks + add readme

* docs: Update readme and add inputs docs

* docs: More documentation
2021-12-10 21:38:18 -08:00
tt2468
d48ddef031 EventHandler: Implement InputVolumeMeters
This is probably one of the most requested features for obs-websocket.
This currently works by firing an event to all explicit subscribers
with an array of all active audio sources every **60 milliseconds.**

The `inputLevelsMul` field follows this data format:

Base: [Channel, Channel]
Channel: [magnitude (mul), peak (mul), input_peak (mul)]

           *Not Muted*         *Muted*
Example: [[0.3, 0.5, 0.9], [0.0, 0.0, 0.0]]

(input_peak is the actual peak value, before volume adjustment.)

You may notice that the values are only in mul. This is because we are
trying to cut down on bandwidth. dB values can be calculated using this
formula:

`dB = 20.0 * log10(mul)`
2021-11-22 03:37:56 -08:00
tt2468
bc7b8d330a RequestHandler: Move RequestStatus.h to types directory 2021-11-21 03:13:53 -08:00
tt2468
0a294a558e WebSocketServer: Move enums to types directory
Code cleanup, makes WebSocketServer match how enums are handled in
other parts of the plugin
2021-11-21 01:37:21 -08:00
tt2468
4ca259b790 Base: Enforce -Wall and fix compiler warnings
That was *a lot* of warnings.
2021-11-20 02:34:48 -08:00
tt2468
99cbaaf34c Base: Implement ObsWebSocketApi + cleanup
- Implements a WIP ObsWebSocketApi, for obs-websocket-api.h. Events are
finished, but requests are not.
- Some logging improvements
- A bit of code cleanup around the plugin
2021-11-20 01:26:50 -08:00
tt2468
5ab091a40b Base: Move WebSocketServer to its own directory
Just helps with organization
2021-11-18 00:29:28 -08:00
tt2468
08eb2defbc Requests: Add GetMediaInputState 2021-11-17 01:17:40 -08:00
tt2468
0671ded7d1 Requests: Add recording requests 2021-11-17 00:30:17 -08:00
tt2468
a8d27ede9e Base: Add request batch execution types
A new `executionType` field has been added to the `RequestBatch` Op

Types added:
- `OBS_WEBSOCKET_REQUEST_BATCH_EXECUTION_TYPE_SERIAL_REALTIME`(default)
- `OBS_WEBSOCKET_REQUEST_BATCH_EXECUTION_TYPE_SERIAL_FRAME`
- `OBS_WEBSOCKET_REQUEST_BATCH_EXECUTION_TYPE_PARALLEL`

`OBS_WEBSOCKET_REQUEST_BATCH_EXECUTION_TYPE_SERIAL_REALTIME`:
- Same as how request batches have always worked.
- Requests are processed in-order
- Requests are processed as soon as possible by one worker thread
- The `Sleep` request blocks execution for a specified amount of real
world time

`OBS_WEBSOCKET_REQUEST_BATCH_EXECUTION_TYPE_SERIAL_FRAME`:
- New!
- Requests are processed in-order
- Requests are processed on the graphics thread. BE VERY CAREFUL NOT
TO OVERLOAD THE GRAPHICS THREAD WITH LARGE REQUESTS. A general rule
of thumb is for your request batches to take a maximum of 2ms per
frame of processing.
- Requests processing starts right before the next frame is composited.
This functionality is perfect for things like `SetSceneItemTransform`
- The `Sleep` request will halt processing of the request batch for
a specified number of frames (ticks)
- To be clear: If you do not have any sleep requests, all requests in
the batch will be processed in the span of a single frame
- For developers: The execution of requests gets profiled by the OBS
profiler under the `obs-websocket-request-batch-frame-tick` name.
This value (shown in the OBS log after OBS shutdown) represents the
amount of time that the graphics thread spent actively processing
requests per frame. This tool can be used to determine the amount of
load that your request batches are placing on the graphics thread.

`OBS_WEBSOCKET_REQUEST_BATCH_EXECUTION_TYPE_PARALLEL`:
- New!
- Requests are processed asynchronously at the soonest possible time.
- Requests are processed by the core obs-websocket thread pool, where
the number of workers == the number of threads on your machine.
  - If you have 12 threads on your machine, obs-websocket will be able
to process 12 requests at any given moment.
- The `results` array is populated by order of request completion.
Consider the order to be random.
- The `Sleep` request will return an error if attempted to be used in
this mode.
- Note: This feature is experimental and can increase the chances of
causing race conditions (crashes). While the implementation is fully
thread-safe, OBS itself is not. Usage of this is only recommended if
you are processing very large batches and need the performance benefit.
- Example use case: Performing `SaveSourceScreenshot` on 8 sources
at once.
2021-09-26 03:12:29 -07:00
tt2468
0c2e40263a WebSocketServer: Remove QtConcurrent dependency
We can avoid requiring QtConcurrent by using QRunnables. Thanks to
micolous for the idea.
2021-09-24 18:11:31 -07:00
tt2468
7e1e1bc33c Base: Large plugin refactor
- Merge WebSocketProtocol into WebSocketServer
  - Having them separated was not doing anything productive
- Request: Move SessionPtr to RequestHandler
  - Less copying to do for batch requests
- Fully modularize EventHandler
  - Make BroadcastEvent a stored callback that WebSocketServer sets
- Return early on high volume events to avoid unnecessary compute
  - These events will only generate a json object when it is actually
needed
2021-09-04 10:04:00 -07:00
tt2468
333737f400 Requests: Additions and code cleanup 2021-09-02 19:29:13 -07:00
tt2468
a3d0ff5eea CMakeLists: More changes for version suffix 2021-08-30 03:08:09 -07:00
tt2468
1ecf2a4fdb CMakeLists: Allow specifying version suffix string 2021-08-30 02:50:02 -07:00
tt2468
96ab90eea1 CMakeLists: Fix indentations 2021-08-26 19:09:52 -07:00
tt2468
43a889c1d4 Utils: Refactor into dedicated components 2021-08-26 19:00:48 -07:00
tt2468
d0e05ae45c Requests: Add more requests
- GetStreamServiceSettings
- SetStreamServiceSettings
- CreateInput
- GetStreamStatus
- StartStream
- StopStream
2021-07-22 16:26:04 -07:00
tt2468
aac06b101e RequestHandler: Add GetInputList 2021-06-16 00:49:07 -07:00
tt2468
39f2db8723 CMakeLists: Convert spaces to tabs 2021-06-14 23:00:33 -07:00
tt2468
cb5ee53956 RequestHandler: Add GetSceneList 2021-06-14 22:52:23 -07:00
tt2468
80b9732f94 RequestHandler: Some source stuff 2021-06-13 07:14:40 -07:00
tt2468
4a00d169e1 RequestHandler: Add some config requests 2021-06-07 01:14:32 -07:00
tt2468
6a325e4c94 CMakeLists: Link Qt5::Svg
Fixes help icon not showing on Windows
2021-06-06 00:15:43 -07:00
tt2468
a7c4f98ffa SettingsDialog: Add tooltip icon to debug checkbox 2021-06-05 23:06:36 -07:00
tt2468
6c03b86514 EventHandler: Add Outputs events and other files 2021-05-31 18:51:56 -07:00
tt2468
9077ac911d EventHandler: Add some transition stuff
Transitions in OBS are implemented badly.
Not sure what will reasonably be possible with them.
I'll probably save implementing them for last
2021-05-14 03:59:00 -07:00
tt2468
45d62e5ce0 EventHandler: General, Config, Scenes, Inputs 2021-05-14 01:13:27 -07:00
tt2468
ab12d5f39f EventHandler: Add some events 2021-05-13 19:11:19 -07:00