Skip to content

Commit 2aeb8b5

Browse files
committed
Add RFC: Add notion of protocol
1 parent e5c925b commit 2aeb8b5

1 file changed

Lines changed: 89 additions & 0 deletions

File tree

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Summary
2+
- Add notion of service protocol in libobs and OBS Studio
3+
- Outputs for streaming are registered with their compatible protocol and codecs
4+
- Only codecs compatible with the output and the service are shown
5+
- Audio encoder can be choosen if various compatible
6+
- Will be extended with RFC 39
7+
8+
# Motivation
9+
Create a better management of outputs, encoders and services with an approach focused on protocols.
10+
11+
# Design
12+
13+
## Outputs API
14+
Only outputs with the `OBS_OUTPUT_SERVICE` flag are concerned.
15+
16+
Adding to the API three flags:
17+
- `OBS_OUTPUT_VCODEC_AGNOSTIC`: indicate that the protocol is video codec agnostic.
18+
- `OBS_OUTPUT_ACODEC_AGNOSTIC`: indicate that the protocol is audio codec agnostic.
19+
- `OBS_OUTPUT_AVCODEC_AGNOSTIC`: combination of the two latter.
20+
21+
Adding to `obs_output_info`:
22+
- `const char *protocols`: protocols separated with a semi-colon (ex: `"RTMP;RTMPS"`), required to register the output.
23+
- `const char *protocols_prefixes`: URL protocols prefixes separated with a semi-colon `"rtmp://;rtmps://"`, optional.
24+
- Only one prefix per protocol in `protocols`.
25+
- Those prefixes should be in the same order as `protocols`.
26+
- Meant to be used for protocol auto-detection.
27+
- Two attributes already existent will be required if non-'codec agnostic':
28+
- `const char *encoded_video_codecs`: video codecs supported by the protocol separated with a semi-colon, required if `OBS_OUTPUT_VCODEC_AGNOSTIC` is not set.
29+
- `const char *encoded_audio_codecs`: audio codecs supported by the protocol separated with a semi-colon, required if `OBS_OUTPUT_ACODEC_AGNOSTIC` is not set.
30+
31+
Asside from getters for new attributes, adding to the API those functions:
32+
- `bool obs_output_is_protocol_registered(const char *protocol)`: return true if an output with the protocol is registered.
33+
- `bool obs_enum_output_service_types(const char *protocol, size_t idx, const char **id)`: enumerate all outputs types compatible with the given protocol.
34+
- `const char *obs_output_get_prefix_protocol(const char *prefix)`: return the protocol bound to the prefix.
35+
36+
### About protocols
37+
RTMP and RTMPS will on be considered compatible only with H264 and AAC.
38+
39+
HLS will have no prefix set and not "auto-detectable".
40+
41+
HLS, SRT and RIST are codec agnostic, since they use MPEG/TS container.
42+
43+
FTL will be considered compatible only with H264 and opus because of the deprecation of the protocol in OBS Studio.
44+
45+
## Services API
46+
Since a streaming service may not accept all the codec usable by a protocol, adding a way to set supported codecs is required.
47+
48+
Adding to `obs_service_info`:
49+
- `const char *(*get_protocol)(void *data)`: return the protocol used by the service. It will allow multi-protocol services in the future.
50+
- `const char *supported_video_codecs`: video codecs supported by the service separated with a semi-colon. Optional, fallback to protocol supported codecs if not set.
51+
- `const char *supported_audio_codecs`: audio codecs supported by the serivce separated with a semi-colon. Optional, fallback to protocol supported codecs if not set.
52+
53+
### About `rtmp-services`
54+
55+
This plugin will only be compatible with H264 and AAC (and opus if FTL) and changed with RFC 39 afterward.
56+
57+
So streaming will be only H264 and AAC or opus.
58+
59+
## UI
60+
61+
### Audio encoders
62+
If "Custom..." service is selected, the UI should allow to choose between compatible audio encoders. Just a combobox to choose which defaults to AAC.
63+
64+
Otherwise AAC will be used or opus if FTL.
65+
66+
### Settings loading order
67+
68+
Service settings need to be loaded first and output ones afterward to show only compatible encoder.
69+
70+
### About service JSON file
71+
72+
- A field `"protocol"` will be added for HLS/FTL services, other protocol will be detected through prefixes, further changes will be done in RFC 39.
73+
- Services still mono-protocol, RTMP+RTMPS combo is the only exception.
74+
- Services that ask for a protocol or only codecs that are not registered will not be shown.
75+
- `"output"` in `"recommended"` is no longer required (kept for backward compatibility) and `const char *(*get_output_type)(void *data)` in `obs_service_info` will be no longer used.
76+
77+
### Service and Output settings interactions
78+
NOTE: Since Services API is not usable by third-party for now. The scenario where there is no simple encoder preset for the service does not need to be considered for now.
79+
80+
Changing protocol by changing the service should update the Output page with only compatible encoders.
81+
82+
If the actual codec is not supported by the service, the codec will be changed and the user warned about the change.
83+
84+
## What if there is various registered outputs for one protocol ?
85+
86+
The improbale situation where a plugin register a output for an already registered protocol could happen, so managing this possibility is required.
87+
88+
- In `obs_service_info`: a `const char *(*get_preferred_output_type)(void *data)` could be considered and be a replacement to `const char *(*get_output_type)(void *data)`.
89+
- A function in the UI to preffer first-party outputs can be considered.

0 commit comments

Comments
 (0)