Skip to content

Commit

Permalink
new class for external services (service informations from other plug…
Browse files Browse the repository at this point in the history
…ins: defined for now: radiotext, lcr, femon); radiotext/lcr-hack no longer necessary because of ext. services; new tokens for ext. services; bug fixes (casting, uint64_t, update detection); patches for femon <= 1.7.7
  • Loading branch information
mrwastl committed Jun 18, 2010
1 parent 4f8e89f commit d8f8154
Show file tree
Hide file tree
Showing 13 changed files with 654 additions and 188 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@ ifdef HAVE_FREETYPE2
DEFINES += -DHAVE_FREETYPE2
endif

### If femon-plugin <= 1.7.7 is used and has already been patched (see README)
# DEFINES += -DGRAPHLCD_SERVICE_FEMON_VALID

### The object files (add further files here):

#OBJS = alias.o common.o display.o i18n.o menu.o plugin.o setup.o skinconfig.o state.o strfct.o
OBJS = alias.o common.o display.o menu.o plugin.o setup.o skinconfig.o state.o strfct.o
OBJS = alias.o common.o display.o menu.o plugin.o setup.o skinconfig.o state.o strfct.o service.o

### The main target:
TARGETS = libvdr-$(PLUGIN).so
Expand Down
111 changes: 66 additions & 45 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Written by Carsten Siebholz (c.siebholz AT t-online.de>
From 0.0.8 on maintained by Andreas 'powARman' Regel (andreas.regel AT powarman.de)
from 0.1.5 on maintained by Wolfgang Astleitner (mrwastl AT users.sourceforge.net) & Andreas 'randy' Weinberger (vdr AT smue.org)

Project's homepage: http://graphlcd.berlios.de/
Project's homepage: http://projects.vdr-developer.org/projects/show/graphlcd
before 0.1.5: http://graphlcd.berlios.de/
before 0.0.8: http://c.siebholz.bei.t-online.de/
GIT repo: http://projects.vdr-developer.org/projects/show/graphlcd

Expand Down Expand Up @@ -41,7 +42,9 @@ Installation and Configuration:
| | |
| | +-- fonts (contains *.fnt files)
| | |
. . +-- logos (contains *.glcd files)
| | +-- logos (contains *.glcd files)
| | |
. . +-- skins (contains skin files and definitions)
. .

5. If you are using VDR 1.3 or higher, you will have to recreate the
Expand All @@ -56,17 +59,22 @@ Installation and Configuration:
Possible options are:
-c CONFIG, --config=CONFIG file name and path of the configuration file
-d DISPLAY, --display=DISPLAY name of the display
-s SKIN, --skin=SKIN name of the skin


-c: Sets the file path and name of the driver library's config file.
If this parameter is not given the default '/etc/graphlcd.conf'
will be used.
-d: Sets the name of the section in the config file that specifies
the display used for the plugin's output. If this parameter is
not given, the first section will be used.
-s: Sets the name of the skin to be used.
If this parameter is not given, skin 'default' will be used.

Examples:
vdr -P 'graphlcd -c /video/graphlcd.conf -d ks0108'
vdr -P 'graphlcd -c /etc/graphlcd.conf'
vdr -P 'graphlcd -c /video/graphlcd.conf -d usb13700 -s bigskin'


Channel Logos
Expand Down Expand Up @@ -187,47 +195,60 @@ Scroll time interval:
(Possible values: 100 <= x <= 2000)


Changing Fonts:
---------------
It's very easy to change the fonts that are used by graphlcd.
The plugin uses 4 fonts:
- a large font, that is used for
the title of the current program and for
the title of the recording (during replay).
- a normal font, that is used for
the date/time bar,
the channel bar,
the starttime, endtime and the subtitle of the current program,
the times in the replay screen,
the title and the items in the menus,
the popup-messages and for
the text items like the content of a recording.
- a small font, that is only used for the text of the 4 colored buttons.
- a symbol font, that contains the symbols.

Because smaller displays should use smaller fonts, the displays will be
classified in 3 categories. Each category should have all 4 fonts.
The name of the font files depend on the category and on the font:
small displays ( vertical size < 64 ):
f_s_l.fnt : large font
f_s_n.fnt : normal font
f_s_s.fnt : small font
f_s_sym.fnt: symbols
medium displays ( vertical size 64..127 ):
f_m_l.fnt : large font
f_m_n.fnt : normal font
f_m_s.fnt : small font
f_m_sym.fnt: symbols
large displays ( vertical size >= 128 ):
f_l_l.fnt : large font
f_l_n.fnt : normal font
f_l_s.fnt : small font
f_l_sym.fnt: symbols

To change the fonts you only have to change the related symbolic link to
another font file.
If you use another already existing font or if you want to create a new
one by yourself does not matter. If you want to create a new one or if
you want to modify an existing font, look into /tools/crtfont in the
GraphLCD base package and read the README.

Patches
-------
femon:
versions <= 1.7.7 require a patch to be functionable with graphlcd.
if graphlcd-plugin detects a femon version <= 1.7.7 and this version has not yet been patched,
femon will ignored by graphlcd (problem: if graphlcd calls an unpatched femon, vdr will crash
when shutting or restarting). the bug has already been reported to the maintainer of femon and
will be fixed in 1.7.8.

note: $SOURCEDIR/VDR == source directory of vdr. replace accordingly.

for femon <= 1.2.x apply the following patch:
cd $SOURCEDIR/VDR/PLUGINS/src/femon
patch -p0 < $SOURCEDIR/VDR/PLUGINS/src/graphlcd/patches/femon-1.1.5_fixnullandsegfault_path.diff

for femon > 1.2.x and <= 1.7.7 apply the following patch:
cd $SOURCEDIR/VDR/PLUGINS/src/femon
patch -p0 < $SOURCEDIR/VDR/PLUGINS/src/graphlcd/patches/femon-1.7.7_fixsegfault_patch.diff

or, if you don't want to apply a patch or the patch fails with your version of femon,
replace the entire function

bool cPluginFemon::Service(const char *Id, void *Data)
{
....
}

with the following one (should be valid for all femon versions >= 1.1.x):

bool cPluginFemon::Service(const char *Id, void *Data)
{
if (strcmp(Id,"FemonService-v1.0") == 0) {
if (Data) {
FemonService_v1_0 *data = (FemonService_v1_0*)Data;
if (! cDevice::ActualDevice() )
return false;

int ndx = cDevice::ActualDevice()->CardIndex();
data->fe_name = getFrontendName(ndx);
data->fe_status = getFrontendStatus(ndx);
data->fe_snr = getSNR(ndx);
data->fe_signal = getSignal(ndx);
data->fe_ber = getBER(ndx);
data->fe_unc = getUNC(ndx);
data->video_bitrate = cFemonOsd::Instance() ? cFemonOsd::Instance()->GetVideoBitrate() : 0.0;
data->audio_bitrate = cFemonOsd::Instance() ? cFemonOsd::Instance()->GetAudioBitrate() : 0.0;
data->dolby_bitrate = cFemonOsd::Instance() ? cFemonOsd::Instance()->GetDolbyBitrate() : 0.0;
}
return true;
}

return false;
}


after applying this patch uncomment DEFINES += -DGRAPHLCD_SERVICE_FEMON_VALID in the Makefile.
4 changes: 2 additions & 2 deletions common.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ GLCD::cType DurationType(int Index, const std::string &Format)
enum { normal, format } state = normal;
int n = 0;
#if VDRVERSNUM >= 10701
int f = (Index % DEFAULTFRAMESPERSECOND) + 1;
int s = (Index / DEFAULTFRAMESPERSECOND);
int f = (Index % (int)DEFAULTFRAMESPERSECOND) + 1;
int s = (Index / (int)DEFAULTFRAMESPERSECOND);
#else
int f = (Index % FRAMESPERSEC) + 1;
int s = (Index / FRAMESPERSEC);
Expand Down
26 changes: 21 additions & 5 deletions display.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ cGraphLCDDisplay::cGraphLCDDisplay()
nCurrentBrightness = -1;
LastTimeBrightness = 0;
bBrightnessActive = true;

mService = NULL; /* cannot be initialised here (mGraphLCDState not yet available) */
}

