1
0
mirror of https://github.com/rofafor/vdr-plugin-femon.git synced 2023-10-10 13:36:53 +02:00

Removed error logging from unimplemented ioctl functions.

This commit is contained in:
Rolf Ahrenberg 2009-09-16 09:37:51 +03:00
parent ba133f15f8
commit fefb7f0fde
4 changed files with 61 additions and 40 deletions

View File

@ -380,3 +380,4 @@ VDR Plugin 'femon' Revision History
2009-xx-xx: Version 1.7.5 2009-xx-xx: Version 1.7.5
- Changed H.264 parser to show display aspect ratio. - Changed H.264 parser to show display aspect ratio.
- Removed error logging from unimplemented ioctl functions.

View File

@ -62,12 +62,12 @@
#define OSDDRAWSTATUSBAR(value) \ #define OSDDRAWSTATUSBAR(value) \
if (value > 0) { \ if (value > 0) { \
value = OSDBARWIDTH(value); \ int32_t barvalue = OSDBARWIDTH(value); \
m_Osd->DrawRectangle(0, OSDSTATUSWIN_Y(offset) + 3, min(OSDBARWIDTH(femonConfig.redlimit), value), OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, femonTheme[femonConfig.theme].clrRed); \ m_Osd->DrawRectangle(0, OSDSTATUSWIN_Y(offset) + 3, min(OSDBARWIDTH(femonConfig.redlimit), barvalue), OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, femonTheme[femonConfig.theme].clrRed); \
if (value > OSDBARWIDTH(femonConfig.redlimit)) \ if (barvalue > OSDBARWIDTH(femonConfig.redlimit)) \
m_Osd->DrawRectangle(OSDBARWIDTH(femonConfig.redlimit), OSDSTATUSWIN_Y(offset) + 3, min((OSDWIDTH * femonConfig.greenlimit / 100), value), OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, femonTheme[femonConfig.theme].clrYellow); \ 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 (value > OSDBARWIDTH(femonConfig.greenlimit)) \ if (barvalue > OSDBARWIDTH(femonConfig.greenlimit)) \
m_Osd->DrawRectangle(OSDBARWIDTH(femonConfig.greenlimit), OSDSTATUSWIN_Y(offset) + 3, value, OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, femonTheme[femonConfig.theme].clrGreen); \ m_Osd->DrawRectangle(OSDBARWIDTH(femonConfig.greenlimit), OSDSTATUSWIN_Y(offset) + 3, barvalue, OSDSTATUSWIN_Y(offset) + OSDROWHEIGHT - 3, femonTheme[femonConfig.theme].clrGreen); \
} }
#define OSDDRAWSTATUSTITLEBAR(title) \ #define OSDDRAWSTATUSTITLEBAR(title) \
@ -164,10 +164,10 @@ cFemonOsd::cFemonOsd()
m_SvdrpPlugin(NULL), m_SvdrpPlugin(NULL),
m_Number(0), m_Number(0),
m_OldNumber(0), m_OldNumber(0),
m_SNR(0), m_SNR(-1),
m_Signal(0), m_Signal(-1),
m_BER(0), m_BER(-1),
m_UNC(0), m_UNC(-1),
m_DisplayMode(femonConfig.displaymode), m_DisplayMode(femonConfig.displaymode),
m_OsdWidth(cOsd::OsdWidth()), m_OsdWidth(cOsd::OsdWidth()),
m_OsdHeight(cOsd::OsdHeight()), m_OsdHeight(cOsd::OsdHeight()),
@ -177,6 +177,8 @@ cFemonOsd::cFemonOsd()
{ {
int tmp; int tmp;
Dprintf("%s()\n", __PRETTY_FUNCTION__); Dprintf("%s()\n", __PRETTY_FUNCTION__);
memset(&m_FrontendInfo, 0, sizeof(m_FrontendInfo));
memset(&m_FrontendStatus, 0, sizeof(m_FrontendStatus));
m_SvdrpConnection.handle = -1; m_SvdrpConnection.handle = -1;
m_Font = cFont::CreateFont(Setup.FontSml, min(max(Setup.FontSmlSize, MINFONTSIZE), MAXFONTSIZE)); m_Font = cFont::CreateFont(Setup.FontSml, min(max(Setup.FontSmlSize, MINFONTSIZE), MAXFONTSIZE));
if (!m_Font || !m_Font->Height()) { if (!m_Font || !m_Font->Height()) {
@ -225,8 +227,6 @@ void cFemonOsd::DrawStatusWindow(void)
{ {
cMutexLock lock(&m_Mutex); cMutexLock lock(&m_Mutex);
cBitmap *bm = NULL; cBitmap *bm = NULL;
int snr = m_SNR / 655;
int signal = m_Signal / 655;
int offset = 0; int offset = 0;
int x = OSDWIDTH - OSDROUNDING; int x = OSDWIDTH - OSDROUNDING;
int y = 0; int y = 0;
@ -317,14 +317,18 @@ void cFemonOsd::DrawStatusWindow(void)
OSDDRAWSTATUSBM(OSDSPACING); OSDDRAWSTATUSBM(OSDSPACING);
} }
offset += OSDROWHEIGHT; offset += OSDROWHEIGHT;
OSDDRAWSTATUSBAR(signal); if (m_Signal >= 0)
OSDDRAWSTATUSBAR(m_Signal / 655);
offset += OSDROWHEIGHT; offset += OSDROWHEIGHT;
OSDDRAWSTATUSBAR(snr); if (m_SNR >= 0)
OSDDRAWSTATUSBAR(m_SNR / 655);
offset += OSDROWHEIGHT; offset += OSDROWHEIGHT;
OSDDRAWSTATUSVALUES("STR:", *cString::sprintf("%04x", m_Signal), *cString::sprintf("(%2d%%)", m_Signal / 655), "BER:", *cString::sprintf("%08x", m_BER), OSDDRAWSTATUSVALUES("STR:", (m_Signal >= 0) ? *cString::sprintf("%04x", m_Signal) : "---", (m_Signal >= 0) ? *cString::sprintf("(%2d%%)", m_Signal / 655) : "",
*cString::sprintf("%s:", tr("Video")), *getBitrateMbits(m_Receiver ? m_Receiver->VideoBitrate() : (m_SvdrpFrontend >= 0 ? m_SvdrpVideoBitrate : -1.0))); "BER:", (m_BER >= 0) ? *cString::sprintf("%08lx", m_BER) : "---", *cString::sprintf("%s:", tr("Video")),
*getBitrateMbits(m_Receiver ? m_Receiver->VideoBitrate() : (m_SvdrpFrontend >= 0 ? m_SvdrpVideoBitrate : -1.0)));
offset += OSDROWHEIGHT; offset += OSDROWHEIGHT;
OSDDRAWSTATUSVALUES("SNR:", *cString::sprintf("%04x", m_SNR), *cString::sprintf("(%2d%%)", m_SNR / 655), "UNC:", *cString::sprintf("%08x", m_UNC), OSDDRAWSTATUSVALUES("SNR:", (m_SNR >= 0) ? *cString::sprintf("%04x", m_SNR) : "---", (m_SNR >= 0) ? *cString::sprintf("(%2d%%)", m_SNR / 655) : "",
"UNC:", (m_UNC >= 0) ? *cString::sprintf("%08lx", m_UNC) : "---",
*cString::sprintf("%s:", (m_Receiver && m_Receiver->AC3Valid() && IS_DOLBY_TRACK(track)) ? tr("AC-3") : tr("Audio")), *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))); *getBitrateKbits(m_Receiver ? ((m_Receiver->AC3Valid() && IS_DOLBY_TRACK(track)) ? m_Receiver->AC3Bitrate() : m_Receiver->AudioBitrate()) : (m_SvdrpFrontend >= 0 ? m_SvdrpAudioBitrate : -1.0)));
offset += OSDROWHEIGHT; offset += OSDROWHEIGHT;
@ -497,11 +501,16 @@ void cFemonOsd::Action(void)
m_SvdrpVideoBitrate = -1.0; m_SvdrpVideoBitrate = -1.0;
m_SvdrpAudioBitrate = -1.0; m_SvdrpAudioBitrate = -1.0;
if (m_Frontend != -1) { if (m_Frontend != -1) {
CHECK(ioctl(m_Frontend, FE_READ_STATUS, &m_FrontendStatus)); if (ioctl(m_Frontend, FE_READ_STATUS, &m_FrontendStatus) < 0)
CHECK(ioctl(m_Frontend, FE_READ_SIGNAL_STRENGTH, &m_Signal)); memset(&m_FrontendStatus, 0, sizeof(m_FrontendStatus));
CHECK(ioctl(m_Frontend, FE_READ_SNR, &m_SNR)); if (ioctl(m_Frontend, FE_READ_SIGNAL_STRENGTH, &m_Signal) < 0)
CHECK(ioctl(m_Frontend, FE_READ_BER, &m_BER)); m_Signal = -1;
CHECK(ioctl(m_Frontend, FE_READ_UNCORRECTED_BLOCKS, &m_UNC)); if (ioctl(m_Frontend, FE_READ_SNR, &m_SNR) < 0)
m_SNR = -1;
if (ioctl(m_Frontend, FE_READ_BER, &m_BER) < 0)
m_BER = -1;
if (ioctl(m_Frontend, FE_READ_UNCORRECTED_BLOCKS, &m_UNC) < 0)
m_UNC = -1;
DrawInfoWindow(); DrawInfoWindow();
DrawStatusWindow(); DrawStatusWindow();
} }
@ -520,13 +529,13 @@ void cFemonOsd::Action(void)
else if (!strncasecmp(s, "STAT:", 5)) else if (!strncasecmp(s, "STAT:", 5))
m_FrontendStatus = (fe_status_t)strtol(s + 5, NULL, 16); m_FrontendStatus = (fe_status_t)strtol(s + 5, NULL, 16);
else if (!strncasecmp(s, "SGNL:", 5)) else if (!strncasecmp(s, "SGNL:", 5))
m_Signal = (uint16_t)strtol(s + 5, NULL, 16); m_Signal = (int32_t)strtol(s + 5, NULL, 16);
else if (!strncasecmp(s, "SNRA:", 5)) else if (!strncasecmp(s, "SNRA:", 5))
m_SNR = (uint16_t)strtol(s + 5, NULL, 16); m_SNR = (int32_t)strtol(s + 5, NULL, 16);
else if (!strncasecmp(s, "BERA:", 5)) else if (!strncasecmp(s, "BERA:", 5))
m_BER = (uint32_t)strtol(s + 5, NULL, 16); m_BER = (int64_t)strtol(s + 5, NULL, 16);
else if (!strncasecmp(s, "UNCB:", 5)) else if (!strncasecmp(s, "UNCB:", 5))
m_UNC = (uint32_t)strtol(s + 5, NULL, 16); m_UNC = (int64_t)strtol(s + 5, NULL, 16);
else if (!strncasecmp(s, "VIBR:", 5)) else if (!strncasecmp(s, "VIBR:", 5))
m_SvdrpVideoBitrate = (double)strtol(s + 5, NULL, 10); m_SvdrpVideoBitrate = (double)strtol(s + 5, NULL, 10);
else if (!strncasecmp(s, "AUBR:", 5)) else if (!strncasecmp(s, "AUBR:", 5))
@ -550,9 +559,11 @@ void cFemonOsd::Show(void)
m_Frontend = open(dev, O_RDONLY | O_NONBLOCK); m_Frontend = open(dev, O_RDONLY | O_NONBLOCK);
if (m_Frontend >= 0) { if (m_Frontend >= 0) {
if (ioctl(m_Frontend, FE_GET_INFO, &m_FrontendInfo) < 0) { if (ioctl(m_Frontend, FE_GET_INFO, &m_FrontendInfo) < 0) {
esyslog("ERROR: cFemonOsd::Show() cannot read frontend info."); if (!femonConfig.usesvdrp)
esyslog("ERROR: cFemonOsd::Show() cannot read frontend info.");
close(m_Frontend); close(m_Frontend);
m_Frontend = -1; m_Frontend = -1;
memset(&m_FrontendInfo, 0, sizeof(m_FrontendInfo));
return; return;
} }
} }
@ -610,9 +621,11 @@ void cFemonOsd::ChannelSwitch(const cDevice * device, int channelNumber)
m_Frontend = open(dev, O_RDONLY | O_NONBLOCK); m_Frontend = open(dev, O_RDONLY | O_NONBLOCK);
if (m_Frontend >= 0) { if (m_Frontend >= 0) {
if (ioctl(m_Frontend, FE_GET_INFO, &m_FrontendInfo) < 0) { if (ioctl(m_Frontend, FE_GET_INFO, &m_FrontendInfo) < 0) {
esyslog("ERROR: cFemonOsd::ChannelSwitch() cannot read frontend info."); if (!femonConfig.usesvdrp)
esyslog("ERROR: cFemonOsd::ChannelSwitch() cannot read frontend info.");
close(m_Frontend); close(m_Frontend);
m_Frontend = -1; m_Frontend = -1;
memset(&m_FrontendInfo, 0, sizeof(m_FrontendInfo));
return; return;
} }
} }

View File

@ -37,10 +37,10 @@ private:
dvb_frontend_info m_FrontendInfo; dvb_frontend_info m_FrontendInfo;
int m_Number; int m_Number;
int m_OldNumber; int m_OldNumber;
uint16_t m_SNR; int32_t m_SNR;
uint16_t m_Signal; int32_t m_Signal;
uint32_t m_BER; int64_t m_BER;
uint32_t m_UNC; int64_t m_UNC;
fe_status_t m_FrontendStatus; fe_status_t m_FrontendStatus;
int m_DisplayMode; int m_DisplayMode;
int m_OsdWidth; int m_OsdWidth;

View File

@ -86,15 +86,22 @@ cString getFrontendInfo(int cardIndex)
int fe = open(dev, O_RDONLY | O_NONBLOCK); int fe = open(dev, O_RDONLY | O_NONBLOCK);
if (fe < 0) if (fe < 0)
return NULL; return NULL;
CHECK(ioctl(fe, FE_GET_INFO, &value));
CHECK(ioctl(fe, FE_READ_STATUS, &status));
CHECK(ioctl(fe, FE_READ_SIGNAL_STRENGTH, &signal));
CHECK(ioctl(fe, FE_READ_SNR, &snr));
CHECK(ioctl(fe, FE_READ_BER, &ber));
CHECK(ioctl(fe, FE_READ_UNCORRECTED_BLOCKS, &unc));
close(fe);
info = cString::sprintf("CARD:%d\nTYPE:%d\nNAME:%s\nSTAT:%02X\nSGNL:%04X\nSNRA:%04X\nBERA:%08X\nUNCB:%08X", cardIndex, value.type, value.name, status, signal, snr, ber, unc); info = cString::sprintf("CARD:%d", cardIndex);
if (ioctl(fe, FE_GET_INFO, &value) >= 0)
info = cString::sprintf("%s\nTYPE:%d\nNAME:%s", *info, value.type, value.name);
if (ioctl(fe, FE_READ_STATUS, &status) >= 0)
info = cString::sprintf("%s\nSTAT:%02X", *info, status);
if (ioctl(fe, FE_READ_SIGNAL_STRENGTH, &signal) >= 0)
info = cString::sprintf("%s\nSGNL:%04X", *info, signal);
if (ioctl(fe, FE_READ_SNR, &snr) >= 0)
info = cString::sprintf("%s\nSNRA:%04X", *info, snr);
if (ioctl(fe, FE_READ_BER, &ber) >= 0)
info = cString::sprintf("%s\nBERA:%08X", *info, ber);
if (ioctl(fe, FE_READ_UNCORRECTED_BLOCKS, &unc) >= 0)
info = cString::sprintf("%s\nUNCB:%08X", *info, unc);
close(fe);
if (cFemonOsd::Instance()) if (cFemonOsd::Instance())
info = cString::sprintf("%s\nVIBR:%.0f\nAUBR:%.0f\nDDBR:%.0f", *info, cFemonOsd::Instance()->GetVideoBitrate(), cFemonOsd::Instance()->GetAudioBitrate(), cFemonOsd::Instance()->GetDolbyBitrate()); info = cString::sprintf("%s\nVIBR:%.0f\nAUBR:%.0f\nDDBR:%.0f", *info, cFemonOsd::Instance()->GetVideoBitrate(), cFemonOsd::Instance()->GetAudioBitrate(), cFemonOsd::Instance()->GetDolbyBitrate());