From 96ef45cef5baae3bf01fbb22051d6da4ee6ceae1 Mon Sep 17 00:00:00 2001 From: Hayden McAfee Date: Sun, 6 Dec 2020 01:54:29 -0800 Subject: [PATCH] UI: Support FTL URLs for custom streaming service Custom streaming service URLs beginning with `ftl` are handled by the `ftl_output` plugin. --- UI/window-basic-main-outputs.cpp | 11 +++++++++-- plugins/obs-outputs/ftl-stream.c | 13 +++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/UI/window-basic-main-outputs.cpp b/UI/window-basic-main-outputs.cpp index 68cc566a5..b66fdaef7 100644 --- a/UI/window-basic-main-outputs.cpp +++ b/UI/window-basic-main-outputs.cpp @@ -16,6 +16,7 @@ volatile bool recording_paused = false; volatile bool replaybuf_active = false; volatile bool virtualcam_active = false; +#define FTL_PROTOCOL "ftl" #define RTMP_PROTOCOL "rtmp" static void OBSStreamStarting(void *data, calldata_t *params) @@ -763,7 +764,10 @@ bool SimpleOutput::SetupStreaming(obs_service_t *service) type = "rtmp_output"; const char *url = obs_service_get_url(service); if (url != NULL && - strncmp(url, RTMP_PROTOCOL, strlen(RTMP_PROTOCOL)) != 0) { + strncmp(url, FTL_PROTOCOL, strlen(FTL_PROTOCOL)) == 0) { + type = "ftl_output"; + } else if (url != NULL && strncmp(url, RTMP_PROTOCOL, + strlen(RTMP_PROTOCOL)) != 0) { type = "ffmpeg_mpegts_muxer"; } } @@ -1684,7 +1688,10 @@ bool AdvancedOutput::SetupStreaming(obs_service_t *service) type = "rtmp_output"; const char *url = obs_service_get_url(service); if (url != NULL && - strncmp(url, RTMP_PROTOCOL, strlen(RTMP_PROTOCOL)) != 0) { + strncmp(url, FTL_PROTOCOL, strlen(FTL_PROTOCOL)) == 0) { + type = "ftl_output"; + } else if (url != NULL && strncmp(url, RTMP_PROTOCOL, + strlen(RTMP_PROTOCOL)) != 0) { type = "ffmpeg_mpegts_muxer"; } } diff --git a/plugins/obs-outputs/ftl-stream.c b/plugins/obs-outputs/ftl-stream.c index 2ae7042f5..99d6e95c4 100644 --- a/plugins/obs-outputs/ftl-stream.c +++ b/plugins/obs-outputs/ftl-stream.c @@ -45,6 +45,8 @@ #define OPT_MAX_SHUTDOWN_TIME_SEC "max_shutdown_time_sec" #define OPT_BIND_IP "bind_ip" +#define FTL_URL_PROTOCOL "ftl://" + typedef struct _nalu_t { int len; int dts_usec; @@ -1020,7 +1022,7 @@ static int init_connect(struct ftl_stream *stream) { obs_service_t *service; obs_data_t *settings; - const char *bind_ip, *key; + const char *bind_ip, *key, *ingest_url; ftl_status_t status_code; info("init_connect"); @@ -1046,7 +1048,14 @@ static int init_connect(struct ftl_stream *stream) obs_output_get_video_encoder(stream->output); obs_data_t *video_settings = obs_encoder_get_settings(video_encoder); - dstr_copy(&stream->path, obs_service_get_url(service)); + ingest_url = obs_service_get_url(service); + if (strncmp(ingest_url, FTL_URL_PROTOCOL, strlen(FTL_URL_PROTOCOL)) == + 0) { + dstr_copy(&stream->path, ingest_url + strlen(FTL_URL_PROTOCOL)); + } else { + dstr_copy(&stream->path, ingest_url); + } + key = obs_service_get_key(service); int target_bitrate = (int)obs_data_get_int(video_settings, "bitrate");