Start adding MENU_FILE_MUSIC and MENU_FILE_MOVIE

This commit is contained in:
twinaphex 2015-06-23 06:13:57 +02:00
parent f64922b618
commit 0944c2de10
6 changed files with 102 additions and 7 deletions

View File

@ -205,7 +205,7 @@ void libretro_ffmpeg_retro_get_system_info(struct retro_system_info *info)
info->library_name = "FFmpeg";
info->library_version = "v1";
info->need_fullpath = true;
info->valid_extensions = "mkv|avi|f4v|f4f|3gp|ogm|flv|mp4|mp3|flac|ogg|m4a";
info->valid_extensions = "mkv|avi|f4v|f4f|3gp|ogm|flv|mp4|mp3|wav|flac|ogg|m4a";
}
void libretro_ffmpeg_retro_get_system_av_info(struct retro_system_av_info *info)

View File

@ -23,6 +23,10 @@
#include "../../database_info.h"
#endif
#ifdef HAVE_FFMPEG
#include "../../cores/internal_cores.h"
#endif
#include "../../general.h"
#include "../../file_ext.h"
#include "../../gfx/video_shader_driver.h"
@ -440,6 +444,15 @@ static int deferred_push_detect_core_list(menu_displaylist_info_t *info)
if (global->core_info)
strlcpy(info->exts, core_info_list_get_all_extensions(
global->core_info), sizeof(info->exts));
#ifdef HAVE_FFMPEG
{
struct retro_system_info sysinfo = {0};
libretro_ffmpeg_retro_get_system_info(&sysinfo);
strlcat(info->exts, "|", sizeof(info->exts));
strlcat(info->exts, sysinfo.valid_extensions, sizeof(info->exts));
}
#endif
return menu_displaylist_push_list(info, DISPLAYLIST_CORES_DETECTED);
}
@ -461,6 +474,15 @@ static int deferred_push_default(menu_displaylist_info_t *info)
else
strlcpy(info->exts, global->system.valid_extensions, sizeof(info->exts));
#ifdef HAVE_FFMPEG
{
struct retro_system_info sysinfo = {0};
libretro_ffmpeg_retro_get_system_info(&sysinfo);
strlcat(info->exts, "|", sizeof(info->exts));
strlcat(info->exts, sysinfo.valid_extensions, sizeof(info->exts));
}
#endif
return menu_displaylist_push_list(info, DISPLAYLIST_DEFAULT);
}

View File

