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.
- Added Apid2, Dpid1, Dpid2 information.
- 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:
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:

View File

@ -11,7 +11,7 @@
#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 *MAINMENUENTRY = "Signal Information";

View File

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

View File

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

View File

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

View File

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