From 3521fb976c80a00904142766eca7e2f64b39e8ca Mon Sep 17 00:00:00 2001 From: pkv Date: Thu, 16 Apr 2020 23:25:10 +0200 Subject: [PATCH] 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). --- plugins/rtmp-services/rtmp-custom.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/rtmp-services/rtmp-custom.c b/plugins/rtmp-services/rtmp-custom.c index 921be2fe3..6879eb99c 100644 --- a/plugins/rtmp-services/rtmp-custom.c +++ b/plugins/rtmp-services/rtmp-custom.c @@ -1,4 +1,5 @@ #include +#include struct rtmp_custom { char *server, *key; @@ -109,6 +110,19 @@ static const char *rtmp_custom_password(void *data) 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 = { .id = "rtmp_custom", .get_name = rtmp_custom_name, @@ -120,4 +134,5 @@ struct obs_service_info rtmp_custom_service = { .get_key = rtmp_custom_key, .get_username = rtmp_custom_username, .get_password = rtmp_custom_password, + .apply_encoder_settings = rtmp_custom_apply_settings, };