rtmp-services/rtmp-custom: Apply repeat_headers video setting to srt output

If the video encoder allows video headers repetition at IDR frames,
and if the output is not rtmp (so srt, udp, etc with mpegts container),
this commit enables application of this setting from the custom service
(since srt is available through that service).
master
pkv 2020-04-16 23:25:10 +02:00
parent 73ac96ac7c
commit 3521fb976c
1 changed files with 15 additions and 0 deletions

View File

@ -1,4 +1,5 @@
#include <obs-module.h> #include <obs-module.h>
#include <util/dstr.h>
struct rtmp_custom { struct rtmp_custom {
char *server, *key; char *server, *key;
@ -109,6 +110,19 @@ static const char *rtmp_custom_password(void *data)
return service->password; return service->password;
} }
#define RTMP_PROTOCOL "rtmp"
static void rtmp_custom_apply_settings(void *data, obs_data_t *video_settings,
obs_data_t *audio_settings)
{
struct rtmp_custom *service = data;
if (service->server != NULL && video_settings != NULL &&
strncmp(service->server, RTMP_PROTOCOL, strlen(RTMP_PROTOCOL)) !=
0) {
obs_data_set_bool(video_settings, "repeat_headers", true);
}
}
struct obs_service_info rtmp_custom_service = { struct obs_service_info rtmp_custom_service = {
.id = "rtmp_custom", .id = "rtmp_custom",
.get_name = rtmp_custom_name, .get_name = rtmp_custom_name,
@ -120,4 +134,5 @@ struct obs_service_info rtmp_custom_service = {
.get_key = rtmp_custom_key, .get_key = rtmp_custom_key,
.get_username = rtmp_custom_username, .get_username = rtmp_custom_username,
.get_password = rtmp_custom_password, .get_password = rtmp_custom_password,
.apply_encoder_settings = rtmp_custom_apply_settings,
}; };