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

Added initial support for PVRINPUT devices (Thanks to Winfried Köhler).

Added initial support for IPTV devices.
This commit is contained in:
Rolf Ahrenberg 2012-02-05 14:04:04 +02:00
parent d809e98052
commit 09cf40f215
4 changed files with 191 additions and 117 deletions

View File

@ -427,3 +427,8 @@ VDR Plugin 'femon' Revision History
- Updated for vdr-1.7.23.
- Updated SVDRP interface.
- Added Hungarian translation (Thanks to Fuley Istvan).
2012-02-05: Version 1.7.13
- Added initial support for PVRINPUT devices (Thanks to Winfried Köhler).
- Added initial support for IPTV devices.

View File

@ -18,7 +18,7 @@
#error "VDR-1.7.23 API version or greater is required!"
#endif
static const char VERSION[] = "1.7.12";
static const char VERSION[] = "1.7.13";
static const char DESCRIPTION[] = trNOOP("DVB Signal Information Monitor (OSD)");
static const char MAINMENUENTRY[] = trNOOP("Signal Information");

View File

@ -184,6 +184,7 @@ cFemonOsd::cFemonOsd()
m_UNC(0),
m_UNCValid(false),
m_FrontendStatusValid(false),
m_DeviceSource(DEVICESOURCE_DVBAPI),
m_DisplayMode(femonConfig.displaymode),
m_OsdWidth(cOsd::OsdWidth() * (100 - femonConfig.downscale) / 100),
m_OsdHeight(cOsd::OsdHeight() * (100 - femonConfig.downscale) / 100),
@ -549,6 +550,41 @@ void cFemonOsd::Action(void)
m_SvdrpFrontend = -1;
m_SvdrpVideoBitrate = -1.0;
m_SvdrpAudioBitrate = -1.0;
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);
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;
m_Signal = m_Strength * 0xFFFF / 100;
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);
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;
m_Signal = m_Strength * 0xFFFF / 100;
m_SignalValid = m_StrengthValid;
m_SNR = m_Quality * 0xFFFF / 100;
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);
@ -559,8 +595,6 @@ void cFemonOsd::Action(void)
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);
DrawInfoWindow();
DrawStatusWindow();
}
else if (m_SvdrpConnection.handle >= 0) {
cmd.handle = m_SvdrpConnection.handle;
@ -616,9 +650,11 @@ void cFemonOsd::Action(void)
m_SvdrpAudioBitrate = (double)strtol(s + 5, NULL, 10);
}
}
}
break;
}
DrawInfoWindow();
DrawStatusWindow();
}
m_Sleep.Wait(max((int)(100 * femonConfig.updateinterval - t.Elapsed()), 3));
}
}
@ -627,6 +663,17 @@ void cFemonOsd::Show(void)
{
debug("%s()\n", __PRETTY_FUNCTION__);
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
m_DeviceSource = DEVICESOURCE_DVBAPI;
if (channel) {
if (channel->IsSourceType('I'))
m_DeviceSource = DEVICESOURCE_IPTV;
else if (channel->IsSourceType('V'))
m_DeviceSource = DEVICESOURCE_PVRINPUT;
}
if (m_DeviceSource == DEVICESOURCE_DVBAPI) {
cDvbDevice *dev = dynamic_cast<cDvbDevice*>(cDevice::ActualDevice());
m_Frontend = dev ? open(*cString::sprintf(FRONTEND_DEVICE, dev->Adapter(), dev->Frontend()), O_RDONLY | O_NONBLOCK) : -1;
if (m_Frontend >= 0) {
@ -647,6 +694,9 @@ void cFemonOsd::Show(void)
error("cFemonOsd::Show() cannot open frontend device.");
return;
}
}
else
m_Frontend = -1;
m_Osd = cOsdProvider::NewOsd(m_OsdLeft, m_OsdTop);
if (m_Osd) {
@ -667,13 +717,10 @@ void cFemonOsd::Show(void)
m_Receiver->Deactivate();
DELETENULL(m_Receiver);
}
if (femonConfig.analyzestream) {
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
if (channel) {
if (femonConfig.analyzestream && channel) {
m_Receiver = new cFemonReceiver(channel->Vtype(), channel->Vpid(), channel->Apid(IS_AUDIO_TRACK(track) ? int(track - ttAudioFirst) : 0), channel->Dpid(IS_DOLBY_TRACK(track) ? int(track - ttDolbyFirst) : 0));
cDevice::ActualDevice()->AttachReceiver(m_Receiver);
}
}
Start();
}
}
@ -682,9 +729,25 @@ void cFemonOsd::ChannelSwitch(const cDevice * device, int channelNumber)
{
debug("%s(%d,%d)\n", __PRETTY_FUNCTION__, device->DeviceNumber(), channelNumber);
eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
if (!device->IsPrimaryDevice() || !channelNumber || cDevice::PrimaryDevice()->CurrentChannel() != channelNumber)
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
if (!device->IsPrimaryDevice() || !channelNumber || !channel || channel->Number() != channelNumber)
return;
m_DeviceSource = DEVICESOURCE_DVBAPI;
if (channel) {
if (channel->IsSourceType('I'))
m_DeviceSource = DEVICESOURCE_IPTV;
else if (channel->IsSourceType('V'))
m_DeviceSource = DEVICESOURCE_PVRINPUT;
}
if (m_Frontend >= 0) {
close(m_Frontend);
m_Frontend = -1;
}
if (m_DeviceSource == DEVICESOURCE_DVBAPI) {
cDvbDevice *dev = dynamic_cast<cDvbDevice*>(cDevice::ActualDevice());
m_Frontend = dev ? open(*cString::sprintf(FRONTEND_DEVICE, dev->Adapter(), dev->Frontend()), O_RDONLY | O_NONBLOCK) : -1;
if (m_Frontend >= 0) {
@ -705,19 +768,17 @@ void cFemonOsd::ChannelSwitch(const cDevice * device, int channelNumber)
error("cFemonOsd::ChannelSwitch() cannot open frontend device.");
return;
}
}
if (m_Receiver) {
m_Receiver->Deactivate();
DELETENULL(m_Receiver);
}
if (femonConfig.analyzestream) {
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
if (channel) {
if (femonConfig.analyzestream && channel) {
m_Receiver = new cFemonReceiver(channel->Vtype(), channel->Vpid(), channel->Apid(IS_AUDIO_TRACK(track) ? int(track - ttAudioFirst) : 0), channel->Dpid(IS_DOLBY_TRACK(track) ? int(track - ttDolbyFirst) : 0));
cDevice::ActualDevice()->AttachReceiver(m_Receiver);
}
}
}
void cFemonOsd::SetAudioTrack(int Index, const char * const *Tracks)
{

View File

@ -24,6 +24,13 @@
class cFemonOsd : public cOsdObject, public cThread, public cStatus {
private:
enum eDeviceSourceType {
DEVICESOURCE_DVBAPI = 0,
DEVICESOURCE_IPTV,
DEVICESOURCE_PVRINPUT,
DEVICESOURCE_COUNT
};
static cFemonOsd *pInstance;
cOsd *m_Osd;
@ -51,6 +58,7 @@ private:
fe_status_t m_FrontendStatus;
bool m_FrontendStatusValid;
dvb_frontend_info m_FrontendInfo;
eDeviceSourceType m_DeviceSource;
int m_DisplayMode;
int m_OsdWidth;
int m_OsdHeight;