rtmp-services: Add connect infos checks

This commit is contained in:
tytan652 2023-01-19 16:08:44 +01:00
parent 22ebed8d02
commit d917ceafe8
2 changed files with 23 additions and 0 deletions

View file

@ -1062,6 +1062,20 @@ static const char *rtmp_common_get_connect_info(void *data, uint32_t type)
return NULL;
}
static bool rtmp_common_can_try_to_connect(void *data)
{
struct rtmp_common *service = data;
const char *key = rtmp_common_key(data);
if (service->service && strcmp(service->service, "Dacast") == 0)
return (key != NULL && key[0] != '\0');
const char *url = rtmp_common_url(data);
return (url != NULL && url[0] != '\0') &&
(key != NULL && key[0] != '\0');
}
struct obs_service_info rtmp_common_service = {
.id = "rtmp_common",
.get_name = rtmp_common_getname,
@ -1081,4 +1095,5 @@ struct obs_service_info rtmp_common_service = {
.get_max_bitrate = rtmp_common_get_max_bitrate,
.get_supported_video_codecs = rtmp_common_get_supported_video_codecs,
.get_supported_audio_codecs = rtmp_common_get_supported_audio_codecs,
.can_try_to_connect = rtmp_common_can_try_to_connect,
};

View file

@ -174,6 +174,13 @@ static const char *rtmp_custom_get_connect_info(void *data, uint32_t type)
return NULL;
}
static bool rtmp_custom_can_try_to_connect(void *data)
{
struct rtmp_custom *service = data;
return (service->server != NULL && service->server[0] != '\0');
}
struct obs_service_info rtmp_custom_service = {
.id = "rtmp_custom",
.get_name = rtmp_custom_name,
@ -188,4 +195,5 @@ struct obs_service_info rtmp_custom_service = {
.get_username = rtmp_custom_username,
.get_password = rtmp_custom_password,
.apply_encoder_settings = rtmp_custom_apply_settings,
.can_try_to_connect = rtmp_custom_can_try_to_connect,
};