2004-02-15 03:20:00 +01:00
|
|
|
/*
|
2015-03-07 21:32:58 +01:00
|
|
|
* osd.c: Frontend Status Monitor plugin for the Video Disk Recorder
|
2004-02-15 03:20:00 +01:00
|
|
|
*
|
|
|
|
* See the README file for copyright information and how to reach the author.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2009-09-16 11:05:15 +02:00
|
|
|
#ifndef __STDC_FORMAT_MACROS
|
2011-06-15 16:50:03 +02:00
|
|
|
#define __STDC_FORMAT_MACROS
|
2009-09-16 11:05:15 +02:00
|
|
|
#endif
|
|
|
|
|
2004-03-03 03:20:00 +01:00
|
|
|
#include <ctype.h>
|
2009-07-08 22:14:19 +02:00
|
|
|
#include <math.h>
|
2015-03-07 21:09:18 +01:00
|
|
|
|
2015-03-07 21:32:58 +01:00
|
|
|
#include "config.h"
|
2012-04-01 21:39:33 +02:00
|
|
|
#include "iptvservice.h"
|
2015-03-07 21:09:18 +01:00
|
|
|
#include "log.h"
|
2015-03-07 21:32:58 +01:00
|
|
|
#include "receiver.h"
|
|
|
|
#include "symbol.h"
|
|
|
|
#include "tools.h"
|
|
|
|
#include "osd.h"
|
2004-02-15 03:20:00 +01:00
|
|
|
|
2005-02-24 03:20:00 +01:00
|
|
|
#define CHANNELINPUT_TIMEOUT 1000
|
2008-11-09 12:43:27 +01:00
|
|
|
#define SVDRPPLUGIN "svdrpservice"
|
2004-03-03 03:20:00 +01:00
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
#define OSDWIDTH osdWidthM // in pixels
|
|
|
|
#define OSDHEIGHT osdHeightM // in pixels
|
|
|
|
#define OSDROWHEIGHT fontM->Height() // in pixels
|
2014-03-16 16:04:28 +01:00
|
|
|
#define OSDINFOHEIGHT (OSDROWHEIGHT * 14) // in pixels (14 rows)
|
2005-02-24 03:20:00 +01:00
|
|
|
#define OSDSTATUSHEIGHT (OSDROWHEIGHT * 6) // in pixels (6 rows)
|
2011-04-20 16:41:17 +02:00
|
|
|
#define OSDSYMBOL(id) femonSymbols.Get(id)
|
|
|
|
#define OSDSPACING femonSymbols.GetSpacing()
|
|
|
|
#define OSDROUNDING femonSymbols.GetRounding()
|
2015-03-07 20:37:46 +01:00
|
|
|
#define IS_OSDROUNDING (FemonConfig.GetSkin() == eFemonSkinElchi)
|
2009-09-22 07:44:30 +02:00
|
|
|
#define IS_OSDRESOLUTION(r1, r2) (abs(r1 - r2) < 20)
|
2015-03-07 20:37:46 +01:00
|
|
|
#define OSDINFOWIN_Y(offset) (FemonConfig.GetPosition() ? (OSDHEIGHT - OSDINFOHEIGHT + offset) : offset)
|
2009-07-08 22:14:19 +02:00
|
|
|
#define OSDINFOWIN_X(col) ((col == 4) ? int(round(OSDWIDTH * 0.76)) : \
|
|
|
|
(col == 3) ? int(round(OSDWIDTH * 0.51)) : \
|
|
|
|
(col == 2) ? int(round(OSDWIDTH * 0.26)) : \
|
|
|
|
int(round(OSDWIDTH * 0.025)))
|
2015-03-07 20:37:46 +01:00
|
|
|
#define OSDSTATUSWIN_Y(offset) (FemonConfig.GetPosition() ? offset : (OSDHEIGHT - OSDSTATUSHEIGHT + offset))
|
2009-07-08 22:14:19 +02:00
|
|
|
#define OSDSTATUSWIN_X(col) ((col == 7) ? int(round(OSDWIDTH * 0.79)) : \
|
|
|
|
(col == 6) ? int(round(OSDWIDTH * 0.68)) : \
|
|
|
|
(col == 5) ? int(round(OSDWIDTH * 0.46)) : \
|
|
|
|
(col == 4) ? int(round(OSDWIDTH * 0.37)) : \
|
|
|
|
(col == 3) ? int(round(OSDWIDTH * 0.21)) : \
|
|
|
|
(col == 2) ? int(round(OSDWIDTH * 0.12)) : \
|
|
|
|
int(round(OSDWIDTH * 0.025)))
|
2005-02-24 03:20:00 +01:00
|
|
|
#define OSDSTATUSWIN_XSYMBOL(c,w) (c * ((OSDWIDTH - (5 * w)) / 6) + ((c - 1) * w))
|
|
|
|
#define OSDBARWIDTH(x) (OSDWIDTH * x / 100)
|
2004-02-15 03:20:00 +01:00
|
|
|
|
2008-11-09 12:43:27 +01:00
|
|
|
#define OSDDRAWSTATUSBM(spacing) \
|
|
|
|
if (bm) { \
|
|
|
|
x -= bm->Width() + spacing; \
|
|
|
|
y = (OSDROWHEIGHT - bm->Height()) / 2; \
|
|
|
|
if (y < 0) y = 0; \
|
2015-03-07 20:37:46 +01:00
|
|
|
osdM->DrawBitmap(x, OSDSTATUSWIN_Y(offset) + y, *bm, FemonTheme[FemonConfig.GetTheme()].clrTitleText, FemonTheme[FemonConfig.GetTheme()].clrTitleBackground); \
|
2008-11-09 12:43:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define OSDDRAWSTATUSFRONTEND(column, bitmap, status) \
|
2015-03-07 20:37:46 +01:00
|
|
|
osdM->DrawBitmap(OSDSTATUSWIN_XSYMBOL(column, x), OSDSTATUSWIN_Y(offset) + y, bitmap, (frontendStatusM & status) ? FemonTheme[FemonConfig.GetTheme()].clrActiveText : FemonTheme[FemonConfig.GetTheme()].clrRed, FemonTheme[FemonConfig.GetTheme()].clrBackground)
|
2008-11-09 12:43:27 +01:00
|
|
|
|
|
|
|
#define OSDDRAWSTATUSVALUES(label1, label2, label3, label4, label5, label6, label7) \
|
2015-03-07 20:37:46 +01:00
|
|
|
osdM->DrawText(OSDSTATUSWIN_X(1), OSDSTATUSWIN_Y(offset), label1, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
|
|
|
osdM->DrawText(OSDSTATUSWIN_X(2), OSDSTATUSWIN_Y(offset), label2, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
|
|
|
osdM->DrawText(OSDSTATUSWIN_X(3), OSDSTATUSWIN_Y(offset), label3, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
|
|
|
osdM->DrawText(OSDSTATUSWIN_X(4), OSDSTATUSWIN_Y(offset), label4, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
|
|
|
osdM->DrawText(OSDSTATUSWIN_X(5), OSDSTATUSWIN_Y(offset), label5, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
|
|
|
osdM->DrawText(OSDSTATUSWIN_X(6), OSDSTATUSWIN_Y(offset), label6, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
|
|
|
osdM->DrawText(OSDSTATUSWIN_X(7), OSDSTATUSWIN_Y(offset), label7, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM)
|
2008-11-09 12:43:27 +01:00
|
|
|
|
|
|
|
#define OSDDRAWSTATUSBAR(value) \
|
|
|
|
if (value > 0) { \
|
2009-09-22 07:44:30 +02:00
|
|
|
int barvalue = OSDBARWIDTH(value); \
|
2015-03-07 20:37:46 +01:00
|
|
|
osdM->DrawRectangle(0, OSDSTATUSWIN_Y(offset) + 3, min(OSDBARWIDTH(FemonConfig.GetRedLimit()), barvalue), OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, FemonTheme[FemonConfig.GetTheme()].clrRed); \
|
|
|
|
if (barvalue > OSDBARWIDTH(FemonConfig.GetRedLimit())) \
|
|
|
|
osdM->DrawRectangle(OSDBARWIDTH(FemonConfig.GetRedLimit()), OSDSTATUSWIN_Y(offset) + 3, min((OSDWIDTH * FemonConfig.GetGreenLimit() / 100), barvalue), OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, FemonTheme[FemonConfig.GetTheme()].clrYellow); \
|
|
|
|
if (barvalue > OSDBARWIDTH(FemonConfig.GetGreenLimit())) \
|
|
|
|
osdM->DrawRectangle(OSDBARWIDTH(FemonConfig.GetGreenLimit()), OSDSTATUSWIN_Y(offset) + 3, barvalue, OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, FemonTheme[FemonConfig.GetTheme()].clrGreen); \
|
2008-11-09 12:43:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define OSDDRAWSTATUSTITLEBAR(title) \
|
2015-03-07 20:37:46 +01:00
|
|
|
osdM->DrawRectangle(0, OSDSTATUSWIN_Y(offset), OSDWIDTH, OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 1, FemonTheme[FemonConfig.GetTheme()].clrTitleBackground); \
|
|
|
|
osdM->DrawText(OSDSTATUSWIN_X(1), OSDSTATUSWIN_Y(offset), title, FemonTheme[FemonConfig.GetTheme()].clrTitleText, FemonTheme[FemonConfig.GetTheme()].clrTitleBackground, fontM); \
|
2008-11-22 22:12:39 +01:00
|
|
|
if (IS_OSDROUNDING) { \
|
2015-03-07 17:22:02 +01:00
|
|
|
osdM->DrawEllipse(0, OSDSTATUSWIN_Y(0), OSDROUNDING, OSDSTATUSWIN_Y(OSDROUNDING), clrTransparent, -2); \
|
|
|
|
osdM->DrawEllipse(OSDWIDTH - OSDROUNDING, OSDSTATUSWIN_Y(0), OSDWIDTH, OSDSTATUSWIN_Y(OSDROUNDING), clrTransparent, -1); \
|
2008-11-23 03:45:20 +01:00
|
|
|
} \
|
2015-03-07 20:37:46 +01:00
|
|
|
osdM->DrawRectangle(0, OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT, OSDWIDTH, OSDSTATUSWIN_Y(offset) + OSDSTATUSHEIGHT - 1, FemonTheme[FemonConfig.GetTheme()].clrBackground)
|
2008-11-09 12:43:27 +01:00
|
|
|
|
|
|
|
#define OSDDRAWSTATUSBOTTOMBAR() \
|
2008-11-22 22:12:39 +01:00
|
|
|
if (IS_OSDROUNDING) { \
|
2015-03-07 17:22:02 +01:00
|
|
|
osdM->DrawEllipse(0, OSDSTATUSWIN_Y(OSDSTATUSHEIGHT) - OSDROUNDING, OSDROUNDING, OSDSTATUSWIN_Y(OSDSTATUSHEIGHT), clrTransparent, -3); \
|
|
|
|
osdM->DrawEllipse(OSDWIDTH - OSDROUNDING, OSDSTATUSWIN_Y(OSDSTATUSHEIGHT) - OSDROUNDING, OSDWIDTH, OSDSTATUSWIN_Y(OSDSTATUSHEIGHT), clrTransparent, -4); \
|
2008-11-09 12:43:27 +01:00
|
|
|
}
|
|
|
|
|
2008-11-23 03:45:20 +01:00
|
|
|
#define OSDCLEARSTATUS() \
|
2015-03-07 17:22:02 +01:00
|
|
|
osdM->DrawRectangle(0, OSDSTATUSWIN_Y(0), OSDWIDTH, OSDSTATUSWIN_Y(OSDSTATUSHEIGHT) - 1, clrTransparent)
|
2008-11-23 03:45:20 +01:00
|
|
|
|
2008-11-09 12:43:27 +01:00
|
|
|
#define OSDDRAWINFOLEFT(label, value) \
|
2015-03-07 20:37:46 +01:00
|
|
|
osdM->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), label, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
|
|
|
osdM->DrawText(OSDINFOWIN_X(2), OSDINFOWIN_Y(offset), value, FemonTheme[FemonConfig.GetTheme()].clrActiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM)
|
2008-11-09 12:43:27 +01:00
|
|
|
|
|
|
|
#define OSDDRAWINFORIGHT(label, value) \
|
2015-03-07 20:37:46 +01:00
|
|
|
osdM->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), label, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
|
|
|
osdM->DrawText(OSDINFOWIN_X(4), OSDINFOWIN_Y(offset), value, FemonTheme[FemonConfig.GetTheme()].clrActiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM)
|
2006-09-17 03:20:00 +02:00
|
|
|
|
2008-11-09 12:43:27 +01:00
|
|
|
#define OSDDRAWINFOACTIVE(label, value) \
|
2015-03-07 20:37:46 +01:00
|
|
|
osdM->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), label, FemonTheme[FemonConfig.GetTheme()].clrActiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
|
|
|
osdM->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), value, FemonTheme[FemonConfig.GetTheme()].clrActiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM)
|
2008-11-09 12:43:27 +01:00
|
|
|
|
|
|
|
#define OSDDRAWINFOINACTIVE(label, value) \
|
2015-03-07 20:37:46 +01:00
|
|
|
osdM->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), label, FemonTheme[FemonConfig.GetTheme()].clrInactiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM); \
|
|
|
|
osdM->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), value, FemonTheme[FemonConfig.GetTheme()].clrActiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM)
|
2008-11-09 12:43:27 +01:00
|
|
|
|
|
|
|
#define OSDDRAWINFOLINE(label) \
|
2015-03-07 20:37:46 +01:00
|
|
|
osdM->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), label, FemonTheme[FemonConfig.GetTheme()].clrActiveText, FemonTheme[FemonConfig.GetTheme()].clrBackground, fontM)
|
2008-11-09 12:43:27 +01:00
|
|
|
|
|
|
|
#define OSDDRAWINFOTITLEBAR(title) \
|
2015-03-07 20:37:46 +01:00
|
|
|
osdM->DrawRectangle(0, OSDINFOWIN_Y(offset), OSDWIDTH, OSDINFOWIN_Y(offset) + OSDROWHEIGHT - 1, FemonTheme[FemonConfig.GetTheme()].clrTitleBackground); \
|
|
|
|
osdM->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), title, FemonTheme[FemonConfig.GetTheme()].clrTitleText, FemonTheme[FemonConfig.GetTheme()].clrTitleBackground, fontM); \
|
2008-11-22 22:12:39 +01:00
|
|
|
if (IS_OSDROUNDING) { \
|
2015-03-07 17:22:02 +01:00
|
|
|
osdM->DrawEllipse(0, OSDINFOWIN_Y(0), OSDROUNDING, OSDINFOWIN_Y(OSDROUNDING), clrTransparent, -2); \
|
|
|
|
osdM->DrawEllipse(OSDWIDTH - OSDROUNDING, OSDINFOWIN_Y(0), OSDWIDTH, OSDINFOWIN_Y(OSDROUNDING), clrTransparent, -1); \
|
2008-11-23 03:45:20 +01:00
|
|
|
} \
|
2015-03-07 20:37:46 +01:00
|
|
|
osdM->DrawRectangle(0, OSDINFOWIN_Y(offset) + OSDROWHEIGHT, OSDWIDTH, OSDINFOWIN_Y(offset) + OSDINFOHEIGHT - 1, FemonTheme[FemonConfig.GetTheme()].clrBackground)
|
2008-11-09 12:43:27 +01:00
|
|
|
|
|
|
|
#define OSDDRAWINFOBOTTOMBAR() \
|
2008-11-22 22:12:39 +01:00
|
|
|
if (IS_OSDROUNDING) { \
|
2015-03-07 17:22:02 +01:00
|
|
|
osdM->DrawEllipse(0, OSDINFOWIN_Y(OSDINFOHEIGHT) - OSDROUNDING, OSDROUNDING, OSDINFOWIN_Y(OSDINFOHEIGHT), clrTransparent, -3); \
|
|
|
|
osdM->DrawEllipse((OSDWIDTH - OSDROUNDING), OSDINFOWIN_Y(OSDINFOHEIGHT) - OSDROUNDING, OSDWIDTH, OSDINFOWIN_Y(OSDINFOHEIGHT), clrTransparent, -4); \
|
2008-11-09 12:43:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define OSDCLEARINFO() \
|
2015-03-07 17:22:02 +01:00
|
|
|
osdM->DrawRectangle(0, OSDINFOWIN_Y(0), OSDWIDTH, OSDINFOWIN_Y(OSDINFOHEIGHT) - 1, clrTransparent)
|
2004-06-06 03:20:00 +02:00
|
|
|
|
2009-06-18 22:08:25 +02:00
|
|
|
#ifndef MINFONTSIZE
|
|
|
|
#define MINFONTSIZE 10
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MAXFONTSIZE
|
|
|
|
#define MAXFONTSIZE 64
|
|
|
|
#endif
|
|
|
|
|
2009-06-18 11:16:11 +02:00
|
|
|
class cFemonDummyFont : public cFont {
|
|
|
|
public:
|
2017-01-05 14:39:52 +01:00
|
|
|
virtual int Width(void) const { return 10; }
|
2015-03-07 17:22:02 +01:00
|
|
|
virtual int Width(uint cP) const { return 10; }
|
|
|
|
virtual int Width(const char *sP) const { return 50; }
|
2009-06-18 11:16:11 +02:00
|
|
|
virtual int Height(void) const { return 20; }
|
2015-03-07 17:22:02 +01:00
|
|
|
virtual void DrawText(cBitmap *bitmapP, int xP, int yP, const char *sP, tColor colorFgP, tColor colorBgP, int widthP) const {}
|
|
|
|
virtual void DrawText(cPixmap *pixmapP, int xP, int yP, const char *sP, tColor colorFgP, tColor colorBgP, int widthP) const {}
|
2009-06-18 11:16:11 +02:00
|
|
|
};
|
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
cFemonOsd *cFemonOsd::pInstanceS = NULL;
|
2005-11-13 03:20:00 +01:00
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
cFemonOsd *cFemonOsd::Instance(bool createP)
|
2005-11-13 03:20:00 +01:00
|
|
|
{
|
2015-03-07 21:09:18 +01:00
|
|
|
debug1("%s (%d)", __PRETTY_FUNCTION__, createP);
|
2015-03-07 17:22:02 +01:00
|
|
|
if ((pInstanceS == NULL) && createP)
|
2005-11-13 03:20:00 +01:00
|
|
|
{
|
2015-03-07 17:22:02 +01:00
|
|
|
pInstanceS = new cFemonOsd();
|
2005-11-13 03:20:00 +01:00
|
|
|
}
|
2015-03-07 17:22:02 +01:00
|
|
|
return (pInstanceS);
|
2005-11-13 03:20:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
cFemonOsd::cFemonOsd()
|
2008-11-12 16:58:32 +01:00
|
|
|
: cOsdObject(true), cThread("femon osd"),
|
2015-03-07 17:22:02 +01:00
|
|
|
osdM(NULL),
|
|
|
|
receiverM(NULL),
|
|
|
|
frontendM(-1),
|
|
|
|
svdrpFrontendM(-1),
|
|
|
|
svdrpVideoBitRateM(-1),
|
|
|
|
svdrpAudioBitRateM(-1),
|
|
|
|
svdrpPluginM(NULL),
|
|
|
|
numberM(0),
|
|
|
|
oldNumberM(0),
|
|
|
|
qualityM(0),
|
|
|
|
qualityValidM(false),
|
|
|
|
strengthM(0),
|
|
|
|
strengthValidM(false),
|
|
|
|
snrM(0),
|
|
|
|
snrValidM(false),
|
|
|
|
signalM(0),
|
|
|
|
signalValidM(false),
|
|
|
|
berM(0),
|
|
|
|
berValidM(false),
|
|
|
|
uncM(0),
|
|
|
|
uncValidM(false),
|
|
|
|
frontendNameM(""),
|
|
|
|
frontendStatusValidM(false),
|
|
|
|
deviceSourceM(DEVICESOURCE_DVBAPI),
|
2015-03-07 20:37:46 +01:00
|
|
|
displayModeM(FemonConfig.GetDisplayMode()),
|
|
|
|
osdWidthM(cOsd::OsdWidth() * (100 - FemonConfig.GetDownscale()) / 100),
|
|
|
|
osdHeightM(cOsd::OsdHeight() * (100 - FemonConfig.GetDownscale()) / 100),
|
|
|
|
osdLeftM(cOsd::OsdLeft() + (cOsd::OsdWidth() * FemonConfig.GetDownscale() / 200)),
|
|
|
|
osdTopM(cOsd::OsdTop() + (cOsd::OsdHeight() * FemonConfig.GetDownscale() / 200)),
|
2015-03-07 17:22:02 +01:00
|
|
|
inputTimeM(0),
|
|
|
|
sleepM(),
|
|
|
|
mutexM()
|
2004-02-15 03:20:00 +01:00
|
|
|
{
|
2009-07-08 22:14:19 +02:00
|
|
|
int tmp;
|
2015-03-07 21:09:18 +01:00
|
|
|
debug1("%s", __PRETTY_FUNCTION__);
|
2015-03-07 17:22:02 +01:00
|
|
|
memset(&frontendStatusM, 0, sizeof(frontendStatusM));
|
|
|
|
memset(&frontendInfoM, 0, sizeof(frontendInfoM));
|
|
|
|
svdrpConnectionM.handle = -1;
|
2011-04-20 16:41:17 +02:00
|
|
|
femonSymbols.Refresh();
|
2015-03-07 17:22:02 +01:00
|
|
|
fontM = cFont::CreateFont(Setup.FontSml, constrain(Setup.FontSmlSize, MINFONTSIZE, MAXFONTSIZE));
|
|
|
|
if (!fontM || !fontM->Height()) {
|
|
|
|
fontM = new cFemonDummyFont;
|
2015-03-07 21:09:18 +01:00
|
|
|
error("%s Cannot create required font", __PRETTY_FUNCTION__);
|
2004-08-18 03:20:00 +02:00
|
|
|
}
|
2011-04-20 16:41:17 +02:00
|
|
|
tmp = 5 * OSDSYMBOL(SYMBOL_LOCK).Width() + 6 * OSDSPACING;
|
2009-07-08 22:14:19 +02:00
|
|
|
if (OSDWIDTH < tmp) {
|
2015-03-07 21:09:18 +01:00
|
|
|
error("%s OSD width (%d) smaller than required (%d).", __PRETTY_FUNCTION__, OSDWIDTH, tmp);
|
2009-07-08 22:14:19 +02:00
|
|
|
OSDWIDTH = tmp;
|
|
|
|
}
|
|
|
|
tmp = OSDINFOHEIGHT + OSDROWHEIGHT + OSDSTATUSHEIGHT;
|
|
|
|
if (OSDHEIGHT < tmp) {
|
2015-03-07 21:09:18 +01:00
|
|
|
error("%s OSD height (%d) smaller than required (%d).", __PRETTY_FUNCTION__, OSDHEIGHT, tmp);
|
2009-07-08 22:14:19 +02:00
|
|
|
OSDHEIGHT = tmp;
|
|
|
|
}
|
2004-02-15 03:20:00 +01:00
|
|
|
}
|
2004-03-03 03:20:00 +01:00
|
|
|
|
2004-02-15 03:20:00 +01:00
|
|
|
cFemonOsd::~cFemonOsd(void)
|
|
|
|
{
|
2015-03-07 21:09:18 +01:00
|
|
|
debug1("%s", __PRETTY_FUNCTION__);
|
2015-03-07 17:22:02 +01:00
|
|
|
sleepM.Signal();
|
2005-11-13 03:20:00 +01:00
|
|
|
if (Running())
|
2004-03-16 03:20:00 +01:00
|
|
|
Cancel(3);
|
2015-03-07 17:22:02 +01:00
|
|
|
if (svdrpConnectionM.handle >= 0) {
|
|
|
|
svdrpPluginM = cPluginManager::GetPlugin(SVDRPPLUGIN);
|
|
|
|
if (svdrpPluginM)
|
|
|
|
svdrpPluginM->Service("SvdrpConnection-v1.0", &svdrpConnectionM);
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
2015-03-07 17:22:02 +01:00
|
|
|
if (receiverM) {
|
|
|
|
receiverM->Deactivate();
|
|
|
|
DELETENULL(receiverM);
|
2008-11-23 21:26:48 +01:00
|
|
|
}
|
2015-03-07 17:22:02 +01:00
|
|
|
if (osdM)
|
|
|
|
DELETENULL(osdM);
|
|
|
|
if (fontM)
|
|
|
|
DELETENULL(fontM);
|
|
|
|
if (frontendM >= 0) {
|
|
|
|
close(frontendM);
|
|
|
|
frontendM = -1;
|
2009-01-06 22:10:02 +01:00
|
|
|
}
|
2015-03-07 17:22:02 +01:00
|
|
|
pInstanceS = NULL;
|
2004-02-15 03:20:00 +01:00
|
|
|
}
|
|
|
|
|
2004-03-03 03:20:00 +01:00
|
|
|
void cFemonOsd::DrawStatusWindow(void)
|
2004-02-15 03:20:00 +01:00
|
|
|
{
|
2015-03-07 17:22:02 +01:00
|
|
|
cMutexLock lock(&mutexM);
|
2015-09-19 16:01:01 +02:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
const cChannel *channel = Channels->GetByNumber(cDevice::CurrentChannel());
|
2004-02-15 03:20:00 +01:00
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
if (osdM && channel) {
|
2011-06-15 16:50:03 +02:00
|
|
|
cBitmap *bm = NULL;
|
|
|
|
int offset = 0;
|
|
|
|
int x = OSDWIDTH - OSDROUNDING;
|
|
|
|
int y = 0;
|
|
|
|
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
|
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWSTATUSTITLEBAR(*cString::sprintf("%d%s %s", numberM ? numberM : channel->Number(), numberM ? "-" : "", channel->ShortName(true)));
|
|
|
|
if (svdrpFrontendM >= 0) {
|
2011-04-20 16:41:17 +02:00
|
|
|
bm = &OSDSYMBOL(SYMBOL_SVDRP);
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWSTATUSBM(OSDSPACING);
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
2008-11-09 12:43:27 +01:00
|
|
|
switch (cDevice::ActualDevice()->CardIndex()) {
|
2011-04-20 16:41:17 +02:00
|
|
|
case 1: bm = &OSDSYMBOL(SYMBOL_ONE); break;
|
|
|
|
case 2: bm = &OSDSYMBOL(SYMBOL_TWO); break;
|
|
|
|
case 3: bm = &OSDSYMBOL(SYMBOL_THREE); break;
|
|
|
|
case 4: bm = &OSDSYMBOL(SYMBOL_FOUR); break;
|
|
|
|
case 5: bm = &OSDSYMBOL(SYMBOL_FIVE); break;
|
|
|
|
case 6: bm = &OSDSYMBOL(SYMBOL_SIX); break;
|
|
|
|
case 7: bm = &OSDSYMBOL(SYMBOL_SEVEN); break;
|
|
|
|
case 8: bm = &OSDSYMBOL(SYMBOL_EIGHT); break;
|
|
|
|
default: bm = &OSDSYMBOL(SYMBOL_ZERO); break;
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWSTATUSBM(OSDSPACING);
|
2011-04-20 16:41:17 +02:00
|
|
|
bm = &OSDSYMBOL(SYMBOL_DEVICE);
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWSTATUSBM(0);
|
2006-09-17 03:20:00 +02:00
|
|
|
if (IS_AUDIO_TRACK(track)) {
|
2008-11-09 12:43:27 +01:00
|
|
|
switch (int(track - ttAudioFirst)) {
|
2011-04-20 16:41:17 +02:00
|
|
|
case 1: bm = &OSDSYMBOL(SYMBOL_ONE); break;
|
|
|
|
case 2: bm = &OSDSYMBOL(SYMBOL_TWO); break;
|
|
|
|
case 3: bm = &OSDSYMBOL(SYMBOL_THREE); break;
|
|
|
|
case 4: bm = &OSDSYMBOL(SYMBOL_FOUR); break;
|
|
|
|
case 5: bm = &OSDSYMBOL(SYMBOL_FIVE); break;
|
|
|
|
case 6: bm = &OSDSYMBOL(SYMBOL_SIX); break;
|
|
|
|
case 7: bm = &OSDSYMBOL(SYMBOL_SEVEN); break;
|
|
|
|
case 8: bm = &OSDSYMBOL(SYMBOL_EIGHT); break;
|
|
|
|
default: bm = &OSDSYMBOL(SYMBOL_ZERO); break;
|
2004-06-06 03:20:00 +02:00
|
|
|
}
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWSTATUSBM(OSDSPACING);
|
2006-09-17 03:20:00 +02:00
|
|
|
switch (cDevice::PrimaryDevice()->GetAudioChannel()) {
|
2011-04-20 16:41:17 +02:00
|
|
|
case 1: bm = &OSDSYMBOL(SYMBOL_MONO_LEFT); break;
|
|
|
|
case 2: bm = &OSDSYMBOL(SYMBOL_MONO_RIGHT); break;
|
|
|
|
default: bm = &OSDSYMBOL(SYMBOL_STEREO); break;
|
2004-06-06 03:20:00 +02:00
|
|
|
}
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWSTATUSBM(0);
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
2015-03-07 17:22:02 +01:00
|
|
|
else if (receiverM && receiverM->AC3Valid() && IS_DOLBY_TRACK(track)) {
|
|
|
|
if (receiverM->AC3_5_1()) bm = &OSDSYMBOL(SYMBOL_DD51);
|
|
|
|
else if (receiverM->AC3_2_0()) bm = &OSDSYMBOL(SYMBOL_DD20);
|
2011-04-20 16:41:17 +02:00
|
|
|
else bm = &OSDSYMBOL(SYMBOL_DD);
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWSTATUSBM(OSDSPACING);
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
2015-03-07 17:22:02 +01:00
|
|
|
if (receiverM) {
|
|
|
|
if (IS_OSDRESOLUTION(receiverM->VideoVerticalSize(), 1080)) {
|
|
|
|
switch (receiverM->VideoScan()) {
|
2011-11-27 01:09:27 +01:00
|
|
|
case VIDEO_SCAN_INTERLACED: bm = &OSDSYMBOL(SYMBOL_FORMAT_1080i); break;
|
|
|
|
case VIDEO_SCAN_PROGRESSIVE: bm = &OSDSYMBOL(SYMBOL_FORMAT_1080p); break;
|
|
|
|
default: bm = &OSDSYMBOL(SYMBOL_FORMAT_1080); break;
|
|
|
|
}
|
|
|
|
}
|
2015-03-07 17:22:02 +01:00
|
|
|
else if (IS_OSDRESOLUTION(receiverM->VideoVerticalSize(), 720)) {
|
|
|
|
switch (receiverM->VideoScan()) {
|
2011-11-27 01:09:27 +01:00
|
|
|
case VIDEO_SCAN_INTERLACED: bm = &OSDSYMBOL(SYMBOL_FORMAT_720i); break;
|
|
|
|
case VIDEO_SCAN_PROGRESSIVE: bm = &OSDSYMBOL(SYMBOL_FORMAT_720p); break;
|
|
|
|
default: bm = &OSDSYMBOL(SYMBOL_FORMAT_720); break;
|
|
|
|
}
|
|
|
|
}
|
2015-03-07 17:22:02 +01:00
|
|
|
else if (IS_OSDRESOLUTION(receiverM->VideoVerticalSize(), 576)) {
|
|
|
|
switch (receiverM->VideoScan()) {
|
2011-11-27 01:09:27 +01:00
|
|
|
case VIDEO_SCAN_INTERLACED: bm = &OSDSYMBOL(SYMBOL_FORMAT_576i); break;
|
|
|
|
case VIDEO_SCAN_PROGRESSIVE: bm = &OSDSYMBOL(SYMBOL_FORMAT_576p); break;
|
|
|
|
default: bm = &OSDSYMBOL(SYMBOL_FORMAT_576); break;
|
|
|
|
}
|
|
|
|
}
|
2015-03-07 17:22:02 +01:00
|
|
|
else if (IS_OSDRESOLUTION(receiverM->VideoVerticalSize(), 480)) {
|
|
|
|
switch (receiverM->VideoScan()) {
|
2011-11-27 01:09:27 +01:00
|
|
|
case VIDEO_SCAN_INTERLACED: bm = &OSDSYMBOL(SYMBOL_FORMAT_480i); break;
|
|
|
|
case VIDEO_SCAN_PROGRESSIVE: bm = &OSDSYMBOL(SYMBOL_FORMAT_480p); break;
|
|
|
|
default: bm = &OSDSYMBOL(SYMBOL_FORMAT_480); break;
|
|
|
|
}
|
|
|
|
}
|
2009-09-03 17:15:04 +02:00
|
|
|
else
|
|
|
|
bm = NULL;
|
2009-09-02 14:58:30 +02:00
|
|
|
OSDDRAWSTATUSBM(OSDSPACING);
|
2015-03-07 17:22:02 +01:00
|
|
|
switch (receiverM->VideoCodec()) {
|
2011-04-20 16:41:17 +02:00
|
|
|
case VIDEO_CODEC_MPEG2: bm = &OSDSYMBOL(SYMBOL_MPEG2); break;
|
|
|
|
case VIDEO_CODEC_H264: bm = &OSDSYMBOL(SYMBOL_H264); break;
|
2017-01-05 16:55:53 +01:00
|
|
|
case VIDEO_CODEC_H265: bm = &OSDSYMBOL(SYMBOL_H265); break;
|
2011-04-20 16:41:17 +02:00
|
|
|
default: bm = NULL; break;
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWSTATUSBM(OSDSPACING);
|
2015-03-07 17:22:02 +01:00
|
|
|
switch (receiverM->VideoFormat()) {
|
2011-04-20 16:41:17 +02:00
|
|
|
case VIDEO_FORMAT_PAL: bm = &OSDSYMBOL(SYMBOL_PAL); break;
|
|
|
|
case VIDEO_FORMAT_NTSC: bm = &OSDSYMBOL(SYMBOL_NTSC); break;
|
|
|
|
default: bm = NULL; break;
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWSTATUSBM(OSDSPACING);
|
2015-03-07 17:22:02 +01:00
|
|
|
switch (receiverM->VideoAspectRatio()) {
|
2011-04-20 16:41:17 +02:00
|
|
|
case VIDEO_ASPECT_RATIO_1_1: bm = &OSDSYMBOL(SYMBOL_AR_1_1); break;
|
|
|
|
case VIDEO_ASPECT_RATIO_4_3: bm = &OSDSYMBOL(SYMBOL_AR_4_3); break;
|
|
|
|
case VIDEO_ASPECT_RATIO_16_9: bm = &OSDSYMBOL(SYMBOL_AR_16_9); break;
|
|
|
|
case VIDEO_ASPECT_RATIO_2_21_1: bm = &OSDSYMBOL(SYMBOL_AR_2_21_1); break;
|
|
|
|
default: bm = NULL; break;
|
2004-06-06 03:20:00 +02:00
|
|
|
}
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWSTATUSBM(OSDSPACING);
|
2004-06-06 03:20:00 +02:00
|
|
|
}
|
2008-11-09 13:35:12 +01:00
|
|
|
if (channel->Ca() > 0xFF) {
|
2011-04-20 16:41:17 +02:00
|
|
|
bm = &OSDSYMBOL(SYMBOL_ENCRYPTED);
|
2008-11-09 13:35:12 +01:00
|
|
|
OSDDRAWSTATUSBM(OSDSPACING);
|
|
|
|
}
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
if (strengthValidM)
|
|
|
|
OSDDRAWSTATUSBAR(strengthM);
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
if (qualityValidM)
|
|
|
|
OSDDRAWSTATUSBAR(qualityM);
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWSTATUSVALUES("STR:", signalValidM ? *cString::sprintf("%04x", signalM) : "", signalValidM ? *cString::sprintf("(%2d%%)", signalM / 655) : "",
|
|
|
|
"BER:", berValidM ? *cString::sprintf("%08x", berM) : "", *cString::sprintf("%s:", tr("Video")),
|
|
|
|
*getBitrateMbits(receiverM ? receiverM->VideoBitrate() : (svdrpFrontendM >= 0 ? svdrpVideoBitRateM : -1.0)));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWSTATUSVALUES("SNR:", snrValidM ? *cString::sprintf("%04x", snrM) : "", snrValidM ? *cString::sprintf("(%2d%%)", snrM / 655) : "",
|
|
|
|
"UNC:", uncValidM ? *cString::sprintf("%08x", uncM) : "",
|
|
|
|
*cString::sprintf("%s:", (receiverM && receiverM->AC3Valid() && IS_DOLBY_TRACK(track)) ? tr("AC-3") : tr("Audio")),
|
|
|
|
*getBitrateKbits(receiverM ? ((receiverM->AC3Valid() && IS_DOLBY_TRACK(track)) ? receiverM->AC3Bitrate() : receiverM->AudioBitrate()) : (svdrpFrontendM >= 0 ? svdrpAudioBitRateM : -1.0)));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2011-04-20 16:41:17 +02:00
|
|
|
x = OSDSYMBOL(SYMBOL_LOCK).Width();
|
|
|
|
y = (OSDROWHEIGHT - OSDSYMBOL(SYMBOL_LOCK).Height()) / 2;
|
2015-03-07 17:22:02 +01:00
|
|
|
if (frontendStatusValidM) {
|
2011-04-20 16:41:17 +02:00
|
|
|
OSDDRAWSTATUSFRONTEND(1, OSDSYMBOL(SYMBOL_LOCK), FE_HAS_LOCK);
|
|
|
|
OSDDRAWSTATUSFRONTEND(2, OSDSYMBOL(SYMBOL_SIGNAL), FE_HAS_SIGNAL);
|
|
|
|
OSDDRAWSTATUSFRONTEND(3, OSDSYMBOL(SYMBOL_CARRIER), FE_HAS_CARRIER);
|
|
|
|
OSDDRAWSTATUSFRONTEND(4, OSDSYMBOL(SYMBOL_VITERBI), FE_HAS_VITERBI);
|
|
|
|
OSDDRAWSTATUSFRONTEND(5, OSDSYMBOL(SYMBOL_SYNC), FE_HAS_SYNC);
|
2009-09-22 07:44:30 +02:00
|
|
|
}
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWSTATUSBOTTOMBAR();
|
2015-03-07 17:22:02 +01:00
|
|
|
osdM->Flush();
|
2004-03-03 03:20:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cFemonOsd::DrawInfoWindow(void)
|
|
|
|
{
|
2015-03-07 17:22:02 +01:00
|
|
|
cMutexLock lock(&mutexM);
|
2015-09-19 16:01:01 +02:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
const cChannel *channel = Channels->GetByNumber(cDevice::CurrentChannel());
|
2004-03-03 03:20:00 +01:00
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
if (osdM && channel) {
|
2011-06-15 16:50:03 +02:00
|
|
|
int offset = 0;
|
|
|
|
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
|
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
switch (displayModeM) {
|
2008-11-09 12:43:27 +01:00
|
|
|
case eFemonModeTransponder:
|
|
|
|
OSDDRAWINFOTITLEBAR(tr("Transponder Information"));
|
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOLEFT( trVDR("Vpid"), *cString::sprintf("%d", channel->Vpid()));
|
|
|
|
OSDDRAWINFORIGHT(trVDR("Ppid"), *cString::sprintf("%d", channel->Ppid()));
|
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOLEFT( tr("Apid"), *getApids(channel));
|
|
|
|
OSDDRAWINFORIGHT( tr("Dpid"), *getDpids(channel));
|
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOLEFT( tr("Spid"), *getSpids(channel));
|
|
|
|
OSDDRAWINFORIGHT(trVDR("Tpid"), *cString::sprintf("%d", channel->Tpid()));
|
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOLEFT( trVDR("Sid"), *cString::sprintf("%d", channel->Sid()));
|
|
|
|
OSDDRAWINFORIGHT( tr("Nid"), *cString::sprintf("%d", channel->Nid()));
|
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOLEFT( tr("Tid"), *cString::sprintf("%d", channel->Tid()));
|
|
|
|
OSDDRAWINFORIGHT( tr("Rid"), *cString::sprintf("%d", channel->Rid()));
|
|
|
|
offset += OSDROWHEIGHT;
|
2008-12-16 11:26:46 +01:00
|
|
|
OSDDRAWINFOLEFT( trVDR("CA"), *getCAids(channel));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2008-12-13 21:25:26 +01:00
|
|
|
switch (channel->Source() & cSource::st_Mask) {
|
2012-03-29 22:31:44 +02:00
|
|
|
case cSource::stSat: {
|
|
|
|
cDvbTransponderParameters dtp(channel->Parameters());
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOLINE(*cString::sprintf("%s #%d - %s", *getSatelliteSystem(dtp.System()), (svdrpFrontendM >= 0) ? svdrpFrontendM : cDevice::ActualDevice()->CardIndex(), *frontendNameM));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOLEFT( trVDR("Frequency"), *getFrequencyMHz(channel->Frequency()));
|
|
|
|
OSDDRAWINFORIGHT(trVDR("Source"), *cSource::ToString(channel->Source()));
|
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOLEFT( trVDR("Srate"), *cString::sprintf("%d", channel->Srate()));
|
2010-02-28 20:42:06 +01:00
|
|
|
OSDDRAWINFORIGHT(trVDR("Polarization"), *cString::sprintf("%c", toupper(dtp.Polarization())));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2010-02-28 20:42:06 +01:00
|
|
|
OSDDRAWINFOLEFT( trVDR("Inversion"), *getInversion(dtp.Inversion()));
|
|
|
|
OSDDRAWINFORIGHT(trVDR("CoderateH"), *getCoderate(dtp.CoderateH()));
|
2008-12-16 11:26:46 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2012-01-15 22:07:53 +01:00
|
|
|
OSDDRAWINFOLEFT( trVDR("System"), *getSatelliteSystem(dtp.System()));
|
2013-03-10 19:12:17 +01:00
|
|
|
if (dtp.System()) {
|
|
|
|
OSDDRAWINFORIGHT(trVDR("RollOff"), *getRollOff(dtp.RollOff()));
|
2014-03-16 16:04:28 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOLEFT( trVDR("Pilot"), *getPilot(dtp.Pilot()));
|
2013-03-10 19:12:17 +01:00
|
|
|
}
|
2012-03-29 22:31:44 +02:00
|
|
|
}
|
2008-11-09 12:43:27 +01:00
|
|
|
break;
|
|
|
|
|
2012-03-29 22:31:44 +02:00
|
|
|
case cSource::stCable: {
|
|
|
|
cDvbTransponderParameters dtp(channel->Parameters());
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOLINE(*cString::sprintf("DVB-C #%d - %s", (svdrpFrontendM >= 0) ? svdrpFrontendM : cDevice::ActualDevice()->CardIndex(), *frontendNameM));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOLEFT( trVDR("Frequency"), *getFrequencyMHz(channel->Frequency()));
|
|
|
|
OSDDRAWINFORIGHT(trVDR("Source"), *cSource::ToString(channel->Source()));
|
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOLEFT( trVDR("Srate"), *cString::sprintf("%d", channel->Srate()));
|
2010-02-28 20:42:06 +01:00
|
|
|
OSDDRAWINFORIGHT(trVDR("Modulation"), *getModulation(dtp.Modulation()));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2010-02-28 20:42:06 +01:00
|
|
|
OSDDRAWINFOLEFT( trVDR("Inversion"), *getInversion(dtp.Inversion()));
|
|
|
|
OSDDRAWINFORIGHT(trVDR("CoderateH"), *getCoderate(dtp.CoderateH()));
|
2012-03-29 22:31:44 +02:00
|
|
|
}
|
2008-11-09 12:43:27 +01:00
|
|
|
break;
|
|
|
|
|
2012-03-29 22:31:44 +02:00
|
|
|
case cSource::stTerr: {
|
|
|
|
cDvbTransponderParameters dtp(channel->Parameters());
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOLINE(*cString::sprintf("%s #%d - %s", *getTerrestrialSystem(dtp.System()), (svdrpFrontendM >= 0) ? svdrpFrontendM : cDevice::ActualDevice()->CardIndex(), *frontendNameM));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOLEFT( trVDR("Frequency"), *getFrequencyMHz(channel->Frequency()));
|
2010-02-28 20:42:06 +01:00
|
|
|
OSDDRAWINFORIGHT(trVDR("Transmission"), *getTransmission(dtp.Transmission()));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2010-02-28 20:42:06 +01:00
|
|
|
OSDDRAWINFOLEFT( trVDR("Bandwidth"), *getBandwidth(dtp.Bandwidth()));
|
|
|
|
OSDDRAWINFORIGHT(trVDR("Modulation"), *getModulation(dtp.Modulation()));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2010-02-28 20:42:06 +01:00
|
|
|
OSDDRAWINFOLEFT( trVDR("Inversion"), *getInversion(dtp.Inversion()));
|
|
|
|
OSDDRAWINFORIGHT(tr ("Coderate"), *cString::sprintf("%s (H) %s (L)", *getCoderate(dtp.CoderateH()), *getCoderate(dtp.CoderateL())));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2010-02-28 20:42:06 +01:00
|
|
|
OSDDRAWINFOLEFT( trVDR("Hierarchy"), *getHierarchy(dtp.Hierarchy()));
|
|
|
|
OSDDRAWINFORIGHT(trVDR("Guard"), *getGuard(dtp.Guard()));
|
2012-01-15 22:07:53 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOLEFT( trVDR("System"), *getTerrestrialSystem(dtp.System()));
|
2013-03-10 19:12:17 +01:00
|
|
|
if (dtp.System()) {
|
|
|
|
OSDDRAWINFORIGHT(trVDR("StreamId"), *cString::sprintf("%d", dtp.StreamId()));
|
2014-03-16 16:04:28 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOLEFT( trVDR("T2SystemId"),*cString::sprintf("%d", dtp.T2SystemId()));
|
|
|
|
OSDDRAWINFORIGHT(trVDR("SISO/MISO"), *cString::sprintf("%d", dtp.SisoMiso()));
|
2013-03-10 19:12:17 +01:00
|
|
|
}
|
2012-03-29 22:31:44 +02:00
|
|
|
}
|
2008-11-09 12:43:27 +01:00
|
|
|
break;
|
|
|
|
|
2012-04-01 21:39:33 +02:00
|
|
|
case stIptv: {
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOLINE(*cString::sprintf("IPTV #%d - %s", (svdrpFrontendM >= 0) ? svdrpFrontendM : cDevice::ActualDevice()->CardIndex(), *frontendNameM));
|
2012-03-31 12:22:11 +02:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
if (svdrpFrontendM < 0) {
|
2012-04-01 21:39:33 +02:00
|
|
|
cPlugin *p;
|
|
|
|
IptvService_v1_0 data;
|
|
|
|
data.cardIndex = cDevice::ActualDevice()->CardIndex();
|
|
|
|
p = cPluginManager::CallFirstService("IptvService-v1.0", &data);
|
|
|
|
if (p) {
|
|
|
|
OSDDRAWINFOLEFT(tr("Protocol"), *data.protocol);
|
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOLEFT(tr("Bitrate"), *data.bitrate);
|
|
|
|
}
|
|
|
|
}
|
2012-03-31 12:22:11 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-11-09 12:43:27 +01:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
OSDDRAWINFOBOTTOMBAR();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eFemonModeStream:
|
|
|
|
OSDDRAWINFOTITLEBAR(tr("Stream Information"));
|
|
|
|
offset += OSDROWHEIGHT;
|
2008-11-10 23:30:00 +01:00
|
|
|
OSDDRAWINFOACTIVE( tr("Video Stream"), *getVideoStream(channel->Vpid()));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Codec"), *getVideoCodec(receiverM ? receiverM->VideoCodec() : VIDEO_CODEC_INVALID));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Bitrate"), *getVideoBitrate(receiverM ? receiverM->VideoBitrate() : 0, receiverM ? receiverM->VideoStreamBitrate() : 0));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Aspect Ratio"), *getAspectRatio(receiverM ? receiverM->VideoAspectRatio() : VIDEO_ASPECT_RATIO_INVALID));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Frame Rate"), *getFrameRate(receiverM ? receiverM->VideoFrameRate() : 0));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Video Format"), *getVideoFormat(receiverM ? receiverM->VideoFormat() : VIDEO_CODEC_INVALID));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Resolution"), *getResolution(receiverM ? receiverM->VideoHorizontalSize() : 0, receiverM ? receiverM->VideoVerticalSize() : 0, receiverM ? receiverM->VideoScan() : VIDEO_SCAN_INVALID));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2008-11-10 23:30:00 +01:00
|
|
|
OSDDRAWINFOACTIVE( tr("Audio Stream"), *getAudioStream(track, channel));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Codec"), *getAudioCodec(receiverM ? receiverM->AudioCodec() : AUDIO_CODEC_INVALID));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Channel Mode"), *getAudioChannelMode(receiverM ? receiverM->AudioChannelMode() : AUDIO_CHANNEL_MODE_INVALID));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Bitrate"), *getAudioBitrate(receiverM ? receiverM->AudioBitrate() : 0, receiverM ? receiverM->AudioStreamBitrate() : 0));
|
2008-11-09 12:43:27 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Sampling Frequency"), *getAudioSamplingFreq(receiverM ? receiverM->AudioSamplingFreq() : AUDIO_SAMPLING_FREQUENCY_INVALID));
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWINFOBOTTOMBAR();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eFemonModeAC3:
|
|
|
|
OSDDRAWINFOTITLEBAR(tr("Stream Information"));
|
2015-03-07 17:22:02 +01:00
|
|
|
if (receiverM && receiverM->AC3Valid() && IS_DOLBY_TRACK(track)) {
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2008-11-22 22:12:39 +01:00
|
|
|
OSDDRAWINFOACTIVE( tr("AC-3 Stream"), *getAC3Stream(track, channel));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Bitrate"), *getAudioBitrate(receiverM->AC3Bitrate(), receiverM->AC3StreamBitrate()));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Sampling Frequency"), *getAudioSamplingFreq(receiverM->AC3SamplingFreq()));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Bit Stream Mode"), *getAC3BitStreamMode(receiverM->AC3BitStreamMode(), receiverM->AC3AudioCodingMode()));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Audio Coding Mode"), *getAC3AudioCodingMode(receiverM->AC3AudioCodingMode(), receiverM->AC3BitStreamMode()));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Center Mix Level"), *getAC3CenterMixLevel(receiverM->AC3CenterMixLevel()));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Surround Mix Level"), *getAC3SurroundMixLevel(receiverM->AC3SurroundMixLevel()));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Dolby Surround Mode"), *getAC3DolbySurroundMode(receiverM->AC3DolbySurroundMode()));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Low Frequency Effects"), *cString::sprintf("%s", receiverM->AC3Lfe() ? trVDR("on") : trVDR("off")));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2015-03-07 17:22:02 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Dialogue Normalization"), *getAC3DialogLevel(receiverM->AC3DialogLevel()));
|
2008-11-09 12:43:27 +01:00
|
|
|
}
|
|
|
|
OSDDRAWINFOBOTTOMBAR();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
OSDCLEARINFO();
|
|
|
|
break;
|
|
|
|
}
|
2015-03-07 17:22:02 +01:00
|
|
|
osdM->Flush();
|
2004-03-03 03:20:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cFemonOsd::Action(void)
|
|
|
|
{
|
2015-03-07 21:09:18 +01:00
|
|
|
debug1("%s", __PRETTY_FUNCTION__);
|
2005-01-15 03:20:00 +01:00
|
|
|
cTimeMs t;
|
2006-09-17 03:20:00 +02:00
|
|
|
SvdrpCommand_v1_0 cmd;
|
|
|
|
cmd.command = cString::sprintf("PLUG %s INFO\r\n", PLUGIN_NAME_I18N);
|
2005-08-15 03:20:00 +02:00
|
|
|
while (Running()) {
|
2005-01-15 03:20:00 +01:00
|
|
|
t.Set(0);
|
2015-03-07 17:22:02 +01:00
|
|
|
svdrpFrontendM = -1;
|
|
|
|
svdrpVideoBitRateM = -1.0;
|
|
|
|
svdrpAudioBitRateM = -1.0;
|
|
|
|
switch (deviceSourceM) {
|
2012-02-05 13:04:04 +01:00
|
|
|
case DEVICESOURCE_PVRINPUT:
|
2015-03-07 17:22:02 +01:00
|
|
|
qualityM = cDevice::ActualDevice()->SignalStrength();
|
|
|
|
qualityValidM = (qualityM >= 0);
|
|
|
|
strengthM = cDevice::ActualDevice()->SignalStrength();
|
|
|
|
strengthValidM = (strengthM >= 0);
|
|
|
|
frontendNameM = cDevice::ActualDevice()->DeviceName();
|
|
|
|
frontendStatusM = (fe_status_t)(strengthValidM ? (FE_HAS_LOCK | FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC) : 0);
|
|
|
|
frontendStatusValidM = strengthValidM;
|
|
|
|
signalM = uint16_t(strengthM * 0xFFFF / 100);
|
|
|
|
signalValidM = strengthValidM;
|
|
|
|
snrM = 0;
|
|
|
|
snrValidM = false;
|
|
|
|
berM = 0;
|
|
|
|
berValidM = false;
|
|
|
|
uncM = 0;
|
|
|
|
uncValidM = false;
|
2012-02-05 13:04:04 +01:00
|
|
|
break;
|
|
|
|
case DEVICESOURCE_IPTV:
|
2015-03-07 17:22:02 +01:00
|
|
|
qualityM = cDevice::ActualDevice()->SignalQuality();
|
|
|
|
qualityValidM = (qualityM >= 0);
|
|
|
|
strengthM = cDevice::ActualDevice()->SignalStrength();
|
|
|
|
strengthValidM = (strengthM >= 0);
|
|
|
|
frontendNameM = cDevice::ActualDevice()->DeviceName();
|
|
|
|
frontendStatusM = (fe_status_t)(strengthValidM ? (FE_HAS_LOCK | FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC) : 0);
|
|
|
|
frontendStatusValidM = strengthValidM;
|
|
|
|
signalM = uint16_t(strengthM * 0xFFFF / 100);
|
|
|
|
signalValidM = strengthValidM;
|
|
|
|
snrM = uint16_t(qualityM * 0xFFFF / 100);
|
|
|
|
snrValidM = qualityValidM;
|
|
|
|
berM = 0;
|
|
|
|
berValidM = false;
|
|
|
|
uncM = 0;
|
|
|
|
uncValidM = false;
|
2012-02-05 13:04:04 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
case DEVICESOURCE_DVBAPI:
|
2015-03-07 17:22:02 +01:00
|
|
|
if (frontendM != -1) {
|
|
|
|
qualityM = cDevice::ActualDevice()->SignalQuality();
|
|
|
|
qualityValidM = (qualityM >= 0);
|
|
|
|
strengthM = cDevice::ActualDevice()->SignalStrength();
|
|
|
|
strengthValidM = (strengthM >= 0);
|
|
|
|
frontendNameM = cDevice::ActualDevice()->DeviceName();
|
|
|
|
frontendStatusValidM = (ioctl(frontendM, FE_READ_STATUS, &frontendStatusM) >= 0);
|
|
|
|
signalValidM = (ioctl(frontendM, FE_READ_SIGNAL_STRENGTH, &signalM) >= 0);
|
|
|
|
snrValidM = (ioctl(frontendM, FE_READ_SNR, &snrM) >= 0);
|
|
|
|
berValidM = (ioctl(frontendM, FE_READ_BER, &berM) >= 0);
|
|
|
|
uncValidM = (ioctl(frontendM, FE_READ_UNCORRECTED_BLOCKS, &uncM) >= 0);
|
2012-02-05 13:04:04 +01:00
|
|
|
}
|
2014-03-15 11:35:49 +01:00
|
|
|
else if (strstr(*cDevice::ActualDevice()->DeviceType(), SATIP_DEVICE)) {
|
2015-03-07 17:22:02 +01:00
|
|
|
qualityM = cDevice::ActualDevice()->SignalQuality();
|
|
|
|
qualityValidM = (qualityM >= 0);
|
|
|
|
strengthM = cDevice::ActualDevice()->SignalStrength();
|
|
|
|
strengthValidM = (strengthM >= 0);
|
|
|
|
frontendNameM = cDevice::ActualDevice()->DeviceName();
|
|
|
|
frontendStatusM = (fe_status_t)(cDevice::ActualDevice()->HasLock() ? (FE_HAS_LOCK | FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC) : 0);
|
|
|
|
frontendStatusValidM = strengthValidM;
|
|
|
|
signalM = uint16_t(strengthM * 0xFFFF / 100);
|
|
|
|
signalValidM = strengthValidM;
|
|
|
|
snrM = uint16_t(qualityM * 0xFFFF / 100);
|
|
|
|
snrValidM = qualityValidM;
|
|
|
|
berM = 0;
|
|
|
|
berValidM = false;
|
|
|
|
uncM = 0;
|
|
|
|
uncValidM = false;
|
2014-03-15 11:35:49 +01:00
|
|
|
}
|
2015-03-07 17:22:02 +01:00
|
|
|
else if (svdrpConnectionM.handle >= 0) {
|
|
|
|
cmd.handle = svdrpConnectionM.handle;
|
|
|
|
svdrpPluginM->Service("SvdrpCommand-v1.0", &cmd);
|
2012-02-05 13:04:04 +01:00
|
|
|
if (cmd.responseCode == 900) {
|
2015-03-07 17:22:02 +01:00
|
|
|
strengthValidM = false;
|
|
|
|
qualityValidM = false;
|
|
|
|
frontendStatusValidM = false;
|
|
|
|
signalValidM = false;
|
|
|
|
snrValidM = false;
|
|
|
|
berValidM = false;
|
|
|
|
uncValidM = false;
|
2012-02-05 13:04:04 +01:00
|
|
|
for (cLine *line = cmd.reply.First(); line; line = cmd.reply.Next(line)) {
|
|
|
|
const char *s = line->Text();
|
|
|
|
if (!strncasecmp(s, "CARD:", 5))
|
2015-03-07 17:22:02 +01:00
|
|
|
svdrpFrontendM = (int)strtol(s + 5, NULL, 10);
|
2012-02-05 13:04:04 +01:00
|
|
|
else if (!strncasecmp(s, "STRG:", 5)) {
|
2015-03-07 17:22:02 +01:00
|
|
|
strengthM = (int)strtol(s + 5, NULL, 10);
|
|
|
|
strengthValidM = (strengthM >= 0);
|
2012-02-05 13:04:04 +01:00
|
|
|
}
|
|
|
|
else if (!strncasecmp(s, "QUAL:", 5)) {
|
2015-03-07 17:22:02 +01:00
|
|
|
qualityM = (int)strtol(s + 5, NULL, 10);
|
|
|
|
qualityValidM = (qualityM >= 0);
|
2012-02-05 13:04:04 +01:00
|
|
|
}
|
|
|
|
else if (!strncasecmp(s, "TYPE:", 5))
|
2015-03-07 17:22:02 +01:00
|
|
|
frontendInfoM.type = (fe_type_t)strtol(s + 5, NULL, 10);
|
2012-02-05 13:04:04 +01:00
|
|
|
else if (!strncasecmp(s, "NAME:", 5)) {
|
2015-03-07 17:22:02 +01:00
|
|
|
frontendNameM = s + 5;
|
2012-02-05 13:04:04 +01:00
|
|
|
}
|
|
|
|
else if (!strncasecmp(s, "STAT:", 5)) {
|
2015-03-07 17:22:02 +01:00
|
|
|
frontendStatusM = (fe_status_t)strtol(s + 5, NULL, 16);
|
|
|
|
frontendStatusValidM = true;
|
2012-02-05 13:04:04 +01:00
|
|
|
}
|
|
|
|
else if (!strncasecmp(s, "SGNL:", 5)) {
|
2015-03-07 17:22:02 +01:00
|
|
|
signalM = (uint16_t)strtol(s + 5, NULL, 16);
|
|
|
|
signalValidM = true;
|
2012-02-05 13:04:04 +01:00
|
|
|
}
|
|
|
|
else if (!strncasecmp(s, "SNRA:", 5)) {
|
2015-03-07 17:22:02 +01:00
|
|
|
snrM = (uint16_t)strtol(s + 5, NULL, 16);
|
|
|
|
snrValidM = true;
|
2012-02-05 13:04:04 +01:00
|
|
|
}
|
|
|
|
else if (!strncasecmp(s, "BERA:", 5)) {
|
2015-03-07 17:22:02 +01:00
|
|
|
berM = (uint32_t)strtol(s + 5, NULL, 16);
|
|
|
|
berValidM = true;
|
2012-02-05 13:04:04 +01:00
|
|
|
}
|
|
|
|
else if (!strncasecmp(s, "UNCB:", 5)) {
|
2015-03-07 17:22:02 +01:00
|
|
|
uncM = (uint32_t)strtol(s + 5, NULL, 16);
|
|
|
|
uncValidM = true;
|
2012-02-05 13:04:04 +01:00
|
|
|
}
|
|
|
|
else if (!strncasecmp(s, "VIBR:", 5))
|
2015-03-07 17:22:02 +01:00
|
|
|
svdrpVideoBitRateM = (double)strtol(s + 5, NULL, 10);
|
2012-02-05 13:04:04 +01:00
|
|
|
else if (!strncasecmp(s, "AUBR:", 5))
|
2015-03-07 17:22:02 +01:00
|
|
|
svdrpAudioBitRateM = (double)strtol(s + 5, NULL, 10);
|
2012-02-05 13:04:04 +01:00
|
|
|
}
|
2009-09-22 07:44:30 +02:00
|
|
|
}
|
2008-12-16 11:51:59 +01:00
|
|
|
}
|
2012-02-05 13:04:04 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
DrawInfoWindow();
|
|
|
|
DrawStatusWindow();
|
2015-03-07 20:37:46 +01:00
|
|
|
sleepM.Wait(max((int)(100 * FemonConfig.GetUpdateInterval() - t.Elapsed()), 3));
|
2004-02-15 03:20:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cFemonOsd::Show(void)
|
|
|
|
{
|
2015-03-07 21:09:18 +01:00
|
|
|
debug1("%s", __PRETTY_FUNCTION__);
|
2005-01-23 03:20:00 +01:00
|
|
|
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
|
2015-09-19 16:01:01 +02:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
const cChannel *channel = Channels->GetByNumber(cDevice::CurrentChannel());
|
2012-02-05 13:04:04 +01:00
|
|
|
|
2016-01-21 20:01:15 +01:00
|
|
|
AttachFrontend();
|
|
|
|
|
|
|
|
osdM = cOsdProvider::NewOsd(osdLeftM, osdTopM);
|
|
|
|
if (osdM) {
|
|
|
|
tArea Areas1[] = { { 0, 0, OSDWIDTH - 1, OSDHEIGHT - 1, 8 } };
|
|
|
|
if (Setup.AntiAlias && osdM->CanHandleAreas(Areas1, sizeof(Areas1) / sizeof(tArea)) == oeOk) {
|
|
|
|
osdM->SetAreas(Areas1, sizeof(Areas1) / sizeof(tArea));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
tArea Areas2[] = { { 0, OSDSTATUSWIN_Y(0), OSDWIDTH - 1, OSDSTATUSWIN_Y(0) + OSDSTATUSHEIGHT - 1, FemonTheme[FemonConfig.GetTheme()].bpp },
|
|
|
|
{ 0, OSDINFOWIN_Y(0), OSDWIDTH - 1, OSDINFOWIN_Y(0) + OSDROWHEIGHT - 1, FemonTheme[FemonConfig.GetTheme()].bpp },
|
|
|
|
{ 0, OSDINFOWIN_Y(OSDROWHEIGHT), OSDWIDTH - 1, OSDINFOWIN_Y(0) + OSDINFOHEIGHT - 1, 2 } };
|
|
|
|
osdM->SetAreas(Areas2, sizeof(Areas2) / sizeof(tArea));
|
|
|
|
}
|
|
|
|
OSDCLEARSTATUS();
|
|
|
|
OSDCLEARINFO();
|
|
|
|
osdM->Flush();
|
|
|
|
if (receiverM) {
|
|
|
|
receiverM->Deactivate();
|
|
|
|
DELETENULL(receiverM);
|
|
|
|
}
|
|
|
|
if (FemonConfig.GetAnalyzeStream() && channel) {
|
|
|
|
receiverM = new cFemonReceiver(channel, IS_AUDIO_TRACK(track) ? int(track - ttAudioFirst) : 0, IS_DOLBY_TRACK(track) ? int(track - ttDolbyFirst) : 0);
|
|
|
|
cDevice::ActualDevice()->AttachReceiver(receiverM);
|
|
|
|
}
|
|
|
|
Start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cFemonOsd::AttachFrontend(void)
|
|
|
|
{
|
|
|
|
debug1("%s", __PRETTY_FUNCTION__);
|
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
const cChannel *channel = Channels->GetByNumber(cDevice::CurrentChannel());
|
|
|
|
|
|
|
|
if (frontendM >= 0) {
|
|
|
|
close(frontendM);
|
|
|
|
frontendM = -1;
|
|
|
|
}
|
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
deviceSourceM = DEVICESOURCE_DVBAPI;
|
2012-02-05 13:04:04 +01:00
|
|
|
if (channel) {
|
2014-03-15 11:35:49 +01:00
|
|
|
if (channel->IsSourceType('I'))
|
2015-03-07 17:22:02 +01:00
|
|
|
deviceSourceM = DEVICESOURCE_IPTV;
|
2012-02-05 13:04:04 +01:00
|
|
|
else if (channel->IsSourceType('V'))
|
2015-03-07 17:22:02 +01:00
|
|
|
deviceSourceM = DEVICESOURCE_PVRINPUT;
|
2004-02-15 03:20:00 +01:00
|
|
|
}
|
2012-02-05 13:04:04 +01:00
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
if (deviceSourceM == DEVICESOURCE_DVBAPI) {
|
2015-02-07 16:07:02 +01:00
|
|
|
if (!strstr(*cDevice::ActualDevice()->DeviceType(), SATIP_DEVICE)) {
|
|
|
|
cDvbDevice *dev = getDvbDevice(cDevice::ActualDevice());
|
2015-03-07 17:22:02 +01:00
|
|
|
frontendM = dev ? open(*cString::sprintf(FRONTEND_DEVICE, dev->Adapter(), dev->Frontend()), O_RDONLY | O_NONBLOCK) : -1;
|
|
|
|
if (frontendM >= 0) {
|
|
|
|
if (ioctl(frontendM, FE_GET_INFO, &frontendInfoM) < 0) {
|
2015-03-07 20:37:46 +01:00
|
|
|
if (!FemonConfig.GetUseSvdrp())
|
2015-03-07 21:09:18 +01:00
|
|
|
error("%s Cannot read frontend info", __PRETTY_FUNCTION__);
|
2015-03-07 17:22:02 +01:00
|
|
|
close(frontendM);
|
|
|
|
frontendM = -1;
|
|
|
|
memset(&frontendInfoM, 0, sizeof(frontendInfoM));
|
2016-01-21 20:01:15 +01:00
|
|
|
return false;
|
2015-02-07 16:07:02 +01:00
|
|
|
}
|
2012-02-05 13:04:04 +01:00
|
|
|
}
|
2015-03-07 20:37:46 +01:00
|
|
|
else if (FemonConfig.GetUseSvdrp()) {
|
2015-02-07 16:07:02 +01:00
|
|
|
if (!SvdrpConnect() || !SvdrpTune())
|
2016-01-21 20:01:15 +01:00
|
|
|
return false;
|
2015-02-07 16:07:02 +01:00
|
|
|
}
|
|
|
|
else {
|
2015-03-07 21:09:18 +01:00
|
|
|
error("%s Cannot open frontend device", __PRETTY_FUNCTION__);
|
2016-01-21 20:01:15 +01:00
|
|
|
return false;
|
2015-02-07 16:07:02 +01:00
|
|
|
}
|
2012-02-05 13:04:04 +01:00
|
|
|
}
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
2012-02-05 13:04:04 +01:00
|
|
|
else
|
2015-03-07 17:22:02 +01:00
|
|
|
frontendM = -1;
|
2006-09-17 03:20:00 +02:00
|
|
|
|
2016-01-21 20:01:15 +01:00
|
|
|
return true;
|
2004-02-15 03:20:00 +01:00
|
|
|
}
|
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
void cFemonOsd::ChannelSwitch(const cDevice * deviceP, int channelNumberP, bool liveViewP)
|
2004-02-15 03:20:00 +01:00
|
|
|
{
|
2015-03-07 21:09:18 +01:00
|
|
|
debug1("%s (%d, %d, %d)", __PRETTY_FUNCTION__, deviceP->DeviceNumber(), channelNumberP, liveViewP);
|
2005-01-23 03:20:00 +01:00
|
|
|
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
|
2015-09-19 16:01:01 +02:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
const cChannel *channel = Channels->GetByNumber(cDevice::CurrentChannel());
|
2012-02-05 13:04:04 +01:00
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
if (!deviceP || !liveViewP)
|
2004-06-06 03:20:00 +02:00
|
|
|
return;
|
2012-02-05 13:04:04 +01:00
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
if (!channelNumberP) {
|
|
|
|
if (receiverM) {
|
|
|
|
receiverM->Deactivate();
|
|
|
|
DELETENULL(receiverM);
|
2015-02-08 18:55:36 +01:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-01-21 20:01:15 +01:00
|
|
|
if (channel && FemonConfig.GetAnalyzeStream() && AttachFrontend()) {
|
|
|
|
if (receiverM) {
|
|
|
|
receiverM->Deactivate();
|
|
|
|
DELETENULL(receiverM);
|
2012-02-05 13:04:04 +01:00
|
|
|
}
|
2016-01-21 20:01:15 +01:00
|
|
|
receiverM = new cFemonReceiver(channel, IS_AUDIO_TRACK(track) ? int(track - ttAudioFirst) : 0, IS_DOLBY_TRACK(track) ? int(track - ttDolbyFirst) : 0);
|
|
|
|
cDevice::ActualDevice()->AttachReceiver(receiverM);
|
2004-02-15 03:20:00 +01:00
|
|
|
}
|
2005-01-15 03:20:00 +01:00
|
|
|
}
|
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
void cFemonOsd::SetAudioTrack(int indexP, const char * const *tracksP)
|
2005-01-15 03:20:00 +01:00
|
|
|
{
|
2015-03-07 21:09:18 +01:00
|
|
|
debug1("%s (%d, )", __PRETTY_FUNCTION__, indexP);
|
2005-01-23 03:20:00 +01:00
|
|
|
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
|
2015-03-07 17:22:02 +01:00
|
|
|
if (receiverM) {
|
|
|
|
receiverM->Deactivate();
|
|
|
|
DELETENULL(receiverM);
|
2008-11-23 21:26:48 +01:00
|
|
|
}
|
2015-03-07 20:37:46 +01:00
|
|
|
if (FemonConfig.GetAnalyzeStream()) {
|
2015-09-19 16:01:01 +02:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
const cChannel *channel = Channels->GetByNumber(cDevice::CurrentChannel());
|
2008-06-20 03:20:00 +02:00
|
|
|
if (channel) {
|
2015-03-07 17:22:02 +01:00
|
|
|
receiverM = new cFemonReceiver(channel, IS_AUDIO_TRACK(track) ? int(track - ttAudioFirst) : 0, IS_DOLBY_TRACK(track) ? int(track - ttDolbyFirst) : 0);
|
|
|
|
cDevice::ActualDevice()->AttachReceiver(receiverM);
|
2008-06-20 03:20:00 +02:00
|
|
|
}
|
2004-03-03 03:20:00 +01:00
|
|
|
}
|
2004-02-15 03:20:00 +01:00
|
|
|
}
|
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
bool cFemonOsd::DeviceSwitch(int directionP)
|
2005-11-13 03:20:00 +01:00
|
|
|
{
|
2015-03-07 21:09:18 +01:00
|
|
|
debug1("%s (%d)", __PRETTY_FUNCTION__, directionP);
|
2006-06-06 03:20:00 +02:00
|
|
|
int device = cDevice::ActualDevice()->DeviceNumber();
|
2015-03-07 17:22:02 +01:00
|
|
|
int direction = sgn(directionP);
|
2005-11-13 03:20:00 +01:00
|
|
|
if (device >= 0) {
|
2015-09-19 16:01:01 +02:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
const cChannel *channel = Channels->GetByNumber(cDevice::CurrentChannel());
|
2008-06-20 03:20:00 +02:00
|
|
|
if (channel) {
|
|
|
|
for (int i = 0; i < cDevice::NumDevices() - 1; i++) {
|
2014-01-12 00:02:03 +01:00
|
|
|
if (direction >= 0) {
|
|
|
|
if (++device >= cDevice::NumDevices())
|
|
|
|
device = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (--device < 0)
|
|
|
|
device = cDevice::NumDevices() - 1;
|
|
|
|
}
|
2014-01-12 21:24:50 +01:00
|
|
|
// Collect the current priorities of all CAM slots that can decrypt the channel:
|
|
|
|
int NumCamSlots = CamSlots.Count();
|
|
|
|
int SlotPriority[NumCamSlots];
|
|
|
|
int NumUsableSlots = 0;
|
|
|
|
bool NeedsDetachAllReceivers = false;
|
|
|
|
bool InternalCamNeeded = false;
|
|
|
|
bool ValidDevice = false;
|
|
|
|
cCamSlot *s = NULL;
|
|
|
|
cDevice *d = cDevice::GetDevice(device);
|
|
|
|
if (channel->Ca() >= CA_ENCRYPTED_MIN) {
|
|
|
|
for (cCamSlot *CamSlot = CamSlots.First(); CamSlot; CamSlot = CamSlots.Next(CamSlot)) {
|
|
|
|
SlotPriority[CamSlot->Index()] = MAXPRIORITY + 1; // assumes it can't be used
|
|
|
|
if (CamSlot->ModuleStatus() == msReady) {
|
|
|
|
if (CamSlot->ProvidesCa(channel->Caids())) {
|
|
|
|
if (!ChannelCamRelations.CamChecked(channel->GetChannelID(), CamSlot->SlotNumber())) {
|
|
|
|
SlotPriority[CamSlot->Index()] = CamSlot->Priority();
|
|
|
|
NumUsableSlots++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!NumUsableSlots)
|
|
|
|
InternalCamNeeded = true; // no CAM is able to decrypt this channel
|
|
|
|
}
|
|
|
|
for (int j = 0; j < NumCamSlots || !NumUsableSlots; ++j) {
|
|
|
|
if (NumUsableSlots && SlotPriority[j] > MAXPRIORITY)
|
|
|
|
continue; // there is no CAM available in this slot
|
|
|
|
bool HasInternalCam = d->HasInternalCam();
|
|
|
|
if (InternalCamNeeded && !HasInternalCam)
|
|
|
|
continue; // no CAM is able to decrypt this channel and the device uses vdr handled CAMs
|
|
|
|
if (NumUsableSlots && !HasInternalCam && !CamSlots.Get(j)->Assign(d, true))
|
|
|
|
continue; // CAM slot can't be used with this device
|
|
|
|
if (d->ProvidesChannel(channel, 0, &NeedsDetachAllReceivers)) { // this device is basically able to do the job
|
2015-03-07 21:09:18 +01:00
|
|
|
debug1("%s (%d) device=%d", __PRETTY_FUNCTION__, direction, device);
|
2014-01-12 21:24:50 +01:00
|
|
|
if (NumUsableSlots && !HasInternalCam && d->CamSlot() && d->CamSlot() != CamSlots.Get(j))
|
|
|
|
NeedsDetachAllReceivers = true; // using a different CAM slot requires detaching receivers
|
|
|
|
if (NumUsableSlots && !HasInternalCam)
|
|
|
|
s = CamSlots.Get(j);
|
|
|
|
ValidDevice = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!NumUsableSlots)
|
|
|
|
break; // no CAM necessary, so just one loop over the devices
|
|
|
|
}
|
|
|
|
// Do the actual switch if valid device found
|
|
|
|
if (d && ValidDevice) {
|
2014-01-12 00:02:03 +01:00
|
|
|
cControl::Shutdown();
|
2014-01-12 21:24:50 +01:00
|
|
|
if (NeedsDetachAllReceivers)
|
|
|
|
d->DetachAllReceivers();
|
|
|
|
if (s) {
|
|
|
|
if (s->Device() != d) {
|
|
|
|
if (s->Device())
|
|
|
|
s->Device()->DetachAllReceivers();
|
|
|
|
if (d->CamSlot())
|
|
|
|
d->CamSlot()->Assign(NULL);
|
|
|
|
s->Assign(d);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (d->CamSlot() && !d->CamSlot()->IsDecrypting())
|
|
|
|
d->CamSlot()->Assign(NULL);
|
2015-02-08 14:34:01 +01:00
|
|
|
d->SwitchChannel(channel, false);
|
2014-01-12 21:24:50 +01:00
|
|
|
cControl::Launch(new cTransferControl(d, channel));
|
2016-01-21 20:01:15 +01:00
|
|
|
AttachFrontend();
|
|
|
|
return true;
|
2014-01-12 00:02:03 +01:00
|
|
|
}
|
|
|
|
}
|
2005-11-13 03:20:00 +01:00
|
|
|
}
|
|
|
|
}
|
2016-01-21 20:01:15 +01:00
|
|
|
return false;
|
2005-11-13 03:20:00 +01:00
|
|
|
}
|
|
|
|
|
2006-09-17 03:20:00 +02:00
|
|
|
bool cFemonOsd::SvdrpConnect(void)
|
|
|
|
{
|
2015-03-07 17:22:02 +01:00
|
|
|
if (svdrpConnectionM.handle < 0) {
|
|
|
|
svdrpPluginM = cPluginManager::GetPlugin(SVDRPPLUGIN);
|
|
|
|
if (svdrpPluginM) {
|
2015-03-07 20:37:46 +01:00
|
|
|
svdrpConnectionM.serverIp = FemonConfig.GetSvdrpIp();
|
|
|
|
svdrpConnectionM.serverPort = (unsigned short)FemonConfig.GetSvdrpPort();
|
2015-03-07 17:22:02 +01:00
|
|
|
svdrpConnectionM.shared = true;
|
|
|
|
svdrpPluginM->Service("SvdrpConnection-v1.0", &svdrpConnectionM);
|
|
|
|
if (svdrpConnectionM.handle >= 0) {
|
2006-09-17 03:20:00 +02:00
|
|
|
SvdrpCommand_v1_0 cmd;
|
2015-03-07 17:22:02 +01:00
|
|
|
cmd.handle = svdrpConnectionM.handle;
|
2006-09-17 03:20:00 +02:00
|
|
|
cmd.command = cString::sprintf("PLUG %s\r\n", PLUGIN_NAME_I18N);
|
2015-03-07 17:22:02 +01:00
|
|
|
svdrpPluginM->Service("SvdrpCommand-v1.0", &cmd);
|
2006-09-17 03:20:00 +02:00
|
|
|
if (cmd.responseCode != 214) {
|
2015-03-07 17:22:02 +01:00
|
|
|
svdrpPluginM->Service("SvdrpConnection-v1.0", &svdrpConnectionM); // close connection
|
2015-03-07 21:09:18 +01:00
|
|
|
error("%s Cannot find plugin '%s' on server %s", __PRETTY_FUNCTION__, PLUGIN_NAME_I18N, *svdrpConnectionM.serverIp);
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2015-03-07 21:09:18 +01:00
|
|
|
error("%s Cannot connect to SVDRP server", __PRETTY_FUNCTION__);
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
|
|
|
else
|
2015-03-07 21:09:18 +01:00
|
|
|
error("%s Cannot find plugin '%s'", __PRETTY_FUNCTION__, SVDRPPLUGIN);
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
2015-03-07 17:22:02 +01:00
|
|
|
return svdrpConnectionM.handle >= 0;
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool cFemonOsd::SvdrpTune(void)
|
|
|
|
{
|
2015-03-07 17:22:02 +01:00
|
|
|
if (svdrpPluginM && svdrpConnectionM.handle >= 0) {
|
2015-09-19 16:01:01 +02:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
const cChannel *channel = Channels->GetByNumber(cDevice::CurrentChannel());
|
2006-09-17 03:20:00 +02:00
|
|
|
if (channel) {
|
|
|
|
SvdrpCommand_v1_0 cmd;
|
2015-03-07 17:22:02 +01:00
|
|
|
cmd.handle = svdrpConnectionM.handle;
|
2006-09-17 03:20:00 +02:00
|
|
|
cmd.command = cString::sprintf("CHAN %s\r\n", *channel->GetChannelID().ToString());
|
2015-03-07 17:22:02 +01:00
|
|
|
svdrpPluginM->Service("SvdrpCommand-v1.0", &cmd);
|
2006-09-17 03:20:00 +02:00
|
|
|
if (cmd.responseCode == 250)
|
|
|
|
return true;
|
2015-03-07 21:09:18 +01:00
|
|
|
error("%s Cannot tune server channel", __PRETTY_FUNCTION__);
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
|
|
|
else
|
2015-03-07 21:09:18 +01:00
|
|
|
error("%s Invalid channel", __PRETTY_FUNCTION__);
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
|
|
|
else
|
2015-03-07 21:09:18 +01:00
|
|
|
error("%s Unexpected connection state", __PRETTY_FUNCTION__);
|
2006-09-17 03:20:00 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2005-11-13 03:20:00 +01:00
|
|
|
double cFemonOsd::GetVideoBitrate(void)
|
|
|
|
{
|
2015-03-07 21:09:18 +01:00
|
|
|
debug1("%s", __PRETTY_FUNCTION__);
|
2005-11-13 03:20:00 +01:00
|
|
|
double value = 0.0;
|
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
if (receiverM)
|
|
|
|
value = receiverM->VideoBitrate();
|
2005-11-13 03:20:00 +01:00
|
|
|
|
|
|
|
return (value);
|
|
|
|
}
|
|
|
|
|
|
|
|
double cFemonOsd::GetAudioBitrate(void)
|
|
|
|
{
|
2015-03-07 21:09:18 +01:00
|
|
|
debug1("%s", __PRETTY_FUNCTION__);
|
2005-11-13 03:20:00 +01:00
|
|
|
double value = 0.0;
|
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
if (receiverM)
|
|
|
|
value = receiverM->AudioBitrate();
|
2005-11-13 03:20:00 +01:00
|
|
|
|
|
|
|
return (value);
|
|
|
|
}
|
|
|
|
|
|
|
|
double cFemonOsd::GetDolbyBitrate(void)
|
|
|
|
{
|
2015-03-07 21:09:18 +01:00
|
|
|
debug1("%s", __PRETTY_FUNCTION__);
|
2005-11-13 03:20:00 +01:00
|
|
|
double value = 0.0;
|
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
if (receiverM)
|
|
|
|
value = receiverM->AC3Bitrate();
|
2005-11-13 03:20:00 +01:00
|
|
|
|
|
|
|
return (value);
|
|
|
|
}
|
|
|
|
|
2015-03-07 17:22:02 +01:00
|
|
|
eOSState cFemonOsd::ProcessKey(eKeys keyP)
|
2009-08-28 19:54:34 +02:00
|
|
|
{
|
2015-03-07 17:22:02 +01:00
|
|
|
eOSState state = cOsdObject::ProcessKey(keyP);
|
2004-02-15 03:20:00 +01:00
|
|
|
if (state == osUnknown) {
|
2015-03-07 17:22:02 +01:00
|
|
|
switch (int(keyP)) {
|
2004-02-15 03:20:00 +01:00
|
|
|
case k0:
|
2015-03-07 17:22:02 +01:00
|
|
|
if ((numberM == 0) && (oldNumberM != 0)) {
|
|
|
|
numberM = oldNumberM;
|
|
|
|
oldNumberM = cDevice::CurrentChannel();
|
2015-09-19 16:01:01 +02:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
Channels->SwitchTo(numberM);
|
2015-03-07 17:22:02 +01:00
|
|
|
numberM = 0;
|
2004-02-15 03:20:00 +01:00
|
|
|
return osContinue;
|
|
|
|
}
|
|
|
|
case k1 ... k9:
|
2015-03-07 17:22:02 +01:00
|
|
|
if (numberM >= 0) {
|
|
|
|
numberM = numberM * 10 + keyP - k0;
|
|
|
|
if (numberM > 0) {
|
2004-03-03 03:20:00 +01:00
|
|
|
DrawStatusWindow();
|
2015-09-19 16:01:01 +02:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
const cChannel *ch = Channels->GetByNumber(numberM);
|
2015-03-07 17:22:02 +01:00
|
|
|
inputTimeM.Set(0);
|
2004-02-15 03:20:00 +01:00
|
|
|
// Lets see if there can be any useful further input:
|
2015-03-07 17:22:02 +01:00
|
|
|
int n = ch ? numberM * 10 : 0;
|
2015-09-19 16:01:01 +02:00
|
|
|
while (ch && (ch = Channels->Next(ch)) != NULL) {
|
2004-02-15 03:20:00 +01:00
|
|
|
if (!ch->GroupSep()) {
|
|
|
|
if (n <= ch->Number() && ch->Number() <= n + 9) {
|
|
|
|
n = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (ch->Number() > n)
|
|
|
|
n *= 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (n > 0) {
|
|
|
|
// This channel is the only one that fits the input, so let's take it right away:
|
2015-03-07 17:22:02 +01:00
|
|
|
oldNumberM = cDevice::CurrentChannel();
|
2015-09-19 16:01:01 +02:00
|
|
|
Channels->SwitchTo(numberM);
|
2015-03-07 17:22:02 +01:00
|
|
|
numberM = 0;
|
2004-02-15 03:20:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case kBack:
|
|
|
|
return osEnd;
|
2004-06-24 03:20:00 +02:00
|
|
|
case kGreen:
|
|
|
|
{
|
2005-01-15 03:20:00 +01:00
|
|
|
eTrackType types[ttMaxTrackTypes];
|
|
|
|
eTrackType CurrentAudioTrack = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
|
|
|
|
int numTracks = 0;
|
|
|
|
int oldTrack = 0;
|
|
|
|
int track = 0;
|
|
|
|
for (int i = ttAudioFirst; i <= ttDolbyLast; i++) {
|
|
|
|
const tTrackId *TrackId = cDevice::PrimaryDevice()->GetTrack(eTrackType(i));
|
|
|
|
if (TrackId && TrackId->id) {
|
|
|
|
types[numTracks] = eTrackType(i);
|
|
|
|
if (i == CurrentAudioTrack)
|
|
|
|
track = numTracks;
|
|
|
|
numTracks++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
oldTrack = track;
|
|
|
|
if (++track >= numTracks)
|
|
|
|
track = 0;
|
|
|
|
if (track != oldTrack) {
|
|
|
|
cDevice::PrimaryDevice()->SetCurrentAudioTrack(types[track]);
|
|
|
|
Setup.CurrentDolby = IS_DOLBY_TRACK(types[track]);
|
2004-06-24 03:20:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2005-01-15 03:20:00 +01:00
|
|
|
case kYellow:
|
|
|
|
if (IS_AUDIO_TRACK(cDevice::PrimaryDevice()->GetCurrentAudioTrack())) {
|
|
|
|
int audioChannel = cDevice::PrimaryDevice()->GetAudioChannel();
|
|
|
|
int oldAudioChannel = audioChannel;
|
|
|
|
if (++audioChannel > 2)
|
|
|
|
audioChannel = 0;
|
|
|
|
if (audioChannel != oldAudioChannel) {
|
|
|
|
cDevice::PrimaryDevice()->SetAudioChannel(audioChannel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2004-06-24 03:20:00 +02:00
|
|
|
case kRight:
|
2005-11-13 03:20:00 +01:00
|
|
|
DeviceSwitch(1);
|
|
|
|
break;
|
2004-06-24 03:20:00 +02:00
|
|
|
case kLeft:
|
2005-11-13 03:20:00 +01:00
|
|
|
DeviceSwitch(-1);
|
2004-06-24 03:20:00 +02:00
|
|
|
break;
|
2004-03-16 03:20:00 +01:00
|
|
|
case kUp|k_Repeat:
|
2004-02-15 03:20:00 +01:00
|
|
|
case kUp:
|
2004-03-16 03:20:00 +01:00
|
|
|
case kDown|k_Repeat:
|
2004-02-15 03:20:00 +01:00
|
|
|
case kDown:
|
2015-03-07 17:22:02 +01:00
|
|
|
oldNumberM = cDevice::CurrentChannel();
|
|
|
|
cDevice::SwitchChannel(NORMALKEY(keyP) == kUp ? 1 : -1);
|
|
|
|
numberM = 0;
|
2004-02-15 03:20:00 +01:00
|
|
|
break;
|
|
|
|
case kNone:
|
2015-03-07 17:22:02 +01:00
|
|
|
if (numberM && (inputTimeM.Elapsed() > CHANNELINPUT_TIMEOUT)) {
|
2015-09-19 16:01:01 +02:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
if (Channels->GetByNumber(numberM)) {
|
2015-03-07 17:22:02 +01:00
|
|
|
oldNumberM = cDevice::CurrentChannel();
|
2015-09-19 16:01:01 +02:00
|
|
|
Channels->SwitchTo(numberM);
|
2015-03-07 17:22:02 +01:00
|
|
|
numberM = 0;
|
2004-02-15 03:20:00 +01:00
|
|
|
}
|
|
|
|
else {
|
2015-03-07 17:22:02 +01:00
|
|
|
inputTimeM.Set(0);
|
|
|
|
numberM = 0;
|
2004-02-15 03:20:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case kOk:
|
2008-06-20 03:20:00 +02:00
|
|
|
{
|
2004-06-11 03:20:00 +02:00
|
|
|
// toggle between display modes
|
2015-09-19 16:01:01 +02:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
const cChannel *channel = Channels->GetByNumber(cDevice::CurrentChannel());
|
2015-03-07 17:22:02 +01:00
|
|
|
if (++displayModeM == eFemonModeAC3 && channel && !channel->Dpid(0)) displayModeM++;
|
|
|
|
if (displayModeM >= eFemonModeMaxNumber) displayModeM = 0;
|
2004-03-03 03:20:00 +01:00
|
|
|
DrawInfoWindow();
|
2008-06-20 03:20:00 +02:00
|
|
|
}
|
2004-02-15 03:20:00 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
state = osContinue;
|
2009-01-06 22:10:02 +01:00
|
|
|
}
|
2004-02-15 03:20:00 +01:00
|
|
|
return state;
|
|
|
|
}
|