2004-02-15 03:20:00 +01:00
|
|
|
/*
|
2004-03-03 03:20:00 +01:00
|
|
|
* 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>
|
2012-04-01 21:39:33 +02:00
|
|
|
#include "iptvservice.h"
|
2004-02-15 03:20:00 +01:00
|
|
|
#include "femoncfg.h"
|
2004-02-27 03:20:00 +01:00
|
|
|
#include "femonreceiver.h"
|
2005-08-28 03:20:00 +02:00
|
|
|
#include "femontools.h"
|
2008-11-09 12:43:27 +01:00
|
|
|
#include "femonsymbol.h"
|
2004-02-26 03:20:00 +01:00
|
|
|
#include "femonosd.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
|
|
|
|
2009-07-08 22:14:19 +02:00
|
|
|
#define OSDWIDTH m_OsdWidth // in pixels
|
|
|
|
#define OSDHEIGHT m_OsdHeight // in pixels
|
2005-02-24 03:20:00 +01:00
|
|
|
#define OSDROWHEIGHT m_Font->Height() // in pixels
|
2008-11-09 12:43:27 +01:00
|
|
|
#define OSDINFOHEIGHT (OSDROWHEIGHT * 13) // in pixels (13 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()
|
2008-11-22 22:12:39 +01:00
|
|
|
#define IS_OSDROUNDING (femonConfig.skin == eFemonSkinElchi)
|
2009-09-22 07:44:30 +02:00
|
|
|
#define IS_OSDRESOLUTION(r1, r2) (abs(r1 - r2) < 20)
|
2005-02-24 03:20:00 +01:00
|
|
|
#define OSDINFOWIN_Y(offset) (femonConfig.position ? (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)))
|
2005-02-24 03:20:00 +01:00
|
|
|
#define OSDSTATUSWIN_Y(offset) (femonConfig.position ? 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; \
|
2008-11-23 03:45:20 +01:00
|
|
|
m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset) + y, *bm, femonTheme[femonConfig.theme].clrTitleText, femonTheme[femonConfig.theme].clrTitleBackground); \
|
2008-11-09 12:43:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define OSDDRAWSTATUSFRONTEND(column, bitmap, status) \
|
2008-11-23 03:45:20 +01:00
|
|
|
m_Osd->DrawBitmap(OSDSTATUSWIN_XSYMBOL(column, x), OSDSTATUSWIN_Y(offset) + y, bitmap, (m_FrontendStatus & status) ? femonTheme[femonConfig.theme].clrActiveText : femonTheme[femonConfig.theme].clrRed, femonTheme[femonConfig.theme].clrBackground)
|
2008-11-09 12:43:27 +01:00
|
|
|
|
|
|
|
#define OSDDRAWSTATUSVALUES(label1, label2, label3, label4, label5, label6, label7) \
|
|
|
|
m_Osd->DrawText(OSDSTATUSWIN_X(1), OSDSTATUSWIN_Y(offset), label1, femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font); \
|
|
|
|
m_Osd->DrawText(OSDSTATUSWIN_X(2), OSDSTATUSWIN_Y(offset), label2, femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font); \
|
|
|
|
m_Osd->DrawText(OSDSTATUSWIN_X(3), OSDSTATUSWIN_Y(offset), label3, femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font); \
|
|
|
|
m_Osd->DrawText(OSDSTATUSWIN_X(4), OSDSTATUSWIN_Y(offset), label4, femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font); \
|
|
|
|
m_Osd->DrawText(OSDSTATUSWIN_X(5), OSDSTATUSWIN_Y(offset), label5, femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font); \
|
|
|
|
m_Osd->DrawText(OSDSTATUSWIN_X(6), OSDSTATUSWIN_Y(offset), label6, femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font); \
|
|
|
|
m_Osd->DrawText(OSDSTATUSWIN_X(7), OSDSTATUSWIN_Y(offset), label7, femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font)
|
|
|
|
|
|
|
|
#define OSDDRAWSTATUSBAR(value) \
|
|
|
|
if (value > 0) { \
|
2009-09-22 07:44:30 +02:00
|
|
|
int barvalue = OSDBARWIDTH(value); \
|
2009-09-16 08:37:51 +02:00
|
|
|
m_Osd->DrawRectangle(0, OSDSTATUSWIN_Y(offset) + 3, min(OSDBARWIDTH(femonConfig.redlimit), barvalue), OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, femonTheme[femonConfig.theme].clrRed); \
|
|
|
|
if (barvalue > OSDBARWIDTH(femonConfig.redlimit)) \
|
|
|
|
m_Osd->DrawRectangle(OSDBARWIDTH(femonConfig.redlimit), OSDSTATUSWIN_Y(offset) + 3, min((OSDWIDTH * femonConfig.greenlimit / 100), barvalue), OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, femonTheme[femonConfig.theme].clrYellow); \
|
|
|
|
if (barvalue > OSDBARWIDTH(femonConfig.greenlimit)) \
|
|
|
|
m_Osd->DrawRectangle(OSDBARWIDTH(femonConfig.greenlimit), OSDSTATUSWIN_Y(offset) + 3, barvalue, OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, femonTheme[femonConfig.theme].clrGreen); \
|
2008-11-09 12:43:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define OSDDRAWSTATUSTITLEBAR(title) \
|
2008-11-23 03:45:20 +01:00
|
|
|
m_Osd->DrawRectangle(0, OSDSTATUSWIN_Y(offset), OSDWIDTH, OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 1, femonTheme[femonConfig.theme].clrTitleBackground); \
|
2008-11-09 12:43:27 +01:00
|
|
|
m_Osd->DrawText(OSDSTATUSWIN_X(1), OSDSTATUSWIN_Y(offset), title, femonTheme[femonConfig.theme].clrTitleText, femonTheme[femonConfig.theme].clrTitleBackground, m_Font); \
|
2008-11-22 22:12:39 +01:00
|
|
|
if (IS_OSDROUNDING) { \
|
|
|
|
m_Osd->DrawEllipse(0, OSDSTATUSWIN_Y(0), OSDROUNDING, OSDSTATUSWIN_Y(OSDROUNDING), clrTransparent, -2); \
|
2008-11-23 03:45:20 +01:00
|
|
|
m_Osd->DrawEllipse(OSDWIDTH - OSDROUNDING, OSDSTATUSWIN_Y(0), OSDWIDTH, OSDSTATUSWIN_Y(OSDROUNDING), clrTransparent, -1); \
|
|
|
|
} \
|
|
|
|
m_Osd->DrawRectangle(0, OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT, OSDWIDTH, OSDSTATUSWIN_Y(offset) + OSDSTATUSHEIGHT - 1, femonTheme[femonConfig.theme].clrBackground)
|
2008-11-09 12:43:27 +01:00
|
|
|
|
|
|
|
#define OSDDRAWSTATUSBOTTOMBAR() \
|
2008-11-22 22:12:39 +01:00
|
|
|
if (IS_OSDROUNDING) { \
|
2008-11-23 03:45:20 +01:00
|
|
|
m_Osd->DrawEllipse(0, OSDSTATUSWIN_Y(OSDSTATUSHEIGHT) - OSDROUNDING, OSDROUNDING, OSDSTATUSWIN_Y(OSDSTATUSHEIGHT), clrTransparent, -3); \
|
|
|
|
m_Osd->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() \
|
|
|
|
m_Osd->DrawRectangle(0, OSDSTATUSWIN_Y(0), OSDWIDTH, OSDSTATUSWIN_Y(OSDSTATUSHEIGHT) - 1, clrTransparent)
|
|
|
|
|
2008-11-09 12:43:27 +01:00
|
|
|
#define OSDDRAWINFOLEFT(label, value) \
|
|
|
|
m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), label, femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font); \
|
|
|
|
m_Osd->DrawText(OSDINFOWIN_X(2), OSDINFOWIN_Y(offset), value, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font)
|
|
|
|
|
|
|
|
#define OSDDRAWINFORIGHT(label, value) \
|
|
|
|
m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), label, femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font); \
|
|
|
|
m_Osd->DrawText(OSDINFOWIN_X(4), OSDINFOWIN_Y(offset), value, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font)
|
2006-09-17 03:20:00 +02:00
|
|
|
|
2008-11-09 12:43:27 +01:00
|
|
|
#define OSDDRAWINFOACTIVE(label, value) \
|
|
|
|
m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), label, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font); \
|
|
|
|
m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), value, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font)
|
|
|
|
|
|
|
|
#define OSDDRAWINFOINACTIVE(label, value) \
|
|
|
|
m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), label, femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font); \
|
|
|
|
m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), value, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font)
|
|
|
|
|
|
|
|
#define OSDDRAWINFOLINE(label) \
|
|
|
|
m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), label, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font)
|
|
|
|
|
|
|
|
#define OSDDRAWINFOTITLEBAR(title) \
|
2008-11-23 03:45:20 +01:00
|
|
|
m_Osd->DrawRectangle(0, OSDINFOWIN_Y(offset), OSDWIDTH, OSDINFOWIN_Y(offset) + OSDROWHEIGHT - 1, femonTheme[femonConfig.theme].clrTitleBackground); \
|
2008-11-09 12:43:27 +01:00
|
|
|
m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), title, femonTheme[femonConfig.theme].clrTitleText, femonTheme[femonConfig.theme].clrTitleBackground, m_Font); \
|
2008-11-22 22:12:39 +01:00
|
|
|
if (IS_OSDROUNDING) { \
|
|
|
|
m_Osd->DrawEllipse(0, OSDINFOWIN_Y(0), OSDROUNDING, OSDINFOWIN_Y(OSDROUNDING), clrTransparent, -2); \
|
2008-11-23 03:45:20 +01:00
|
|
|
m_Osd->DrawEllipse(OSDWIDTH - OSDROUNDING, OSDINFOWIN_Y(0), OSDWIDTH, OSDINFOWIN_Y(OSDROUNDING), clrTransparent, -1); \
|
|
|
|
} \
|
|
|
|
m_Osd->DrawRectangle(0, OSDINFOWIN_Y(offset) + OSDROWHEIGHT, OSDWIDTH, OSDINFOWIN_Y(offset) + OSDINFOHEIGHT - 1, femonTheme[femonConfig.theme].clrBackground)
|
2008-11-09 12:43:27 +01:00
|
|
|
|
|
|
|
#define OSDDRAWINFOBOTTOMBAR() \
|
2008-11-22 22:12:39 +01:00
|
|
|
if (IS_OSDROUNDING) { \
|
2008-11-23 03:45:20 +01:00
|
|
|
m_Osd->DrawEllipse(0, OSDINFOWIN_Y(OSDINFOHEIGHT) - OSDROUNDING, OSDROUNDING, OSDINFOWIN_Y(OSDINFOHEIGHT), clrTransparent, -3); \
|
|
|
|
m_Osd->DrawEllipse((OSDWIDTH - OSDROUNDING), OSDINFOWIN_Y(OSDINFOHEIGHT) - OSDROUNDING, OSDWIDTH, OSDINFOWIN_Y(OSDINFOHEIGHT), clrTransparent, -4); \
|
2008-11-09 12:43:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define OSDCLEARINFO() \
|
2008-11-23 03:45:20 +01:00
|
|
|
m_Osd->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:
|
|
|
|
virtual int Width(uint c) const { return 10; }
|
|
|
|
virtual int Width(const char *s) const { return 50; }
|
|
|
|
virtual int Height(void) const { return 20; }
|
|
|
|
virtual void DrawText(cBitmap *Bitmap, int x, int y, const char *s, tColor ColorFg, tColor ColorBg, int Width) const {}
|
2011-03-13 18:09:01 +01:00
|
|
|
virtual void DrawText(cPixmap *Pixmap, int x, int y, const char *s, tColor ColorFg, tColor ColorBg, int Width) const {}
|
2009-06-18 11:16:11 +02:00
|
|
|
};
|
|
|
|
|
2005-11-13 03:20:00 +01:00
|
|
|
cFemonOsd *cFemonOsd::pInstance = NULL;
|
|
|
|
|
|
|
|
cFemonOsd *cFemonOsd::Instance(bool create)
|
|
|
|
{
|
2009-10-01 11:13:35 +02:00
|
|
|
debug("%s()\n", __PRETTY_FUNCTION__);
|
2009-01-06 22:10:02 +01:00
|
|
|
if ((pInstance == NULL) && create)
|
2005-11-13 03:20:00 +01:00
|
|
|
{
|
|
|
|
pInstance = new cFemonOsd();
|
|
|
|
}
|
|
|
|
return (pInstance);
|
|
|
|
}
|
|
|
|
|
|
|
|
cFemonOsd::cFemonOsd()
|
2008-11-12 16:58:32 +01:00
|
|
|
: cOsdObject(true), cThread("femon osd"),
|
|
|
|
m_Osd(NULL),
|
|
|
|
m_Receiver(NULL),
|
|
|
|
m_Frontend(-1),
|
|
|
|
m_SvdrpFrontend(-1),
|
|
|
|
m_SvdrpVideoBitrate(-1),
|
|
|
|
m_SvdrpAudioBitrate(-1),
|
|
|
|
m_SvdrpPlugin(NULL),
|
|
|
|
m_Number(0),
|
|
|
|
m_OldNumber(0),
|
2011-09-03 22:00:33 +02:00
|
|
|
m_Quality(0),
|
|
|
|
m_QualityValid(false),
|
|
|
|
m_Strength(0),
|
|
|
|
m_StrengthValid(false),
|
2009-09-22 07:44:30 +02:00
|
|
|
m_SNR(0),
|
|
|
|
m_SNRValid(false),
|
|
|
|
m_Signal(0),
|
|
|
|
m_SignalValid(false),
|
|
|
|
m_BER(0),
|
|
|
|
m_BERValid(false),
|
|
|
|
m_UNC(0),
|
|
|
|
m_UNCValid(false),
|
2012-03-25 15:55:42 +02:00
|
|
|
m_FrontendName(""),
|
2009-09-22 07:44:30 +02:00
|
|
|
m_FrontendStatusValid(false),
|
2012-02-05 13:04:04 +01:00
|
|
|
m_DeviceSource(DEVICESOURCE_DVBAPI),
|
2008-11-12 16:58:32 +01:00
|
|
|
m_DisplayMode(femonConfig.displaymode),
|
2010-02-25 19:33:20 +01:00
|
|
|
m_OsdWidth(cOsd::OsdWidth() * (100 - femonConfig.downscale) / 100),
|
|
|
|
m_OsdHeight(cOsd::OsdHeight() * (100 - femonConfig.downscale) / 100),
|
|
|
|
m_OsdLeft(cOsd::OsdLeft() + (cOsd::OsdWidth() * femonConfig.downscale / 200)),
|
|
|
|
m_OsdTop(cOsd::OsdTop() + (cOsd::OsdHeight() * femonConfig.downscale / 200)),
|
2008-11-12 16:58:32 +01:00
|
|
|
m_InputTime(0),
|
|
|
|
m_Sleep(),
|
|
|
|
m_Mutex()
|
2004-02-15 03:20:00 +01:00
|
|
|
{
|
2009-07-08 22:14:19 +02:00
|
|
|
int tmp;
|
2009-10-01 11:13:35 +02:00
|
|
|
debug("%s()\n", __PRETTY_FUNCTION__);
|
2009-09-16 08:37:51 +02:00
|
|
|
memset(&m_FrontendStatus, 0, sizeof(m_FrontendStatus));
|
2009-09-22 07:44:30 +02:00
|
|
|
memset(&m_FrontendInfo, 0, sizeof(m_FrontendInfo));
|
2006-09-17 03:20:00 +02:00
|
|
|
m_SvdrpConnection.handle = -1;
|
2011-04-20 16:41:17 +02:00
|
|
|
femonSymbols.Refresh();
|
2012-03-03 14:19:18 +01:00
|
|
|
m_Font = cFont::CreateFont(Setup.FontSml, constrain(Setup.FontSmlSize, MINFONTSIZE, MAXFONTSIZE));
|
2009-06-18 11:16:11 +02:00
|
|
|
if (!m_Font || !m_Font->Height()) {
|
|
|
|
m_Font = new cFemonDummyFont;
|
2009-10-01 11:13:35 +02:00
|
|
|
error("cFemonOsd::cFemonOsd() cannot create required font.");
|
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) {
|
2009-10-01 11:13:35 +02:00
|
|
|
error("cFemonOsd::cFemonOsd() OSD width (%d) smaller than required (%d).", OSDWIDTH, tmp);
|
2009-07-08 22:14:19 +02:00
|
|
|
OSDWIDTH = tmp;
|
|
|
|
}
|
|
|
|
tmp = OSDINFOHEIGHT + OSDROWHEIGHT + OSDSTATUSHEIGHT;
|
|
|
|
if (OSDHEIGHT < tmp) {
|
2009-10-01 11:13:35 +02:00
|
|
|
error("cFemonOsd::cFemonOsd() OSD height (%d) smaller than required (%d).", 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)
|
|
|
|
{
|
2009-10-01 11:13:35 +02:00
|
|
|
debug("%s()\n", __PRETTY_FUNCTION__);
|
2008-09-17 17:51:38 +02:00
|
|
|
m_Sleep.Signal();
|
2005-11-13 03:20:00 +01:00
|
|
|
if (Running())
|
2004-03-16 03:20:00 +01:00
|
|
|
Cancel(3);
|
2006-09-17 03:20:00 +02:00
|
|
|
if (m_SvdrpConnection.handle >= 0) {
|
|
|
|
m_SvdrpPlugin = cPluginManager::GetPlugin(SVDRPPLUGIN);
|
|
|
|
if (m_SvdrpPlugin)
|
|
|
|
m_SvdrpPlugin->Service("SvdrpConnection-v1.0", &m_SvdrpConnection);
|
|
|
|
}
|
2008-11-23 21:26:48 +01:00
|
|
|
if (m_Receiver) {
|
|
|
|
m_Receiver->Deactivate();
|
|
|
|
DELETENULL(m_Receiver);
|
|
|
|
}
|
2004-02-15 03:20:00 +01:00
|
|
|
if (m_Osd)
|
2008-11-23 21:26:48 +01:00
|
|
|
DELETENULL(m_Osd);
|
2009-06-18 11:16:11 +02:00
|
|
|
if (m_Font)
|
|
|
|
DELETENULL(m_Font);
|
2009-01-06 22:10:02 +01:00
|
|
|
if (m_Frontend >= 0) {
|
|
|
|
close(m_Frontend);
|
|
|
|
m_Frontend = -1;
|
|
|
|
}
|
2005-11-13 03:20:00 +01:00
|
|
|
pInstance = 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
|
|
|
{
|
2008-11-12 16:58:32 +01:00
|
|
|
cMutexLock lock(&m_Mutex);
|
2004-03-07 03:20:00 +01:00
|
|
|
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
2004-02-15 03:20:00 +01:00
|
|
|
|
2008-06-20 03:20:00 +02:00
|
|
|
if (m_Osd && 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();
|
|
|
|
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWSTATUSTITLEBAR(*cString::sprintf("%d%s %s", m_Number ? m_Number : channel->Number(), m_Number ? "-" : "", channel->ShortName(true)));
|
2006-09-17 03:20:00 +02:00
|
|
|
if (m_SvdrpFrontend >= 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
|
|
|
}
|
|
|
|
else if (m_Receiver && m_Receiver->AC3Valid() && IS_DOLBY_TRACK(track)) {
|
2011-04-20 16:41:17 +02:00
|
|
|
if (m_Receiver->AC3_5_1()) bm = &OSDSYMBOL(SYMBOL_DD51);
|
|
|
|
else if (m_Receiver->AC3_2_0()) bm = &OSDSYMBOL(SYMBOL_DD20);
|
|
|
|
else bm = &OSDSYMBOL(SYMBOL_DD);
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWSTATUSBM(OSDSPACING);
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
|
|
|
if (m_Receiver) {
|
2011-11-27 01:09:27 +01:00
|
|
|
if (IS_OSDRESOLUTION(m_Receiver->VideoVerticalSize(), 1080)) {
|
|
|
|
switch (m_Receiver->VideoScan()) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (IS_OSDRESOLUTION(m_Receiver->VideoVerticalSize(), 720)) {
|
|
|
|
switch (m_Receiver->VideoScan()) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (IS_OSDRESOLUTION(m_Receiver->VideoVerticalSize(), 576)) {
|
|
|
|
switch (m_Receiver->VideoScan()) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (IS_OSDRESOLUTION(m_Receiver->VideoVerticalSize(), 480)) {
|
|
|
|
switch (m_Receiver->VideoScan()) {
|
|
|
|
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);
|
2008-11-09 12:43:27 +01:00
|
|
|
switch (m_Receiver->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;
|
|
|
|
default: bm = NULL; break;
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWSTATUSBM(OSDSPACING);
|
|
|
|
switch (m_Receiver->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);
|
2006-09-17 03:20:00 +02:00
|
|
|
switch (m_Receiver->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;
|
2011-09-03 22:00:33 +02:00
|
|
|
if (m_StrengthValid)
|
|
|
|
OSDDRAWSTATUSBAR(m_Strength);
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2011-09-03 22:00:33 +02:00
|
|
|
if (m_QualityValid)
|
|
|
|
OSDDRAWSTATUSBAR(m_Quality);
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2009-09-22 07:44:30 +02:00
|
|
|
OSDDRAWSTATUSVALUES("STR:", m_SignalValid ? *cString::sprintf("%04x", m_Signal) : "", m_SignalValid ? *cString::sprintf("(%2d%%)", m_Signal / 655) : "",
|
|
|
|
"BER:", m_BERValid ? *cString::sprintf("%08x", m_BER) : "", *cString::sprintf("%s:", tr("Video")),
|
2009-09-16 08:37:51 +02:00
|
|
|
*getBitrateMbits(m_Receiver ? m_Receiver->VideoBitrate() : (m_SvdrpFrontend >= 0 ? m_SvdrpVideoBitrate : -1.0)));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2009-09-22 07:44:30 +02:00
|
|
|
OSDDRAWSTATUSVALUES("SNR:", m_SNRValid ? *cString::sprintf("%04x", m_SNR) : "", m_SNRValid ? *cString::sprintf("(%2d%%)", m_SNR / 655) : "",
|
|
|
|
"UNC:", m_UNCValid ? *cString::sprintf("%08x", m_UNC) : "",
|
2008-11-09 12:43:27 +01:00
|
|
|
*cString::sprintf("%s:", (m_Receiver && m_Receiver->AC3Valid() && IS_DOLBY_TRACK(track)) ? tr("AC-3") : tr("Audio")),
|
|
|
|
*getBitrateKbits(m_Receiver ? ((m_Receiver->AC3Valid() && IS_DOLBY_TRACK(track)) ? m_Receiver->AC3Bitrate() : m_Receiver->AudioBitrate()) : (m_SvdrpFrontend >= 0 ? m_SvdrpAudioBitrate : -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;
|
2009-09-22 07:44:30 +02:00
|
|
|
if (m_FrontendStatusValid) {
|
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();
|
2004-03-03 03:20:00 +01:00
|
|
|
m_Osd->Flush();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cFemonOsd::DrawInfoWindow(void)
|
|
|
|
{
|
2008-11-12 16:58:32 +01:00
|
|
|
cMutexLock lock(&m_Mutex);
|
2004-03-07 03:20:00 +01:00
|
|
|
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
2004-03-03 03:20:00 +01:00
|
|
|
|
2008-06-20 03:20:00 +02:00
|
|
|
if (m_Osd && channel) {
|
2011-06-15 16:50:03 +02:00
|
|
|
int offset = 0;
|
|
|
|
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
|
|
|
|
|
2008-11-09 12:43:27 +01:00
|
|
|
switch (m_DisplayMode) {
|
|
|
|
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());
|
2012-03-25 15:55:42 +02:00
|
|
|
OSDDRAWINFOLINE(*cString::sprintf("%s #%d - %s", *getSatelliteSystem(dtp.System()), (m_SvdrpFrontend >= 0) ? m_SvdrpFrontend : cDevice::ActualDevice()->CardIndex(), *m_FrontendName));
|
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()));
|
|
|
|
}
|
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());
|
2012-03-25 15:55:42 +02:00
|
|
|
OSDDRAWINFOLINE(*cString::sprintf("DVB-C #%d - %s", (m_SvdrpFrontend >= 0) ? m_SvdrpFrontend : cDevice::ActualDevice()->CardIndex(), *m_FrontendName));
|
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());
|
2012-03-25 15:55:42 +02:00
|
|
|
OSDDRAWINFOLINE(*cString::sprintf("%s #%d - %s", *getTerrestrialSystem(dtp.System()), (m_SvdrpFrontend >= 0) ? m_SvdrpFrontend : cDevice::ActualDevice()->CardIndex(), *m_FrontendName));
|
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()));
|
|
|
|
}
|
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: {
|
2012-03-31 12:22:11 +02:00
|
|
|
OSDDRAWINFOLINE(*cString::sprintf("IPTV #%d - %s", (m_SvdrpFrontend >= 0) ? m_SvdrpFrontend : cDevice::ActualDevice()->CardIndex(), *m_FrontendName));
|
|
|
|
offset += OSDROWHEIGHT;
|
2012-04-01 21:39:33 +02:00
|
|
|
if (m_SvdrpFrontend < 0) {
|
|
|
|
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;
|
|
|
|
OSDDRAWINFOINACTIVE(tr("Codec"), *getVideoCodec(m_Receiver ? m_Receiver->VideoCodec() : VIDEO_CODEC_INVALID));
|
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOINACTIVE(tr("Bitrate"), *getVideoBitrate(m_Receiver ? m_Receiver->VideoBitrate() : 0, m_Receiver ? m_Receiver->VideoStreamBitrate() : 0));
|
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOINACTIVE(tr("Aspect Ratio"), *getAspectRatio(m_Receiver ? m_Receiver->VideoAspectRatio() : VIDEO_ASPECT_RATIO_INVALID));
|
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOINACTIVE(tr("Frame Rate"), *getFrameRate(m_Receiver ? m_Receiver->VideoFrameRate() : 0));
|
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOINACTIVE(tr("Video Format"), *getVideoFormat(m_Receiver ? m_Receiver->VideoFormat() : VIDEO_CODEC_INVALID));
|
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOINACTIVE(tr("Resolution"), *getResolution(m_Receiver ? m_Receiver->VideoHorizontalSize() : 0, m_Receiver ? m_Receiver->VideoVerticalSize() : 0, m_Receiver ? m_Receiver->VideoScan() : VIDEO_SCAN_INVALID));
|
|
|
|
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;
|
|
|
|
OSDDRAWINFOINACTIVE(tr("Codec"), *getAudioCodec(m_Receiver ? m_Receiver->AudioCodec() : AUDIO_CODEC_INVALID));
|
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOINACTIVE(tr("Channel Mode"), *getAudioChannelMode(m_Receiver ? m_Receiver->AudioChannelMode() : AUDIO_CHANNEL_MODE_INVALID));
|
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOINACTIVE(tr("Bitrate"), *getAudioBitrate(m_Receiver ? m_Receiver->AudioBitrate() : 0, m_Receiver ? m_Receiver->AudioStreamBitrate() : 0));
|
|
|
|
offset += OSDROWHEIGHT;
|
|
|
|
OSDDRAWINFOINACTIVE(tr("Sampling Frequency"), *getAudioSamplingFreq(m_Receiver ? m_Receiver->AudioSamplingFreq() : AUDIO_SAMPLING_FREQUENCY_INVALID));
|
|
|
|
OSDDRAWINFOBOTTOMBAR();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eFemonModeAC3:
|
|
|
|
OSDDRAWINFOTITLEBAR(tr("Stream Information"));
|
|
|
|
if (m_Receiver && m_Receiver->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;
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Bitrate"), *getAudioBitrate(m_Receiver->AC3Bitrate(), m_Receiver->AC3StreamBitrate()));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Sampling Frequency"), *getAudioSamplingFreq(m_Receiver->AC3SamplingFreq()));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Bit Stream Mode"), *getAC3BitStreamMode(m_Receiver->AC3BitStreamMode(), m_Receiver->AC3AudioCodingMode()));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Audio Coding Mode"), *getAC3AudioCodingMode(m_Receiver->AC3AudioCodingMode(), m_Receiver->AC3BitStreamMode()));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Center Mix Level"), *getAC3CenterMixLevel(m_Receiver->AC3CenterMixLevel()));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Surround Mix Level"), *getAC3SurroundMixLevel(m_Receiver->AC3SurroundMixLevel()));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Dolby Surround Mode"), *getAC3DolbySurroundMode(m_Receiver->AC3DolbySurroundMode()));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2009-08-29 20:01:20 +02:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Low Frequency Effects"), *cString::sprintf("%s", m_Receiver->AC3Lfe() ? trVDR("on") : trVDR("off")));
|
2005-02-24 03:20:00 +01:00
|
|
|
offset += OSDROWHEIGHT;
|
2008-11-09 12:43:27 +01:00
|
|
|
OSDDRAWINFOINACTIVE(tr("Dialogue Normalization"), *getAC3DialogLevel(m_Receiver->AC3DialogLevel()));
|
|
|
|
}
|
|
|
|
OSDDRAWINFOBOTTOMBAR();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
OSDCLEARINFO();
|
|
|
|
break;
|
|
|
|
}
|
2004-03-03 03:20:00 +01:00
|
|
|
m_Osd->Flush();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cFemonOsd::Action(void)
|
|
|
|
{
|
2009-10-01 11:13:35 +02:00
|
|
|
debug("%s()\n", __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);
|
2006-09-17 03:20:00 +02:00
|
|
|
m_SvdrpFrontend = -1;
|
|
|
|
m_SvdrpVideoBitrate = -1.0;
|
|
|
|
m_SvdrpAudioBitrate = -1.0;
|
2012-02-05 13:04:04 +01:00
|
|
|
switch (m_DeviceSource) {
|
|
|
|
case DEVICESOURCE_PVRINPUT:
|
|
|
|
m_Quality = cDevice::ActualDevice()->SignalStrength();
|
|
|
|
m_QualityValid = (m_Quality >= 0);
|
|
|
|
m_Strength = cDevice::ActualDevice()->SignalStrength();
|
|
|
|
m_StrengthValid = (m_Strength >= 0);
|
2012-03-25 15:55:42 +02:00
|
|
|
m_FrontendName = cDevice::ActualDevice()->DeviceName();
|
2012-02-05 13:04:04 +01:00
|
|
|
m_FrontendStatus = (fe_status_t)(m_StrengthValid ? (FE_HAS_LOCK | FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC) : 0);
|
|
|
|
m_FrontendStatusValid = m_StrengthValid;
|
2012-02-19 17:54:19 +01:00
|
|
|
m_Signal = uint16_t(m_Strength * 0xFFFF / 100);
|
2012-02-05 13:04:04 +01:00
|
|
|
m_SignalValid = m_StrengthValid;
|
|
|
|
m_SNR = 0;
|
|
|
|
m_SNRValid = false;
|
|
|
|
m_BER = 0;
|
|
|
|
m_BERValid = false;
|
|
|
|
m_UNC = 0;
|
|
|
|
m_UNCValid = false;
|
|
|
|
break;
|
|
|
|
case DEVICESOURCE_IPTV:
|
|
|
|
m_Quality = cDevice::ActualDevice()->SignalQuality();
|
|
|
|
m_QualityValid = (m_Quality >= 0);
|
|
|
|
m_Strength = cDevice::ActualDevice()->SignalStrength();
|
|
|
|
m_StrengthValid = (m_Strength >= 0);
|
2012-03-25 15:55:42 +02:00
|
|
|
m_FrontendName = cDevice::ActualDevice()->DeviceName();
|
2012-02-05 13:04:04 +01:00
|
|
|
m_FrontendStatus = (fe_status_t)(m_StrengthValid ? (FE_HAS_LOCK | FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC) : 0);
|
|
|
|
m_FrontendStatusValid = m_StrengthValid;
|
2012-02-19 17:54:19 +01:00
|
|
|
m_Signal = uint16_t(m_Strength * 0xFFFF / 100);
|
2012-02-05 13:04:04 +01:00
|
|
|
m_SignalValid = m_StrengthValid;
|
2012-02-19 17:54:19 +01:00
|
|
|
m_SNR = uint16_t(m_Quality * 0xFFFF / 100);
|
2012-02-05 13:04:04 +01:00
|
|
|
m_SNRValid = m_QualityValid;
|
|
|
|
m_BER = 0;
|
|
|
|
m_BERValid = false;
|
|
|
|
m_UNC = 0;
|
|
|
|
m_UNCValid = false;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
case DEVICESOURCE_DVBAPI:
|
|
|
|
if (m_Frontend != -1) {
|
|
|
|
m_Quality = cDevice::ActualDevice()->SignalQuality();
|
|
|
|
m_QualityValid = (m_Quality >= 0);
|
|
|
|
m_Strength = cDevice::ActualDevice()->SignalStrength();
|
|
|
|
m_StrengthValid = (m_Strength >= 0);
|
2012-03-25 15:55:42 +02:00
|
|
|
m_FrontendName = cDevice::ActualDevice()->DeviceName();
|
2012-02-05 13:04:04 +01:00
|
|
|
m_FrontendStatusValid = (ioctl(m_Frontend, FE_READ_STATUS, &m_FrontendStatus) >= 0);
|
|
|
|
m_SignalValid = (ioctl(m_Frontend, FE_READ_SIGNAL_STRENGTH, &m_Signal) >= 0);
|
|
|
|
m_SNRValid = (ioctl(m_Frontend, FE_READ_SNR, &m_SNR) >= 0);
|
|
|
|
m_BERValid = (ioctl(m_Frontend, FE_READ_BER, &m_BER) >= 0);
|
|
|
|
m_UNCValid = (ioctl(m_Frontend, FE_READ_UNCORRECTED_BLOCKS, &m_UNC) >= 0);
|
|
|
|
}
|
|
|
|
else if (m_SvdrpConnection.handle >= 0) {
|
|
|
|
cmd.handle = m_SvdrpConnection.handle;
|
|
|
|
m_SvdrpPlugin->Service("SvdrpCommand-v1.0", &cmd);
|
|
|
|
if (cmd.responseCode == 900) {
|
|
|
|
m_StrengthValid = false;
|
|
|
|
m_QualityValid = false;
|
|
|
|
m_FrontendStatusValid = false;
|
|
|
|
m_SignalValid = false;
|
|
|
|
m_SNRValid = false;
|
|
|
|
m_BERValid = false;
|
|
|
|
m_UNCValid = false;
|
|
|
|
for (cLine *line = cmd.reply.First(); line; line = cmd.reply.Next(line)) {
|
|
|
|
const char *s = line->Text();
|
|
|
|
if (!strncasecmp(s, "CARD:", 5))
|
|
|
|
m_SvdrpFrontend = (int)strtol(s + 5, NULL, 10);
|
|
|
|
else if (!strncasecmp(s, "STRG:", 5)) {
|
|
|
|
m_Strength = (int)strtol(s + 5, NULL, 10);
|
|
|
|
m_StrengthValid = (m_Strength >= 0);
|
|
|
|
}
|
|
|
|
else if (!strncasecmp(s, "QUAL:", 5)) {
|
|
|
|
m_Quality = (int)strtol(s + 5, NULL, 10);
|
|
|
|
m_QualityValid = (m_Quality >= 0);
|
|
|
|
}
|
|
|
|
else if (!strncasecmp(s, "TYPE:", 5))
|
|
|
|
m_FrontendInfo.type = (fe_type_t)strtol(s + 5, NULL, 10);
|
|
|
|
else if (!strncasecmp(s, "NAME:", 5)) {
|
2012-03-25 15:55:42 +02:00
|
|
|
m_FrontendName = s + 5;
|
2012-02-05 13:04:04 +01:00
|
|
|
}
|
|
|
|
else if (!strncasecmp(s, "STAT:", 5)) {
|
|
|
|
m_FrontendStatus = (fe_status_t)strtol(s + 5, NULL, 16);
|
|
|
|
m_FrontendStatusValid = true;
|
|
|
|
}
|
|
|
|
else if (!strncasecmp(s, "SGNL:", 5)) {
|
|
|
|
m_Signal = (uint16_t)strtol(s + 5, NULL, 16);
|
|
|
|
m_SignalValid = true;
|
|
|
|
}
|
|
|
|
else if (!strncasecmp(s, "SNRA:", 5)) {
|
|
|
|
m_SNR = (uint16_t)strtol(s + 5, NULL, 16);
|
|
|
|
m_SNRValid = true;
|
|
|
|
}
|
|
|
|
else if (!strncasecmp(s, "BERA:", 5)) {
|
|
|
|
m_BER = (uint32_t)strtol(s + 5, NULL, 16);
|
|
|
|
m_BERValid = true;
|
|
|
|
}
|
|
|
|
else if (!strncasecmp(s, "UNCB:", 5)) {
|
|
|
|
m_UNC = (uint32_t)strtol(s + 5, NULL, 16);
|
|
|
|
m_UNCValid = true;
|
|
|
|
}
|
|
|
|
else if (!strncasecmp(s, "VIBR:", 5))
|
|
|
|
m_SvdrpVideoBitrate = (double)strtol(s + 5, NULL, 10);
|
|
|
|
else if (!strncasecmp(s, "AUBR:", 5))
|
|
|
|
m_SvdrpAudioBitrate = (double)strtol(s + 5, NULL, 10);
|
|
|
|
}
|
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();
|
2008-09-17 17:51:38 +02:00
|
|
|
m_Sleep.Wait(max((int)(100 * femonConfig.updateinterval - t.Elapsed()), 3));
|
2004-02-15 03:20:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cFemonOsd::Show(void)
|
|
|
|
{
|
2009-10-01 11:13:35 +02:00
|
|
|
debug("%s()\n", __PRETTY_FUNCTION__);
|
2005-01-23 03:20:00 +01:00
|
|
|
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
|
2012-03-31 10:47:57 +02:00
|
|
|
const cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
2012-02-05 13:04:04 +01:00
|
|
|
|
|
|
|
m_DeviceSource = DEVICESOURCE_DVBAPI;
|
|
|
|
if (channel) {
|
|
|
|
if (channel->IsSourceType('I'))
|
|
|
|
m_DeviceSource = DEVICESOURCE_IPTV;
|
|
|
|
else if (channel->IsSourceType('V'))
|
|
|
|
m_DeviceSource = DEVICESOURCE_PVRINPUT;
|
2004-02-15 03:20:00 +01:00
|
|
|
}
|
2012-02-05 13:04:04 +01:00
|
|
|
|
|
|
|
if (m_DeviceSource == DEVICESOURCE_DVBAPI) {
|
2012-03-29 20:48:52 +02:00
|
|
|
cDvbDevice *dev = getDvbDevice(cDevice::ActualDevice());
|
2012-02-05 13:04:04 +01:00
|
|
|
m_Frontend = dev ? open(*cString::sprintf(FRONTEND_DEVICE, dev->Adapter(), dev->Frontend()), O_RDONLY | O_NONBLOCK) : -1;
|
|
|
|
if (m_Frontend >= 0) {
|
|
|
|
if (ioctl(m_Frontend, FE_GET_INFO, &m_FrontendInfo) < 0) {
|
|
|
|
if (!femonConfig.usesvdrp)
|
|
|
|
error("cFemonOsd::Show() cannot read frontend info.");
|
|
|
|
close(m_Frontend);
|
|
|
|
m_Frontend = -1;
|
|
|
|
memset(&m_FrontendInfo, 0, sizeof(m_FrontendInfo));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (femonConfig.usesvdrp) {
|
|
|
|
if (!SvdrpConnect() || !SvdrpTune())
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
error("cFemonOsd::Show() cannot open frontend device.");
|
2006-09-17 03:20:00 +02:00
|
|
|
return;
|
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
|
|
|
|
m_Frontend = -1;
|
2006-09-17 03:20:00 +02:00
|
|
|
|
2010-02-25 19:33:20 +01:00
|
|
|
m_Osd = cOsdProvider::NewOsd(m_OsdLeft, m_OsdTop);
|
2004-02-15 03:20:00 +01:00
|
|
|
if (m_Osd) {
|
2008-11-23 03:45:20 +01:00
|
|
|
tArea Areas1[] = { { 0, 0, OSDWIDTH - 1, OSDHEIGHT - 1, 8 } };
|
2008-11-23 01:22:13 +01:00
|
|
|
if (Setup.AntiAlias && m_Osd->CanHandleAreas(Areas1, sizeof(Areas1) / sizeof(tArea)) == oeOk) {
|
2005-02-24 03:20:00 +01:00
|
|
|
m_Osd->SetAreas(Areas1, sizeof(Areas1) / sizeof(tArea));
|
2004-05-18 03:20:00 +02:00
|
|
|
}
|
|
|
|
else {
|
2008-11-23 03:45:20 +01:00
|
|
|
tArea Areas2[] = { { 0, OSDSTATUSWIN_Y(0), OSDWIDTH - 1, OSDSTATUSWIN_Y(0) + OSDSTATUSHEIGHT - 1, femonTheme[femonConfig.theme].bpp },
|
|
|
|
{ 0, OSDINFOWIN_Y(0), OSDWIDTH - 1, OSDINFOWIN_Y(0) + OSDROWHEIGHT - 1, femonTheme[femonConfig.theme].bpp },
|
|
|
|
{ 0, OSDINFOWIN_Y(OSDROWHEIGHT), OSDWIDTH - 1, OSDINFOWIN_Y(0) + OSDINFOHEIGHT - 1, 2 } };
|
2005-02-24 03:20:00 +01:00
|
|
|
m_Osd->SetAreas(Areas2, sizeof(Areas2) / sizeof(tArea));
|
2004-05-18 03:20:00 +02:00
|
|
|
}
|
2008-11-23 03:45:20 +01:00
|
|
|
OSDCLEARSTATUS();
|
|
|
|
OSDCLEARINFO();
|
2004-02-15 03:20:00 +01:00
|
|
|
m_Osd->Flush();
|
2008-11-23 21:26:48 +01:00
|
|
|
if (m_Receiver) {
|
|
|
|
m_Receiver->Deactivate();
|
|
|
|
DELETENULL(m_Receiver);
|
|
|
|
}
|
2012-02-05 13:04:04 +01:00
|
|
|
if (femonConfig.analyzestream && channel) {
|
2012-03-31 10:47:57 +02:00
|
|
|
m_Receiver = new cFemonReceiver(channel, IS_AUDIO_TRACK(track) ? int(track - ttAudioFirst) : 0, IS_DOLBY_TRACK(track) ? int(track - ttDolbyFirst) : 0);
|
2012-02-05 13:04:04 +01:00
|
|
|
cDevice::ActualDevice()->AttachReceiver(m_Receiver);
|
2004-03-03 03:20:00 +01:00
|
|
|
}
|
2004-02-15 03:20:00 +01:00
|
|
|
Start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-10 22:05:38 +01:00
|
|
|
void cFemonOsd::ChannelSwitch(const cDevice * device, int channelNumber, bool liveView)
|
2004-02-15 03:20:00 +01:00
|
|
|
{
|
2009-10-01 11:13:35 +02:00
|
|
|
debug("%s(%d,%d)\n", __PRETTY_FUNCTION__, device->DeviceNumber(), channelNumber);
|
2005-01-23 03:20:00 +01:00
|
|
|
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
|
2012-03-31 10:47:57 +02:00
|
|
|
const cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
2012-02-05 13:04:04 +01:00
|
|
|
|
2012-03-12 20:59:34 +01:00
|
|
|
if (!liveView || !channelNumber || !channel || channel->Number() != channelNumber)
|
2004-06-06 03:20:00 +02:00
|
|
|
return;
|
2012-02-05 13:04:04 +01:00
|
|
|
|
|
|
|
m_DeviceSource = DEVICESOURCE_DVBAPI;
|
|
|
|
if (channel) {
|
|
|
|
if (channel->IsSourceType('I'))
|
|
|
|
m_DeviceSource = DEVICESOURCE_IPTV;
|
|
|
|
else if (channel->IsSourceType('V'))
|
|
|
|
m_DeviceSource = DEVICESOURCE_PVRINPUT;
|
|
|
|
}
|
|
|
|
|
2006-09-17 03:20:00 +02:00
|
|
|
if (m_Frontend >= 0) {
|
2012-02-05 13:04:04 +01:00
|
|
|
close(m_Frontend);
|
|
|
|
m_Frontend = -1;
|
2004-02-15 03:20:00 +01:00
|
|
|
}
|
2012-02-05 13:04:04 +01:00
|
|
|
|
|
|
|
if (m_DeviceSource == DEVICESOURCE_DVBAPI) {
|
2012-03-29 20:48:52 +02:00
|
|
|
cDvbDevice *dev = getDvbDevice(cDevice::ActualDevice());
|
2012-02-05 13:04:04 +01:00
|
|
|
m_Frontend = dev ? open(*cString::sprintf(FRONTEND_DEVICE, dev->Adapter(), dev->Frontend()), O_RDONLY | O_NONBLOCK) : -1;
|
|
|
|
if (m_Frontend >= 0) {
|
|
|
|
if (ioctl(m_Frontend, FE_GET_INFO, &m_FrontendInfo) < 0) {
|
|
|
|
if (!femonConfig.usesvdrp)
|
|
|
|
error("cFemonOsd::ChannelSwitch() cannot read frontend info.");
|
|
|
|
close(m_Frontend);
|
|
|
|
m_Frontend = -1;
|
|
|
|
memset(&m_FrontendInfo, 0, sizeof(m_FrontendInfo));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (femonConfig.usesvdrp) {
|
|
|
|
if (!SvdrpConnect() || !SvdrpTune())
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
error("cFemonOsd::ChannelSwitch() cannot open frontend device.");
|
2006-09-17 03:20:00 +02:00
|
|
|
return;
|
2012-02-05 13:04:04 +01:00
|
|
|
}
|
2004-02-15 03:20:00 +01:00
|
|
|
}
|
2006-09-17 03:20:00 +02:00
|
|
|
|
2008-11-23 21:26:48 +01:00
|
|
|
if (m_Receiver) {
|
|
|
|
m_Receiver->Deactivate();
|
|
|
|
DELETENULL(m_Receiver);
|
|
|
|
}
|
2012-02-05 13:04:04 +01:00
|
|
|
if (femonConfig.analyzestream && channel) {
|
2012-03-31 10:47:57 +02:00
|
|
|
m_Receiver = new cFemonReceiver(channel, IS_AUDIO_TRACK(track) ? int(track - ttAudioFirst) : 0, IS_DOLBY_TRACK(track) ? int(track - ttDolbyFirst) : 0);
|
2012-02-05 13:04:04 +01:00
|
|
|
cDevice::ActualDevice()->AttachReceiver(m_Receiver);
|
2005-01-15 03:20:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cFemonOsd::SetAudioTrack(int Index, const char * const *Tracks)
|
|
|
|
{
|
2009-10-01 11:13:35 +02:00
|
|
|
debug("%s()\n", __PRETTY_FUNCTION__);
|
2005-01-23 03:20:00 +01:00
|
|
|
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
|
2008-11-23 21:26:48 +01:00
|
|
|
if (m_Receiver) {
|
|
|
|
m_Receiver->Deactivate();
|
|
|
|
DELETENULL(m_Receiver);
|
|
|
|
}
|
2005-01-15 03:20:00 +01:00
|
|
|
if (femonConfig.analyzestream) {
|
2012-03-31 10:47:57 +02:00
|
|
|
const cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
2008-06-20 03:20:00 +02:00
|
|
|
if (channel) {
|
2012-03-31 10:47:57 +02:00
|
|
|
m_Receiver = new cFemonReceiver(channel, IS_AUDIO_TRACK(track) ? int(track - ttAudioFirst) : 0, IS_DOLBY_TRACK(track) ? int(track - ttDolbyFirst) : 0);
|
2008-06-20 03:20:00 +02:00
|
|
|
cDevice::ActualDevice()->AttachReceiver(m_Receiver);
|
|
|
|
}
|
2004-03-03 03:20:00 +01:00
|
|
|
}
|
2004-02-15 03:20:00 +01:00
|
|
|
}
|
|
|
|
|
2005-11-13 03:20:00 +01:00
|
|
|
bool cFemonOsd::DeviceSwitch(int direction)
|
|
|
|
{
|
2009-10-01 11:13:35 +02:00
|
|
|
debug("%s()\n", __PRETTY_FUNCTION__);
|
2006-06-06 03:20:00 +02:00
|
|
|
int device = cDevice::ActualDevice()->DeviceNumber();
|
2005-11-13 03:20:00 +01:00
|
|
|
direction = sgn(direction);
|
|
|
|
if (device >= 0) {
|
|
|
|
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++) {
|
2010-03-06 21:01:42 +01:00
|
|
|
if (direction >= 0) {
|
2008-06-20 03:20:00 +02:00
|
|
|
if (++device >= cDevice::NumDevices())
|
|
|
|
device = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (--device < 0)
|
|
|
|
device = cDevice::NumDevices() - 1;
|
|
|
|
}
|
|
|
|
if (cDevice::GetDevice(device)->ProvidesChannel(channel, 0)) {
|
2009-10-01 11:13:35 +02:00
|
|
|
debug("%s(%d) device(%d)\n", __PRETTY_FUNCTION__, direction, device);
|
2012-03-10 22:05:38 +01:00
|
|
|
cStatus::MsgChannelSwitch(cDevice::PrimaryDevice(), 0, true);
|
2008-06-20 03:20:00 +02:00
|
|
|
cControl::Shutdown();
|
|
|
|
cDevice::GetDevice(device)->SwitchChannel(channel, true);
|
|
|
|
if (cDevice::GetDevice(device) == cDevice::PrimaryDevice())
|
|
|
|
cDevice::GetDevice(device)->ForceTransferMode();
|
2010-02-01 12:48:28 +01:00
|
|
|
cControl::Launch(new cTransferControl(cDevice::GetDevice(device), channel));
|
2012-03-10 22:05:38 +01:00
|
|
|
cStatus::MsgChannelSwitch(cDevice::PrimaryDevice(), channel->Number(), true);
|
2008-06-20 03:20:00 +02:00
|
|
|
return (true);
|
|
|
|
}
|
2005-11-13 03:20:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (false);
|
|
|
|
}
|
|
|
|
|
2006-09-17 03:20:00 +02:00
|
|
|
bool cFemonOsd::SvdrpConnect(void)
|
|
|
|
{
|
|
|
|
if (m_SvdrpConnection.handle < 0) {
|
|
|
|
m_SvdrpPlugin = cPluginManager::GetPlugin(SVDRPPLUGIN);
|
|
|
|
if (m_SvdrpPlugin) {
|
|
|
|
m_SvdrpConnection.serverIp = femonConfig.svdrpip;
|
2009-03-24 11:51:51 +01:00
|
|
|
m_SvdrpConnection.serverPort = (unsigned short)femonConfig.svdrpport;
|
2006-09-17 03:20:00 +02:00
|
|
|
m_SvdrpConnection.shared = true;
|
|
|
|
m_SvdrpPlugin->Service("SvdrpConnection-v1.0", &m_SvdrpConnection);
|
|
|
|
if (m_SvdrpConnection.handle >= 0) {
|
|
|
|
SvdrpCommand_v1_0 cmd;
|
2009-08-28 19:54:34 +02:00
|
|
|
cmd.handle = m_SvdrpConnection.handle;
|
2006-09-17 03:20:00 +02:00
|
|
|
cmd.command = cString::sprintf("PLUG %s\r\n", PLUGIN_NAME_I18N);
|
|
|
|
m_SvdrpPlugin->Service("SvdrpCommand-v1.0", &cmd);
|
|
|
|
if (cmd.responseCode != 214) {
|
|
|
|
m_SvdrpPlugin->Service("SvdrpConnection-v1.0", &m_SvdrpConnection); // close connection
|
2009-10-01 11:13:35 +02:00
|
|
|
error("cFemonOsd::SvdrpConnect() cannot find plugin '%s' on server %s.", PLUGIN_NAME_I18N, *m_SvdrpConnection.serverIp);
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2009-10-01 11:13:35 +02:00
|
|
|
error("cFemonOsd::SvdrpConnect() cannot connect to SVDRP server.");
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
|
|
|
else
|
2009-10-01 11:13:35 +02:00
|
|
|
error("cFemonOsd::SvdrpConnect() cannot find plugin '%s'.", SVDRPPLUGIN);
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
|
|
|
return m_SvdrpConnection.handle >= 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cFemonOsd::SvdrpTune(void)
|
|
|
|
{
|
|
|
|
if (m_SvdrpPlugin && m_SvdrpConnection.handle >= 0) {
|
|
|
|
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
|
|
|
if (channel) {
|
|
|
|
SvdrpCommand_v1_0 cmd;
|
2009-08-28 19:54:34 +02:00
|
|
|
cmd.handle = m_SvdrpConnection.handle;
|
2006-09-17 03:20:00 +02:00
|
|
|
cmd.command = cString::sprintf("CHAN %s\r\n", *channel->GetChannelID().ToString());
|
|
|
|
m_SvdrpPlugin->Service("SvdrpCommand-v1.0", &cmd);
|
|
|
|
if (cmd.responseCode == 250)
|
|
|
|
return true;
|
2009-10-01 11:13:35 +02:00
|
|
|
error("cFemonOsd::SvdrpTune() cannot tune server channel.");
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
|
|
|
else
|
2009-10-01 11:13:35 +02:00
|
|
|
error("cFemonOsd::SvdrpTune() invalid channel.");
|
2006-09-17 03:20:00 +02:00
|
|
|
}
|
|
|
|
else
|
2009-10-01 11:13:35 +02:00
|
|
|
error("cFemonOsd::SvdrpTune() unexpected connection state.");
|
2006-09-17 03:20:00 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2005-11-13 03:20:00 +01:00
|
|
|
double cFemonOsd::GetVideoBitrate(void)
|
|
|
|
{
|
2009-10-01 11:13:35 +02:00
|
|
|
debug("%s()\n", __PRETTY_FUNCTION__);
|
2005-11-13 03:20:00 +01:00
|
|
|
double value = 0.0;
|
|
|
|
|
|
|
|
if (m_Receiver)
|
|
|
|
value = m_Receiver->VideoBitrate();
|
|
|
|
|
|
|
|
return (value);
|
|
|
|
}
|
|
|
|
|
|
|
|
double cFemonOsd::GetAudioBitrate(void)
|
|
|
|
{
|
2009-10-01 11:13:35 +02:00
|
|
|
debug("%s()\n", __PRETTY_FUNCTION__);
|
2005-11-13 03:20:00 +01:00
|
|
|
double value = 0.0;
|
|
|
|
|
|
|
|
if (m_Receiver)
|
|
|
|
value = m_Receiver->AudioBitrate();
|
|
|
|
|
|
|
|
return (value);
|
|
|
|
}
|
|
|
|
|
|
|
|
double cFemonOsd::GetDolbyBitrate(void)
|
|
|
|
{
|
2009-10-01 11:13:35 +02:00
|
|
|
debug("%s()\n", __PRETTY_FUNCTION__);
|
2005-11-13 03:20:00 +01:00
|
|
|
double value = 0.0;
|
|
|
|
|
|
|
|
if (m_Receiver)
|
|
|
|
value = m_Receiver->AC3Bitrate();
|
|
|
|
|
|
|
|
return (value);
|
|
|
|
}
|
|
|
|
|
2004-02-15 03:20:00 +01:00
|
|
|
eOSState cFemonOsd::ProcessKey(eKeys Key)
|
2009-08-28 19:54:34 +02:00
|
|
|
{
|
2004-02-15 03:20:00 +01:00
|
|
|
eOSState state = cOsdObject::ProcessKey(Key);
|
|
|
|
if (state == osUnknown) {
|
2011-12-04 18:30:24 +01:00
|
|
|
switch (int(Key)) {
|
2004-02-15 03:20:00 +01:00
|
|
|
case k0:
|
2004-03-16 03:20:00 +01:00
|
|
|
if ((m_Number == 0) && (m_OldNumber != 0)) {
|
|
|
|
m_Number = m_OldNumber;
|
|
|
|
m_OldNumber = cDevice::CurrentChannel();
|
|
|
|
Channels.SwitchTo(m_Number);
|
|
|
|
m_Number = 0;
|
2004-02-15 03:20:00 +01:00
|
|
|
return osContinue;
|
|
|
|
}
|
|
|
|
case k1 ... k9:
|
|
|
|
if (m_Number >= 0) {
|
|
|
|
m_Number = m_Number * 10 + Key - k0;
|
|
|
|
if (m_Number > 0) {
|
2004-03-03 03:20:00 +01:00
|
|
|
DrawStatusWindow();
|
2004-02-15 03:20:00 +01:00
|
|
|
cChannel *ch = Channels.GetByNumber(m_Number);
|
2005-01-15 03:20:00 +01:00
|
|
|
m_InputTime.Set(0);
|
2004-02-15 03:20:00 +01:00
|
|
|
// Lets see if there can be any useful further input:
|
|
|
|
int n = ch ? m_Number * 10 : 0;
|
|
|
|
while (ch && (ch = Channels.Next(ch)) != NULL) {
|
|
|
|
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:
|
2004-03-16 03:20:00 +01:00
|
|
|
m_OldNumber = cDevice::CurrentChannel();
|
2004-02-15 03:20:00 +01:00
|
|
|
Channels.SwitchTo(m_Number);
|
|
|
|
m_Number = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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:
|
2004-03-16 03:20:00 +01:00
|
|
|
m_OldNumber = cDevice::CurrentChannel();
|
2004-02-15 03:20:00 +01:00
|
|
|
cDevice::SwitchChannel(NORMALKEY(Key) == kUp ? 1 : -1);
|
2004-03-16 03:20:00 +01:00
|
|
|
m_Number = 0;
|
2004-02-15 03:20:00 +01:00
|
|
|
break;
|
|
|
|
case kNone:
|
2005-01-15 03:20:00 +01:00
|
|
|
if (m_Number && (m_InputTime.Elapsed() > CHANNELINPUT_TIMEOUT)) {
|
2004-02-15 03:20:00 +01:00
|
|
|
if (Channels.GetByNumber(m_Number)) {
|
2004-03-16 03:20:00 +01:00
|
|
|
m_OldNumber = cDevice::CurrentChannel();
|
2004-02-15 03:20:00 +01:00
|
|
|
Channels.SwitchTo(m_Number);
|
|
|
|
m_Number = 0;
|
|
|
|
}
|
|
|
|
else {
|
2005-01-15 03:20:00 +01:00
|
|
|
m_InputTime.Set(0);
|
2004-03-03 03:20:00 +01:00
|
|
|
m_Number = 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
|
2008-06-20 03:20:00 +02:00
|
|
|
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
|
|
|
|
if (++m_DisplayMode == eFemonModeAC3 && channel && !channel->Dpid(0)) m_DisplayMode++;
|
2005-02-24 03:20:00 +01:00
|
|
|
if (m_DisplayMode >= eFemonModeMaxNumber) m_DisplayMode = 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;
|
|
|
|
}
|