Create video_poke get_frame_count function

This commit is contained in:
twinaphex 2015-05-09 15:52:06 +02:00
parent 4ecfe639b3
commit ae408a1d41
13 changed files with 150 additions and 45 deletions

View File

@ -1950,9 +1950,7 @@ static void d3d_set_menu_texture_enable(void *data,
{
d3d_video_t *d3d = (d3d_video_t*)data;
if (!d3d)
return;
if (!d3d->menu)
if (!d3d || !d3d->menu)
return;
d3d->menu->enabled = state;
@ -1960,7 +1958,16 @@ static void d3d_set_menu_texture_enable(void *data,
}
#endif
static uint64_t d3d_get_frame_count(void *data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
if (!d3d)
return 0;
return d3d->frame_count;
}
static const video_poke_interface_t d3d_poke_interface = {
d3d_get_frame_count,
NULL,
NULL,
NULL, /* get_video_output_size */

View File

@ -501,8 +501,17 @@ static void ctr_viewport_info(void* data, struct video_viewport* vp)
return;
}
static uint64_t ctr_get_frame_count(void *data)
{
ctr_video_t* ctr = (ctr_video_t*)data;
if (!ctr)
return 0;
return ctr->frame_count;
}
static const video_poke_interface_t ctr_poke_interface =
{
ctr_get_frame_count,
NULL,
ctr_set_filtering,
NULL, /* get_video_output_size */

View File

@ -589,22 +589,31 @@ static bool dispmanx_gfx_read_viewport(void *data, uint8_t *buffer)
return true;
}
static uint64_t dispmanx_gfx_get_frame_count(void *data)
{
struct dispmanx_video *_dispvars = data;
if (!_dispvars)
return 0;
return _dispvars->frame_count;
}
static const video_poke_interface_t dispmanx_poke_interface = {
NULL, /* set_video_mode */
NULL, /* set_filtering */
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL, /* get_current_framebuffer */
NULL, /* get_proc_address */
NULL, /* dispmanx_set_aspect_ratio */
NULL, /* dispmanx_apply_state_changes */
dispmanx_get_frame_count,
NULL, /* set_video_mode */
NULL, /* set_filtering */
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL, /* get_current_framebuffer */
NULL, /* get_proc_address */
NULL, /* dispmanx_set_aspect_ratio */
NULL, /* dispmanx_apply_state_changes */
#ifdef HAVE_MENU
dispmanx_set_texture_frame,
dispmanx_set_texture_enable,
dispmanx_set_texture_frame,
dispmanx_set_texture_enable,
#endif
NULL, /* dispmanx_set_osd_msg */
NULL /* dispmanx_show_mouse */
NULL, /* dispmanx_set_osd_msg */
NULL /* dispmanx_show_mouse */
};
static void dispmanx_gfx_get_poke_interface(void *data,

View File

@ -1623,22 +1623,31 @@ static void exynos_show_mouse(void *data, bool state)
(void)state;
}
static uint64_t exynos_get_frame_count(void *data)
{
struct exynos_video *vid = data;
if (!vid)
return 0;
return vid->frame_count;
}
static const video_poke_interface_t exynos_poke_interface = {
NULL, /* set_video_mode */
NULL, /* set_filtering */
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL, /* get_current_framebuffer */
NULL, /* get_proc_address */
exynos_set_aspect_ratio,
exynos_apply_state_changes,
exynos_get_frame_count,
NULL, /* set_video_mode */
NULL, /* set_filtering */
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL, /* get_current_framebuffer */
NULL, /* get_proc_address */
exynos_set_aspect_ratio,
exynos_apply_state_changes,
#ifdef HAVE_MENU
exynos_set_texture_frame,
exynos_set_texture_enable,
exynos_set_texture_frame,
exynos_set_texture_enable,
#endif
exynos_set_osd_msg,
exynos_show_mouse
exynos_set_osd_msg,
exynos_show_mouse
};
static void exynos_gfx_get_poke_interface(void *data,

View File

@ -3184,8 +3184,17 @@ static void gl_get_video_output_next(void *data)
gfx_ctx_get_video_output_next(data);
}
static uint64_t gl_get_frame_count(void *data)
{
gl_t *gl = (gl_t*)data;
if (!gl)
return 0;
return gl->frame_count;
}
static const video_poke_interface_t gl_poke_interface = {
gl_get_frame_count,
gl_set_video_mode,
NULL,
gl_get_video_output_size,

View File

@ -1302,7 +1302,16 @@ static void gx_get_video_output_next(void *data)
}
}
static uint64_t gx_get_frame_count(void *data)
{
gx_video_t *gx = (gx_video_t*)data;
if (!gx)
return 0;
return gx->frame_count;
}
static const video_poke_interface_t gx_poke_interface = {
gx_get_frame_count,
gx_set_video_mode,
NULL,
gx_get_video_output_size,

View File

@ -1138,7 +1138,16 @@ static void omap_gfx_set_texture_enable(void *data, bool state, bool full_screen
(void) full_screen;
}
static uint64_t omap_gfx_get_frame_count(void *data)
{
omap_video_t *vid = (omap_video_t*)data;
if (!vid)
return 0;
return vid->frame_count;
}
static const video_poke_interface_t omap_gfx_poke_interface = {
omap_gfx_get_frame_count,
NULL,
NULL, /* set_filtering */
NULL, /* get_video_output_size */

View File

@ -840,7 +840,16 @@ static void psp_viewport_info(void *data, struct video_viewport *vp)
*vp = psp->vp;
}
static uint64_t psp_get_frame_count(void *data)
{
psp1_video_t *psp = (psp1_video_t*)data;
if (!psp)
return 0;
return psp->frame_count;
}
static const video_poke_interface_t psp_poke_interface = {
psp_get_frame_count,
NULL,
psp_set_filtering,
NULL, /* get_video_output_size */

View File

@ -719,7 +719,16 @@ void sdl2_grab_mouse_toggle(void *data)
SDL_SetWindowGrab(vid->window, SDL_GetWindowGrab(vid->window));
}
static uint64_t sdl2_get_frame_count(void *data)
{
sdl2_video_t *vid = (sdl2_video_t*)data;
if (!vid)
return 0;
return vid->frame_count;
}
static video_poke_interface_t sdl2_video_poke_interface = {
sdl2_get_frame_count,
NULL,
sdl2_poke_set_filtering,
NULL, /* get_video_output_size */

View File

@ -515,7 +515,16 @@ static void sdl_grab_mouse_toggle(void *data)
SDL_WM_GrabInput(mode == SDL_GRAB_ON ? SDL_GRAB_OFF : SDL_GRAB_ON);
}
static void sdl_get_frame_count(void *data)
{
sdl_video_t *vid = (sdl_video_t*)data;
if (!vid)
return 0;
return vid->frame_count;
}
static const video_poke_interface_t sdl_poke_interface = {
sdl_get_frame_count,
NULL,
sdl_set_filtering,
NULL, /* get_video_output_size */

View File

@ -932,22 +932,31 @@ static void sunxi_set_texture_frame(void *data, const void *frame, bool rgb32,
_dispvars->pages[0].offset, width, height, _dispvars->sunxi_disp->xres);
}
static uint64_t sunxi_get_frame_count(void *data)
{
struct sunxi_video *_dispvars = (struct sunxi_video*)data;
if (!_dispvars)
return 0;
return _dispvars->frame_count;
}
static const video_poke_interface_t sunxi_poke_interface = {
NULL, /* set_video_mode */
NULL, /* set_filtering */
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL, /* get_current_framebuffer */
NULL, /* get_proc_address */
NULL, /* sunxi_set_aspect_ratio */
NULL, /* sunxi_apply_state_changes */
sunxi_get_frame_count,
NULL, /* set_video_mode */
NULL, /* set_filtering */
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */
NULL, /* get_current_framebuffer */
NULL, /* get_proc_address */
NULL, /* sunxi_set_aspect_ratio */
NULL, /* sunxi_apply_state_changes */
#ifdef HAVE_MENU
sunxi_set_texture_frame,
sunxi_set_texture_enable,
sunxi_set_texture_frame,
sunxi_set_texture_enable,
#endif
NULL, /* sunxi_set_osd_msg */
NULL /* sunxi_show_mouse */
NULL, /* sunxi_set_osd_msg */
NULL /* sunxi_show_mouse */
};
static void sunxi_gfx_get_poke_interface(void *data,

View File

@ -100,6 +100,7 @@ enum texture_filter_type
typedef struct video_poke_interface
{
uint64_t (*get_frame_count)(void *data);
void (*set_video_mode)(void *data, unsigned width, unsigned height, bool fullscreen);
void (*set_filtering)(void *data, unsigned index, bool smooth);
void (*get_video_output_size)(void *data, unsigned *width, unsigned *height);

View File

@ -948,14 +948,21 @@ static void thread_apply_state_changes(void *data)
static struct video_shader *thread_get_current_shader(void *data)
{
thread_video_t *thr = (thread_video_t*)data;
if (!thr)
return NULL;
if (!thr->poke)
if (!thr || !thr->poke)
return NULL;
return thr->poke->get_current_shader(thr->driver_data);
}
static uint64_t thread_get_frame_count(void *data)
{
thread_video_t *thr = (thread_video_t*)data;
if (!thr || !thr->poke)
return NULL;
return thr->poke->get_frame_count(thr->driver_data);
}
static const video_poke_interface_t thread_poke = {
thread_get_frame_count,
thread_set_video_mode,
thread_set_filtering,
thread_get_video_output_size,