From 1764bfe60f9831d371d207926afed16ad461b201 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 26 Sep 2018 23:34:45 +0200 Subject: [PATCH] Added Streaming Mode --- configuration.c | 1 + configuration.h | 1 + intl/msg_hash_ar.h | 2 ++ intl/msg_hash_chs.h | 2 ++ intl/msg_hash_cht.h | 2 ++ intl/msg_hash_de.h | 2 ++ intl/msg_hash_eo.h | 2 ++ intl/msg_hash_es.h | 2 ++ intl/msg_hash_fr.h | 2 ++ intl/msg_hash_it.h | 2 ++ intl/msg_hash_ja.h | 2 ++ intl/msg_hash_ko.h | 2 ++ intl/msg_hash_lbl.h | 2 ++ intl/msg_hash_nl.h | 2 ++ intl/msg_hash_pl.h | 2 ++ intl/msg_hash_pt_br.h | 2 ++ intl/msg_hash_pt_pt.h | 2 ++ intl/msg_hash_ru.h | 2 ++ intl/msg_hash_us.h | 2 ++ intl/msg_hash_vn.h | 2 ++ menu/menu_displaylist.c | 4 ++++ menu/menu_setting.c | 38 ++++++++++++++++++++++++++++++++++++++ msg_hash.h | 1 + record/record_driver.h | 7 +++++++ 24 files changed, 88 insertions(+) diff --git a/configuration.c b/configuration.c index 1831f5337c..661573c666 100644 --- a/configuration.c +++ b/configuration.c @@ -1536,6 +1536,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, unsigned count = 0; struct config_uint_setting *tmp = (struct config_uint_setting*)malloc((*size + 1) * sizeof(struct config_uint_setting)); + SETTING_UINT("streaming_mode", &settings->uints.streaming_mode, true, STREAMING_MODE_TWITCH, false); SETTING_UINT("crt_switch_resolution", &settings->uints.crt_switch_resolution, true, crt_switch_resolution, false); SETTING_UINT("input_bind_timeout", &settings->uints.input_bind_timeout, true, input_bind_timeout, false); SETTING_UINT("input_bind_hold", &settings->uints.input_bind_hold, true, input_bind_hold, false); diff --git a/configuration.h b/configuration.h index 9b150befb2..c873a8d094 100644 --- a/configuration.h +++ b/configuration.h @@ -432,6 +432,7 @@ typedef struct settings unsigned run_ahead_frames; unsigned midi_volume; + unsigned streaming_mode; } uints; struct diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 1694947179..5d4d0ffc6c 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -3651,3 +3651,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 88f1407edd..80f308ad6a 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -3435,3 +3435,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index a0e2effc1d..50e3d17f4c 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -3427,3 +3427,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index be45d4f8a9..62984378c9 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -3537,3 +3537,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index 318589b705..a4f265f648 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -3302,3 +3302,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index 52d813a1bf..cdf9ab8eaa 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -7557,3 +7557,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index 52c814fd2b..ac1b1555b5 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -3461,3 +3461,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 8975b99735..bca6a4bf45 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -3521,3 +3521,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index dcd7b75d37..0b3dc7027b 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -3924,3 +3924,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 4857b205e2..2cb15c3ec6 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -3422,3 +3422,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index d0a3e48cef..3dc2422412 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1699,3 +1699,5 @@ MSG_HASH(MENU_ENUM_LABEL_TWITCH_STREAM_KEY, "twitch_stream_key") MSG_HASH(MENU_ENUM_LABEL_YOUTUBE_STREAM_KEY, "youtube_stream_key") +MSG_HASH(MENU_ENUM_LABEL_STREAMING_MODE, + "streaming_mode") diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 28a0130864..832ce22ca4 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -3296,3 +3296,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 130526327b..d00b566130 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3724,3 +3724,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index daeff89b32..799a453ae8 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -7540,3 +7540,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index 4c2b328b8e..c2e7238914 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -3388,3 +3388,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index ad5e2497ed..4be91f3cb5 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -3591,3 +3591,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 7628fc645c..9d843ed4aa 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -7578,3 +7578,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 77e3a2a0b2..1c14c1f9aa 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -3459,3 +3459,5 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_TWITCH_STREAM_KEY, "Twitch Stream Key") MSG_HASH(MENU_ENUM_LABEL_VALUE_YOUTUBE_STREAM_KEY, "YouTube Stream Key") +MSG_HASH(MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + "Streaming Mode") diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 1f1a278c78..556adcdf1b 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7067,6 +7067,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) MENU_ENUM_LABEL_RECORD_PATH, PARSE_ONLY_STRING, false) == 0) count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_STREAMING_MODE, + PARSE_ONLY_UINT, false) == 0) + count++; if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_RECORD_USE_OUTPUT_DIRECTORY, PARSE_ONLY_BOOL, false) == 0) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 1c5b303708..0981042b42 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -289,6 +289,28 @@ static int setting_action_ok_uint(rarch_setting_t *setting, bool wraparound) return 0; } +static void setting_get_string_representation_streaming_mode( + rarch_setting_t *setting, + char *s, size_t len) +{ + if (!setting) + return; + + /* TODO/FIXME - localize this */ + switch (*setting->value.target.unsigned_integer) + { + case STREAMING_MODE_TWITCH: + strlcpy(s, "Twitch", len); + break; + case STREAMING_MODE_YOUTUBE: + strlcpy(s, "YouTube", len); + break; + case STREAMING_MODE_UDP: + strlcpy(s, "UDP", len); + break; + } +} + static void setting_get_string_representation_video_stream_quality( rarch_setting_t *setting, char *s, size_t len) @@ -6491,6 +6513,22 @@ static bool setting_append_list( general_read_handler); menu_settings_list_current_add_values(list, list_info, "cfg"); + CONFIG_UINT( + list, list_info, + &settings->uints.streaming_mode, + MENU_ENUM_LABEL_STREAMING_MODE, + MENU_ENUM_LABEL_VALUE_STREAMING_MODE, + STREAMING_MODE_TWITCH, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_streaming_mode; + menu_settings_list_current_add_range(list, list_info, 0, 2, 1, true, true); + CONFIG_UINT( list, list_info, &settings->uints.video_stream_port, diff --git a/msg_hash.h b/msg_hash.h index b14254ead6..87a77e7865 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -415,6 +415,7 @@ enum msg_hash_enums MSG_RUNAHEAD_FAILED_TO_SAVE_STATE, MSG_RUNAHEAD_FAILED_TO_LOAD_STATE, MSG_RUNAHEAD_FAILED_TO_CREATE_SECONDARY_INSTANCE, + MENU_LABEL(STREAMING_MODE), MENU_LABEL(VIDEO_RECORD_QUALITY), MENU_LABEL(VIDEO_STREAM_QUALITY), MENU_LABEL(STREAMING_URL), diff --git a/record/record_driver.h b/record/record_driver.h index 400fcbe87f..cf1a4c112c 100644 --- a/record/record_driver.h +++ b/record/record_driver.h @@ -31,6 +31,13 @@ enum ffemu_pix_format FFEMU_PIX_ARGB8888 }; +enum streaming_mode +{ + STREAMING_MODE_TWITCH = 0, + STREAMING_MODE_YOUTUBE, + STREAMING_MODE_UDP +}; + enum record_config_type { RECORD_CONFIG_TYPE_RECORDING_CUSTOM = 0,