Add music tab for non-ffmpeg enabled builds now; add 'Run'

and 'Add to mixer' options when selecting Ogg/WAV files
This commit is contained in:
twinaphex 2017-05-27 23:56:10 +02:00
parent 63638ee571
commit 9438545bca
12 changed files with 159 additions and 40 deletions

View File

@ -227,6 +227,8 @@ MSG_HASH(MENU_ENUM_LABEL_DATABASE_MANAGER,
"database_manager")
MSG_HASH(MENU_ENUM_LABEL_DATABASE_MANAGER_LIST,
"database_manager_list")
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_MUSIC,
"deferred_music")
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_BROWSE_URL_START,
"deferred_browse_url_start")
MSG_HASH(MENU_ENUM_LABEL_DEFERRED_BROWSE_URL_LIST,
@ -837,6 +839,8 @@ MSG_HASH(MENU_ENUM_LABEL_RGUI_SHOW_START_SCREEN,
"rgui_show_start_screen")
MSG_HASH(MENU_ENUM_LABEL_RUN,
"collection")
MSG_HASH(MENU_ENUM_LABEL_RUN_MUSIC,
"collection_music")
MSG_HASH(MENU_ENUM_LABEL_SAMBA_ENABLE,
"samba_enable")
MSG_HASH(MENU_ENUM_LABEL_SAVEFILE_DIRECTORY,
@ -1223,3 +1227,5 @@ MSG_HASH(MENU_ENUM_LABEL_NETPLAY_USE_MITM_SERVER,
"netplay_use_mitm_server")
MSG_HASH(MENU_ENUM_LABEL_ADD_TO_MIXER,
"audio_add_to_mixer")
MSG_HASH(MENU_ENUM_LABEL_ADD_TO_MIXER_AND_COLLECTION,
"audio_add_to_mixer_and_collection")

View File

@ -1245,6 +1245,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_RIGHT_ANALOG,
"Right Analog")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN,
"Run")
MSG_HASH(MENU_ENUM_LABEL_VALUE_RUN_MUSIC,
"Run")
MSG_HASH(MENU_ENUM_LABEL_VALUE_SAMBA_ENABLE,
"SAMBA Enable")
MSG_HASH(MENU_ENUM_LABEL_VALUE_SAVEFILE_DIRECTORY,
@ -3011,3 +3013,5 @@ MSG_HASH(MENU_ENUM_SUBLABEL_NETPLAY_USE_MITM_SERVER,
"Forward netplay connections through a man-in-the-middle server. Useful if the host is behind a firewall or has NAT/UPnP problems.")
MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER,
"Add to mixer")
MSG_HASH(MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_COLLECTION,
"Add to mixer")

View File

@ -93,6 +93,11 @@ static int deferred_main_menu_list(menu_displaylist_info_t *info)
return deferred_push_dlist(info, DISPLAYLIST_MAIN_MENU);
}
static int deferred_music_list(menu_displaylist_info_t *info)
{
return deferred_push_dlist(info, DISPLAYLIST_MUSIC_LIST);
}
static int deferred_user_binds_list(menu_displaylist_info_t *info)
{
return deferred_push_dlist(info, DISPLAYLIST_USER_BINDS_LIST);
@ -1022,7 +1027,11 @@ static int menu_cbs_init_bind_deferred_push_compare_label(
#endif
return 0;
}
if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MUSIC)))
{
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_music_list);
return 0;
}
if (strstr(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RDB_ENTRY_DETAIL)))
{
BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_rdb_entry_detail);

View File

