From 2392a433d87965423b5493484af577af7754127b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 23 Mar 2015 00:50:33 +0100 Subject: [PATCH] Create video_driver_get_video_output_next/video_driver_get_video_output_prev --- gfx/video_driver.c | 34 ++++++++++++++++++++++++++++++++++ gfx/video_driver.h | 4 ++++ menu/menu_entries_cbs_toggle.c | 12 ++---------- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/gfx/video_driver.c b/gfx/video_driver.c index d94f4a9647..8bcdb3de10 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -846,3 +846,37 @@ void video_driver_apply_state_changes(void) return; driver->video_poke->apply_state_changes(driver->video_data); } + +void video_driver_get_video_output_next(void) +{ + driver_t *driver = driver_get_ptr(); + + if (!driver) + return; + if (!driver->video) + return; + if (!driver->video_data) + return; + if (!driver->video_poke) + return; + if (!driver->video_poke->get_video_output_next) + return; + driver->video_poke->get_video_output_next(driver->video_data); +} + +void video_driver_get_video_output_prev(void) +{ + driver_t *driver = driver_get_ptr(); + + if (!driver) + return; + if (!driver->video) + return; + if (!driver->video_data) + return; + if (!driver->video_poke) + return; + if (!driver->video_poke->get_video_output_prev) + return; + driver->video_poke->get_video_output_prev(driver->video_data); +} diff --git a/gfx/video_driver.h b/gfx/video_driver.h index c7b398e77c..e93dc29248 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -314,6 +314,10 @@ void video_driver_set_filtering(unsigned index, bool smooth); void video_driver_apply_state_changes(void); +void video_driver_get_video_output_next(void); + +void video_driver_get_video_output_prev(void); + #ifdef __cplusplus } #endif diff --git a/menu/menu_entries_cbs_toggle.c b/menu/menu_entries_cbs_toggle.c index d65e241b74..2bd499e542 100644 --- a/menu/menu_entries_cbs_toggle.c +++ b/menu/menu_entries_cbs_toggle.c @@ -442,18 +442,10 @@ static int action_toggle_video_resolution(unsigned type, const char *label, switch (action) { case MENU_ACTION_LEFT: - if (driver->video_data && driver->video_poke && - driver->video_poke->get_video_output_prev) - { - driver->video_poke->get_video_output_prev(driver->video_data); - } + video_driver_get_video_output_prev(); break; case MENU_ACTION_RIGHT: - if (driver->video_data && driver->video_poke && - driver->video_poke->get_video_output_next) - { - driver->video_poke->get_video_output_next(driver->video_data); - } + video_driver_get_video_output_next(); break; } #endif