@@ -36,8 +36,8 @@ struct ffmpeg_cfg {
36
36
const char * url ;
37
37
const char * format_name ;
38
38
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 ] ;
41
41
int video_bitrate ;
42
42
int audio_bitrate ;
43
43
const char * video_encoder ;
@@ -53,6 +53,12 @@ struct ffmpeg_cfg {
53
53
int scale_height ;
54
54
int width ;
55
55
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 ;
56
62
};
57
63
58
64
struct ffmpeg_data {
@@ -1028,8 +1034,6 @@ static bool try_connect(struct ffmpeg_output *output)
1028
1034
config .format_name = get_string_or_null (settings , "format_name" );
1029
1035
config .format_mime_type = get_string_or_null (settings ,
1030
1036
"format_mime_type" );
1031
- config .audio_muxer_settings = "ssrc=2 payload_type=97" ;
1032
- config .muxer_settings = "ssrc=1" ;
1033
1037
config .video_bitrate = (int )obs_data_get_int (settings , "video_bitrate" );
1034
1038
config .audio_bitrate = (int )obs_data_get_int (settings , "audio_bitrate" );
1035
1039
config .scale_width = (int )obs_data_get_int (settings , "scale_width" );
@@ -1038,6 +1042,26 @@ static bool try_connect(struct ffmpeg_output *output)
1038
1042
config .height = (int )obs_output_get_height (output -> output );
1039
1043
config .format = AV_PIX_FMT_YUV420P ;
1040
1044
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
+
1041
1065
if (format_is_yuv (voi -> format )) {
1042
1066
config .color_range = voi -> range == VIDEO_RANGE_FULL ?
1043
1067
AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG ;
@@ -1067,15 +1091,12 @@ static bool try_connect(struct ffmpeg_output *output)
1067
1091
}
1068
1092
1069
1093
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 );
1073
1095
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 );
1075
1097
ftl_attach_video_component_to_stream (output -> stream_config , output -> video_component );
1076
1098
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 );
1079
1100
ftl_attach_audio_component_to_stream (output -> stream_config , output -> audio_component );
1080
1101
1081
1102
if (ftl_activate_stream (output -> stream_config ) != FTL_SUCCESS ) {
0 commit comments