Fixed channel toggling with '0' key.

Bitrate calculation thread is now canceled immediately to speed up channel switching.
This commit is contained in:
Rolf Ahrenberg 2004-03-16 04:20:00 +02:00
parent 954f09182f
commit 43c68bcf23
7 changed files with 27 additions and 12 deletions

View File

@ -35,3 +35,8 @@ VDR Plugin 'femon' Revision History
- Fixed frequency, guard and bandwidth units in transponder information. - Fixed frequency, guard and bandwidth units in transponder information.
- Added Apid2, Dpid1, Dpid2 information. - Added Apid2, Dpid1, Dpid2 information.
- Added option to write signal information into system log. - Added option to write signal information into system log.
2004-03-16: Version 0.0.3b
- Fixed channel toggling with '0' key.
- Bitrate calculation thread is now canceled immediately to speed up channel switching.

2
README
View File

@ -11,7 +11,7 @@ See the file COPYING for license information.
Requirements: Requirements:
Ph.D. in Astro Physics and preferably a six-pack waiting in a fridge. Ph.D. in Astro Physics and preferably a six-pack waiting in a fridge.
Never trust a Klingon. "Qu'vaD lI' De'vam" Never trust a Klingon. "Qu'vaD lI' De'vam". Beam me up, Scotty!
Description: Description:

View File

@ -11,7 +11,7 @@
#include <vdr/plugin.h> #include <vdr/plugin.h>
static const char *VERSION = "0.0.3a"; static const char *VERSION = "0.0.3b";
static const char *DESCRIPTION = "DVB Signal Information Monitor (OSD)"; static const char *DESCRIPTION = "DVB Signal Information Monitor (OSD)";
static const char *MAINMENUENTRY = "Signal Information"; static const char *MAINMENUENTRY = "Signal Information";

View File