cGraphLCDDisplay::~cGraphLCDDisplay()
Expand All @@ -59,6 +61,8 @@ cGraphLCDDisplay::~cGraphLCDDisplay()
delete mSkinConfig;
delete mScreen;
delete mGraphLCDState;

delete mService;
}

bool cGraphLCDDisplay::Initialise(GLCD::cDriver * Lcd, const std::string & CfgPath, const std::string & SkinsPath, const std::string & SkinName)
Expand All @@ -73,6 +77,9 @@ bool cGraphLCDDisplay::Initialise(GLCD::cDriver * Lcd, const std::string & CfgPa
if (!mGraphLCDState)
return false;

// must be initialised before cGraphLCDSkinConfig (else: seg fault)
mService = new cGraphLCDService(mGraphLCDState);

skinsPath = SkinsPath;
if (skinsPath == "")
skinsPath = CfgPath + "/skins";
Expand Down Expand Up @@ -191,19 +198,28 @@ void cGraphLCDDisplay::Action(void)
mUpdate = true;
}


bool bActive = bBrightnessActive
|| (mState != StateNormal)
|| (GraphLCDSetup.ShowVolume && mShowVolume)
|| (GraphLCDSetup.ShowMessages && mGraphLCDState->ShowMessage())
|| (GraphLCDSetup.BrightnessDelay == 900);

// update display if BrightnessDelay is exceeded
if ((nCurrentBrightness == GraphLCDSetup.BrightnessActive) &&
((cTimeMs::Now() - LastTimeBrightness) > (uint64_t) (GraphLCDSetup.BrightnessDelay*1000)))
if (bActive && (nCurrentBrightness == GraphLCDSetup.BrightnessActive) &&
((int)((cTimeMs::Now() - LastTimeBrightness)) > (GraphLCDSetup.BrightnessDelay*1000)))
{
mUpdate = true;
}

