[recording] update streaming url at startup and whenever the stream keys are updated

This commit is contained in:
radius 2018-09-26 21:40:57 -05:00
parent 70dcdc7cf0
commit c0f9f7b9a9
4 changed files with 55 additions and 48 deletions

View File

@ -3041,6 +3041,7 @@ static bool config_load_file(const char *path, bool set_defaults,
}
frontend_driver_set_sustained_performance_mode(settings->bools.sustained_performance_mode);
recording_driver_update_streaming_url();
ret = true;

View File

@ -2956,53 +2956,8 @@ static void achievement_hardcore_mode_write_handler(rarch_setting_t *setting)
#ifdef HAVE_FFMPEG
static void update_streaming_url_write_handler(rarch_setting_t *setting)
{
settings_t *settings = config_get_ptr();
const char* youtube_url = "rtmp://a.rtmp.youtube.com/live2/";
const char* twitch_url = "rtmp://live.twitch.tv/app/";
if (!setting)
return;
switch (settings->uints.streaming_mode)
{
case STREAMING_MODE_TWITCH:
{
if (!string_is_empty(settings->arrays.twitch_stream_key))
snprintf(settings->paths.path_stream_url, sizeof(settings->paths.path_stream_url),
"%s%s", twitch_url, settings->arrays.twitch_stream_key);
else
{
/* To-Do: Show input box for twitch_stream_key*/
RARCH_LOG("[recording] twitch streaming key empty");
}
break;
}
case STREAMING_MODE_YOUTUBE:
{
if (!string_is_empty(settings->arrays.youtube_stream_key))
{
snprintf(settings->paths.path_stream_url, sizeof(settings->paths.path_stream_url),
"%s%s", youtube_url, settings->arrays.youtube_stream_key);
}
else
{
/* To-Do: Show input box for youtube_stream_key*/
RARCH_LOG("[recording] youtube streaming key empty");
}
break;
}
case STREAMING_MODE_LOCAL:
/* To-Do: figure out default interface and bind to that instead */
snprintf(settings->paths.path_stream_url, sizeof(settings->paths.path_stream_url),
"udp://%s:%u", "127.0.0.1", settings->uints.video_stream_port);
break;
case STREAMING_MODE_CUSTOM:
default:
/* Do nothing, let the user input the URL */
break;
}
recording_driver_update_streaming_url();
}
#endif
#ifdef HAVE_LAKKA
@ -9702,7 +9657,7 @@ static bool setting_append_list(
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
update_streaming_url_write_handler,
general_read_handler);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT);
@ -9728,7 +9683,7 @@ static bool setting_append_list(
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
update_streaming_url_write_handler,
general_read_handler);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT);

View File

@ -520,6 +520,55 @@ unsigned *recording_driver_get_height(void)
return &recording_height;
}
void recording_driver_update_streaming_url()
{
settings_t *settings = config_get_ptr();
const char* youtube_url = "rtmp://a.rtmp.youtube.com/live2/";
const char* twitch_url = "rtmp://live.twitch.tv/app/";
if (!settings)
return;
switch (settings->uints.streaming_mode)
{
case STREAMING_MODE_TWITCH:
{
if (!string_is_empty(settings->arrays.twitch_stream_key))
snprintf(settings->paths.path_stream_url, sizeof(settings->paths.path_stream_url),
"%s%s", twitch_url, settings->arrays.twitch_stream_key);
else
{
/* To-Do: Show input box for twitch_stream_key*/
RARCH_LOG("[recording] twitch streaming key empty");
}
break;
}
case STREAMING_MODE_YOUTUBE:
{
if (!string_is_empty(settings->arrays.youtube_stream_key))
{
snprintf(settings->paths.path_stream_url, sizeof(settings->paths.path_stream_url),
"%s%s", youtube_url, settings->arrays.youtube_stream_key);
}
else
{
/* To-Do: Show input box for youtube_stream_key*/
RARCH_LOG("[recording] youtube streaming key empty");
}
break;
}
case STREAMING_MODE_LOCAL:
/* To-Do: figure out default interface and bind to that instead */
snprintf(settings->paths.path_stream_url, sizeof(settings->paths.path_stream_url),
"udp://%s:%u", "127.0.0.1", settings->uints.video_stream_port);
break;
case STREAMING_MODE_CUSTOM:
default:
/* Do nothing, let the user input the URL */
break;
}
}
void recording_driver_free_state(void)
{
recording_gpu_width = 0;

View File

@ -208,6 +208,8 @@ bool recording_is_enabled(void);
bool streaming_is_enabled(void);
void recording_driver_update_streaming_url();
extern void *recording_data;
RETRO_END_DECLS