Add "builtin_mediaplayer_enable" setting

This commit is contained in:
twinaphex 2015-06-23 07:09:24 +02:00
parent 38b3b87812
commit be2ae1c602
9 changed files with 94 additions and 17 deletions

View File

@ -447,6 +447,9 @@ static void config_set_defaults(void)
settings->history_list_enable = def_history_list_enable;
settings->load_dummy_on_core_shutdown = load_dummy_on_core_shutdown;
#ifdef HAVE_FFMPEG
settings->mediaplayer.builtin_enable = true;
#endif
settings->video.scale = scale;
settings->video.fullscreen = global->force_fullscreen ? true : fullscreen;
settings->video.windowed_fullscreen = windowed_fullscreen;
@ -1434,6 +1437,9 @@ static bool config_load_file(const char *path, bool set_defaults)
CONFIG_GET_BOOL_BASE(conf, settings, ui.suspend_screensaver_enable, "suspend_screensaver_enable");
CONFIG_GET_BOOL_BASE(conf, settings, fps_show, "fps_show");
CONFIG_GET_BOOL_BASE(conf, settings, load_dummy_on_core_shutdown, "load_dummy_on_core_shutdown");
#ifdef HAVE_FFMPEG
CONFIG_GET_BOOL_BASE(conf, settings, mediaplayer.builtin_enable, "builtin_mediaplayer_enable");
#endif
config_get_path(conf, "libretro_info_path", settings->libretro_info_path, sizeof(settings->libretro_info_path));
@ -2293,6 +2299,8 @@ bool config_save_file(const char *path)
settings->input.input_descriptor_hide_unbound);
config_set_bool(conf, "load_dummy_on_core_shutdown",
settings->load_dummy_on_core_shutdown);
config_set_bool(conf, "builtin_mediaplayer_enable",
settings->mediaplayer.builtin_enable);
config_set_bool(conf, "fps_show", settings->fps_show);
config_set_bool(conf, "ui_menubar_enable", settings->ui.menubar_enable);
config_set_path(conf, "libretro_path", settings->libretro);

View File

@ -266,6 +266,13 @@ typedef struct settings
bool set_supports_no_game_enable;
} core;
#ifdef HAVE_FFMPEG
struct
{
bool builtin_enable;
} mediaplayer;
#endif
int state_slot;
char core_options_path[PATH_MAX_LENGTH];

View File

