Merge pull request #2 from libretro/master

Merge master
This commit is contained in:
Aleksey Samoilov 2018-11-26 22:32:54 +04:00 committed by GitHub
commit 2c35f05560
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 993 additions and 851 deletions

View File

@ -14,6 +14,7 @@
- SWITCH: Proper button labels.
- VULKAN: Fix RGUI crashing at startup.
- VULKAN: Fix secondary screens in overlays not working.
- WAYLAND: Implement idle-inhibit support (needed for screensaver suspend).
- WINDOWS/WSA: Network Information info is blank until first network operation.
- WIIU: Initial netplay peer-to-peer support. Network information working.

View File

@ -1666,7 +1666,7 @@ static void cheevos_test_cheevo_set(const cheevoset_t *set)
if (settings && settings->bools.cheevos_auto_screenshot)
{
char shotname[256];
char shotname[4200];
snprintf(shotname, sizeof(shotname), "%s/%s-cheevo-%u",
settings->paths.directory_screenshot,

View File

@ -125,6 +125,10 @@ static const unsigned window_height = 720;
static const unsigned fullscreen_x = 0;
static const unsigned fullscreen_y = 0;
/* Number of threads to use for video recording */
static const unsigned video_record_threads = 2;
/* Amount of transparency to use for the main window.
* 1 is the most transparent while 100 is opaque.
*/

View File

@ -1676,6 +1676,8 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
SETTING_UINT("video_windowed_position_width", &settings->uints.window_position_width, true, window_width, false);
SETTING_UINT("video_windowed_position_height", &settings->uints.window_position_height, true, window_height, false);
SETTING_UINT("video_record_threads", &settings->uints.video_record_threads, true, video_record_threads, false);
*size = count;
return tmp;

View File

@ -443,6 +443,8 @@ typedef struct settings
unsigned window_position_y;
unsigned window_position_width;
unsigned window_position_height;
unsigned video_record_threads;
} uints;
struct

View File

@ -134,7 +134,8 @@ void x11_move_window(Display *dpy, Window win, int x, int y,
{
XEvent xev = {0};
XA_NET_MOVERESIZE_WINDOW = XInternAtom(dpy, "_NET_MOVERESIZE_WINDOW", False);
XA_NET_MOVERESIZE_WINDOW = XInternAtom(dpy,
"_NET_MOVERESIZE_WINDOW", False);
xev.xclient.type = ClientMessage;
xev.xclient.send_event = True;
@ -170,12 +171,12 @@ static void x11_set_window_pid(Display *dpy, Window win)
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&pid, 1);
errno = 0;
if((scret = sysconf(_SC_HOST_NAME_MAX)) == -1 && errno)
if ((scret = sysconf(_SC_HOST_NAME_MAX)) == -1 && errno)
return;
if((hostname = (char*)malloc(scret + 1)) == NULL)
if ((hostname = (char*)malloc(scret + 1)) == NULL)
return;
if(gethostname(hostname, scret + 1) == -1)
if (gethostname(hostname, scret + 1) == -1)
RARCH_WARN("Failed to get hostname.\n");
else
{
@ -752,22 +753,21 @@ bool x11_has_net_wm_fullscreen(Display *dpy)
char *x11_get_wm_name(Display *dpy)
{
Atom type;
int format;
Window window;
Atom XA_NET_SUPPORTING_WM_CHECK = XInternAtom(g_x11_dpy, "_NET_SUPPORTING_WM_CHECK", False);
Atom XA_NET_WM_NAME = XInternAtom(g_x11_dpy, "_NET_WM_NAME", False);
Atom XA_UTF8_STRING = XInternAtom(g_x11_dpy, "UTF8_STRING", False);
int status;
Atom type;
int format;
unsigned long nitems;
unsigned long bytes_after;
unsigned char *propdata;
char *title;
Window window;
unsigned long nitems = 0;
unsigned long bytes_after = 0;
char *title = NULL;
unsigned char *propdata = NULL;
if (!XA_NET_SUPPORTING_WM_CHECK || !XA_NET_WM_NAME)
return NULL;
status = XGetWindowProperty(dpy,
if (!(XGetWindowProperty(dpy,
DefaultRootWindow(dpy),
XA_NET_SUPPORTING_WM_CHECK,
0,
@ -778,16 +778,15 @@ char *x11_get_wm_name(Display *dpy)
&format,
&nitems,
&bytes_after,
&propdata);
&propdata) == Success &&
propdata))
return NULL;
if (status == Success && propdata)
window = ((Window *) propdata)[0];
else
return NULL;
window = ((Window *) propdata)[0];
XFree(propdata);
status = XGetWindowProperty(dpy,
if (!(XGetWindowProperty(dpy,
window,
XA_NET_WM_NAME,
0,
@ -798,13 +797,11 @@ char *x11_get_wm_name(Display *dpy)
&format,
&nitems,
&bytes_after,
&propdata);
if (status == Success && propdata)
title = strdup((char *) propdata);
else
return NULL;
&propdata) == Success
&& propdata))
return NULL;
title = strdup((char *) propdata);
XFree(propdata);
return title;

View File

@ -1990,14 +1990,14 @@ static void d3d9_video_texture_load_d3d(
*id = (uintptr_t)tex;
}
static int d3d9_video_texture_load_wrap_d3d(void *data)
static int64_t d3d9_video_texture_load_wrap_d3d(void *data)
{
uintptr_t id = 0;
struct d3d9_texture_info *info = (struct d3d9_texture_info*)data;
if (!info)
return 0;
d3d9_video_texture_load_d3d(info, &id);
return id;
return (int64_t)(uintptr_t)id;
}
static uintptr_t d3d9_load_texture(void *video_data, void *data,

View File

@ -2509,7 +2509,7 @@ static void video_texture_load_gl(
}
#ifdef HAVE_THREADS
static int video_texture_load_wrap_gl_mipmap(void *data)
static int64_t video_texture_load_wrap_gl_mipmap(void *data)
{
uintptr_t id = 0;
@ -2517,10 +2517,10 @@ static int video_texture_load_wrap_gl_mipmap(void *data)
return 0;
video_texture_load_gl((struct texture_image*)data,
TEXTURE_FILTER_MIPMAP_LINEAR, &id);
return (int)id;
return (int64_t)(uintptr_t)id;
}
static int video_texture_load_wrap_gl(void *data)
static int64_t video_texture_load_wrap_gl(void *data)
{
uintptr_t id = 0;
@ -2528,7 +2528,7 @@ static int video_texture_load_wrap_gl(void *data)
return 0;
video_texture_load_gl((struct texture_image*)data,
TEXTURE_FILTER_LINEAR, &id);
return (int)id;
return (int64_t)(uintptr_t)id;
}
#endif

View File

@ -1078,7 +1078,7 @@ static bool gfx_ctx_x_bind_api(void *data, enum gfx_ctx_api api,
case GFX_CTX_OPENGL_ES_API:
#ifdef HAVE_OPENGLES2
{
Display *dpy = XOpenDisplay(NULL);
Display *dpy = XOpenDisplay(NULL);
const char *exts = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
bool ret = exts && strstr(exts,
"GLX_EXT_create_context_es2_profile");

View File

@ -20,7 +20,7 @@
#include "video_driver.h"
#include "../verbosity.h"
static const video_display_server_t *current_display_server = NULL;
static const video_display_server_t *current_display_server = &dispserv_null;
static void *current_display_server_data = NULL;
const char *video_display_server_get_ident(void)

View File

@ -985,16 +985,25 @@ static bool video_driver_init_internal(bool *video_is_threaded)
}
else
{
if (settings->bools.video_force_aspect)
/* To-Do: remove when the new window resizing core is hooked */
if (settings->uints.window_position_width || settings->uints.window_position_height)
{
/* Do rounding here to simplify integer scale correctness. */
unsigned base_width =
roundf(geom->base_height * video_driver_get_aspect_ratio());
width = roundf(base_width * settings->floats.video_scale);
width = settings->uints.window_position_width;
height = settings->uints.window_position_height;
}
else
width = roundf(geom->base_width * settings->floats.video_scale);
height = roundf(geom->base_height * settings->floats.video_scale);
{
if (settings->bools.video_force_aspect)
{
/* Do rounding here to simplify integer scale correctness. */
unsigned base_width =
roundf(geom->base_height * video_driver_get_aspect_ratio());
width = roundf(base_width * settings->floats.video_scale);
}
else
width = roundf(geom->base_width * settings->floats.video_scale);
height = roundf(geom->base_height * settings->floats.video_scale);
}
}
if (width && height)

View File

@ -48,9 +48,6 @@ enum thread_cmd
CMD_POKE_SET_VIDEO_MODE,
CMD_POKE_SET_FILTERING,
CMD_POKE_GET_VIDEO_OUTPUT_SIZE,
CMD_POKE_GET_VIDEO_OUTPUT_PREV,
CMD_POKE_GET_VIDEO_OUTPUT_NEXT,
CMD_POKE_SET_FBO_STATE,
CMD_POKE_GET_FBO_STATE,
@ -499,26 +496,6 @@ static bool video_thread_handle_packet(
video_thread_reply(thr, &pkt);
break;
case CMD_POKE_GET_VIDEO_OUTPUT_SIZE:
if (thr->poke && thr->poke->get_video_output_size)
thr->poke->get_video_output_size(thr->driver_data,
&pkt.data.output.width,
&pkt.data.output.height);
video_thread_reply(thr, &pkt);
break;
case CMD_POKE_GET_VIDEO_OUTPUT_PREV:
if (thr->poke && thr->poke->get_video_output_prev)
thr->poke->get_video_output_prev(thr->driver_data);
video_thread_reply(thr, &pkt);
break;
case CMD_POKE_GET_VIDEO_OUTPUT_NEXT:
if (thr->poke && thr->poke->get_video_output_next)
thr->poke->get_video_output_next(thr->driver_data);
video_thread_reply(thr, &pkt);
break;
case CMD_POKE_SET_ASPECT_RATIO:
if (thr->poke && thr->poke->set_aspect_ratio)
thr->poke->set_aspect_ratio(thr->driver_data,
@ -1107,37 +1084,36 @@ static void thread_get_video_output_size(void *data,
unsigned *width, unsigned *height)
{
thread_video_t *thr = (thread_video_t*)data;
thread_packet_t pkt = { CMD_POKE_GET_VIDEO_OUTPUT_SIZE };
if (!thr)
return;
video_thread_send_and_wait_user_to_thread(thr, &pkt);
*width = pkt.data.output.width;
*height = pkt.data.output.height;
if (thr->poke && thr->poke->get_video_output_size)
thr->poke->get_video_output_size(thr->driver_data,
width,
height);
}
static void thread_get_video_output_prev(void *data)
{
thread_video_t *thr = (thread_video_t*)data;
thread_packet_t pkt = { CMD_POKE_GET_VIDEO_OUTPUT_PREV };
if (!thr)
return;
video_thread_send_and_wait_user_to_thread(thr, &pkt);
if (thr->poke && thr->poke->get_video_output_prev)
thr->poke->get_video_output_prev(thr->driver_data);
}
static void thread_get_video_output_next(void *data)
{
thread_video_t *thr = (thread_video_t*)data;
thread_packet_t pkt = { CMD_POKE_GET_VIDEO_OUTPUT_NEXT };
if (!thr)
return;
video_thread_send_and_wait_user_to_thread(thr, &pkt);
if (thr->poke && thr->poke->get_video_output_next)
thr->poke->get_video_output_next(thr->driver_data);
}
static void thread_set_aspect_ratio(void *data, unsigned aspectratio_idx)

View File

@ -27,7 +27,7 @@
RETRO_BEGIN_DECLS
typedef int (*custom_command_method_t)(void*);
typedef int64_t (*custom_command_method_t)(void*);
typedef bool (*custom_font_command_method_t)(const void **font_driver,
void **font_handle, void *video_data, const char *font_path,

View File

@ -3798,4 +3798,4 @@ MSG_HASH(
"Brak ulubionych."
)
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_WINDOW_SAVE_POSITION,
"Remember Window Position and Size")
"Zapamiętaj położenie i rozmiar okna")

View File

@ -3206,6 +3206,10 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SCALE,
"Windowed Scale"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_THREADS,
"Recording Threads"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_SCALE_INTEGER,
"Integer Scale"

View File

@ -812,7 +812,6 @@ static void ozone_update_scroll(ozone_handle_t *ozone, bool allow_animation, ozo
else
{
ozone->selection_old = ozone->selection;
ozone->animations.cursor_alpha = 1.0f;
ozone->animations.scroll_y = new_scroll;
}
}

View File

@ -42,7 +42,7 @@ typedef struct ozone_handle ozone_handle_t;
#define INTERVAL_BATTERY_LEVEL_CHECK (30 * 1000000)
#define INTERVAL_OSK_CURSOR (0.5f * 1000000)
typedef struct ozone_handle
struct ozone_handle
{
uint64_t frame_count;
@ -152,7 +152,7 @@ typedef struct ozone_handle
unsigned old_list_offset_y;
file_list_t *horizontal_list; /* console tabs */
} ozone_handle_t;
};
/* If you change this struct, also
change ozone_alloc_node and
@ -207,4 +207,4 @@ void ozone_free_list_nodes(file_list_t *list, bool actiondata);
bool ozone_is_playlist(ozone_handle_t *ozone);
#endif
#endif

View File

@ -118,10 +118,10 @@ void ozone_set_color_theme(ozone_handle_t *ozone, unsigned color_theme)
last_color_theme = color_theme;
}
unsigned ozone_get_system_theme()
unsigned ozone_get_system_theme(void)
{
unsigned ret = 0;
#ifdef HAVE_LIBNX
unsigned ret = 0;
if (R_SUCCEEDED(setsysInitialize()))
{
ColorSetId theme;
@ -133,4 +133,4 @@ unsigned ozone_get_system_theme()
return ret;
#endif
return 0;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -373,7 +373,7 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
gfx_ctx_ident_t ident_info;
#endif
char tmp[PATH_MAX_LENGTH];
char tmp[8192];
char feat_str[255];
#ifdef ANDROID
bool perms = false;
@ -432,7 +432,7 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
}
{
char cpu_str[255];
char cpu_str[8192];
char cpu_arch_str[PATH_MAX_LENGTH];
char cpu_text_str[PATH_MAX_LENGTH];
enum frontend_architecture arch = frontend_driver_get_cpu_architecture();
@ -1445,7 +1445,7 @@ static int menu_displaylist_parse_shader_options(menu_displaylist_info_t *info)
for (i = 0; i < pass_count; i++)
{
char buf_tmp[64];
char buf[64];
char buf[128];
buf[0] = buf_tmp[0] = '\0';
@ -3381,8 +3381,8 @@ static int menu_displaylist_parse_options_remappings(
{
for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND + 8; retro_id++)
{
char desc_label[64];
char descriptor[255];
char desc_label[400];
char descriptor[300];
const struct retro_keybind *auto_bind = NULL;
const struct retro_keybind *keybind = NULL;
@ -6546,6 +6546,16 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_SUSPEND_SCREENSAVER_ENABLE,
PARSE_ONLY_BOOL, false);
#if defined(GEKKO) || defined(__CELLOS_LV2__)
if (true)
#else
if (!string_is_equal(video_display_server_get_ident(), "null"))
#endif
{
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_SCREEN_RESOLUTION,
PARSE_ACTION, false);
}
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_PAL60_ENABLE,
PARSE_ONLY_BOOL, false);
@ -7306,6 +7316,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist
MENU_ENUM_LABEL_STREAMING_MODE,
PARSE_ONLY_UINT, false) == 0)
count++;
if (menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_VIDEO_RECORD_THREADS,
PARSE_ONLY_UINT, true) == 0)
count++;
if (menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_STREAMING_TITLE,
PARSE_ONLY_STRING, false) == 0)

View File

@ -336,16 +336,16 @@ static void setting_get_string_representation_video_stream_quality(
/* TODO/FIXME - localize this */
switch (*setting->value.target.unsigned_integer)
{
case 5:
case 8:
strlcpy(s, "Custom", len);
break;
case 6:
case 9:
strlcpy(s, "Low", len);
break;
case 7:
case 10:
strlcpy(s, "Medium", len);
break;
case 8:
case 11:
strlcpy(s, "High", len);
break;
}
@ -375,6 +375,15 @@ static void setting_get_string_representation_video_record_quality(rarch_setting
case 4:
strlcpy(s, "Lossless", len);
break;
case 5:
strlcpy(s, "WebM Fast", len);
break;
case 6:
strlcpy(s, "WebM High Quality", len);
break;
case 7:
strlcpy(s, "GIF", len);
break;
}
}
@ -6689,7 +6698,7 @@ static bool setting_append_list(
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
(*list)[list_info->index - 1].get_string_representation =
&setting_get_string_representation_video_record_quality;
menu_settings_list_current_add_range(list, list_info, RECORD_CONFIG_TYPE_RECORDING_CUSTOM, RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY, 1, true, true);
menu_settings_list_current_add_range(list, list_info, RECORD_CONFIG_TYPE_RECORDING_CUSTOM, RECORD_CONFIG_TYPE_RECORDING_GIF, 1, true, true);
CONFIG_PATH(
list, list_info,
@ -6750,7 +6759,7 @@ static bool setting_append_list(
(*list)[list_info->index - 1].offset_by = 1;
menu_settings_list_current_add_range(list, list_info, 1, 65536, 1, true, true);
CONFIG_UINT(
CONFIG_UINT(
list, list_info,
&settings->uints.video_stream_quality,
MENU_ENUM_LABEL_VIDEO_STREAM_QUALITY,
@ -6764,7 +6773,6 @@ static bool setting_append_list(
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
(*list)[list_info->index - 1].get_string_representation =
&setting_get_string_representation_video_stream_quality;
(*list)[list_info->index - 1].offset_by = 5;
menu_settings_list_current_add_range(list, list_info, RECORD_CONFIG_TYPE_STREAMING_CUSTOM, RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY, 1, true, true);
CONFIG_PATH(
@ -6795,6 +6803,22 @@ static bool setting_append_list(
general_read_handler);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT);
CONFIG_UINT(
list, list_info,
&settings->uints.video_record_threads,
MENU_ENUM_LABEL_VIDEO_RECORD_THREADS,
MENU_ENUM_LABEL_VALUE_VIDEO_RECORD_THREADS,
video_record_threads,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler);
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint_special;
menu_settings_list_current_add_range(list, list_info, 1, 8, 1, true, true);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED);
CONFIG_DIR(
list, list_info,
global->record.output_dir,

View File

@ -758,6 +758,7 @@ enum msg_hash_enums
MENU_LABEL(VIDEO_FORCE_SRGB_DISABLE),
MENU_LABEL(VIDEO_ROTATION),
MENU_LABEL(VIDEO_SCALE),
MENU_LABEL(VIDEO_RECORD_THREADS),
MENU_LABEL(VIDEO_SMOOTH),
MENU_LABEL(VIDEO_CROP_OVERSCAN),

View File

@ -851,7 +851,7 @@ void netplay_get_architecture(char *frontend_architecture, size_t size)
static void netplay_announce(void)
{
char buf [2048];
char buf [4600];
char frontend_architecture[PATH_MAX_LENGTH];
char url [2048] = "http://lobby.libretro.com/add/";
char *username = NULL;

View File

@ -1990,7 +1990,7 @@ void netplay_handle_slaves(netplay_t *netplay)
void netplay_announce_nat_traversal(netplay_t *netplay)
{
#ifndef HAVE_SOCKET_LEGACY
char msg[512], host[PATH_MAX_LENGTH], port[6];
char msg[4200], host[PATH_MAX_LENGTH], port[6];
if (netplay->nat_traversal_state.have_inet4)
{

View File

@ -97,6 +97,14 @@ extern "C" {
#define PIX_FMT_BGR24 AV_PIX_FMT_BGR24
#endif
#ifndef PIX_FMT_RGB24
#define PIX_FMT_RGB24 AV_PIX_FMT_RGB24
#endif
#ifndef PIX_FMT_RGB8
#define PIX_FMT_RGB8 AV_PIX_FMT_RGB8
#endif
#ifndef PIX_FMT_RGB565
#define PIX_FMT_RGB565 AV_PIX_FMT_RGB565
#endif
@ -556,7 +564,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p
{
case RECORD_CONFIG_TYPE_RECORDING_LOW_QUALITY:
case RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY:
params->threads = 1;
params->threads = settings->uints.video_record_threads;
params->frame_drop_ratio = 1;
params->audio_enable = true;
params->audio_global_quality = 75;
@ -572,7 +580,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p
break;
case RECORD_CONFIG_TYPE_RECORDING_MED_QUALITY:
case RECORD_CONFIG_TYPE_STREAMING_MED_QUALITY:
params->threads = 1;
params->threads = settings->uints.video_record_threads;
params->frame_drop_ratio = 1;
params->audio_enable = true;
params->audio_global_quality = 75;
@ -588,7 +596,7 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p
break;
case RECORD_CONFIG_TYPE_RECORDING_HIGH_QUALITY:
case RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY:
params->threads = 1;
params->threads = settings->uints.video_record_threads;
params->frame_drop_ratio = 1;
params->audio_enable = true;
params->audio_global_quality = 100;
@ -603,10 +611,10 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p
av_dict_set(&params->audio_opts, "audio_global_quality", "100", 0);
break;
case RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY:
params->threads = 1;
params->threads = settings->uints.video_record_threads;
params->frame_drop_ratio = 1;
params->audio_enable = true;
params->audio_global_quality = 100;
params->audio_global_quality = 80;
params->out_pix_fmt = PIX_FMT_BGR24;
strlcpy(params->vcodec, "libx264rgb", sizeof(params->vcodec));
@ -615,10 +623,51 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p
av_dict_set(&params->video_opts, "preset", "medium", 0);
av_dict_set(&params->video_opts, "tune", "animation", 0);
av_dict_set(&params->video_opts, "crf", "0", 0);
av_dict_set(&params->audio_opts, "audio_global_quality", "100", 0);
av_dict_set(&params->audio_opts, "audio_global_quality", "80", 0);
break;
case RECORD_CONFIG_TYPE_RECORDING_WEBM_FAST:
params->threads = settings->uints.video_record_threads;
params->frame_drop_ratio = 1;
params->audio_enable = true;
params->audio_global_quality = 50;
params->out_pix_fmt = PIX_FMT_YUV420P;
strlcpy(params->vcodec, "libvpx", sizeof(params->vcodec));
strlcpy(params->acodec, "libopus", sizeof(params->acodec));
av_dict_set(&params->video_opts, "deadline", "realtime", 0);
av_dict_set(&params->video_opts, "crf", "14", 0);
av_dict_set(&params->audio_opts, "audio_global_quality", "50", 0);
break;
case RECORD_CONFIG_TYPE_RECORDING_WEBM_HIGH_QUALITY:
params->threads = settings->uints.video_record_threads;
params->frame_drop_ratio = 1;
params->audio_enable = true;
params->audio_global_quality = 75;
params->out_pix_fmt = PIX_FMT_YUV420P;
strlcpy(params->vcodec, "libvpx", sizeof(params->vcodec));
strlcpy(params->acodec, "libopus", sizeof(params->acodec));
av_dict_set(&params->video_opts, "deadline", "realtime", 0);
av_dict_set(&params->video_opts, "crf", "4", 0);
av_dict_set(&params->audio_opts, "audio_global_quality", "75", 0);
break;
case RECORD_CONFIG_TYPE_RECORDING_GIF:
params->threads = settings->uints.video_record_threads;
params->frame_drop_ratio = 1;
params->audio_enable = false;
params->audio_global_quality = 0;
params->out_pix_fmt = PIX_FMT_RGB8;
strlcpy(params->vcodec, "gif", sizeof(params->vcodec));
strlcpy(params->acodec, "", sizeof(params->acodec));
av_dict_set(&params->video_opts, "framerate", "50", 0);
av_dict_set(&params->audio_opts, "audio_global_quality", "0", 0);
break;
case RECORD_CONFIG_TYPE_STREAMING_NETPLAY:
params->threads = 1;
params->threads = settings->uints.video_record_threads;
params->frame_drop_ratio = 1;
params->audio_enable = true;
params->audio_global_quality = 50;
@ -645,6 +694,24 @@ static bool ffmpeg_init_config_common(struct ff_config_param *params, unsigned p
params->scale_factor = 1;
strlcpy(params->format, "matroska", sizeof(params->format));
}
else if (preset >= RECORD_CONFIG_TYPE_RECORDING_WEBM_FAST && settings->uints.video_record_quality < RECORD_CONFIG_TYPE_RECORDING_GIF)
{
if (!settings->bools.video_gpu_record)
params->scale_factor = settings->uints.video_record_scale_factor > 0 ?
settings->uints.video_record_scale_factor : 1;
else
params->scale_factor = 1;
strlcpy(params->format, "webm", sizeof(params->format));
}
else if (preset <= RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY)
{
if (!settings->bools.video_gpu_record)
params->scale_factor = settings->uints.video_record_scale_factor > 0 ?
settings->uints.video_record_scale_factor : 1;
else
params->scale_factor = 1;
strlcpy(params->format, "gif", sizeof(params->format));
}
else if (preset <= RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY)
{
if (!settings->bools.video_gpu_record)

View File

@ -366,10 +366,24 @@ bool recording_init(void)
else
{
const char *game_name = path_basename(path_get(RARCH_PATH_BASENAME));
fill_str_dated_filename(buf, game_name,
"mkv", sizeof(buf));
fill_pathname_join(output, global->record.output_dir, buf, sizeof(output));
if (settings->uints.video_record_quality < RECORD_CONFIG_TYPE_RECORDING_WEBM_FAST)
{
fill_str_dated_filename(buf, game_name,
"mkv", sizeof(buf));
fill_pathname_join(output, global->record.output_dir, buf, sizeof(output));
}
else if (settings->uints.video_record_quality >= RECORD_CONFIG_TYPE_RECORDING_WEBM_FAST && settings->uints.video_record_quality < RECORD_CONFIG_TYPE_RECORDING_GIF)
{
fill_str_dated_filename(buf, game_name,
"webm", sizeof(buf));
fill_pathname_join(output, global->record.output_dir, buf, sizeof(output));
}
else
{
fill_str_dated_filename(buf, game_name,
"gif", sizeof(buf));
fill_pathname_join(output, global->record.output_dir, buf, sizeof(output));
}
}
}

View File

@ -46,11 +46,15 @@ enum record_config_type
RECORD_CONFIG_TYPE_RECORDING_MED_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_HIGH_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_LOSSLESS_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_WEBM_FAST,
RECORD_CONFIG_TYPE_RECORDING_WEBM_HIGH_QUALITY,
RECORD_CONFIG_TYPE_RECORDING_GIF,
RECORD_CONFIG_TYPE_STREAMING_CUSTOM,
RECORD_CONFIG_TYPE_STREAMING_LOW_QUALITY,
RECORD_CONFIG_TYPE_STREAMING_MED_QUALITY,
RECORD_CONFIG_TYPE_STREAMING_HIGH_QUALITY,
RECORD_CONFIG_TYPE_STREAMING_NETPLAY
};
/* Parameters passed to ffemu_new() */

View File

@ -28,6 +28,8 @@
#include "../verbosity.h"
#include "../msg_hash.h"
#define CALLBACK_ERROR_SIZE 4200
static int file_decompressed_target_file(const char *name,
const char *valid_exts,
const uint8_t *cdata,
@ -80,9 +82,9 @@ next_file:
return 1;
error:
userdata->dec->callback_error = (char*)malloc(PATH_MAX_LENGTH);
userdata->dec->callback_error = (char*)malloc(CALLBACK_ERROR_SIZE);
snprintf(userdata->dec->callback_error,
PATH_MAX_LENGTH, "Failed to deflate %s.\n", path);
CALLBACK_ERROR_SIZE, "Failed to deflate %s.\n", path);
return 0;
}
@ -122,8 +124,8 @@ next_file:
return 1;
error:
dec->callback_error = (char*)malloc(PATH_MAX_LENGTH);
snprintf(dec->callback_error, PATH_MAX_LENGTH,
dec->callback_error = (char*)malloc(CALLBACK_ERROR_SIZE);
snprintf(dec->callback_error, CALLBACK_ERROR_SIZE,
"Failed to deflate %s.\n", path);
return 0;