Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Support FTL URLs for custom streaming service #3834

Merged
merged 1 commit into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions UI/window-basic-main-outputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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";
}
}
Expand Down Expand Up @@ -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";
}
}
Expand Down
13 changes: 11 additions & 2 deletions plugins/obs-outputs/ftl-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1019,7 +1021,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");
Expand All @@ -1045,7 +1047,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");
Expand Down