Separate ffmpeg and audiomixer conditionals (#15872)

There are cases when mixer exists without ffmpeg. In such cases,
some music content can still be added to the mixer for playback.
Logic added to separate the two cases.
This commit is contained in:
zoltanvb 2023-11-06 00:32:14 +01:00 committed by GitHub
parent c9de6e5932
commit e35afdb57a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 76 additions and 32 deletions

View File

@ -12737,7 +12737,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RUN_MUSIC,
"Run"
"Play in Media Player"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_SECONDS,

View File

@ -408,7 +408,7 @@ static int general_push(menu_displaylist_info_t *info,
char newstring2[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
menu_handle_t *menu = menu_state_get_ptr()->driver_data;
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV) || defined (HAVE_AUDIOMIXER)
bool
multimedia_builtin_mediaplayer_enable = settings->bools.multimedia_builtin_mediaplayer_enable;
#endif
@ -559,13 +559,29 @@ static int general_push(menu_displaylist_info_t *info,
string_list_initialize(&str_list3);
string_split_noalloc(&str_list3, newstring, "|");
#ifdef HAVE_IBXM
#if defined(HAVE_AUDIOMIXER)
if (multimedia_builtin_mediaplayer_enable)
{
union string_list_elem_attr attr;
attr.i = 0;
#if defined(HAVE_DR_MP3)
string_list_append(&str_list3, "mp3", attr);
#endif
#if defined(HAVE_STB_VORBIS)
string_list_append(&str_list3, "ogg", attr);
#endif
#if defined(HAVE_DR_FLAC)
string_list_append(&str_list3, "flac", attr);
#endif
#if defined(HAVE_RWAV)
string_list_append(&str_list3, "wav", attr);
#endif
#ifdef HAVE_IBXM
string_list_append(&str_list3, "s3m", attr);
string_list_append(&str_list3, "mod", attr);
string_list_append(&str_list3, "xm", attr);
#endif
}
#endif
string_list_join_concat(newstring2, sizeof(newstring2),

View File

@ -86,6 +86,9 @@
#if defined(HAVE_MATERIALUI) || defined(HAVE_XMB) || defined(HAVE_OZONE)
#include "menu_screensaver.h"
#endif
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
#include "../../cores/internal_cores.h"
#endif
#include "../configuration.h"
#include "../file_path_special.h"
@ -406,7 +409,7 @@ static int filebrowser_parse(
switch (path_type)
{
case RARCH_CONTENT_MUSIC:
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV) || defined(HAVE_AUDIOMIXER)
if (builtin_mediaplayer_enable)
file_type = FILE_TYPE_MUSIC;
#endif
@ -12167,17 +12170,18 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
#endif /* HAVE_LIBNX */
case DISPLAYLIST_MUSIC_LIST:
{
bool multimedia_builtin_mediaplayer_enable = settings->bools.multimedia_builtin_mediaplayer_enable;
char combined_path[PATH_MAX_LENGTH];
const char *ext = NULL;
fill_pathname_join_special(combined_path, menu->scratch2_buf,
menu->scratch_buf, sizeof(combined_path));
ext = path_get_extension(combined_path);
menu_entries_clear(info->list);
#ifdef HAVE_AUDIOMIXER
if (multimedia_builtin_mediaplayer_enable)
{
char combined_path[PATH_MAX_LENGTH];
const char *ext = NULL;
fill_pathname_join_special(combined_path, menu->scratch2_buf,
menu->scratch_buf, sizeof(combined_path));
ext = path_get_extension(combined_path);
if (audio_driver_mixer_extension_supported(ext))
{
if (menu_entries_append(info->list,
@ -12198,9 +12202,15 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
#endif
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
if (multimedia_builtin_mediaplayer_enable)
{
bool multimedia_builtin_mediaplayer_enable = settings->bools.multimedia_builtin_mediaplayer_enable;
if (multimedia_builtin_mediaplayer_enable)
struct retro_system_info sysinfo = {0};
#if defined(HAVE_FFMPEG)
libretro_ffmpeg_retro_get_system_info(&sysinfo);
#elif defined(HAVE_MPV)
libretro_mpv_retro_get_system_info(&sysinfo);
#endif
if (strstr(sysinfo.valid_extensions,ext))
{
if (menu_entries_append(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RUN_MUSIC),

View File

@ -800,16 +800,8 @@ enum msg_file_type msg_hash_to_file_type(uint32_t hash)
return FILE_TYPE_MOV;
case MENU_VALUE_FILE_WMV:
return FILE_TYPE_WMV;
case MENU_VALUE_FILE_MP3:
return FILE_TYPE_MP3;
case MENU_VALUE_FILE_M4A:
return FILE_TYPE_M4A;
case MENU_VALUE_FILE_OGG:
return FILE_TYPE_OGG;
case MENU_VALUE_FILE_FLAC:
return FILE_TYPE_FLAC;
case MENU_VALUE_FILE_WAV:
return FILE_TYPE_WAV;
case MENU_VALUE_FILE_3G2:
return FILE_TYPE_3G2;
case MENU_VALUE_FILE_MPG:
@ -835,7 +827,24 @@ enum msg_file_type msg_hash_to_file_type(uint32_t hash)
case MENU_VALUE_FILE_WMA:
return FILE_TYPE_WMA;
#endif
#ifdef HAVE_IBXM
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV) || defined(HAVE_AUDIOMIXER)
#if !defined(HAVE_AUDIOMIXER) || defined(HAVE_DR_MP3)
case MENU_VALUE_FILE_MP3:
return FILE_TYPE_MP3;
#endif
#if !defined(HAVE_AUDIOMIXER) || defined(HAVE_STB_VORBIS)
case MENU_VALUE_FILE_OGG:
return FILE_TYPE_OGG;
#endif
#if !defined(HAVE_AUDIOMIXER) || defined(HAVE_DR_FLAC)
case MENU_VALUE_FILE_FLAC:
return FILE_TYPE_FLAC;
#endif
#if !defined(HAVE_AUDIOMIXER) || defined(HAVE_RWAV)
case MENU_VALUE_FILE_WAV:
return FILE_TYPE_WAV;
#endif
#if !defined(HAVE_AUDIOMIXER) || defined(HAVE_IBXM)
case MENU_VALUE_FILE_MOD:
return FILE_TYPE_MOD;
case MENU_VALUE_FILE_S3M:
@ -843,6 +852,7 @@ enum msg_file_type msg_hash_to_file_type(uint32_t hash)
case MENU_VALUE_FILE_XM:
return FILE_TYPE_XM;
#endif
#endif
#ifdef HAVE_IMAGEVIEWER
case MENU_VALUE_FILE_JPG:
case MENU_VALUE_FILE_JPG_CAPS:

View File

@ -2036,11 +2036,26 @@ enum rarch_content_type path_is_media_type(const char *path)
case FILE_TYPE_MXF:
return RARCH_CONTENT_MOVIE;
case FILE_TYPE_WMA:
case FILE_TYPE_OGG:
case FILE_TYPE_MP3:
case FILE_TYPE_M4A:
#endif
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV) || defined(HAVE_AUDIOMIXER)
#if !defined(HAVE_AUDIOMIXER) || defined(HAVE_STB_VORBIS)
case FILE_TYPE_OGG:
#endif
#if !defined(HAVE_AUDIOMIXER) || defined(HAVE_DR_MP3)
case FILE_TYPE_MP3:
#endif
#if !defined(HAVE_AUDIOMIXER) || defined(HAVE_DR_FLAC)
case FILE_TYPE_FLAC:
#endif
#if !defined(HAVE_AUDIOMIXER) || defined(HAVE_RWAV)
case FILE_TYPE_WAV:
#endif
#if !defined(HAVE_AUDIOMIXER) || defined(HAVE_IBXM)
case FILE_TYPE_MOD:
case FILE_TYPE_S3M:
case FILE_TYPE_XM:
#endif
return RARCH_CONTENT_MUSIC;
#endif
#ifdef HAVE_IMAGEVIEWER
@ -2050,13 +2065,6 @@ enum rarch_content_type path_is_media_type(const char *path)
case FILE_TYPE_BMP:
return RARCH_CONTENT_IMAGE;
#endif
#ifdef HAVE_IBXM
case FILE_TYPE_MOD:
case FILE_TYPE_S3M:
case FILE_TYPE_XM:
return RARCH_CONTENT_MUSIC;
#endif
case FILE_TYPE_NONE:
default:
break;