@ -438,14 +438,18 @@ static int deferred_push_content_history_path(menu_displaylist_info_t *info)
static int deferred_push_detect_core_list(menu_displaylist_info_t *info)
{
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
info->type_default = MENU_FILE_PLAIN;
if (global->core_info)
strlcpy(info->exts, core_info_list_get_all_extensions(
global->core_info), sizeof(info->exts));
(void)settings;
#ifdef HAVE_FFMPEG
if (settings->mediaplayer.builtin_enable)
{
struct retro_system_info sysinfo = {0};
libretro_ffmpeg_retro_get_system_info(&sysinfo);
@ -459,7 +463,8 @@ static int deferred_push_detect_core_list(menu_displaylist_info_t *info)
static int deferred_push_default(menu_displaylist_info_t *info)
{
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
info->type_default = MENU_FILE_PLAIN;
info->setting = menu_setting_find(info->label);
@ -474,7 +479,10 @@ static int deferred_push_default(menu_displaylist_info_t *info)
else
strlcpy(info->exts, global->system.valid_extensions, sizeof(info->exts));
(void)settings;
#ifdef HAVE_FFMPEG
if (settings->mediaplayer.builtin_enable)
{
struct retro_system_info sysinfo = {0};
libretro_ffmpeg_retro_get_system_info(&sysinfo);

View File

@ -1812,6 +1812,7 @@ static int menu_displaylist_parse_generic(menu_displaylist_info_t *info, bool *n
}
#ifdef HAVE_FFMPEG
if (settings->mediaplayer.builtin_enable)
{
uint32_t hash_ext = menu_hash_calculate(path_get_extension(path));

View File

@ -1572,6 +1572,10 @@ static const char *menu_hash_to_str_english(uint32_t hash)
{
switch (hash)
{
case MENU_LABEL_USE_BUILTIN_PLAYER:
return "use_builtin_player";
case MENU_LABEL_VALUE_USE_BUILTIN_PLAYER:
return "Use Builtin Player";
case MENU_LABEL_CONTENT_SETTINGS:
return "content_settings";
case MENU_LABEL_VALUE_CONTENT_SETTINGS:

View File

@ -49,6 +49,9 @@ extern "C" {
#define MENU_VALUE_OPEN_ARCHIVE 0x96da22b9U
#define MENU_VALUE_ASK_ARCHIVE 0x0b87d6a4U
#define MENU_LABEL_USE_BUILTIN_PLAYER 0x9927ca74U
#define MENU_LABEL_VALUE_USE_BUILTIN_PLAYER 0x038e4816U
#define MENU_LABEL_CONTENT_SETTINGS 0xf31dcaf0U
#define MENU_LABEL_VALUE_CONTENT_SETTINGS 0x399ea371U

View File

@ -5777,6 +5777,42 @@ static bool setting_append_list_menu_options(
return true;
}
#ifdef HAVE_FFMPEG
static bool setting_append_list_mediaplayer_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
const char *parent_group)
{
rarch_setting_group_info_t group_info = {0};
rarch_setting_group_info_t subgroup_info = {0};
settings_t *settings = config_get_ptr();
START_GROUP(group_info, "Media Player Settings", parent_group);
parent_group = menu_hash_to_str(MENU_LABEL_VALUE_SETTINGS);
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info, parent_group);
CONFIG_BOOL(
settings->mediaplayer.builtin_enable,
menu_hash_to_str(MENU_LABEL_USE_BUILTIN_PLAYER),
menu_hash_to_str(MENU_LABEL_VALUE_USE_BUILTIN_PLAYER),
true,
menu_hash_to_str(MENU_VALUE_OFF),
menu_hash_to_str(MENU_VALUE_ON),
group_info.name,
subgroup_info.name,
parent_group,
general_write_handler,
general_read_handler);
END_SUB_GROUP(list, list_info, parent_group);
END_GROUP(list, list_info, parent_group);
return true;
}
#endif
static bool setting_append_list_ui_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
@ -7060,6 +7096,14 @@ rarch_setting_t *menu_setting_new(unsigned mask)
goto error;
}
#ifdef HAVE_FFMPEG
if (mask & SL_FLAG_MEDIA_PLAYER_OPTIONS)
{
if (!setting_append_list_mediaplayer_options(&list, list_info, root))
goto error;
}
#endif
if (mask & SL_FLAG_UI_OPTIONS)
{
if (!setting_append_list_ui_options(&list, list_info, root))

View File

@ -82,21 +82,22 @@ enum setting_list_flags
SL_FLAG_INPUT_HOTKEY_OPTIONS = (1 << 11),
SL_FLAG_OVERLAY_OPTIONS = (1 << 12),
SL_FLAG_MENU_OPTIONS = (1 << 13),
SL_FLAG_UI_OPTIONS = (1 << 14),
SL_FLAG_CORE_UPDATER_OPTIONS = (1 << 15),
SL_FLAG_NETPLAY_OPTIONS = (1 << 16),
SL_FLAG_USER_OPTIONS = (1 << 17),
SL_FLAG_DIRECTORY_OPTIONS = (1 << 18),
SL_FLAG_PRIVACY_OPTIONS = (1 << 19),
SL_FLAG_PLAYLIST_OPTIONS = (1 << 20),
SL_FLAG_MENU_BROWSER_OPTIONS = (1 << 21),
SL_FLAG_PATCH_OPTIONS = (1 << 22),
SL_FLAG_RECORDING_OPTIONS = (1 << 23),
SL_FLAG_FRAME_THROTTLE_OPTIONS= (1 << 24),
SL_FLAG_LOGGING_OPTIONS = (1 << 25),
SL_FLAG_SAVING_OPTIONS = (1 << 26),
SL_FLAG_ALL = (1 << 27),
SL_FLAG_ALLOW_EMPTY_LIST = (1 << 28)
SL_FLAG_MEDIA_PLAYER_OPTIONS = (1 << 14),
SL_FLAG_UI_OPTIONS = (1 << 15),
SL_FLAG_CORE_UPDATER_OPTIONS = (1 << 16),
SL_FLAG_NETPLAY_OPTIONS = (1 << 17),
SL_FLAG_USER_OPTIONS = (1 << 18),
SL_FLAG_DIRECTORY_OPTIONS = (1 << 19),
SL_FLAG_PRIVACY_OPTIONS = (1 << 20),
SL_FLAG_PLAYLIST_OPTIONS = (1 << 21),
SL_FLAG_MENU_BROWSER_OPTIONS = (1 << 22),
SL_FLAG_PATCH_OPTIONS = (1 << 23),
SL_FLAG_RECORDING_OPTIONS = (1 << 24),
SL_FLAG_FRAME_THROTTLE_OPTIONS= (1 << 25),
SL_FLAG_LOGGING_OPTIONS = (1 << 26),
SL_FLAG_SAVING_OPTIONS = (1 << 27),
SL_FLAG_ALL = (1 << 28),
SL_FLAG_ALLOW_EMPTY_LIST = (1 << 29),
};
#define SL_FLAG_ALL_SETTINGS (SL_FLAG_ALL - SL_FLAG_MAIN_MENU)

View File

@ -846,6 +846,7 @@ static void parse_input(int argc, char *argv[])
global->libretro_no_content = true;
#ifdef HAVE_FFMPEG
if (settings->mediaplayer.builtin_enable)
{
uint32_t hash_ext = djb2_calculate(path_get_extension(global->fullpath));