From 8c7f3adb413ccea35aef3878f020d6a10e9ad5de Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 30 Apr 2015 21:33:54 +0200 Subject: vo_rpi: update display size on display mode switches --- video/out/vo_rpi.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'video') diff --git a/video/out/vo_rpi.c b/video/out/vo_rpi.c index 684eddc560..6e0e92e7fb 100644 --- a/video/out/vo_rpi.c +++ b/video/out/vo_rpi.c @@ -30,6 +30,8 @@ #include +#include "osdep/atomics.h" + #include "common/common.h" #include "common/msg.h" #include "options/m_config.h" @@ -73,6 +75,8 @@ struct priv { // for RAM input MMAL_POOL_T *swpool; + atomic_bool update_display; + int background_layer; int video_layer; int osd_layer; @@ -525,15 +529,32 @@ static int control(struct vo *vo, uint32_t request, void *data) case VOCTRL_SCREENSHOT_WIN: *(struct mp_image **)data = take_screenshot(vo); return VO_TRUE; + case VOCTRL_CHECK_EVENTS: + if (atomic_load(&p->update_display)) { + atomic_store(&p->update_display, false); + update_display_size(vo); + } + return VO_TRUE; } return VO_NOTIMPL; } +static void tv_callback(void *callback_data, uint32_t reason, uint32_t param1, + uint32_t param2) +{ + struct vo *vo = callback_data; + struct priv *p = vo->priv; + atomic_store(&p->update_display, true); + vo_wakeup(vo); +} + static void uninit(struct vo *vo) { struct priv *p = vo->priv; + vc_tv_unregister_callback_full(tv_callback, vo); + talloc_free(p->next_image); wipe_osd(vo); @@ -588,6 +609,8 @@ static int preinit(struct vo *vo) if (update_display_size(vo) < 0) goto fail; + vc_tv_register_callback(tv_callback, vo); + return 0; fail: -- cgit v1.2.3