summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2015-01-15 11:33:58 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2015-01-15 11:33:58 +0100
commit66c65beea7ac5c6dbc416b89b3a5800d31a0ecd7 (patch)
treefb0cc3da4effd5b327e51019e0122fe2940a5ef6
parentbe9a6de0ef0bb282842f57a86d00075539f4156c (diff)
downloadvdr-66c65beea7ac5c6dbc416b89b3a5800d31a0ecd7.tar.gz
vdr-66c65beea7ac5c6dbc416b89b3a5800d31a0ecd7.tar.bz2
Added cOsdProvider::OsdSizeChanged()
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY3
-rw-r--r--menu.c7
-rw-r--r--menu.h3
-rw-r--r--osd.c13
-rw-r--r--osd.h9
6 files changed, 32 insertions, 4 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 1c3dd2ec..108ff79d 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -3271,6 +3271,7 @@ Thomas Reufer <thomas@reufer.ch>
for implementing cOsd::DrawScaledBitmap()
for adding handling for DTS audio tracks to cPatPmtParser::ParsePmt()
for adding support for PGS subtitles
+ for adding cOsdProvider::OsdSizeChanged()
Eike Sauer <EikeSauer@t-online.de>
for reporting a problem with channels that need more than 5 TS packets for detecting
diff --git a/HISTORY b/HISTORY
index 84870418..fbcd0d0d 100644
--- a/HISTORY
+++ b/HISTORY
@@ -8376,3 +8376,6 @@ Video Disk Recorder Revision History
- Plugins can now implement the function SetMenuSortMode() in their skin objects
derived from cSkinDisplayMenu, to get informed about the currently used sort
mode, if applicable (suggested by Martin Schirrmacher).
+- Added cOsdProvider::OsdSizeChanged(), which plugins that implement an output device
+ can call to signal a change in the OSD that requires a redraw of the currently
+ displayed object (thanks to Thomas Reufer).
diff --git a/menu.c b/menu.c
index 08445bc1..a48bfdaf 100644
--- a/menu.c
+++ b/menu.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: menu.c 3.27 2015/01/15 10:31:41 kls Exp $
+ * $Id: menu.c 3.28 2015/01/15 11:14:21 kls Exp $
*/
#include "menu.h"
@@ -4033,6 +4033,7 @@ cDisplayChannel::cDisplayChannel(int Number, bool Switched)
displayChannel = Skins.Current()->DisplayChannel(withInfo);
number = 0;
timeout = Switched || Setup.TimeoutRequChInfo;
+ cOsdProvider::OsdSizeChanged(osdState); // just to get the current state
positioner = NULL;
channel = Channels.GetByNumber(Number);
lastPresent = lastFollowing = NULL;
@@ -4118,6 +4119,10 @@ cChannel *cDisplayChannel::NextAvailableChannel(cChannel *Channel, int Direction
eOSState cDisplayChannel::ProcessKey(eKeys Key)
{
+ if (cOsdProvider::OsdSizeChanged(osdState)) {
+ delete displayChannel;
+ displayChannel = Skins.Current()->DisplayChannel(withInfo);
+ }
cChannel *NewChannel = NULL;
if (Key != kNone)
lastTime.Set();
diff --git a/menu.h b/menu.h
index 24516c36..87670c72 100644
--- a/menu.h
+++ b/menu.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: menu.h 3.5 2013/12/25 12:06:03 kls Exp $
+ * $Id: menu.h 3.6 2015/01/15 11:12:57 kls Exp $
*/
#ifndef __MENU_H
@@ -121,6 +121,7 @@ private:
cTimeMs lastTime;
int number;
bool timeout;
+ int osdState;
const cPositioner *positioner;
cChannel *channel;
const cEvent *lastPresent;
diff --git a/osd.c b/osd.c
index 0532c0a8..d31ee8a3 100644
--- a/osd.c
+++ b/osd.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: osd.c 3.3 2015/01/04 15:46:39 kls Exp $
+ * $Id: osd.c 3.4 2015/01/15 11:20:56 kls Exp $
*/
#include "osd.h"
@@ -1978,6 +1978,7 @@ int cOsdProvider::oldWidth = 0;
int cOsdProvider::oldHeight = 0;
double cOsdProvider::oldAspect = 1.0;
cImage *cOsdProvider::images[MAXOSDIMAGES] = { NULL };
+int cOsdProvider::osdState = 0;
cOsdProvider::cOsdProvider(void)
{
@@ -2015,6 +2016,7 @@ void cOsdProvider::UpdateOsdSize(bool Force)
int Width;
int Height;
double Aspect;
+ cMutexLock MutexLock(&cOsd::mutex);
cDevice::PrimaryDevice()->GetOsdSize(Width, Height, Aspect);
if (Width != oldWidth || Height != oldHeight || !DoubleEqual(Aspect, oldAspect) || Force) {
Setup.OSDLeft = int(round(Width * Setup.OSDLeftP));
@@ -2032,9 +2034,18 @@ void cOsdProvider::UpdateOsdSize(bool Force)
oldHeight = Height;
oldAspect = Aspect;
dsyslog("OSD size changed to %dx%d @ %g", Width, Height, Aspect);
+ osdState++;
}
}
+bool cOsdProvider::OsdSizeChanged(int &State)
+{
+ cMutexLock MutexLock(&cOsd::mutex);
+ bool Result = osdState != State;
+ State = osdState;
+ return Result;
+}
+
bool cOsdProvider::SupportsTrueColor(void)
{
if (osdProvider) {
diff --git a/osd.h b/osd.h
index 5195f8d6..e5864c4f 100644
--- a/osd.h
+++ b/osd.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: osd.h 3.4 2015/01/14 10:50:55 kls Exp $
+ * $Id: osd.h 3.5 2015/01/15 11:23:52 kls Exp $
*/
#ifndef __OSD_H
@@ -949,6 +949,7 @@ private:
static int oldHeight;
static double oldAspect;
static cImage *images[MAXOSDIMAGES];
+ static int osdState;
protected:
virtual cOsd *CreateOsd(int Left, int Top, uint Level) = 0;
///< Returns a pointer to a newly created cOsd object, which will be located
@@ -985,6 +986,12 @@ public:
///< font sizes accordingly. If Force is true, all settings are recalculated,
///< even if the video resolution hasn't changed since the last call to
///< this function.
+ static bool OsdSizeChanged(int &State);
+ ///< Checks if the OSD size has changed and a currently displayed OSD needs to
+ ///< be redrawn. An internal reference value is incremented on every size change
+ ///< and is compared against State when calling the method.
+ ///< OsdSizeChanged() can be called with an uninitialized State to just get
+ ///< the current value of State.
static bool SupportsTrueColor(void);
///< Returns true if the current OSD provider is able to handle a true color OSD.
static int StoreImage(const cImage &Image);