@ -168,6 +168,20 @@ int generic_action_ok_displaylist_push(const char *path,
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_USER_BINDS_LIST;
dl_type = DISPLAYLIST_GENERIC;
break;
case ACTION_OK_DL_MUSIC:
if (!string_is_empty(path))
strlcpy(menu->scratch_buf, path, sizeof(menu->scratch_buf));
if (!string_is_empty(menu_path))
strlcpy(menu->scratch2_buf, menu_path, sizeof(menu->scratch2_buf));
info_label = msg_hash_to_str(
MENU_ENUM_LABEL_DEFERRED_MUSIC);
info.enum_idx = MENU_ENUM_LABEL_DEFERRED_MUSIC;
info_path = path;
info.type = type;
info.directory_ptr = idx;
dl_type = DISPLAYLIST_GENERIC;
break;
case ACTION_OK_DL_OPEN_ARCHIVE_DETECT_CORE:
if (menu)
{
@ -1716,6 +1730,36 @@ static int action_ok_audio_add_to_mixer(const char *path,
return 0;
}
static int action_ok_audio_add_to_mixer_and_collection(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char combined_path[PATH_MAX_LENGTH];
const char *entry_path = NULL;
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
fill_pathname_join(combined_path, menu->scratch2_buf,
menu->scratch_buf, sizeof(combined_path));
playlist_push(g_defaults.music_history,
combined_path,
NULL,
"builtin",
"musicplayer",
NULL,
NULL);
playlist_write_file(g_defaults.music_history);
if(path_file_exists(combined_path))
task_push_audio_mixer_load(combined_path,
NULL, NULL);
return 0;
}
static int action_ok_menu_wallpaper(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
@ -2239,8 +2283,6 @@ static int action_ok_start_video_processor_core(const char *path,
return 0;
}
#ifdef HAVE_FFMPEG
static int action_ok_file_load_ffmpeg(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
@ -2270,7 +2312,34 @@ static int action_ok_file_load_ffmpeg(const char *path,
return 0;
}
#endif
static int action_ok_audio_run(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char combined_path[PATH_MAX_LENGTH];
content_ctx_info_t content_info;
menu_handle_t *menu = NULL;
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
fill_pathname_join(combined_path, menu->scratch2_buf,
menu->scratch_buf, sizeof(combined_path));
content_info.argc = 0;
content_info.argv = NULL;
content_info.args = NULL;
content_info.environ_get = NULL;
if (!task_push_load_content_with_core_from_menu(
combined_path,
&content_info,
CORE_TYPE_FFMPEG,
NULL, NULL))
return -1;
return 0;
}
static int action_ok_file_load_imageviewer(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
@ -3871,6 +3940,14 @@ static int action_ok_open_archive_detect_core(const char *path,
ACTION_OK_DL_OPEN_ARCHIVE_DETECT_CORE);
}
static int action_ok_file_load_music(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
return generic_action_ok_displaylist_push(path, NULL,
label, type, idx, entry_idx,
ACTION_OK_DL_MUSIC);
}
static int action_ok_push_accounts_list(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
@ -4339,6 +4416,12 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
{
switch (cbs->enum_idx)
{
case MENU_ENUM_LABEL_RUN_MUSIC:
BIND_ACTION_OK(cbs, action_ok_audio_run);
break;
case MENU_ENUM_LABEL_ADD_TO_MIXER_AND_COLLECTION:
BIND_ACTION_OK(cbs, action_ok_audio_add_to_mixer_and_collection);
break;
case MENU_ENUM_LABEL_ADD_TO_MIXER:
BIND_ACTION_OK(cbs, action_ok_audio_add_to_mixer);
break;
@ -5067,12 +5150,14 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
}
break;
case FILE_TYPE_MOVIE:
case FILE_TYPE_MUSIC:
#ifdef HAVE_FFMPEG
/* TODO/FIXME - handle scan case */
BIND_ACTION_OK(cbs, action_ok_file_load_ffmpeg);
#endif
break;
case FILE_TYPE_MUSIC:
BIND_ACTION_OK(cbs, action_ok_file_load_music);
break;
case FILE_TYPE_IMAGEVIEWER:
/* TODO/FIXME - handle scan case */
BIND_ACTION_OK(cbs, action_ok_file_load_imageviewer);

View File

@ -90,8 +90,8 @@ enum
XMB_TEXTURE_MAIN_MENU = 0,
XMB_TEXTURE_SETTINGS,
XMB_TEXTURE_HISTORY,
#ifdef HAVE_FFMPEG
XMB_TEXTURE_MUSICS,
#ifdef HAVE_FFMPEG
XMB_TEXTURE_MOVIES,
#endif
#ifdef HAVE_NETWORKING
@ -147,8 +147,8 @@ enum
XMB_SYSTEM_TAB_MAIN = 0,
XMB_SYSTEM_TAB_SETTINGS,
XMB_SYSTEM_TAB_HISTORY,
#ifdef HAVE_FFMPEG
XMB_SYSTEM_TAB_MUSIC,
#ifdef HAVE_FFMPEG
XMB_SYSTEM_TAB_VIDEO,
#endif
#ifdef HAVE_IMAGEVIEWER
@ -160,19 +160,6 @@ enum
XMB_SYSTEM_TAB_ADD
};
#if defined(HAVE_LIBRETRODB)
#define XMB_SYSTEM_TAB_END XMB_SYSTEM_TAB_ADD
#elif defined(HAVE_NETWORKING)
#define XMB_SYSTEM_TAB_END XMB_SYSTEM_TAB_NETPLAY
#elif defined(HAVE_IMAGEVIEWER)
#define XMB_SYSTEM_TAB_END XMB_SYSTEM_TAB_IMAGES
#elif defined(HAVE_FFMPEG)
#define XMB_SYSTEM_TAB_END XMB_SYSTEM_TAB_MUSIC
#else
#define XMB_SYSTEM_TAB_END XMB_SYSTEM_TAB_HISTORY
#endif
typedef struct xmb_handle
{
file_list_t *menu_stack_old;
@ -308,9 +295,9 @@ typedef struct xmb_handle
#ifdef HAVE_IMAGEVIEWER
xmb_node_t images_tab_node;
#endif
xmb_node_t music_tab_node;
#ifdef HAVE_FFMPEG
xmb_node_t video_tab_node;
xmb_node_t music_tab_node;
#endif
xmb_node_t settings_tab_node;
xmb_node_t history_tab_node;
@ -1559,9 +1546,9 @@ static xmb_node_t* xmb_get_node(xmb_handle_t *xmb, unsigned i)
case XMB_SYSTEM_TAB_IMAGES:
return &xmb->images_tab_node;
#endif
#ifdef HAVE_FFMPEG
case XMB_SYSTEM_TAB_MUSIC:
return &xmb->music_tab_node;
#ifdef HAVE_FFMPEG
case XMB_SYSTEM_TAB_VIDEO:
return &xmb->video_tab_node;
#endif
@ -2092,23 +2079,21 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
if (core_node)
return core_node->content_icon;
#if defined(HAVE_IMAGEVIEWER) || defined(HAVE_FFMPEG)
switch (xmb_get_system_tab(xmb, (unsigned)xmb->categories.selection_ptr))
{
case XMB_SYSTEM_TAB_MUSIC:
return xmb->textures.list[XMB_TEXTURE_MUSIC];
#ifdef HAVE_IMAGEVIEWER
case XMB_SYSTEM_TAB_IMAGES:
return xmb->textures.list[XMB_TEXTURE_IMAGE];
#endif
#ifdef HAVE_FFMPEG
case XMB_SYSTEM_TAB_MUSIC:
return xmb->textures.list[XMB_TEXTURE_MUSIC];
case XMB_SYSTEM_TAB_VIDEO:
return xmb->textures.list[XMB_TEXTURE_MOVIE];
#endif
default:
break;
}
#endif
return xmb->textures.list[XMB_TEXTURE_FILE];
case FILE_TYPE_CARCHIVE:
return xmb->textures.list[XMB_TEXTURE_ZIP];
@ -3311,9 +3296,9 @@ static void *xmb_init(void **userdata, bool video_is_threaded)
if (settings->bools.menu_xmb_show_images)
xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_IMAGES;
#endif
#ifdef HAVE_FFMPEG
if (settings->bools.menu_xmb_show_music)
xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_MUSIC;
#ifdef HAVE_FFMPEG
if (settings->bools.menu_xmb_show_video)
xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_VIDEO;
#endif
@ -3460,9 +3445,9 @@ static const char *xmb_texture_path(unsigned id)
return "settings.png";
case XMB_TEXTURE_HISTORY:
return "history.png";
#ifdef HAVE_FFMPEG
case XMB_TEXTURE_MUSICS:
return "musics.png";
#ifdef HAVE_FFMPEG
case XMB_TEXTURE_MOVIES:
return "movies.png";
#endif
@ -3580,11 +3565,11 @@ static void xmb_context_reset_textures(
xmb->history_tab_node.alpha = xmb->categories.active.alpha;
xmb->history_tab_node.zoom = xmb->categories.active.zoom;
#ifdef HAVE_FFMPEG
xmb->music_tab_node.icon = xmb->textures.list[XMB_TEXTURE_MUSICS];
xmb->music_tab_node.alpha = xmb->categories.active.alpha;
xmb->music_tab_node.zoom = xmb->categories.active.zoom;
#ifdef HAVE_FFMPEG
xmb->video_tab_node.icon = xmb->textures.list[XMB_TEXTURE_MOVIES];
xmb->video_tab_node.alpha = xmb->categories.active.alpha;
xmb->video_tab_node.zoom = xmb->categories.active.zoom;
@ -3892,13 +3877,13 @@ static void xmb_list_cache(void *data, enum menu_list_type type, unsigned action
MENU_IMAGES_TAB;
break;
#endif
#ifdef HAVE_FFMPEG
case XMB_SYSTEM_TAB_MUSIC:
menu_stack->list[stack_size - 1].label =
strdup(msg_hash_to_str(MENU_ENUM_LABEL_MUSIC_TAB));
menu_stack->list[stack_size - 1].type =
MENU_MUSIC_TAB;
break;
#ifdef HAVE_FFMPEG
case XMB_SYSTEM_TAB_VIDEO:
menu_stack->list[stack_size - 1].label =
strdup(msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_TAB));

View File

@ -32,6 +32,7 @@ enum
ACTION_OK_DL_DEFAULT = 0,
ACTION_OK_DL_OPEN_ARCHIVE,
ACTION_OK_DL_OPEN_ARCHIVE_DETECT_CORE,
ACTION_OK_DL_MUSIC,
ACTION_OK_DL_SCAN_DIR_LIST,
ACTION_OK_DL_HELP,
ACTION_OK_DL_RPL_ENTRY,

View File

@ -4111,6 +4111,37 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
switch (type)
{
case DISPLAYLIST_MUSIC_LIST:
{
char combined_path[PATH_MAX_LENGTH];
fill_pathname_join(combined_path, menu->scratch2_buf,
menu->scratch_buf, sizeof(combined_path));
const char *ext = path_get_extension(combined_path);
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
if (audio_driver_mixer_extension_supported(ext))
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ADD_TO_MIXER_AND_COLLECTION),
msg_hash_to_str(MENU_ENUM_LABEL_ADD_TO_MIXER_AND_COLLECTION),
MENU_ENUM_LABEL_ADD_TO_MIXER_AND_COLLECTION,
FILE_TYPE_PLAYLIST_ENTRY, 0, 0);
#ifdef HAVE_FFMPEG
if (settings->bools.multimedia_builtin_mediaplayer_enable)
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RUN_MUSIC),
msg_hash_to_str(MENU_ENUM_LABEL_RUN_MUSIC),
MENU_ENUM_LABEL_RUN_MUSIC,
FILE_TYPE_PLAYLIST_ENTRY, 0, 0);
#endif
}
info->need_push = true;
info->need_refresh = true;
info->need_clear = true;
break;
case DISPLAYLIST_NETPLAY_LAN_SCAN_SETTINGS_LIST:
/* TODO/FIXME ? */
break;

View File

@ -64,6 +64,7 @@ enum menu_displaylist_ctl_state
DISPLAYLIST_VIDEO_HISTORY,
DISPLAYLIST_MUSIC_HISTORY,
DISPLAYLIST_IMAGES_HISTORY,
DISPLAYLIST_MUSIC_LIST,
DISPLAYLIST_PLAYLIST_COLLECTION,
DISPLAYLIST_DEFAULT,
DISPLAYLIST_FILE_BROWSER_SELECT_DIR,

View File

@ -5220,7 +5220,6 @@ static bool setting_append_list(
SD_FLAG_NONE);
#endif
#ifdef HAVE_FFMPEG
CONFIG_BOOL(
list, list_info,
&settings->bools.menu_xmb_show_music,
@ -5236,6 +5235,7 @@ static bool setting_append_list(
general_read_handler,
SD_FLAG_NONE);
#ifdef HAVE_FFMPEG
CONFIG_BOOL(
list, list_info,
&settings->bools.menu_xmb_show_video,

View File

@ -182,7 +182,9 @@ void filebrowser_parse(void *data, unsigned type_data)
file_type = FILE_TYPE_PLAYLIST_COLLECTION;
}
if (!is_dir &&
if (!is_dir && path_is_media_type(path) == RARCH_CONTENT_MUSIC)
file_type = FILE_TYPE_MUSIC;
else if (!is_dir &&
(settings->bools.multimedia_builtin_mediaplayer_enable ||
settings->bools.multimedia_builtin_imageviewer_enable))
{
@ -192,12 +194,6 @@ void filebrowser_parse(void *data, unsigned type_data)
#ifdef HAVE_FFMPEG
if (settings->bools.multimedia_builtin_mediaplayer_enable)
file_type = FILE_TYPE_MOVIE;
#endif
break;
case RARCH_CONTENT_MUSIC:
#ifdef HAVE_FFMPEG
if (settings->bools.multimedia_builtin_mediaplayer_enable)
file_type = FILE_TYPE_MUSIC;
#endif
break;
case RARCH_CONTENT_IMAGE:

View File

@ -377,6 +377,7 @@ enum msg_hash_enums
MSG_NO_CONTENT_STARTING_DUMMY_CORE,
MENU_LABEL(ADD_TO_MIXER),
MENU_LABEL(ADD_TO_MIXER_AND_COLLECTION),
MENU_ENUM_LABEL_MENU_TOGGLE,
MENU_LABEL(NO_HISTORY_AVAILABLE),
@ -648,6 +649,7 @@ enum msg_hash_enums
/* Menu settings */
MENU_LABEL(RUN_MUSIC),
MENU_LABEL(RUN),
MENU_LABEL(MENU_WALLPAPER),
MENU_LABEL(DYNAMIC_WALLPAPER),
@ -800,6 +802,7 @@ enum msg_hash_enums
MENU_LABEL(BROWSE_URL),
MENU_LABEL(BROWSE_START),
/* Deferred */
MENU_ENUM_LABEL_DEFERRED_MUSIC,
MENU_ENUM_LABEL_DEFERRED_BROWSE_URL_START,
MENU_ENUM_LABEL_DEFERRED_BROWSE_URL_LIST,
MENU_ENUM_LABEL_DEFERRED_ARCHIVE_ACTION_DETECT_CORE,

View File

@ -870,11 +870,9 @@ static bool task_load_content(content_ctx_info_t *content_info,
#endif
break;
case RARCH_CONTENT_MUSIC:
#ifdef HAVE_FFMPEG
playlist_tmp = g_defaults.music_history;
core_name = "musicplayer";
core_path = "builtin";
#endif
break;
case RARCH_CONTENT_IMAGE:
#ifdef HAVE_IMAGEVIEWER