// external service changed (check each second)
if ( (currTimeMs/1000 != mLastTimeMs/1000) && mGraphLCDState->CheckServiceEventUpdate())

// external service changed (check each 1/10th second)
if ( (currTimeMs/100 != mLastTimeMs/100) && mService->NeedsUpdate(currTimeMs))
{
mUpdate = true;
}


if (mUpdate)
{
mUpdateAt = 0;
Expand Down Expand Up @@ -353,7 +369,7 @@ void cGraphLCDDisplay::SetBrightness()
else
{
if (GraphLCDSetup.BrightnessDelay < 1
|| ((cTimeMs::Now() - LastTimeBrightness) > (uint64_t) (GraphLCDSetup.BrightnessDelay*1000)))
|| ((int)(cTimeMs::Now() - LastTimeBrightness) > (GraphLCDSetup.BrightnessDelay*1000)))
{
mLcd->SetBrightness(GraphLCDSetup.BrightnessIdle);
nCurrentBrightness = GraphLCDSetup.BrightnessIdle;
Expand Down
7 changes: 6 additions & 1 deletion display.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include "state.h"
#include "skinconfig.h"

#include "service.h"

#include <vdr/thread.h>


Expand Down Expand Up @@ -56,6 +58,7 @@ class cGraphLCDDisplay : public cThread

void ForceUpdateBrightness();

const cGraphLCDService * GetServiceObject() const { return mService; }
protected:
virtual void Action();

Expand All @@ -79,11 +82,13 @@ class cGraphLCDDisplay : public cThread

void UpdateIn(uint64_t msec);

/** set brightness depending on user activity */
/* set brightness depending on user activity */
void SetBrightness();
uint64_t LastTimeBrightness;
int nCurrentBrightness;
bool bBrightnessActive;
/* external services */
cGraphLCDService * mService;
};

#endif
38 changes: 38 additions & 0 deletions patches/femon-1.1.5_fixnullandsegfault_path.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
--- femon.c_orig 2008-01-20 03:20:00.000000000 +0100
+++ femon.c 2010-06-05 01:30:33.000000000 +0200
@@ -134,18 +134,23 @@

bool cPluginFemon::Service(const char *Id, void *Data)
{
- if ((strcmp(Id,"FemonService-v1.0") == 0) && Data) {
- FemonService_v1_0 *data = (FemonService_v1_0*)Data;
- int ndx = cDevice::ActualDevice()->CardIndex();
- data->fe_name = getFrontendName(ndx);
- data->fe_status = getFrontendStatus(ndx);
- data->fe_snr = getSNR(ndx);
- data->fe_signal = getSignal(ndx);
- data->fe_ber = getBER(ndx);
- data->fe_unc = getUNC(ndx);
- data->video_bitrate = cFemonOsd::Instance() ? cFemonOsd::Instance()->GetVideoBitrate() : 0.0;
- data->audio_bitrate = cFemonOsd::Instance() ? cFemonOsd::Instance()->GetAudioBitrate() : 0.0;
- data->dolby_bitrate = cFemonOsd::Instance() ? cFemonOsd::Instance()->GetDolbyBitrate() : 0.0;
+ if (strcmp(Id,"FemonService-v1.0") == 0) {
+ if (Data) {
+ FemonService_v1_0 *data = (FemonService_v1_0*)Data;
+ if (! cDevice::ActualDevice() )
+ return false;
+
+ int ndx = cDevice::ActualDevice()->CardIndex();
+ data->fe_name = getFrontendName(ndx);
+ data->fe_status = getFrontendStatus(ndx);
+ data->fe_snr = getSNR(ndx);
+ data->fe_signal = getSignal(ndx);
+ data->fe_ber = getBER(ndx);
+ data->fe_unc = getUNC(ndx);
+ data->video_bitrate = cFemonOsd::Instance() ? cFemonOsd::Instance()->GetVideoBitrate() : 0.0;
+ data->audio_bitrate = cFemonOsd::Instance() ? cFemonOsd::Instance()->GetAudioBitrate() : 0.0;
+ data->dolby_bitrate = cFemonOsd::Instance() ? cFemonOsd::Instance()->GetDolbyBitrate() : 0.0;
+ }
return true;
}

11 changes: 11 additions & 0 deletions patches/femon-1.7.7_fixsegfault_patch.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- femon.c_orig 2010-06-05 01:34:59.000000000 +0200
+++ femon.c 2010-06-05 01:35:23.000000000 +0200
@@ -133,6 +133,8 @@
if (strcmp(Id,"FemonService-v1.0") == 0) {
if (Data) {
FemonService_v1_0 *data = (FemonService_v1_0*)Data;
+ if (! cDevice::ActualDevice() )
+ return false;
int ndx = cDevice::ActualDevice()->CardIndex();
data->fe_name = getFrontendName(ndx);
data->fe_status = getFrontendStatus(ndx);
Loading

0 comments on commit d8f8154

Please sign in to comment.