1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Added cOsdProvider::OsdSizeChanged()

This commit is contained in:
Klaus Schmidinger 2015-01-15 11:33:58 +01:00
parent be9a6de0ef
commit 66c65beea7
6 changed files with 32 additions and 4 deletions

View File

@ -3271,6 +3271,7 @@ Thomas Reufer <thomas@reufer.ch>
for implementing cOsd::DrawScaledBitmap() for implementing cOsd::DrawScaledBitmap()
for adding handling for DTS audio tracks to cPatPmtParser::ParsePmt() for adding handling for DTS audio tracks to cPatPmtParser::ParsePmt()
for adding support for PGS subtitles for adding support for PGS subtitles
for adding cOsdProvider::OsdSizeChanged()
Eike Sauer <EikeSauer@t-online.de> Eike Sauer <EikeSauer@t-online.de>
for reporting a problem with channels that need more than 5 TS packets for detecting for reporting a problem with channels that need more than 5 TS packets for detecting

View File

@ -8376,3 +8376,6 @@ Video Disk Recorder Revision History
- Plugins can now implement the function SetMenuSortMode() in their skin objects - Plugins can now implement the function SetMenuSortMode() in their skin objects
derived from cSkinDisplayMenu, to get informed about the currently used sort derived from cSkinDisplayMenu, to get informed about the currently used sort
mode, if applicable (suggested by Martin Schirrmacher). 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).

7
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "menu.h"
@ -4033,6 +4033,7 @@ cDisplayChannel::cDisplayChannel(int Number, bool Switched)
displayChannel = Skins.Current()->DisplayChannel(withInfo); displayChannel = Skins.Current()->DisplayChannel(withInfo);
number = 0; number = 0;
timeout = Switched || Setup.TimeoutRequChInfo; timeout = Switched || Setup.TimeoutRequChInfo;
cOsdProvider::OsdSizeChanged(osdState); // just to get the current state
positioner = NULL; positioner = NULL;
channel = Channels.GetByNumber(Number); channel = Channels.GetByNumber(Number);
lastPresent = lastFollowing = NULL; lastPresent = lastFollowing = NULL;
@ -4118,6 +4119,10 @@ cChannel *cDisplayChannel::NextAvailableChannel(cChannel *Channel, int Direction
eOSState cDisplayChannel::ProcessKey(eKeys Key) eOSState cDisplayChannel::ProcessKey(eKeys Key)
{ {
if (cOsdProvider::OsdSizeChanged(osdState)) {
delete displayChannel;
displayChannel = Skins.Current()->DisplayChannel(withInfo);
}
cChannel *NewChannel = NULL; cChannel *NewChannel = NULL;
if (Key != kNone) if (Key != kNone)
lastTime.Set(); lastTime.Set();

3
menu.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __MENU_H
@ -121,6 +121,7 @@ private:
cTimeMs lastTime; cTimeMs lastTime;
int number; int number;
bool timeout; bool timeout;
int osdState;
const cPositioner *positioner; const cPositioner *positioner;
cChannel *channel; cChannel *channel;
const cEvent *lastPresent; const cEvent *lastPresent;

13
osd.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "osd.h"
@ -1978,6 +1978,7 @@ int cOsdProvider::oldWidth = 0;
int cOsdProvider::oldHeight = 0; int cOsdProvider::oldHeight = 0;
double cOsdProvider::oldAspect = 1.0; double cOsdProvider::oldAspect = 1.0;
cImage *cOsdProvider::images[MAXOSDIMAGES] = { NULL }; cImage *cOsdProvider::images[MAXOSDIMAGES] = { NULL };
int cOsdProvider::osdState = 0;
cOsdProvider::cOsdProvider(void) cOsdProvider::cOsdProvider(void)
{ {
@ -2015,6 +2016,7 @@ void cOsdProvider::UpdateOsdSize(bool Force)
int Width; int Width;
int Height; int Height;
double Aspect; double Aspect;
cMutexLock MutexLock(&cOsd::mutex);
cDevice::PrimaryDevice()->GetOsdSize(Width, Height, Aspect); cDevice::PrimaryDevice()->GetOsdSize(Width, Height, Aspect);
if (Width != oldWidth || Height != oldHeight || !DoubleEqual(Aspect, oldAspect) || Force) { if (Width != oldWidth || Height != oldHeight || !DoubleEqual(Aspect, oldAspect) || Force) {
Setup.OSDLeft = int(round(Width * Setup.OSDLeftP)); Setup.OSDLeft = int(round(Width * Setup.OSDLeftP));
@ -2032,9 +2034,18 @@ void cOsdProvider::UpdateOsdSize(bool Force)
oldHeight = Height; oldHeight = Height;
oldAspect = Aspect; oldAspect = Aspect;
dsyslog("OSD size changed to %dx%d @ %g", Width, Height, 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) bool cOsdProvider::SupportsTrueColor(void)
{ {
if (osdProvider) { if (osdProvider) {

9
osd.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __OSD_H
@ -949,6 +949,7 @@ private:
static int oldHeight; static int oldHeight;
static double oldAspect; static double oldAspect;
static cImage *images[MAXOSDIMAGES]; static cImage *images[MAXOSDIMAGES];
static int osdState;
protected: protected:
virtual cOsd *CreateOsd(int Left, int Top, uint Level) = 0; virtual cOsd *CreateOsd(int Left, int Top, uint Level) = 0;
///< Returns a pointer to a newly created cOsd object, which will be located ///< 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, ///< font sizes accordingly. If Force is true, all settings are recalculated,
///< even if the video resolution hasn't changed since the last call to ///< even if the video resolution hasn't changed since the last call to
///< this function. ///< 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); static bool SupportsTrueColor(void);
///< Returns true if the current OSD provider is able to handle a true color OSD. ///< Returns true if the current OSD provider is able to handle a true color OSD.
static int StoreImage(const cImage &Image); static int StoreImage(const cImage &Image);