@ -58,6 +58,7 @@ cFemonOsd::cFemonOsd(void)
m_Frontend = -1; m_Frontend = -1;
m_Active = false; m_Active = false;
m_Number = 0; m_Number = 0;
m_OldNumber = 0;
m_InputTime = 0; m_InputTime = 0;
m_Signal = 0; m_Signal = 0;
m_SNR = 0; m_SNR = 0;
@ -72,7 +73,7 @@ cFemonOsd::~cFemonOsd(void)
//printf("cFemonOsd::~cFemonOsd()\n"); //printf("cFemonOsd::~cFemonOsd()\n");
if (m_Active) { if (m_Active) {
m_Active = false; m_Active = false;
Cancel(5); Cancel(3);
} }
if (m_Receiver) if (m_Receiver)
delete m_Receiver; delete m_Receiver;
@ -496,9 +497,11 @@ eOSState cFemonOsd::ProcessKey(eKeys Key)
if (state == osUnknown) { if (state == osUnknown) {
switch (Key & ~k_Repeat) { switch (Key & ~k_Repeat) {
case k0: case k0:
if (m_Number == 0) { if ((m_Number == 0) && (m_OldNumber != 0)) {
// keep the "Toggle channels" function working - however it isn't working now :) m_Number = m_OldNumber;
cRemote::Put(Key); m_OldNumber = cDevice::CurrentChannel();
Channels.SwitchTo(m_Number);
m_Number = 0;
return osContinue; return osContinue;
} }
case k1 ... k9: case k1 ... k9:
@ -522,6 +525,7 @@ eOSState cFemonOsd::ProcessKey(eKeys Key)
} }
if (n > 0) { if (n > 0) {
// This channel is the only one that fits the input, so let's take it right away: // This channel is the only one that fits the input, so let's take it right away:
m_OldNumber = cDevice::CurrentChannel();
Channels.SwitchTo(m_Number); Channels.SwitchTo(m_Number);
m_Number = 0; m_Number = 0;
} }
@ -530,13 +534,18 @@ eOSState cFemonOsd::ProcessKey(eKeys Key)
break; break;
case kBack: case kBack:
return osEnd; return osEnd;
case kUp|k_Repeat:
case kUp: case kUp:
case kDown|k_Repeat:
case kDown: case kDown:
m_OldNumber = cDevice::CurrentChannel();
cDevice::SwitchChannel(NORMALKEY(Key) == kUp ? 1 : -1); cDevice::SwitchChannel(NORMALKEY(Key) == kUp ? 1 : -1);
m_Number = 0;
break; break;
case kNone: case kNone:
if (m_Number && (time_ms() - m_InputTime > CHANNELINPUT_TIMEOUT)) { if (m_Number && (time_ms() - m_InputTime > CHANNELINPUT_TIMEOUT)) {
if (Channels.GetByNumber(m_Number)) { if (Channels.GetByNumber(m_Number)) {
m_OldNumber = cDevice::CurrentChannel();
Channels.SwitchTo(m_Number); Channels.SwitchTo(m_Number);
m_Number = 0; m_Number = 0;
} }

View File

@ -28,6 +28,7 @@ private:
int m_Frontend; int m_Frontend;
struct dvb_frontend_info m_FrontendInfo; struct dvb_frontend_info m_FrontendInfo;
int m_Number; int m_Number;
int m_OldNumber;
int m_InputTime; int m_InputTime;
uint16_t m_SNR; uint16_t m_SNR;
uint16_t m_Signal; uint16_t m_Signal;

View File

@ -32,7 +32,7 @@ cFemonReceiver::~cFemonReceiver(void)
//printf("cFemonReceiver::~cFemonReceiver()\n"); //printf("cFemonReceiver::~cFemonReceiver()\n");
if (m_Active) { if (m_Active) {
m_Active = false; m_Active = false;
Cancel(3); Cancel(0);
} }
} }
@ -45,7 +45,8 @@ void cFemonReceiver::Activate(bool On)
void cFemonReceiver::Receive(uchar *Data, int Length) void cFemonReceiver::Receive(uchar *Data, int Length)
{ {
//printf("cFemonReceiver::Receive()\n"); //printf("cFemonReceiver::Receive()\n");
if (Length == TS_SIZE) { // TS packet length: 188
if (Length == 188) {
int pid = ((Data[1] & 0x1f) << 8) | (Data[2]); int pid = ((Data[1] & 0x1f) << 8) | (Data[2]);
if (pid == m_VideoPid) { if (pid == m_VideoPid) {
m_VideoPacketCount++; m_VideoPacketCount++;
@ -64,10 +65,10 @@ void cFemonReceiver::Action(void)
#endif #endif
m_Active = true; m_Active = true;
while (m_Active) { while (m_Active) {
// should we strip the 4 byte header off from TS packet ? // TS packet 188 bytes - 4 byte header; MPEG standard defines 1Mbit = 1000000bit
m_VideoBitrate = (8.0 * TS_SIZE * m_VideoPacketCount) / (femonConfig.calcinterval * 102.4 * 1024.0); m_VideoBitrate = (8.0 * 184.0 * m_VideoPacketCount) / (femonConfig.calcinterval * 100000.0);
m_VideoPacketCount = 0; m_VideoPacketCount = 0;
m_AudioBitrate = (8.0 * TS_SIZE * m_AudioPacketCount) / (femonConfig.calcinterval * 102.4); m_AudioBitrate = (8.0 * 184.0 * m_AudioPacketCount) / (femonConfig.calcinterval * 100.0);
m_AudioPacketCount = 0; m_AudioPacketCount = 0;
usleep(100000L * femonConfig.calcinterval); usleep(100000L * femonConfig.calcinterval);
} }

View File

@ -9,7 +9,6 @@
#ifndef __FEMONRECEIVER_H #ifndef __FEMONRECEIVER_H
#define __FEMONRECEIVER_H #define __FEMONRECEIVER_H
#include <vdr/device.h> // only for TS_SIZE
#include <vdr/thread.h> #include <vdr/thread.h>
#include <vdr/receiver.h> #include <vdr/receiver.h>