diff options
| author | Thomas Reufer <thomas@reufer.ch> | 2014-11-02 18:39:57 +0100 |
|---|---|---|
| committer | Thomas Reufer <thomas@reufer.ch> | 2014-11-14 23:16:13 +0100 |
| commit | dfd3a619c4821da65c3bb84dccc0f6843371f63c (patch) | |
| tree | cd560fde49825f4710ad18a5e92ed1002b2869cb | |
| parent | a9897d45d7b37b48f39170695176f254185daa7b (diff) | |
| download | vdr-plugin-rpihddevice-dfd3a619c4821da65c3bb84dccc0f6843371f63c.tar.gz vdr-plugin-rpihddevice-dfd3a619c4821da65c3bb84dccc0f6843371f63c.tar.bz2 | |
reset OSD only after video mode change
| -rw-r--r-- | display.c | 18 | ||||
| -rw-r--r-- | display.h | 3 | ||||
| -rw-r--r-- | ovgosd.c | 21 | ||||
| -rw-r--r-- | ovgosd.h | 5 |
4 files changed, 33 insertions, 14 deletions
@@ -5,11 +5,11 @@ */ #include "display.h" +#include "ovgosd.h" #include "tools.h" #include "setup.h" #include <vdr/tools.h> -#include <vdr/osd.h> extern "C" { #include "interface/vmcs_host/vc_tvservice.h" @@ -209,10 +209,8 @@ int cRpiDisplay::Update(int width, int height, int frameRate, bool interlaced) // set new mode only if necessary if (newWidth != m_width || newHeight != m_height || newFrameRate != m_frameRate || newInterlaced != m_interlaced) - { - if (!SetMode(newWidth, newHeight, newFrameRate, newInterlaced)) - cOsdProvider::UpdateOsdSize(true); - } + return SetMode(newWidth, newHeight, newFrameRate, newInterlaced); + return 0; } @@ -237,6 +235,7 @@ cRpiHDMIDisplay::cRpiHDMIDisplay(int width, int height, int frameRate, m_startMode(mode), m_modified(false) { + vc_tv_register_callback(TvServiceCallback, 0); m_modes->nModes = vc_tv_hdmi_get_supported_modes_new(HDMI_RES_GROUP_CEA, m_modes->modes, HDMI_MAX_MODES, NULL, NULL); @@ -290,6 +289,8 @@ cRpiHDMIDisplay::cRpiHDMIDisplay(int width, int height, int frameRate, cRpiHDMIDisplay::~cRpiHDMIDisplay() { + vc_tv_unregister_callback(TvServiceCallback); + // if mode has been changed, set back to previous state if (m_modified) SetMode(m_startGroup, m_startMode); @@ -346,6 +347,13 @@ int cRpiHDMIDisplay::SetMode(int group, int mode) return ret; } +void cRpiHDMIDisplay::TvServiceCallback(void *data, unsigned int reason, + unsigned int param1, unsigned int param2) +{ + if (reason & VC_HDMI_DVI + VC_HDMI_HDMI) + cRpiOsdProvider::ResetOsd(); +} + /* ------------------------------------------------------------------------- */ cRpiCompositeDisplay::cRpiCompositeDisplay(int width, int height, @@ -68,6 +68,9 @@ private: virtual int SetMode(int width, int height, int frameRate, bool interlaced); int SetMode(int group, int mode); + static void TvServiceCallback(void *data, unsigned int reason, + unsigned int param1, unsigned int param2); + class ModeList; ModeList *m_modes; @@ -292,6 +292,8 @@ protected: vgClear(0, 0, width, height); eglSwapBuffers(display, surface); + cOsdProvider::UpdateOsdSize(true); + while (!reset) { while (!m_commands.empty()) @@ -312,11 +314,6 @@ protected: if (!reset) cCondWait::SleepMs(10); } - - // clear screen - glClear(GL_COLOR_BUFFER_BIT); - eglSwapBuffers(display, surface); - // Release OpenGL resources eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); @@ -339,17 +336,21 @@ private: /* ------------------------------------------------------------------------- */ +cRpiOsdProvider* cRpiOsdProvider::s_instance = 0; + cRpiOsdProvider::cRpiOsdProvider() : cOsdProvider(), m_ovg(0) { DLOG("new cOsdProvider()"); m_ovg = new cOvg(); + s_instance = this; } cRpiOsdProvider::~cRpiOsdProvider() { DLOG("delete cOsdProvider()"); + s_instance = 0; delete m_ovg; } @@ -358,14 +359,18 @@ cOsd *cRpiOsdProvider::CreateOsd(int Left, int Top, uint Level) return new cOvgOsd(Left, Top, Level, m_ovg); } +void cRpiOsdProvider::ResetOsd(void) +{ + if (s_instance) + s_instance->m_ovg->DoCmd(new cOvgReset()); +} + /* ------------------------------------------------------------------------- */ cOvgOsd::cOvgOsd(int Left, int Top, uint Level, cOvg *ovg) : cOsd(Left, Top, Level), m_ovg(ovg) -{ - m_ovg->DoCmd(new cOvgReset()); -} +{ } cOvgOsd::~cOvgOsd() { @@ -19,16 +19,19 @@ public: cRpiOsdProvider(); ~cRpiOsdProvider(); + static void ResetOsd(void); + protected: virtual cOsd *CreateOsd(int Left, int Top, uint Level); virtual bool ProvidesTrueColor(void) { return true; } virtual int StoreImageData(const cImage &Image) { return 0; } - virtual void DropImageData(int ImageHandle) {} + virtual void DropImageData(int ImageHandle) { } private: cOvg *m_ovg; + static cRpiOsdProvider *s_instance; }; #endif |