@ -604,6 +604,32 @@ static void menu_action_setting_disp_set_label_menu_file_image(
path, "(IMG)", s2, len2);
}
static void menu_action_setting_disp_set_label_movie(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *entry_label,
const char *path,
char *s2, size_t len2)
{
menu_action_setting_generic_disp_set_label(w, s, len,
path, "(MOVIE)", s2, len2);
}
static void menu_action_setting_disp_set_label_music(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
const char *label,
char *s, size_t len,
const char *entry_label,
const char *path,
char *s2, size_t len2)
{
menu_action_setting_generic_disp_set_label(w, s, len,
path, "(MUSIC)", s2, len2);
}
static void menu_action_setting_disp_set_label_menu_file_use_directory(
file_list_t* list,
unsigned *w, unsigned type, unsigned i,
@ -938,6 +964,14 @@ static int menu_cbs_init_bind_get_string_representation_compare_type(
cbs->action_get_value =
menu_action_setting_disp_set_label_menu_file_plain;
break;
case MENU_FILE_MOVIE:
cbs->action_get_value =
menu_action_setting_disp_set_label_movie;
break;
case MENU_FILE_MUSIC:
cbs->action_get_value =
menu_action_setting_disp_set_label_music;
break;
case MENU_FILE_IMAGE:
cbs->action_get_value =
menu_action_setting_disp_set_label_menu_file_image;

View File

@ -88,6 +88,8 @@ typedef enum
MENU_FILE_CURSOR,
MENU_FILE_RECORD_CONFIG,
MENU_FILE_PLAYLIST_COLLECTION,
MENU_FILE_MOVIE,
MENU_FILE_MUSIC,
MENU_SETTINGS,
MENU_SETTING_DRIVER,
MENU_SETTING_ACTION,

View File

@ -778,7 +778,7 @@ static int menu_displaylist_parse_shader_options(menu_displaylist_info_t *info)
static int create_string_list_rdb_entry_string(const char *desc, const char *label,
const char *actual_string, const char *path, file_list_t *list)
{
union string_list_elem_attr attr;
union string_list_elem_attr attr = {0};
char tmp[PATH_MAX_LENGTH] = {0};
char *output_label = NULL;
int str_len = 0;
@ -787,8 +787,6 @@ static int create_string_list_rdb_entry_string(const char *desc, const char *lab
if (!str_list)
return -1;
attr.i = 0;
str_len += strlen(label) + 1;
string_list_append(str_list, label, attr);
@ -824,7 +822,7 @@ static int create_string_list_rdb_entry_string(const char *desc, const char *lab
static int create_string_list_rdb_entry_int(const char *desc, const char *label,
int actual_int, const char *path, file_list_t *list)
{
union string_list_elem_attr attr;
union string_list_elem_attr attr = {0};
char tmp[PATH_MAX_LENGTH] = {0};
char str[PATH_MAX_LENGTH] = {0};
char *output_label = NULL;
@ -834,8 +832,6 @@ static int create_string_list_rdb_entry_int(const char *desc, const char *label,
if (!str_list)
return -1;
attr.i = 0;
str_len += strlen(label) + 1;
string_list_append(str_list, label, attr);
@ -1815,6 +1811,33 @@ static int menu_displaylist_parse_generic(menu_displaylist_info_t *info, bool *n
break;
}
#ifdef HAVE_FFMPEG
{
uint32_t hash_ext = menu_hash_calculate(path_get_extension(path));
switch (hash_ext)
{
case MENU_VALUE_FILE_OGM:
case MENU_VALUE_FILE_MKV:
case MENU_VALUE_FILE_AVI:
case MENU_VALUE_FILE_MP4:
case MENU_VALUE_FILE_FLV:
case MENU_VALUE_FILE_3GP:
case MENU_VALUE_FILE_F4F:
case MENU_VALUE_FILE_F4V:
file_type = MENU_FILE_MOVIE;
break;
case MENU_VALUE_FILE_MP3:
case MENU_VALUE_FILE_M4A:
case MENU_VALUE_FILE_OGG:
case MENU_VALUE_FILE_FLAC:
case MENU_VALUE_FILE_WAV:
file_type = MENU_FILE_MUSIC;
break;
}
}
#endif
menu_list_push(info->list, path, label,
file_type, 0, 0);
}

View File

@ -20,6 +20,20 @@
extern "C" {
#endif
#define MENU_VALUE_FILE_F4F 0x0b886be5U
#define MENU_VALUE_FILE_F4V 0x0b886bf5U
#define MENU_VALUE_FILE_OGM 0x0b8898c8U
#define MENU_VALUE_FILE_MKV 0x0b8890d3U
#define MENU_VALUE_FILE_AVI 0x0b885f25U
#define MENU_VALUE_FILE_M4A 0x0b8889a7U
#define MENU_VALUE_FILE_3GP 0x0b87998fU
#define MENU_VALUE_FILE_MP4 0x0b889136U
#define MENU_VALUE_FILE_MP3 0x0b889135U
#define MENU_VALUE_FILE_FLAC 0x7c96d67bU
#define MENU_VALUE_FILE_OGG 0x0b8898c2U
#define MENU_VALUE_FILE_FLV 0x0b88732dU
#define MENU_VALUE_FILE_WAV 0x0b88ba13U
#define MENU_VALUE_DONT_CARE 0x19da07bcU
#define MENU_VALUE_LINEAR 0xc0d12dc0U
#define MENU_VALUE_NEAREST 0x6ab2b0b7U