Skip to content
This repository was archived by the owner on Jul 21, 2020. It is now read-only.

Commit 5a15e10

Browse files
author
Michael Casadevall
committed
Add passthrough all FTL settings except URL
Signed-off-by: Michael Casadevall <michael@beam.pro>
1 parent b2ebf87 commit 5a15e10

File tree

2 files changed

+46
-11
lines changed

2 files changed

+46
-11
lines changed

obs/window-basic-main-outputs.cpp

+15-1
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,16 @@ inline void AdvancedOutput::SetupFFmpeg()
789789
"FFACustom");
790790
const char *aMuxCustom = config_get_string(main->Config(), "AdvOut",
791791
"FFAMuxer");
792+
793+
int ftlChannelId = config_get_int(main->Config(), "AdvOut",
794+
"FTLChannelID");
795+
const char *ftlStreamKey = config_get_string(main->Config(), "AdvOut",
796+
"FTLStreamKey");
797+
int ftlAudioSSRC = config_get_int(main->Config(), "AdvOut",
798+
"FTLAudioSSRC");
799+
int ftlVideoSSRC = config_get_int(main->Config(), "AdvOut",
800+
"FTLVideoSSRC");
801+
792802
obs_data_t *settings = obs_data_create();
793803

794804
obs_data_set_string(settings, "url", url);
@@ -804,7 +814,11 @@ inline void AdvancedOutput::SetupFFmpeg()
804814
obs_data_set_string(settings, "audio_encoder", aEncoder);
805815
obs_data_set_int(settings, "audio_encoder_id", aEncoderId);
806816
obs_data_set_string(settings, "audio_settings", aEncCustom);
807-
817+
obs_data_set_int(settings, "ftl_channel_id", ftlChannelId);
818+
obs_data_set_string(settings, "ftl_stream_key", ftlStreamKey);
819+
obs_data_set_int(settings, "ftl_audio_ssrc", ftlAudioSSRC);
820+
obs_data_set_int(settings, "ftl_video_ssrc", ftlVideoSSRC);
821+
808822
if (rescale && rescaleRes && *rescaleRes) {
809823
int width;
810824
int height;

plugins/obs-ffmpeg/obs-ffmpeg-output.c

+31-10
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ struct ffmpeg_cfg {
3636
const char *url;
3737
const char *format_name;
3838
const char *format_mime_type;
39-
const char *audio_muxer_settings;
40-
const char *muxer_settings;
39+
char audio_muxer_settings[2048];
40+
char muxer_settings[2048];
4141
int video_bitrate;
4242
int audio_bitrate;
4343
const char *video_encoder;
@@ -53,6 +53,12 @@ struct ffmpeg_cfg {
5353
int scale_height;
5454
int width;
5555
int height;
56+
57+
/* FTL specific fields */
58+
uint32_t channel_id;
59+
const char *stream_key;
60+
uint32_t audio_ssrc;
61+
uint32_t video_ssrc;
5662
};
5763

5864
struct ffmpeg_data {
@@ -1028,8 +1034,6 @@ static bool try_connect(struct ffmpeg_output *output)
10281034
config.format_name = get_string_or_null(settings, "format_name");
10291035
config.format_mime_type = get_string_or_null(settings,
10301036
"format_mime_type");
1031-
config.audio_muxer_settings = "ssrc=2 payload_type=97";
1032-
config.muxer_settings = "ssrc=1";
10331037
config.video_bitrate = (int)obs_data_get_int(settings, "video_bitrate");
10341038
config.audio_bitrate = (int)obs_data_get_int(settings, "audio_bitrate");
10351039
config.scale_width = (int)obs_data_get_int(settings, "scale_width");
@@ -1038,6 +1042,26 @@ static bool try_connect(struct ffmpeg_output *output)
10381042
config.height = (int)obs_output_get_height(output->output);
10391043
config.format = AV_PIX_FMT_YUV420P;
10401044

1045+
/* Load in FTL specific settings */
1046+
config.channel_id = (uint32_t)obs_data_get_int(settings, "ftl_channel_id");
1047+
config.stream_key = get_string_or_null(settings, "ftl_stream_key");
1048+
config.audio_ssrc = (uint32_t)obs_data_get_int(settings, "ftl_audio_ssrc");
1049+
config.video_ssrc = (uint32_t)obs_data_get_int(settings, "ftl_video_ssrc");
1050+
1051+
/* snprintf out the muxer settings */
1052+
int size = 0;
1053+
size = snprintf(config.muxer_settings, 2048, "ssrc=%u", config.video_ssrc);
1054+
if (size == 2048) {
1055+
blog(LOG_WARNING, "snprintf failed on muxer settings!");
1056+
return false;
1057+
}
1058+
1059+
size = snprintf(config.audio_muxer_settings, 2048, "ssrc=%u payload_type=97", config.audio_ssrc);
1060+
if (size == 2048) {
1061+
blog(LOG_WARNING, "snprintf failed on muxer settings!");
1062+
return false;
1063+
}
1064+
10411065
if (format_is_yuv(voi->format)) {
10421066
config.color_range = voi->range == VIDEO_RANGE_FULL ?
10431067
AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
@@ -1067,15 +1091,12 @@ static bool try_connect(struct ffmpeg_output *output)
10671091
}
10681092

10691093
ftl_set_ingest_location(output->stream_config, "127.0.0.1");
1070-
ftl_set_authetication_key(output->stream_config, 2, "1234561abcde");
1071-
1072-
int video_ssrc = 1;
1094+
ftl_set_authetication_key(output->stream_config, config.channel_id, config.stream_key);
10731095

1074-
output->video_component = ftl_create_video_component(FTL_VIDEO_VP8, 96, video_ssrc, config.scale_width, config.scale_height);
1096+
output->video_component = ftl_create_video_component(FTL_VIDEO_VP8, 96, config.video_ssrc, config.scale_width, config.scale_height);
10751097
ftl_attach_video_component_to_stream(output->stream_config, output->video_component);
10761098

1077-
int audio_ssrc = 2;
1078-
output->audio_component = ftl_create_audio_component(FTL_AUDIO_OPUS, 97, audio_ssrc);
1099+
output->audio_component = ftl_create_audio_component(FTL_AUDIO_OPUS, 97, config.audio_ssrc);
10791100
ftl_attach_audio_component_to_stream(output->stream_config, output->audio_component);
10801101

10811102
if (ftl_activate_stream(output->stream_config) != FTL_SUCCESS) {

0 commit comments

Comments
 (0)