Implement get_video_output_prev/get_video_output_next

This commit is contained in:
twinaphex 2015-02-24 21:36:23 +01:00
parent e3844f409d
commit 13a391c165
27 changed files with 140 additions and 16 deletions

View File

@ -401,7 +401,9 @@ const gfx_ctx_driver_t gfx_ctx_apple = {
apple_gfx_ctx_swap_interval,
apple_gfx_ctx_set_video_mode,
apple_gfx_ctx_get_video_size,
NULL,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL,
apple_gfx_ctx_update_window_title,
apple_gfx_ctx_check_window,

View File

@ -1919,6 +1919,8 @@ static void d3d_set_menu_texture_enable(void *data,
static const video_poke_interface_t d3d_poke_interface = {
NULL,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
#ifdef HAVE_FBO
NULL,
#endif

View File

@ -1615,6 +1615,8 @@ static void exynos_show_mouse(void *data, bool state)
static const video_poke_interface_t exynos_poke_interface = {
NULL, /* set_filtering */
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
#ifdef HAVE_FBO
NULL, /* get_current_framebuffer */
#endif

View File

@ -3096,9 +3096,28 @@ static void gl_get_video_output_size(void *data, unsigned *width, unsigned *heig
gl->ctx_driver->get_video_output_size(gl, width, height);
}
static void gl_get_video_output_prev(void *data)
{
gl_t *gl = (gl_t*)data;
if (gl && gl->ctx_driver->get_video_output_prev)
gl->ctx_driver->get_video_output_prev(gl);
}
static void gl_get_video_output_next(void *data)
{
gl_t *gl = (gl_t*)data;
if (gl && gl->ctx_driver->get_video_output_next)
gl->ctx_driver->get_video_output_next(gl);
}
static const video_poke_interface_t gl_poke_interface = {
NULL,
gl_get_video_output_size,
gl_get_video_output_prev,
gl_get_video_output_next,
#ifdef HAVE_FBO
gl_get_current_framebuffer,
#endif

View File

@ -216,9 +216,6 @@ void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines)
viHeightMultiplier = 1;
viWidth = g_settings.video.viwidth;
#if defined(HW_RVL)
#if 0
#endif
progressive = CONF_GetProgressiveScan() > 0 && VIDEO_HaveComponentCable();
switch (CONF_GetVideo())
{
@ -1244,9 +1241,31 @@ static void gx_get_video_output_size(void *data, unsigned *width, unsigned *heig
*height = menu_gx_resolutions[menu_current_gx_resolution][1];
}
static void gx_video_output_get_prev(void *data)
{
if (menu_current_gx_resolution > 0)
menu_current_gx_resolution--;
}
static void gx_video_output_get_next(void *data)
{
if (menu_current_gx_resolution < GX_RESOLUTIONS_LAST - 1)
{
#ifdef HW_RVL
if ((menu_current_gx_resolution + 1) > GX_RESOLUTIONS_640_480)
if (CONF_GetVideo() != CONF_VIDEO_PAL)
return;
#endif
menu_current_gx_resolution++;
}
}
static const video_poke_interface_t gx_poke_interface = {
NULL,
gx_get_video_output_size,
gx_get_video_output_prev,
gx_get_video_output_next,
NULL,
gx_set_aspect_ratio,
gx_apply_state_changes,

View File

@ -842,6 +842,8 @@ static void psp_viewport_info(void *data, struct video_viewport *vp)
static const video_poke_interface_t psp_poke_interface = {
psp_set_filtering,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL,
NULL,
psp_set_aspect_ratio,

View File

@ -719,6 +719,8 @@ void sdl2_grab_mouse_toggle(void *data)
static video_poke_interface_t sdl2_video_poke_interface = {
sdl2_poke_set_filtering,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
#ifdef HAVE_FBO
NULL,
#endif

View File

@ -508,6 +508,8 @@ static void sdl_grab_mouse_toggle(void *data)
static const video_poke_interface_t sdl_poke_interface = {
sdl_set_filtering,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
#ifdef HAVE_FBO
NULL,
NULL,

View File

@ -380,7 +380,9 @@ const gfx_ctx_driver_t gfx_ctx_android = {
android_gfx_ctx_set_swap_interval,
android_gfx_ctx_set_video_mode,
android_gfx_ctx_get_video_size,
NULL,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL,
android_gfx_ctx_update_window_title,
android_gfx_ctx_check_window,

View File

@ -451,7 +451,9 @@ const gfx_ctx_driver_t gfx_ctx_bbqnx = {
gfx_ctx_qnx_set_swap_interval,
gfx_ctx_qnx_set_video_mode,
gfx_ctx_qnx_get_video_size,
NULL,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL,
gfx_ctx_qnx_update_window_title,
gfx_ctx_qnx_check_window,

View File

@ -499,7 +499,9 @@ const gfx_ctx_driver_t gfx_ctx_d3d = {
gfx_ctx_d3d_swap_interval,
NULL,
gfx_ctx_d3d_get_video_size,
NULL,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL,
gfx_ctx_d3d_update_title,
gfx_ctx_d3d_check_window,

View File

@ -957,7 +957,9 @@ const gfx_ctx_driver_t gfx_ctx_drm_egl = {
gfx_ctx_drm_egl_swap_interval,
gfx_ctx_drm_egl_set_video_mode,
gfx_ctx_drm_egl_get_video_size,
NULL,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL,
gfx_ctx_drm_egl_update_window_title,
gfx_ctx_drm_egl_check_window,

View File

@ -308,7 +308,10 @@ const gfx_ctx_driver_t gfx_ctx_emscripten = {
gfx_ctx_emscripten_swap_interval,
gfx_ctx_emscripten_set_video_mode,
gfx_ctx_emscripten_get_video_size,
NULL,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL,
gfx_ctx_emscripten_translate_aspect,
gfx_ctx_emscripten_update_window_title,
gfx_ctx_emscripten_check_window,

View File

@ -140,7 +140,9 @@ const gfx_ctx_driver_t gfx_ctx_null = {
gfx_ctx_null_swap_interval,
gfx_ctx_null_set_video_mode,
gfx_ctx_null_get_video_size,
NULL,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL,
gfx_ctx_null_update_window_title,
gfx_ctx_null_check_window,

View File

@ -733,7 +733,9 @@ const gfx_ctx_driver_t gfx_ctx_glx = {
gfx_ctx_glx_swap_interval,
gfx_ctx_glx_set_video_mode,
gfx_ctx_glx_get_video_size,
NULL,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL,
gfx_ctx_glx_update_window_title,
gfx_ctx_glx_check_window,

View File

@ -318,7 +318,9 @@ const gfx_ctx_driver_t gfx_ctx_mali_fbdev = {
gfx_ctx_mali_fbdev_set_swap_interval,
gfx_ctx_mali_fbdev_set_video_mode,
gfx_ctx_mali_fbdev_get_video_size,
NULL,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL,
gfx_ctx_mali_fbdev_update_window_title,
gfx_ctx_mali_fbdev_check_window,

View File

@ -378,6 +378,8 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = {
gfx_ctx_ps3_set_video_mode,
gfx_ctx_ps3_get_video_size,
gfx_ctx_ps3_get_video_output_size,
gfx_ctx_ps3_get_video_output_prev,
gfx_ctx_ps3_get_video_output_next,
NULL,
gfx_ctx_ps3_update_window_title,
gfx_ctx_ps3_check_window,

View File

@ -422,6 +422,8 @@ const gfx_ctx_driver_t gfx_ctx_sdl_gl =
sdl_ctx_set_video_mode,
sdl_ctx_get_video_size,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL, /* translate_aspect */
sdl_ctx_update_window_title,
sdl_ctx_check_window,

View File

@ -640,6 +640,9 @@ const gfx_ctx_driver_t gfx_ctx_videocore = {
gfx_ctx_vc_swap_interval,
gfx_ctx_vc_set_video_mode,
gfx_ctx_vc_get_video_size,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL,
gfx_ctx_vc_translate_aspect,
gfx_ctx_vc_update_window_title,

View File

@ -303,7 +303,9 @@ const gfx_ctx_driver_t gfx_ctx_vivante_fbdev = {
gfx_ctx_vivante_set_swap_interval,
gfx_ctx_vivante_set_video_mode,
gfx_ctx_vivante_get_video_size,
NULL,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL,
gfx_ctx_vivante_update_window_title,
gfx_ctx_vivante_check_window,

View File

@ -880,7 +880,9 @@ const gfx_ctx_driver_t gfx_ctx_wayland = {
gfx_ctx_wl_swap_interval,
gfx_ctx_wl_set_video_mode,
gfx_ctx_wl_get_video_size,
NULL,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL,
gfx_ctx_wl_update_window_title,
gfx_ctx_wl_check_window,

View File

@ -684,7 +684,9 @@ const gfx_ctx_driver_t gfx_ctx_wgl = {
gfx_ctx_wgl_swap_interval,
gfx_ctx_wgl_set_video_mode,
gfx_ctx_wgl_get_video_size,
NULL,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL,
gfx_ctx_wgl_update_window_title,
gfx_ctx_wgl_check_window,

View File

@ -799,7 +799,9 @@ const gfx_ctx_driver_t gfx_ctx_x_egl = {
gfx_ctx_xegl_swap_interval,
gfx_ctx_xegl_set_video_mode,
gfx_ctx_xegl_get_video_size,
NULL,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL,
gfx_ctx_xegl_update_window_title,
gfx_ctx_xegl_check_window,

View File

@ -72,6 +72,10 @@ typedef struct gfx_ctx_driver
void (*get_video_output_size)(void*, unsigned*, unsigned*);
void (*get_video_output_prev)(void*);
void (*get_video_output_next)(void*);
/* Translates a window size to an aspect ratio.
* In most cases this will be just width / height, but
* some contexts will better know which actual aspect ratio is used.

View File

@ -94,6 +94,8 @@ typedef struct video_poke_interface
{
void (*set_filtering)(void *data, unsigned index, bool smooth);
void (*get_video_output_size)(void *data, unsigned *width, unsigned *height);
void (*get_video_output_prev)(void *data);
void (*get_video_output_next)(void *data);
#ifdef HAVE_FBO
uintptr_t (*get_current_framebuffer)(void *data);
#endif

View File

@ -265,6 +265,18 @@ static void thread_loop(void *data)
thread_reply(thr, CMD_POKE_GET_VIDEO_OUTPUT_SIZE);
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);
thread_reply(thr, CMD_POKE_GET_VIDEO_OUTPUT_PREV);
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);
thread_reply(thr, CMD_POKE_GET_VIDEO_OUTPUT_NEXT);
break;
case CMD_POKE_SET_ASPECT_RATIO:
thr->poke->set_aspect_ratio(thr->driver_data,
thr->cmd_data.i);
@ -780,6 +792,26 @@ static void thread_get_video_output_size(void *data,
*height = thr->cmd_data.output.width;
}
static void thread_get_video_output_prev(void *data)
{
thread_video_t *thr = (thread_video_t*)data;
if (!thr)
return;
thread_send_cmd(thr, CMD_POKE_GET_VIDEO_OUTPUT_PREV);
thread_wait_reply(thr, CMD_POKE_GET_VIDEO_OUTPUT_PREV);
}
static void thread_get_video_output_next(void *data)
{
thread_video_t *thr = (thread_video_t*)data;
if (!thr)
return;
thread_send_cmd(thr, CMD_POKE_GET_VIDEO_OUTPUT_NEXT);
thread_wait_reply(thr, CMD_POKE_GET_VIDEO_OUTPUT_NEXT);
}
static void thread_set_aspect_ratio(void *data, unsigned aspectratio_idx)
{
thread_video_t *thr = (thread_video_t*)data;
@ -874,6 +906,8 @@ static struct video_shader *thread_get_current_shader(void *data)
static const video_poke_interface_t thread_poke = {
thread_set_filtering,
thread_get_video_output_size,
thread_get_video_output_prev,
thread_get_video_output_next,
#ifdef HAVE_FBO
NULL,
#endif

View File

@ -43,6 +43,8 @@ enum thread_cmd
CMD_POKE_SET_FILTERING,
CMD_POKE_GET_VIDEO_OUTPUT_SIZE,
CMD_POKE_GET_VIDEO_OUTPUT_PREV,
CMD_POKE_GET_VIDEO_OUTPUT_NEXT,
#ifdef HAVE_FBO
CMD_POKE_SET_FBO_STATE,
CMD_POKE_GET_FBO_STATE,