Skip to content

Commit 476d519

Browse files
committed
Add RFC: Protocol API
1 parent e5c925b commit 476d519

1 file changed

Lines changed: 103 additions & 0 deletions

File tree

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Summary
2+
3+
- Add notion of protocol in service outputs and services
4+
- Those outputs are registered with a list of compatible codecs
5+
- Show stream services or their servers that have the needed protocol registered
6+
- Show only stream encoders compatible with the selected outputs
7+
- Add as byproduct the possibility to add plugin with new service output with a new protocol (useless without [RFC 39](https://github.com/obsproject/rfcs/pull/39))
8+
9+
# Motivation
10+
11+
Create a better management of outputs, encoders and services with a protocol centered approach.
12+
13+
Byproduct: Add also the possibility to support third-party plugin which add protocol support with his own output.
14+
15+
*Services addition is a part of [RFC 39](https://github.com/obsproject/rfcs/pull/39).*
16+
17+
# Design
18+
*This RFC does not consider that because a protocol support a encoder it should be implemented in the main project.*
19+
20+
## Outputs API
21+
**This only mainly concern outputs with the flag `OBS_OUTPUT_SERVICE`.**
22+
23+
Adding to the API those fields:
24+
- `protocols`: protocols "official" acronym (ex: RTMP, WebRTC)
25+
- `protocols_prefixes` (optional): for custom service detection (eg `rtmp://`, `srt://`)
26+
27+
28+
If an output support various protocol like `;` should be used as a separator between them (e.g `"RTMP;RTMPS"`, `"SRT;RIST"`). Same for prefixes (e.g `"rtmps://;rtmp://"`, `"srt://;rist://"`).
29+
30+
Adding to the API those functions:
31+
- `bool obs_output_find_protocol(const char*)`: return true if an output with the protocol is registered
32+
- `obs_output_enum_types_with_protocol` return outputs corresponding to the protocol
33+
- a way to enum prefixes and/or a way to find protocol based on the prefix so `obs_output_enum_protocol_prefix` and/or `obs_output_find_protocol_with_prefix`
34+
35+
Protocols like SRT or RIST are codec agnostic so, we need to add 3 new flags:
36+
- One indicating that the output is video codec agnostic.
37+
- One indicating that the output is audio codec agnostic.
38+
- One combining the two.
39+
40+
If not `encoded_video_codecs` and `encoded_audio_codecs` will be required.
41+
42+
### About Protocols
43+
`encoded_video_codecs` and `encoded_audio_codecs` shall contain any codec compatible with the protocol following their specification. Except RTMP(S), it will only support H.264 and AAC for now.
44+
45+
It does not mean that services are compatible with all the codecs present in the specs. And neither mean that OBS shall support those codecs.
46+
47+
The actually supported protocol with their specification documents :
48+
- RTMP (https://wwwimages2.adobe.com/content/dam/acom/en/devnet/rtmp/pdf/rtmp_specification_1.0.pdf)
49+
- RTMPS (same as RTMP)
50+
- HLS (https://datatracker.ietf.org/doc/html/rfc8216)
51+
- SRT (https://github.com/Haivision/srt/files/2489142/SRT_Protocol_TechnicalOverview_DRAFT_2018-10-17.pdf ; TLDR: codec agnostic)
52+
- FTL (no official one found except this https://github.com/microsoft/ftl-sdk/blob/master/README.md)
53+
54+
## Services API
55+
Adding to the API the field/function `get_protocol`, this will allow services to be multi-protocol.
56+
57+
`rtmp-services` will be modified to not show unsupported services/servers if OBS is not build with RTMPS or FTL support.
58+
59+
And with RFC 39, OBS could prevent showing services where the protocol is not provided by any registered service output.
60+
And also make services able to not show unsupported protocol if multi-protocol.
61+
62+
We shall consider that if a service handle a protocol, it doens't mean it can handle all the compatible codecs.
63+
So if a service can't handle all the compatible codec, adding a list of supported codec to a service related to his protocol shall be considered.
64+
65+
Adding to the API those fields:
66+
- `supported_video_codecs` (optional): sometime stream services don't support all the codec of the specification
67+
- `supported_audio_codecs` (optional): sometime stream services don't support all the codec of the specification
68+
69+
## UI
70+
Compatible stream encoders are based on what service can handle and if they specify nothing, any codec accepted by the protocol will be shown.
71+
72+
The user will also be able to choose an audio encoder if various compatible is available with two version of the option simple and advanced.
73+
74+
### Settings loading
75+
76+
Service settings will be load first making stream encoders combobox filled with compatible encoders.
77+
78+
Then the Outputs will be load afterward.
79+
80+
### Service -> Output settings behavior
81+
82+
Changing protocol/output through service change will update the Output page with only compatible encoders.
83+
84+
If the compatible codec is only not available on simple mode, Output settings will be forced switch to advanced mode.
85+
86+
If the service ask for codec not compatible with the protocol, it will be ignored and written in the log as error.
87+
88+
It will reset encoder settings if the actual encoder was not compatible.
89+
90+
The user may need to be warn about the fact that the encoder was not compatible and he need to setup again his encoder.
91+
92+
## What if there is various registered outputs for one protocol ?
93+
It could happen that a plugin register a output for a already registered protocol, so we need to manage this possibility.
94+
95+
- Add `preferred_output` to the Services API to use what OBS already provide for some protocols with maybe some hardcode in his getter or maybe hardcode the default output per protocol in the UI.
96+
- It completely replace `recommended_output` as not a recommendation but as a default choice for output.
97+
- Add `obs_output_enum_types_with_protocol` return all outputs corresponding to the protocol to the Outputs API.
98+
- Make the user able also to choose an output if various providing the same protocol are registered (e.g FFmpeg SRT and "Native" SRT) as an advanced options.
99+
- Deprecate `obs_service_get_output_type` because it got replaced.
100+
101+
# Benefit
102+
- FTL, if deprecated by OBS and still used by stream services could be separated in a plugin providing the protocol and the output and also service with [RFC 39
103+
](https://github.com/obsproject/rfcs/pull/39)

0 commit comments

Comments
 (0)