Commit Graph

403 Commits

Author SHA1 Message Date
tt2468
c720df5938 lib: Fix build on <c++20
C99 and C++20 are the minimum versions that support dedicated
initializer lists.
2021-11-20 01:58:16 -08:00
tt2468
32a9e12f62 Base: Logging improvements
Use blog_debug() in place of almost all debug logging messages, and
change some log levels to be less verbose.
2021-11-20 01:50:49 -08:00
tt2468
60f12a16f3 plugin-macros: Add blog_debug()
obs-studio's LOG_DEBUG setting only works in very specific
circumstances, which is why we implement our own debug logging. This
will help a lot of code cleanup.
2021-11-20 01:46:01 -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
bc1d5386a5 Base: Add external plugin library
This header file is meant to be included by 3rd party OBS plugins,
which allows them to add custom requests and events to obs-websocket.

*not finished yet*
2021-11-19 18:10:01 -08:00
tt2468
bd6c663775 Base: Add copyright header to source 2021-11-19 17:32:22 -08:00
tt2468
18ed1589ae Base: Update obs-websocket git locations
obs-websocket has moved to the obsproject
2021-11-19 17:24:15 -08:00
tt2468
07a20b6458
Merge pull request #856 from dnaka91/record-pause-resume
Events: Add events for record pause and resume
2021-11-18 22:28:04 -08:00
Dominik Nakamura
6cb8eef96d
Events: Add events for record pause and resume 2021-11-19 15:24:00 +09:00
tt2468
5ab091a40b Base: Move WebSocketServer to its own directory
Just helps with organization
2021-11-18 00:29:28 -08:00
tt2468
c60d09246c Revert "Events: Re-enable *Changing events"
This reverts commit 32be21886c.
2021-11-17 03:16:42 -08:00
tt2468
061c228ad5
Merge pull request #851 from obs-websocket/event/changing_events
Put normal commits on this branch by accident dammit
2021-11-17 03:16:15 -08:00
tt2468
4076c0baa9 Requests: Add media input requests 2021-11-17 03:03:14 -08:00
tt2468
01013c1b27 Base: Fix compile error
I literally could have sworn I remember json::null() being valid, but
I guess not. Oops
2021-11-17 02:58:11 -08:00
tt2468
1dbb7a9686 Requests: Apply some code style changes 2021-11-17 02:14:13 -08:00
tt2468
061fb6f012 Base: Update various links
Now that obs-websocket has been moved to an org, let's update
any links accordingly.
2021-11-17 01:37:37 -08:00
tt2468
32e4ad74b7 CONTRIBUTING: Update standards
Update some links and standards with what we've been using
2021-11-17 01:32:37 -08:00
tt2468
0f17d3d6f8 Utils/Obs: Update StringHelper function names
I hated having `String` appended to half of the utils since it was
extra
2021-11-17 01:23:23 -08:00
tt2468
08eb2defbc Requests: Add GetMediaInputState 2021-11-17 01:17:40 -08:00
tt2468
7403264d42 Requests/Utils: Modify utils naming/usage
A bit too niche to have a util that takes an output and returns a
timecode string. Let's just make it take a duration in milliseconds.
2021-11-17 01:07:04 -08:00
tt2468
32be21886c Events: Re-enable *Changing events 2021-11-17 00:37:50 -08:00
tt2468
d5a702b0e8 Events: Disable *Changing events
CI fails right now because they are not yet included in an OBS release.
2021-11-17 00:36:53 -08:00
tt2468
0671ded7d1 Requests: Add recording requests 2021-11-17 00:30:17 -08:00
tt2468
9197a48088 Requests: Add SetSceneItemTransform
Yay party
2021-11-12 23:24:39 -08:00
tt2468
5faadc12de Utils/Obs: Add scaleX and scaleY plus new util 2021-11-12 23:23:51 -08:00
tt2468
45f7661a5d Requests: Add DuplicateSceneItem 2021-11-12 17:31:11 -08:00
tt2468
aa46bb74a5 RequestHandler/RPC: Add ValidateScene2 2021-11-12 17:30:46 -08:00
tt2468
af52a26e68 Utils: Add ability to specify transform/crop for scene item creation 2021-11-12 17:29:43 -08:00
tt2468
69494d9c85 Base: Add OBSSceneAutoRelease 2021-11-12 17:19:57 -08:00
tt2468
152faa5fe2 Events: Add profile/scene collection change events 2021-11-12 15:20:01 -08:00
tt2468
622e1c9aeb
Merge pull request #842 from dnaka91/macos-scripts
Build: Make scripts executable and fix dep links
2021-10-29 17:20:18 -07:00
Dominik Nakamura
ee3216968d
Build: Make scripts executable and fix dep links 2021-10-24 14:54:34 +09:00
tt2468
4e956d1ef4 Requests: Add note SetCurrentSceneCollection 2021-10-06 00:45:14 -07:00
tt2468
42c78f1831 Events: Prepare to add a few new OBS events
Pending PR merge and version release
2021-10-06 00:44:42 -07:00
tt2468
1b25e98dc2 Revert "Requests: Add Compare"
This reverts commit 3687086ce0.

I realized that I'm adding too much too fast, and that we should
focus on getting v5 out first.
2021-10-05 20:17:45 -07:00
tt2468
3687086ce0 Requests: Add Compare
Non-functional, will have to finish impl later
2021-10-04 17:32:17 -07:00
tt2468
f0b207d021 Base: Add variable support to request batches + refactor
- Adds variables to execution types SERIAL_REALTIME and SERIAL_FRAME
- Pass by reference where copy is unnecessary
- Start WebSocket server after OBS finishes loading instead of on
plugin load
2021-10-01 17:34:09 -07:00
tt2468
16ea2c82e1 Requests: Verify current program scene
Crashes can occur if there is no current program scene. Currently
caused by connecting to obs-websocket and calling `GetSceneList`
before OBS has actually finished loading.
2021-10-01 17:20:38 -07:00
tt2468
981538aa2a Base: Make some items atomic 2021-09-30 19:14:17 -07:00
tt2468
9f71e4af2c
Merge pull request #829 from dnaka91/add-obws-reference
README: Add Rust obws to library list
2021-09-28 11:52:34 -07:00
Dominik Nakamura
0fc813f48b
README: Add Rust obws to library list 2021-09-28 23:34:30 +09:00
tt2468
df7af451a7 Requests: Fix some parameter validation
Thanks to t2t2 for the report over Discord
2021-09-26 03:54:16 -07: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
45854e2949 Config: Properly add more logging, fix bug 2021-09-26 03:10:43 -07:00
tt2468
181003af89 Utils: Use emplace_back instead of push_back
Saves copy operations
2021-09-25 19:34:05 -07:00
tt2468
2218b7956c Requests: Support groups in most of the scene item requests
Tested each request to the fullest reasonable extent. Requests performed properly without errors or leaks
2021-09-25 18:59:04 -07:00
tt2468
0e8650dbd2 Requests: Support groups in GetSceneItemId 2021-09-25 18:45:37 -07:00
tt2468
da4297ee88 Request: Clarify error messages 2021-09-25 18:45:00 -07:00
tt2468
5350c115bf Requests: Improve more request checks 2021-09-25 18:29:27 -07:00
tt2468
d09571f0e3 Requests: Improve some check logic in GetSourceActive 2021-09-25 18:20:01 -07:00