From 6f9961f4994e75c4d76b611f5e79ecc880273b0c Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Sat, 15 Jan 2005 04:20:00 +0200 Subject: [PATCH] Updated for vdr-1.3.18. Added DEBUG mode (make DEBUG=1 plugins). OSD height is now user configurable. Added audio channel selection into Yellow key. --- HISTORY | 7 + README | 18 +-- femon.c | 5 +- femon.h | 2 +- femoncfg.c | 5 + femoncfg.h | 7 + femoni18n.c | 63 ++++++++ femonosd.c | 335 +++++++++++++++++++++++++++--------------- femonosd.h | 9 +- femonreceiver.c | 21 +-- symbols/apid1.xpm | 23 --- symbols/apid2.xpm | 23 --- symbols/dev0.xpm | 23 --- symbols/dev1.xpm | 23 --- symbols/dev2.xpm | 23 --- symbols/dev3.xpm | 23 --- symbols/device.xpm | 23 +++ symbols/five.xpm | 23 +++ symbols/four.xpm | 23 +++ symbols/monoleft.xpm | 23 +++ symbols/monoright.xpm | 23 +++ symbols/one.xpm | 23 +++ symbols/stereo.xpm | 23 +++ symbols/three.xpm | 23 +++ symbols/two.xpm | 23 +++ symbols/zero.xpm | 23 +++ 26 files changed, 561 insertions(+), 279 deletions(-) delete mode 100644 symbols/apid1.xpm delete mode 100644 symbols/apid2.xpm delete mode 100644 symbols/dev0.xpm delete mode 100644 symbols/dev1.xpm delete mode 100644 symbols/dev2.xpm delete mode 100644 symbols/dev3.xpm create mode 100644 symbols/device.xpm create mode 100644 symbols/five.xpm create mode 100644 symbols/four.xpm create mode 100644 symbols/monoleft.xpm create mode 100644 symbols/monoright.xpm create mode 100644 symbols/one.xpm create mode 100644 symbols/stereo.xpm create mode 100644 symbols/three.xpm create mode 100644 symbols/two.xpm create mode 100644 symbols/zero.xpm diff --git a/HISTORY b/HISTORY index 3385173..cb615c4 100644 --- a/HISTORY +++ b/HISTORY @@ -111,3 +111,10 @@ VDR Plugin 'femon' Revision History - Updated for vdr-1.3.17. - Fixed receiver related crash (Thanks to Marco Schluessler). + +2005-01-15: Version 0.7.7 + +- Updated for vdr-1.3.18. +- Added DEBUG mode (make DEBUG=1 plugins). +- OSD height is now user configurable. +- Added audio channel selection into Yellow key. diff --git a/README b/README index 4f783b5..527a4b5 100644 --- a/README +++ b/README @@ -30,7 +30,7 @@ Metzler Brothers. Terminology: -------------------------------------------------------------- -|## Channel Name ######################### [DD][AR][VF][A][D]| +|## Channel Name ########################## [AR][VF][A/DD][D]| |[=====Signal Strength in % ==============|=================]| |[=====Signal-to-Noise Ratio in % ========|=================]| | STR: #0000 (0%) BER: #00000000 Video: 0 Mbit/s | @@ -51,10 +51,9 @@ CARRIER - Found a DVB signal VITERBI - FEC (forward error correction) is stable SYNC - Found sync bytes -DD - AC-3 stream (optional) AR - Aspect Ratio: 1:1/4:3/16:9/2.21:1 (optional) VF - Video format: PAL/NTSC (optional) -A - Audio track: 1..2 (optional) +A/DD - Audio (0..5) / AC-3 track (optional) D - Device number: 0..3 (optional) Controls: @@ -63,9 +62,10 @@ ChanUp/ChanDn - Switch channel up/down Up/Down - Switch channel up/down 0-9 - Select channel Ok - Switch between display modes: basic, transponder, stream, AC-3 -Right/Left - Switch to next/previous device that provides the current channel -Green - Select language (APID) +Green - Select next audio track +Yellow - Select audio channel: stereo, mono left, mono right Back - Exit plugin +(Left/Right - Switch to next/previous device that provides the current channel) Installation: @@ -82,14 +82,14 @@ Notes: - The plugin supports only those DVB cards with _one_ frontend (do any cards with multiple frontends even exist?), because I haven't yet figured howto do it without patching the VDR core. -- Sometimes (read always) ttxtsubs plugin messes up the OSD - user should disable - ttxtsubs, but closing and reopening the femon plugin might help temporarily as - well. Btw., this same thing happens with OSDTeletext plugin too :) - Disable the stream analyze to speed up heavy zapping sessions. - The signal strength and signal-to-noise ratio values are comparable only between the same brand/model frontends. Due to the lack of proper frontend specifications those values cannot be calculated into any real units. -- Shrinked OSD is available for NTSC users: make NTSC_SYSTEM=1 +- If the OSD isn't visible, you've configured the OSD height too big or too + small. Please, try to adjust the variable on the setup page before writing + any bug reports. +- There's a shrinked default OSD height for NTSC users: make NTSC_SYSTEM=1 - The device switching feature is still non-functional. "Femon - A real womon who lives according to her natural feminine inclinations." diff --git a/femon.c b/femon.c index f0dbe25..ee3b4fa 100644 --- a/femon.c +++ b/femon.c @@ -12,7 +12,7 @@ #include "femonosd.h" #include "femon.h" -#if VDRVERSNUM && VDRVERSNUM < 10317 +#if VDRVERSNUM && VDRVERSNUM < 10318 #error "You don't exist! Go away!" #endif @@ -71,6 +71,7 @@ bool cPluginFemon::SetupParse(const char *Name, const char *Value) else if (!strcasecmp(Name, "SyslogOutput")) femonConfig.syslogoutput = atoi(Value); else if (!strcasecmp(Name, "DisplayMode")) femonConfig.displaymode = atoi(Value); else if (!strcasecmp(Name, "Position")) femonConfig.position = atoi(Value); + else if (!strcasecmp(Name, "OSDHeight")) femonConfig.osdheight = atoi(Value); else if (!strcasecmp(Name, "ShowCASystem")) femonConfig.showcasystem = atoi(Value); else if (!strcasecmp(Name, "RedLimit")) femonConfig.redlimit = atoi(Value); else if (!strcasecmp(Name, "GreenLimit")) femonConfig.greenlimit = atoi(Value); @@ -102,6 +103,7 @@ void cMenuFemonSetup::Setup(void) Add(new cMenuEditBoolItem( tr("Use Syslog Output"), &femonConfig.syslogoutput, tr("no"), tr("yes"))); Add(new cMenuEditStraItem( tr("Default Display Mode"), &femonConfig.displaymode, modeMaxNumber, dispmodes)); Add(new cMenuEditBoolItem( tr("Position"), &femonConfig.position, tr("bottom"), tr("top"))); + Add(new cMenuEditIntItem( tr("Height"), &femonConfig.osdheight, 400, 500)); Add(new cMenuEditBoolItem( tr("Show CA System"), &femonConfig.showcasystem, tr("no"), tr("yes"))); Add(new cMenuEditIntItem( tr("Red Limit [%]"), &femonConfig.redlimit, 1, 50)); Add(new cMenuEditIntItem( tr("Green Limit [%]"), &femonConfig.greenlimit, 51, 100)); @@ -120,6 +122,7 @@ void cMenuFemonSetup::Store(void) SetupStore("SyslogOutput", femonConfig.syslogoutput); SetupStore("DisplayMode", femonConfig.displaymode); SetupStore("Position", femonConfig.position); + SetupStore("OSDHeight", femonConfig.osdheight); SetupStore("ShowCASystem", femonConfig.showcasystem); SetupStore("RedLimit", femonConfig.redlimit); SetupStore("GreenLimit", femonConfig.greenlimit); diff --git a/femon.h b/femon.h index cabf9aa..d258645 100644 --- a/femon.h +++ b/femon.h @@ -11,7 +11,7 @@ #include -static const char *VERSION = "0.1.7"; +static const char *VERSION = "0.7.7"; static const char *DESCRIPTION = "DVB Signal Information Monitor (OSD)"; static const char *MAINMENUENTRY = "Signal Information"; diff --git a/femoncfg.c b/femoncfg.c index 69800fc..4de4c5a 100644 --- a/femoncfg.c +++ b/femoncfg.c @@ -22,4 +22,9 @@ cFemonConfig::cFemonConfig(void) calcinterval = 20; syslogoutput = 0; showcasystem = 0; +#ifdef NTSC_SYSTEM + osdheight = 420; +#else + osdheight = 480; +#endif } diff --git a/femoncfg.h b/femoncfg.h index e458a39..a24f30c 100644 --- a/femoncfg.h +++ b/femoncfg.h @@ -9,6 +9,12 @@ #ifndef __FEMONCFG_H #define __FEMONCFG_H +#ifdef DEBUG +#define debug(x) (x); +#else +#define debug(x) ; +#endif + enum dispModes { modeBasic, modeTransponder, @@ -31,6 +37,7 @@ public: int calcinterval; int syslogoutput; int showcasystem; + int osdheight; }; extern cFemonConfig femonConfig; diff --git a/femoni18n.c b/femoni18n.c index 50ab82f..e4cf76e 100644 --- a/femoni18n.c +++ b/femoni18n.c @@ -72,6 +72,27 @@ const tI18nPhrase Phrases[] = { "", // Eesti "", // Dansk }, + { "Height", // English + "Höhe", // Deutsch + "", // Slovenski + "Altezza", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "Korkeus", // suomi + "", // Polski + "", // Español + "", // ÅëëçíéêÜ (Greek) + "", // Svenska + "", // Romaneste + "", // Magyar + "", // Català + "²ëáÞâÐ", // ÀãááÚØÙ (Russian) + "", // Hrvatski (Croatian) + "", // Eesti + "", // Dansk + }, { "Default Display Mode", // English "Standard Anzeigemodus", // Deutsch "", // Slovenski @@ -1038,6 +1059,48 @@ const tI18nPhrase Phrases[] = { "kHz", // Eesti "kHz", // Dansk }, + { "Apid", // English + "Apid", // Deutsch + "Apid", // Slovenski + "Apid", // Italiano + "Apid", // Nederlands + "Apid", // Português + "Apid", // Français + "Apid", // Norsk + "Ääni PID", // suomi + "Apid", // Polski + "Apid", // Español + "Apid", // ÅëëçíéêÜ (Greek) + "Apid", // Svenska + "Apid", // Romaneste + "Apid", // Magyar + "Apid", // Català + "Apid", // ÀãááÚØÙ (Russian) + "Apid", // Hrvatski (Croatian) + "Apid", // Eesti + "Apid", // Dansk + }, + { "Dpid", // English + "Dpid", // Deutsch + "Dpid", // Slovenski + "Dpid", // Italiano + "Dpid", // Nederlands + "Dpid", // Português + "Dpid", // Français + "Dpid", // Norsk + "Dolby PID", // suomi + "Dpid", // Polski + "Dpid", // Español + "Dpid", // ÅëëçíéêÜ (Greek) + "Dpid", // Svenska + "Dpid", // Romaneste + "Dpid", // Magyar + "Dpid", // Català + "Dpid", // ÀãááÚØÙ (Russian) + "Dpid", // Hrvatski (Croatian) + "Dpid", // Eesti + "Dpid", // Dansk + }, { "Nid", // English "Nid", // Deutsch "Nid", // Slovenski diff --git a/femonosd.c b/femonosd.c index a57b228..e3c0e60 100644 --- a/femonosd.c +++ b/femonosd.c @@ -12,12 +12,16 @@ #include "femonreceiver.h" #include "femonosd.h" -#include "symbols/dev0.xpm" -#include "symbols/dev1.xpm" -#include "symbols/dev2.xpm" -#include "symbols/dev3.xpm" -#include "symbols/apid1.xpm" -#include "symbols/apid2.xpm" +#include "symbols/device.xpm" +#include "symbols/stereo.xpm" +#include "symbols/monoleft.xpm" +#include "symbols/monoright.xpm" +#include "symbols/zero.xpm" +#include "symbols/one.xpm" +#include "symbols/two.xpm" +#include "symbols/three.xpm" +#include "symbols/four.xpm" +#include "symbols/five.xpm" #include "symbols/ar11.xpm" #include "symbols/ar169.xpm" #include "symbols/ar2211.xpm" @@ -31,12 +35,8 @@ #define FRONTEND_DEVICE "/dev/dvb/adapter%d/frontend%d" #define CHANNELINPUT_TIMEOUT 1000 -#ifdef NTSC_SYSTEM -#define OSDHEIGHT 420 // in pixels -#else -#define OSDHEIGHT 480 // in pixels -#endif -#define OSDWIDTH 600 // in pixels +#define OSDHEIGHT femonConfig.osdheight // in pixels +#define OSDWIDTH 600 // in pixels #define OSDINFOHEIGHT (m_Font->Height() * 11) // in pixels (11 rows) #define OSDSTATUSHEIGHT (m_Font->Height() * 6) // in pixels (6 rows) @@ -50,12 +50,16 @@ #define clrBackground clrGray50 // this should be tied somehow into current theme -cBitmap cFemonOsd::bmDevice0(dev0_xpm); -cBitmap cFemonOsd::bmDevice1(dev1_xpm); -cBitmap cFemonOsd::bmDevice2(dev2_xpm); -cBitmap cFemonOsd::bmDevice3(dev3_xpm); -cBitmap cFemonOsd::bmApid1(apid1_xpm); -cBitmap cFemonOsd::bmApid2(apid2_xpm); +cBitmap cFemonOsd::bmDevice(device_xpm); +cBitmap cFemonOsd::bmStereo(stereo_xpm); +cBitmap cFemonOsd::bmMonoLeft(monoleft_xpm); +cBitmap cFemonOsd::bmMonoRight(monoright_xpm); +cBitmap cFemonOsd::bmZero(zero_xpm); +cBitmap cFemonOsd::bmOne(one_xpm); +cBitmap cFemonOsd::bmTwo(two_xpm); +cBitmap cFemonOsd::bmThree(three_xpm); +cBitmap cFemonOsd::bmFour(four_xpm); +cBitmap cFemonOsd::bmFive(five_xpm); cBitmap cFemonOsd::bmAspectRatio_1_1(ar11_xpm); cBitmap cFemonOsd::bmAspectRatio_16_9(ar169_xpm); cBitmap cFemonOsd::bmAspectRatio_2_21_1(ar2211_xpm); @@ -69,19 +73,19 @@ cBitmap cFemonOsd::bmDD51(dolbydigital51_xpm); cFemonOsd::cFemonOsd(void) :cOsdObject(true), cThread("femon osd") { - //printf("cFemonOsd::cFemonOsd()\n"); + debug(printf("cFemonOsd::cFemonOsd()\n")); m_Osd = NULL; m_Receiver = NULL; m_Frontend = -1; m_Active = false; m_Number = 0; m_OldNumber = 0; - m_InputTime = 0; m_Signal = 0; m_SNR = 0; m_BER = 0; m_UNC = 0; m_DisplayMode = femonConfig.displaymode; + m_InputTime.Set(0); m_Mutex = new cMutex(); if (Setup.UseSmallFont == 0) { // Dirty hack to force the small fonts... @@ -95,7 +99,7 @@ cFemonOsd::cFemonOsd(void) cFemonOsd::~cFemonOsd(void) { - //printf("cFemonOsd::~cFemonOsd()\n"); + debug(printf("cFemonOsd::~cFemonOsd()\n")); if (m_Active) { m_Active = false; Cancel(3); @@ -109,60 +113,127 @@ cFemonOsd::~cFemonOsd(void) void cFemonOsd::DrawStatusWindow(void) { cMutexLock lock(m_Mutex); - //printf("cFemonOsd::DrawStatusWindow()\n"); + debug(printf("cFemonOsd::DrawStatusWindow()\n")); char buf[128]; int snr = m_SNR / 655; int signal = m_Signal / 655; int offset = 0; int x = OSDWIDTH; int y = 0; + int value = 0; cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel()); if (m_Osd) { m_Osd->DrawRectangle(0, OSDSTATUSWIN_Y(0), OSDWIDTH, OSDSTATUSWIN_Y(OSDSTATUSHEIGHT), clrBackground); - snprintf(buf, sizeof(buf), "%d%s %s", m_Number ? m_Number : channel->Number(), m_Number ? "-" : "", channel->ShortName(true)); + snprintf(buf, sizeof(buf), "%d%s %s (%s)", m_Number ? m_Number : channel->Number(), m_Number ? "-" : "", channel->ShortName(true), channel->Provider()); m_Osd->DrawRectangle(0, OSDSTATUSWIN_Y(offset), OSDWIDTH, OSDSTATUSWIN_Y(offset+m_Font->Height()-1), clrWhite); m_Osd->DrawText(OSDSTATUSWIN_X(1), OSDSTATUSWIN_Y(offset), buf, clrBlack, clrWhite, m_Font); if (m_Receiver) { - int value = cDevice::ActualDevice()->CardIndex(); - if (value == 0) { - x -= bmDevice0.Width() + SPACING; - y = (m_Font->Height() - bmDevice0.Height()) / 2; + value = cDevice::ActualDevice()->CardIndex(); + if (value == 1) { + x -= bmOne.Width() + SPACING; + y = (m_Font->Height() - bmOne.Height()) / 2; if (y < 0) y = 0; - m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmDevice0, clrBlack, clrWhite); - } - else if (value == 1) { - x -= bmDevice1.Width() + SPACING; - y = (m_Font->Height() - bmDevice1.Height()) / 2; - if (y < 0) y = 0; - m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmDevice1, clrBlack, clrWhite); + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmOne, clrBlack, clrWhite); } else if (value == 2) { - x -= bmDevice2.Width() + SPACING; - y = (m_Font->Height() - bmDevice2.Height()) / 2; + x -= bmTwo.Width() + SPACING; + y = (m_Font->Height() - bmTwo.Height()) / 2; if (y < 0) y = 0; - m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmDevice2, clrBlack, clrWhite); + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmTwo, clrBlack, clrWhite); } else if (value == 3) { - x -= bmDevice3.Width() + SPACING; - y = (m_Font->Height() - bmDevice3.Height()) / 2; + x -= bmThree.Width() + SPACING; + y = (m_Font->Height() - bmThree.Height()) / 2; if (y < 0) y = 0; - m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmDevice3, clrBlack, clrWhite); + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmThree, clrBlack, clrWhite); } - value = -1; - const char **AudioTracks = cDevice::PrimaryDevice()->GetAudioTracks(&value); - if (AudioTracks) { - if (value == 0) { - x -= bmApid1.Width() + SPACING; - y = (m_Font->Height() - bmApid1.Height()) / 2; + else { + x -= bmZero.Width() + SPACING; + y = (m_Font->Height() - bmZero.Height()) / 2; + if (y < 0) y = 0; + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmZero, clrBlack, clrWhite); + } + x -= bmDevice.Width(); + y = (m_Font->Height() - bmDevice.Height()) / 2; + if (y < 0) y = 0; + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmDevice, clrBlack, clrWhite); + if (IS_AUDIO_TRACK(cDevice::PrimaryDevice()->GetCurrentAudioTrack())) { + value = int(cDevice::PrimaryDevice()->GetCurrentAudioTrack() - ttAudioFirst); + if (value == 1) { + x -= bmOne.Width() + SPACING; + y = (m_Font->Height() - bmOne.Height()) / 2; if (y < 0) y = 0; - m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmApid1, clrBlack, clrWhite); + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmOne, clrBlack, clrWhite); } - else if (value == 1) { - x -= bmApid2.Width() + SPACING; - y = (m_Font->Height() - bmApid2.Height()) / 2; + else if (value == 2) { + x -= bmTwo.Width() + SPACING; + y = (m_Font->Height() - bmTwo.Height()) / 2; if (y < 0) y = 0; - m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmApid2, clrBlack, clrWhite); + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmTwo, clrBlack, clrWhite); + } + else if (value == 3) { + x -= bmThree.Width() + SPACING; + y = (m_Font->Height() - bmThree.Height()) / 2; + if (y < 0) y = 0; + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmThree, clrBlack, clrWhite); + } + else if (value == 4) { + x -= bmFour.Width() + SPACING; + y = (m_Font->Height() - bmFour.Height()) / 2; + if (y < 0) y = 0; + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmFour, clrBlack, clrWhite); + } + else if (value == 5) { + x -= bmFive.Width() + SPACING; + y = (m_Font->Height() - bmFive.Height()) / 2; + if (y < 0) y = 0; + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmFive, clrBlack, clrWhite); + } + else { + x -= bmZero.Width() + SPACING; + y = (m_Font->Height() - bmZero.Height()) / 2; + if (y < 0) y = 0; + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmZero, clrBlack, clrWhite); + } + value = cDevice::PrimaryDevice()->GetAudioChannel(); + if (value == 1) { + x -= bmMonoLeft.Width(); + y = (m_Font->Height() - bmMonoLeft.Height()) / 2; + if (y < 0) y = 0; + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmMonoLeft, clrBlack, clrWhite); + } + else if (value == 2) { + x -= bmMonoRight.Width(); + y = (m_Font->Height() - bmMonoRight.Height()) / 2; + if (y < 0) y = 0; + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmMonoRight, clrBlack, clrWhite); + } + else { + x -= bmStereo.Width(); + y = (m_Font->Height() - bmStereo.Height()) / 2; + if (y < 0) y = 0; + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmStereo, clrBlack, clrWhite); + } + } + else if (m_Receiver && m_Receiver->AC3Valid() && IS_DOLBY_TRACK(cDevice::PrimaryDevice()->GetCurrentAudioTrack())) { + if (m_Receiver->AC3_5_1()) { + x -= bmDD51.Width() + SPACING; + y = (m_Font->Height() - bmDD51.Height()) / 2; + if (y < 0) y = 0; + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmDD51, clrBlack, clrWhite); + } + else if (m_Receiver->AC3_2_0()) { + x -= bmDD20.Width() + SPACING; + y = (m_Font->Height() - bmDD20.Height()) / 2; + if (y < 0) y = 0; + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmDD20, clrBlack, clrWhite); + } + else { + x -= bmDD.Width() + SPACING; + y = (m_Font->Height() - bmDD.Height()) / 2; + if (y < 0) y = 0; + m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmDD, clrBlack, clrWhite); } } value = m_Receiver->VideoFormat(); @@ -203,26 +274,6 @@ void cFemonOsd::DrawStatusWindow(void) if (y < 0) y = 0; m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmAspectRatio_2_21_1, clrBlack, clrWhite); } - if (m_Receiver && m_Receiver->AC3Valid()) { - if (m_Receiver->AC3_5_1()) { - x -= bmDD51.Width() + SPACING; - y = (m_Font->Height() - bmDD51.Height()) / 2; - if (y < 0) y = 0; - m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmDD51, clrBlack, clrWhite); - } - else if (m_Receiver->AC3_2_0()) { - x -= bmDD20.Width() + SPACING; - y = (m_Font->Height() - bmDD20.Height()) / 2; - if (y < 0) y = 0; - m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmDD20, clrBlack, clrWhite); - } - else { - x -= bmDD.Width() + SPACING; - y = (m_Font->Height() - bmDD.Height()) / 2; - if (y < 0) y = 0; - m_Osd->DrawBitmap(x, OSDSTATUSWIN_Y(offset+y), bmDD, clrBlack, clrWhite); - } - } } offset += m_Font->Height(); if (signal > 0) { @@ -269,9 +320,9 @@ void cFemonOsd::DrawStatusWindow(void) m_Osd->DrawText(OSDSTATUSWIN_X(4), OSDSTATUSWIN_Y(offset), "UNC:", clrWhite, clrBackground, m_Font); snprintf(buf, sizeof(buf), "%08x", m_UNC); m_Osd->DrawText(OSDSTATUSWIN_X(5), OSDSTATUSWIN_Y(offset), buf, clrWhite, clrBackground, m_Font); - snprintf(buf, sizeof(buf), "%s:", (m_Receiver && m_Receiver->AC3Valid()) ? tr("AC-3") : tr("Audio")); + snprintf(buf, sizeof(buf), "%s:", (m_Receiver && m_Receiver->AC3Valid() && IS_DOLBY_TRACK(cDevice::PrimaryDevice()->GetCurrentAudioTrack())) ? tr("AC-3") : tr("Audio")); m_Osd->DrawText(OSDSTATUSWIN_X(6), OSDSTATUSWIN_Y(offset), buf, clrWhite, clrBackground, m_Font); - if (m_Receiver) snprintf(buf, sizeof(buf), "%.0f %s", m_Receiver->AC3Valid() ? m_Receiver->AC3Bitrate() : m_Receiver->AudioBitrate(), tr("kbit/s")); + if (m_Receiver) snprintf(buf, sizeof(buf), "%.0f %s", (m_Receiver->AC3Valid() && IS_DOLBY_TRACK(cDevice::PrimaryDevice()->GetCurrentAudioTrack())) ? m_Receiver->AC3Bitrate() : m_Receiver->AudioBitrate(), tr("kbit/s")); else snprintf(buf, sizeof(buf), "--- %s", tr("kbit/s")); m_Osd->DrawText(OSDSTATUSWIN_X(7), OSDSTATUSWIN_Y(offset), buf, clrWhite, clrBackground, m_Font); offset += m_Font->Height(); @@ -287,7 +338,7 @@ void cFemonOsd::DrawStatusWindow(void) void cFemonOsd::DrawInfoWindow(void) { cMutexLock lock(m_Mutex); - //printf("cFemonOsd::DrawInfoWindow()\n"); + debug(printf("cFemonOsd::DrawInfoWindow()\n")); char buf[128]; char buf2[20]; int offset = 0; @@ -308,15 +359,21 @@ void cFemonOsd::DrawInfoWindow(void) snprintf(buf, sizeof(buf), "%d", channel->Ppid()); m_Osd->DrawText(OSDINFOWIN_X(4), OSDINFOWIN_Y(offset), buf, clrYellow, clrBackground, m_Font); offset += m_Font->Height(); - m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Apid1"), clrWhite, clrBackground, m_Font); - value = channel->Apid2(); - if (value) snprintf(buf, sizeof(buf), "%d, %d", channel->Apid1(), value); - else snprintf(buf, sizeof(buf), "%d", channel->Apid1()); + m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Apid"), clrWhite, clrBackground, m_Font); + snprintf(buf, sizeof(buf), "%d", channel->Apid(0)); + value = 1; + while (channel->Apid(value) && (value < MAXAPIDS)) { + snprintf(buf2, sizeof(buf2), ", %d", channel->Apid(value++)); + strncat(buf, buf2, sizeof(buf)); + } m_Osd->DrawText(OSDINFOWIN_X(2), OSDINFOWIN_Y(offset), buf, clrYellow, clrBackground, m_Font); - m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), tr("Dpid1"), clrWhite, clrBackground, m_Font); - value = channel->Dpid2(); - if (value) snprintf(buf, sizeof(buf), "%d, %d", channel->Dpid1(), value); - else snprintf(buf, sizeof(buf), "%d", channel->Dpid1()); + m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), tr("Dpid"), clrWhite, clrBackground, m_Font); + snprintf(buf, sizeof(buf), "%d", channel->Dpid(0)); + value = 1; + while (channel->Dpid(value) && (value < MAXAPIDS)) { + snprintf(buf2, sizeof(buf2), ", %d", channel->Dpid(value++)); + strncat(buf, buf2, sizeof(buf)); + } m_Osd->DrawText(OSDINFOWIN_X(4), OSDINFOWIN_Y(offset), buf, clrYellow, clrBackground, m_Font); offset += m_Font->Height(); m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("CA"), clrWhite, clrBackground, m_Font); @@ -419,7 +476,7 @@ void cFemonOsd::DrawInfoWindow(void) snprintf(buf, sizeof(buf), "%d %s", value, tr("MHz")); m_Osd->DrawText(OSDINFOWIN_X(2), OSDINFOWIN_Y(offset), buf, clrYellow, clrBackground, m_Font); m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), tr("Source"), clrWhite, clrBackground, m_Font); - snprintf(buf, sizeof(buf), "%s", cSource::ToString(channel->Source())); + snprintf(buf, sizeof(buf), "%s", *cSource::ToString(channel->Source())); m_Osd->DrawText(OSDINFOWIN_X(4), OSDINFOWIN_Y(offset), buf, clrYellow, clrBackground, m_Font); offset += m_Font->Height(); m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Srate"), clrWhite, clrBackground, m_Font); @@ -460,7 +517,7 @@ void cFemonOsd::DrawInfoWindow(void) snprintf(buf, sizeof(buf), "%d %s", value, tr("MHz")); m_Osd->DrawText(OSDINFOWIN_X(2), OSDINFOWIN_Y(offset), buf, clrYellow, clrBackground, m_Font); m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), tr("Source"), clrWhite, clrBackground, m_Font); - snprintf(buf, sizeof(buf), "%s", cSource::ToString(channel->Source())); + snprintf(buf, sizeof(buf), "%s", *cSource::ToString(channel->Source())); m_Osd->DrawText(OSDINFOWIN_X(4), OSDINFOWIN_Y(offset), buf, clrYellow, clrBackground, m_Font); offset += m_Font->Height(); m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Srate"), clrWhite, clrBackground, m_Font); @@ -630,9 +687,8 @@ void cFemonOsd::DrawInfoWindow(void) m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), buf, clrYellow, clrBackground, m_Font); offset += m_Font->Height(); m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Audio Stream"), clrYellow, clrBackground, m_Font); - value = -1; - cDevice::PrimaryDevice()->GetAudioTracks(&value); - snprintf(buf, sizeof(buf), "#%d", (value > 0 ? channel->Apid2() : channel->Apid1())); + value = int(cDevice::PrimaryDevice()->GetCurrentAudioTrack()); + snprintf(buf, sizeof(buf), "#%d", IS_AUDIO_TRACK(value) ? channel->Apid(value - ttAudioFirst) : channel->Apid(0)); m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), buf, clrYellow, clrBackground, m_Font); offset += m_Font->Height(); m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Bitrate"), clrWhite, clrBackground, m_Font); @@ -663,10 +719,11 @@ void cFemonOsd::DrawInfoWindow(void) else if (m_DisplayMode == modeAC3) { m_Osd->DrawRectangle(0, OSDINFOWIN_Y(0), OSDWIDTH, OSDINFOWIN_Y(OSDINFOHEIGHT), clrBackground); m_Osd->DrawRectangle(0, OSDINFOWIN_Y(offset), OSDWIDTH, OSDINFOWIN_Y(offset+m_Font->Height()-1), clrWhite); - snprintf(buf, sizeof(buf), "%s - %s #%d", tr("Stream Information"), tr("AC-3 Stream"), channel->Dpid1()); + value = int(cDevice::PrimaryDevice()->GetCurrentAudioTrack()); + snprintf(buf, sizeof(buf), "%s - %s #%d", tr("Stream Information"), tr("AC-3 Stream"), IS_DOLBY_TRACK(value) ? channel->Dpid(value - ttDolbyFirst) : 0); m_Osd->DrawText( OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), buf, clrBackground, clrWhite, m_Font); offset += m_Font->Height(); - if (m_Receiver && m_Receiver->AC3Valid()) { + if (m_Receiver && m_Receiver->AC3Valid() && IS_DOLBY_TRACK(cDevice::PrimaryDevice()->GetCurrentAudioTrack())) { m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Bitrate"), clrWhite, clrBackground, m_Font); snprintf(buf, sizeof(buf), "%.0f %s (%0.f %s)", m_Receiver->AC3StreamBitrate(), tr("kbit/s"), m_Receiver->AC3Bitrate(), tr("kbit/s")); m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), buf, clrYellow, clrBackground, m_Font); @@ -761,11 +818,11 @@ void cFemonOsd::DrawInfoWindow(void) void cFemonOsd::Action(void) { - int t0; - //printf("cFemonOsd::Action()\n"); + debug(printf("cFemonOsd::Action()\n")); + cTimeMs t; m_Active = true; while (m_Active) { - t0 = time_ms(); + t.Set(0); if (m_Frontend != -1) { CHECK(ioctl(m_Frontend, FE_READ_STATUS, &m_FrontendStatus)); CHECK(ioctl(m_Frontend, FE_READ_SIGNAL_STRENGTH, &m_Signal)); @@ -778,13 +835,15 @@ void cFemonOsd::Action(void) isyslog("Card #%d (%s) STR: %04x SNR: %04x BER: %08x UNC: %08x |%c|%c|%c|%c|%c|", cDevice::ActualDevice()->CardIndex(), m_FrontendInfo.name, m_Signal, m_SNR, m_BER, m_UNC, (m_FrontendStatus & FE_HAS_LOCK) ? 'L' : ' ', (m_FrontendStatus & FE_HAS_SIGNAL) ? 'S' : ' ', (m_FrontendStatus & FE_HAS_CARRIER) ? 'C' : ' ', (m_FrontendStatus & FE_HAS_VITERBI) ? 'V' : ' ', (m_FrontendStatus & FE_HAS_SYNC) ? 'Z' : ' '); } } - cCondWait::SleepMs(100 * femonConfig.updateinterval - (time_ms() - t0)); + cCondWait::SleepMs(100 * femonConfig.updateinterval - t.Elapsed()); } } void cFemonOsd::Show(void) { - //printf("cFemonOsd::Show()\n"); + debug(printf("cFemonOsd::Show()\n")); + eTrackType track = ttNone; + int apid = 0, dpid = 0; char *dev = NULL; asprintf(&dev, FRONTEND_DEVICE, cDevice::ActualDevice()->CardIndex(), 0); m_Frontend = open(dev, O_RDONLY | O_NONBLOCK); @@ -817,8 +876,11 @@ void cFemonOsd::Show(void) if (m_Receiver) delete m_Receiver; if (femonConfig.analyzestream) { + track = cDevice::PrimaryDevice()->GetCurrentAudioTrack(); + if (IS_AUDIO_TRACK(track)) apid = int(track - ttAudioFirst); + else if (IS_DOLBY_TRACK(track)) dpid = int(track - ttDolbyFirst); cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel()); - m_Receiver = new cFemonReceiver(channel->Ca(), channel->Vpid(), channel->Apid1(), channel->Dpid1()); + m_Receiver = new cFemonReceiver(channel->Ca(), channel->Vpid(), channel->Apid(apid), channel->Dpid(dpid)); cDevice::ActualDevice()->AttachReceiver(m_Receiver); } Start(); @@ -827,7 +889,9 @@ void cFemonOsd::Show(void) void cFemonOsd::ChannelSwitch(const cDevice * device, int channelNumber) { - //printf("cFemonOsd::ChannelSwitch()\n"); + debug(printf("cFemonOsd::ChannelSwitch()\n")); + eTrackType track = ttNone; + int apid = 0, dpid = 0; char *dev = NULL; if (!device->IsPrimaryDevice() || !channelNumber || cDevice::PrimaryDevice()->CurrentChannel() != channelNumber) return; @@ -849,8 +913,28 @@ void cFemonOsd::ChannelSwitch(const cDevice * device, int channelNumber) if (m_Receiver) delete m_Receiver; if (femonConfig.analyzestream) { + track = cDevice::PrimaryDevice()->GetCurrentAudioTrack(); + if (IS_AUDIO_TRACK(track)) apid = int(track - ttAudioFirst); + else if (IS_DOLBY_TRACK(track)) dpid = int(track - ttDolbyFirst); cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel()); - m_Receiver = new cFemonReceiver(channel->Ca(), channel->Vpid(), channel->Apid1(), channel->Dpid1()); + m_Receiver = new cFemonReceiver(channel->Ca(), channel->Vpid(), channel->Apid(apid), channel->Dpid(dpid)); + cDevice::ActualDevice()->AttachReceiver(m_Receiver); + } +} + +void cFemonOsd::SetAudioTrack(int Index, const char * const *Tracks) +{ + debug(printf("cFemonOsd::SetAudioTrack()\n")); + eTrackType track = ttNone; + int apid = 0, dpid = 0; + if (m_Receiver) + delete m_Receiver; + if (femonConfig.analyzestream) { + track = cDevice::PrimaryDevice()->GetCurrentAudioTrack(); + if (IS_AUDIO_TRACK(track)) apid = int(track - ttAudioFirst); + else if (IS_DOLBY_TRACK(track)) dpid = int(track - ttDolbyFirst); + cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel()); + m_Receiver = new cFemonReceiver(channel->Ca(), channel->Vpid(), channel->Apid(apid), channel->Dpid(dpid)); cDevice::ActualDevice()->AttachReceiver(m_Receiver); } } @@ -874,7 +958,7 @@ eOSState cFemonOsd::ProcessKey(eKeys Key) if (m_Number > 0) { DrawStatusWindow(); cChannel *ch = Channels.GetByNumber(m_Number); - m_InputTime = time_ms(); + m_InputTime.Set(0); // Lets see if there can be any useful further input: int n = ch ? m_Number * 10 : 0; while (ch && (ch = Channels.Next(ch)) != NULL) { @@ -900,23 +984,40 @@ eOSState cFemonOsd::ProcessKey(eKeys Key) return osEnd; case kGreen: { - int CurrentAudioTrack = -1; - const char **AudioTracks = cDevice::PrimaryDevice()->GetAudioTracks(&CurrentAudioTrack); - if (AudioTracks) { - const char **at = &AudioTracks[CurrentAudioTrack]; - if (!*++at) - at = AudioTracks; - cDevice::PrimaryDevice()->SetAudioTrack(at - AudioTracks); - if (femonConfig.analyzestream) { - cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel()); - if (m_Receiver) - delete m_Receiver; - m_Receiver = new cFemonReceiver(channel->Ca(), channel->Vpid(), (at - AudioTracks) ? channel->Apid2() : channel->Apid1(), channel->Dpid1()); - cDevice::ActualDevice()->AttachReceiver(m_Receiver); - } + 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]); } } break; + 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; case kRight: case kLeft: { @@ -924,7 +1025,7 @@ eOSState cFemonOsd::ProcessKey(eKeys Key) if (device >= 0) { cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel()); for (int i = 0; i < cDevice::NumDevices() - 1; i++) { - if (NORMALKEY(Key) == kRight) { + if (NORMALKEY(Key) == kBlue) { if (++device >= cDevice::NumDevices()) device = 0; } else { @@ -933,7 +1034,7 @@ eOSState cFemonOsd::ProcessKey(eKeys Key) if (cDevice::GetDevice(device)->ProvidesChannel(channel)) { //cStatus::MsgChannelSwitch(cDevice::GetDevice(device), 0); //implement some tuning mechanism here - //cControl::Launch(new cTransferControl(cDevice::GetDevice(device), channel->Vpid(), channel->Apid1(), channel->Apid2(), channel->Dpid1(), channel->Dpid2())); + //cControl::Launch(new cTransferControl(cDevice::GetDevice(device), channel->Vpid(), channel->Apid(0), channel->Apid(1), channel->Dpid(0), channel->Dpid(1))); //cStatus::MsgChannelSwitch(cDevice::GetDevice(device), channel->Number()); break; } @@ -950,21 +1051,21 @@ eOSState cFemonOsd::ProcessKey(eKeys Key) m_Number = 0; break; case kNone: - if (m_Number && (time_ms() - m_InputTime > CHANNELINPUT_TIMEOUT)) { + if (m_Number && (m_InputTime.Elapsed() > CHANNELINPUT_TIMEOUT)) { if (Channels.GetByNumber(m_Number)) { m_OldNumber = cDevice::CurrentChannel(); Channels.SwitchTo(m_Number); m_Number = 0; } else { - m_InputTime = time_ms(); + m_InputTime.Set(0); m_Number = 0; } } break; case kOk: // toggle between display modes - if (++m_DisplayMode == modeAC3 && !Channels.GetByNumber(cDevice::CurrentChannel())->Dpid1()) m_DisplayMode++; + if (++m_DisplayMode == modeAC3 && !Channels.GetByNumber(cDevice::CurrentChannel())->Dpid(0)) m_DisplayMode++; if (m_DisplayMode >= modeMaxNumber) m_DisplayMode = 0; DrawInfoWindow(); break; diff --git a/femonosd.h b/femonosd.h index 4d4dbfc..6cfc13f 100644 --- a/femonosd.h +++ b/femonosd.h @@ -17,6 +17,7 @@ #include #include #include +#include class cFemonOsd : public cOsdObject, public cThread, public cStatus { private: @@ -27,7 +28,6 @@ private: struct dvb_frontend_info m_FrontendInfo; int m_Number; int m_OldNumber; - int m_InputTime; uint16_t m_SNR; uint16_t m_Signal; uint32_t m_BER; @@ -35,15 +35,18 @@ private: fe_status_t m_FrontendStatus; int m_DisplayMode; const cFont *m_Font; + cTimeMs m_InputTime; cMutex* m_Mutex; - static cBitmap bmDevice0, bmDevice1, bmDevice2, bmDevice3, bmApid1, bmApid2, bmDD, bmDD20, bmDD51; - static cBitmap bmPAL, bmNTSC, bmAspectRatio_1_1, bmAspectRatio_16_9, bmAspectRatio_2_21_1, bmAspectRatio_4_3; + static cBitmap bmStereo, bmMonoLeft, bmMonoRight, bmDD, bmDD20, bmDD51; + static cBitmap bmZero, bmDevice, bmPAL, bmNTSC, bmOne, bmTwo, bmThree, bmFour, bmFive; + static cBitmap bmAspectRatio_1_1, bmAspectRatio_16_9, bmAspectRatio_2_21_1, bmAspectRatio_4_3; void DrawStatusWindow(void); void DrawInfoWindow(void); protected: virtual void Action(void); virtual void ChannelSwitch(const cDevice * device, int channelNumber); + virtual void SetAudioTrack(int Index, const char * const *Tracks); public: cFemonOsd(void); diff --git a/femonreceiver.c b/femonreceiver.c index 7f21712..0ffb14c 100644 --- a/femonreceiver.c +++ b/femonreceiver.c @@ -7,6 +7,7 @@ */ #include +#include #include "femoncfg.h" #include "femonreceiver.h" @@ -19,7 +20,7 @@ cFemonReceiver::cFemonReceiver(int Ca, int Vpid, int Apid, int Dpid) :cReceiver(Ca, -1, 3, Vpid, Apid, Dpid), cThread("femon receiver") { - //printf("cFemonReceiver::cFemonReceiver()\n"); + debug(printf("cFemonReceiver::cFemonReceiver()\n")); m_Active = false; m_VideoPid = Vpid; m_AudioPid = Apid; @@ -57,7 +58,7 @@ cFemonReceiver::cFemonReceiver(int Ca, int Vpid, int Apid, int Dpid) cFemonReceiver::~cFemonReceiver(void) { - //printf("cFemonReceiver::~cFemonReceiver()\n"); + debug(printf("cFemonReceiver::~cFemonReceiver()\n")); Detach(); if (m_Active) { m_Active = false; @@ -68,7 +69,7 @@ cFemonReceiver::~cFemonReceiver(void) /* The following function originates from libdvbmpeg: */ void cFemonReceiver::GetVideoInfo(uint8_t *mbuf, int count) { - //printf("cFemonReceiver::GetVideoInfo()\n"); + debug(printf("cFemonReceiver::GetVideoInfo()\n")); uint8_t *headr; int found = 0; int c = 0; @@ -161,7 +162,7 @@ static unsigned int samplerates[4] = /* The following function originates from libdvbmpeg: */ void cFemonReceiver::GetAudioInfo(uint8_t *mbuf, int count) { - //printf("cFemonReceiver::GetAudioInfo()\n"); + debug(printf("cFemonReceiver::GetAudioInfo()\n")); uint8_t *headr; int found = 0; int c = 0; @@ -253,7 +254,7 @@ void cFemonReceiver::GetAC3Info(uint8_t *mbuf, int count) void cFemonReceiver::Activate(bool On) { - //printf("cFemonReceiver::Activate()\n"); + debug(printf("cFemonReceiver::Activate()\n")); if (On) { if (!m_Active) Start(); @@ -266,7 +267,7 @@ void cFemonReceiver::Activate(bool On) void cFemonReceiver::Receive(uchar *Data, int Length) { - //printf("cFemonReceiver::Receive()\n"); + debug(printf("cFemonReceiver::Receive()\n")); // TS packet length: TS_SIZE if (Length == TS_SIZE) { int pid = ((Data[1] & 0x1f) << 8) | (Data[2]); @@ -309,11 +310,11 @@ void cFemonReceiver::Receive(uchar *Data, int Length) void cFemonReceiver::Action(void) { - int t0; - //printf("cFemonReceiver::Action()\n"); + debug(printf("cFemonReceiver::Action()\n")); + cTimeMs t; m_Active = true; while (m_Active) { - t0 = time_ms(); + t.Set(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; @@ -321,6 +322,6 @@ void cFemonReceiver::Action(void) m_AudioPacketCount = 0; m_AC3Bitrate = (8.0 * 184.0 * m_AC3PacketCount) / (femonConfig.calcinterval * 100.0); m_AC3PacketCount = 0; - cCondWait::SleepMs(100 * femonConfig.calcinterval - (time_ms() - t0)); + cCondWait::SleepMs(100 * femonConfig.calcinterval - t.Elapsed()); } } diff --git a/symbols/apid1.xpm b/symbols/apid1.xpm deleted file mode 100644 index 048c1ed..0000000 --- a/symbols/apid1.xpm +++ /dev/null @@ -1,23 +0,0 @@ -/* XPM */ -static char * apid1_xpm[] = { -"32 18 2 1", -". c #FFFFFF", -"+ c #000000", -"++++++++++++++++++++++++++++++++", -"+..............................+", -"+..............++.......++.....+", -"+............++++....+++++.....+", -"+..........+++.++....+++++.....+", -"+........+++...++.......++.....+", -"+...+++++++....++.......++.....+", -"+...++++++.....++.......++.....+", -"+...++..++.....++.......++.....+", -"+...++..++.....++.......++.....+", -"+...++++++.....++.......++.....+", -"+...+++++++....++.......++.....+", -"+........+++...++.......++.....+", -"+..........+++.++.......++.....+", -"+............++++.......++.....+", -"+.............+++.......++.....+", -"+..............................+", -"++++++++++++++++++++++++++++++++"}; diff --git a/symbols/apid2.xpm b/symbols/apid2.xpm deleted file mode 100644 index fe5249c..0000000 --- a/symbols/apid2.xpm +++ /dev/null @@ -1,23 +0,0 @@ -/* XPM */ -static char * apid2_xpm[] = { -"32 18 2 1", -". c #FFFFFF", -"+ c #000000", -"++++++++++++++++++++++++++++++++", -"+..............................+", -"+..............++.....++++.....+", -"+............++++...+++++++....+", -"+..........+++.++...++....++...+", -"+........+++...++.........++...+", -"+...+++++++....++.........++...+", -"+...++++++.....++........+++...+", -"+...++..++.....++.......+++....+", -"+...++..++.....++......+++.....+", -"+...++++++.....++.....+++......+", -"+...+++++++....++....+++.......+", -"+........+++...++...+++........+", -"+..........+++.++...++.........+", -"+............++++...++++++++...+", -"+.............+++...++++++++...+", -"+..............................+", -"++++++++++++++++++++++++++++++++"}; diff --git a/symbols/dev0.xpm b/symbols/dev0.xpm deleted file mode 100644 index 1b4670b..0000000 --- a/symbols/dev0.xpm +++ /dev/null @@ -1,23 +0,0 @@ -/* XPM */ -static char * dev0_xpm[] = { -"29 18 2 1", -". c #FFFFFF", -"+ c #000000", -"+++++++++++++++++++++++++++++", -"+...........................+", -"+.......+..+.......++++.....+", -"+.......+..+......++++++....+", -"+.......+..+......++..++....+", -"+....+++++++++...++....++...+", -"+....+++++++++...++....++...+", -"+......+..+......++....++...+", -"+......+..+......++....++...+", -"+......+..+......++....++...+", -"+......+..+......++....++...+", -"+...+++++++++....++....++...+", -"+...+++++++++....++....++...+", -"+.....+..+........++..++....+", -"+.....+..+........++++++....+", -"+.....+..+.........++++.....+", -"+...........................+", -"+++++++++++++++++++++++++++++"}; diff --git a/symbols/dev1.xpm b/symbols/dev1.xpm deleted file mode 100644 index 20df921..0000000 --- a/symbols/dev1.xpm +++ /dev/null @@ -1,23 +0,0 @@ -/* XPM */ -static char * dev1_xpm[] = { -"29 18 2 1", -". c #FFFFFF", -"+ c #000000", -"+++++++++++++++++++++++++++++", -"+...........................+", -"+.......+..+.........++.....+", -"+.......+..+......+++++.....+", -"+.......+..+......+++++.....+", -"+....+++++++++.......++.....+", -"+....+++++++++.......++.....+", -"+......+..+..........++.....+", -"+......+..+..........++.....+", -"+......+..+..........++.....+", -"+......+..+..........++.....+", -"+...+++++++++........++.....+", -"+...+++++++++........++.....+", -"+.....+..+...........++.....+", -"+.....+..+...........++.....+", -"+.....+..+...........++.....+", -"+...........................+", -"+++++++++++++++++++++++++++++"}; diff --git a/symbols/dev2.xpm b/symbols/dev2.xpm deleted file mode 100644 index abf44dc..0000000 --- a/symbols/dev2.xpm +++ /dev/null @@ -1,23 +0,0 @@ -/* XPM */ -static char * dev2_xpm[] = { -"29 18 2 1", -". c #FFFFFF", -"+ c #000000", -"+++++++++++++++++++++++++++++", -"+...........................+", -"+.......+..+.......++++.....+", -"+.......+..+.....+++++++....+", -"+.......+..+.....++....++...+", -"+....+++++++++.........++...+", -"+....+++++++++.........++...+", -"+......+..+...........+++...+", -"+......+..+..........+++....+", -"+......+..+.........+++.....+", -"+......+..+........+++......+", -"+...+++++++++.....+++.......+", -"+...+++++++++....+++........+", -"+.....+..+.......++.........+", -"+.....+..+.......++++++++...+", -"+.....+..+.......++++++++...+", -"+...........................+", -"+++++++++++++++++++++++++++++"}; diff --git a/symbols/dev3.xpm b/symbols/dev3.xpm deleted file mode 100644 index 4d4dd9d..0000000 --- a/symbols/dev3.xpm +++ /dev/null @@ -1,23 +0,0 @@ -/* XPM */ -static char * dev3_xpm[] = { -"29 18 2 1", -". c #FFFFFF", -"+ c #000000", -"+++++++++++++++++++++++++++++", -"+...........................+", -"+.......+..+.......+++++....+", -"+.......+..+......+++++++...+", -"+.......+..+.....++....++...+", -"+....+++++++++...++....++...+", -"+....+++++++++.........++...+", -"+......+..+...........++....+", -"+......+..+.........+++.....+", -"+......+..+.........++++....+", -"+......+..+...........+++...+", -"+...+++++++++..........++...+", -"+...+++++++++....++....++...+", -"+.....+..+.......++...+++...+", -"+.....+..+........++++++....+", -"+.....+..+.........++++.....+", -"+...........................+", -"+++++++++++++++++++++++++++++"}; diff --git a/symbols/device.xpm b/symbols/device.xpm new file mode 100644 index 0000000..949f342 --- /dev/null +++ b/symbols/device.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * device_xpm[] = { +"14 18 2 1", +". c #FFFFFF", +"+ c #000000", +"++++++++++++++", +"+.............", +"+.......+..+..", +"+.......+..+..", +"+.......+..+..", +"+....+++++++++", +"+....+++++++++", +"+......+..+...", +"+......+..+...", +"+......+..+...", +"+......+..+...", +"+...+++++++++.", +"+...+++++++++.", +"+.....+..+....", +"+.....+..+....", +"+.....+..+....", +"+.............", +"++++++++++++++"}; diff --git a/symbols/five.xpm b/symbols/five.xpm new file mode 100644 index 0000000..49c14f7 --- /dev/null +++ b/symbols/five.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * five_xpm[] = { +"15 18 2 1", +". c #FFFFFF", +"+ c #000000", +"+++++++++++++++", +"..............+", +"...+++++++....+", +"...+++++++....+", +"...++.........+", +"...++.........+", +"...++.........+", +"...++++++.....+", +"...+++++++....+", +"...++...+++...+", +".........++...+", +".........++...+", +"...++....++...+", +"...++...+++...+", +"...+++++++....+", +"....+++++.....+", +"..............+", +"+++++++++++++++"}; diff --git a/symbols/four.xpm b/symbols/four.xpm new file mode 100644 index 0000000..a2ffd56 --- /dev/null +++ b/symbols/four.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * four_xpm[] = { +"15 18 2 1", +". c #FFFFFF", +"+ c #000000", +"+++++++++++++++", +"..............+", +".........++...+", +"........+++...+", +".......++++...+", +"......++.++...+", +".....++..++...+", +".....++..++...+", +"....++...++...+", +"...++....++...+", +"...+++++++++..+", +"...+++++++++..+", +".........++...+", +".........++...+", +".........++...+", +".........++...+", +"..............+", +"+++++++++++++++"}; diff --git a/symbols/monoleft.xpm b/symbols/monoleft.xpm new file mode 100644 index 0000000..29ab478 --- /dev/null +++ b/symbols/monoleft.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * monoleft_xpm[] = { +"17 18 2 1", +". c #FFFFFF", +"+ c #000000", +"+++++++++++++++++", +"+................", +"+...++...........", +"+...++++.........", +"+...++++++.......", +"+...++++++++.....", +"+...+++++++++++++", +"+...+++++++++++++", +"+...+++++++++..++", +"+...+++++++++..++", +"+...+++++++++++++", +"+...+++++++++++++", +"+...++++++++.....", +"+...++++++.......", +"+...++++.........", +"+...+++..........", +"+................", +"+++++++++++++++++"}; diff --git a/symbols/monoright.xpm b/symbols/monoright.xpm new file mode 100644 index 0000000..2ae1080 --- /dev/null +++ b/symbols/monoright.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * monoright_xpm[] = { +"17 18 2 1", +". c #FFFFFF", +"+ c #000000", +"+++++++++++++++++", +"+................", +"+..............++", +"+............++++", +"+..........++++++", +"+........++++++++", +"+...+++++++++++++", +"+...+++++++++++++", +"+...++..+++++++++", +"+...++..+++++++++", +"+...+++++++++++++", +"+...+++++++++++++", +"+........++++++++", +"+..........++++++", +"+............++++", +"+.............+++", +"+................", +"+++++++++++++++++"}; diff --git a/symbols/one.xpm b/symbols/one.xpm new file mode 100644 index 0000000..715dfd5 --- /dev/null +++ b/symbols/one.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * one_xpm[] = { +"15 18 2 1", +". c #FFFFFF", +"+ c #000000", +"+++++++++++++++", +"..............+", +".......++.....+", +"....+++++.....+", +"....+++++.....+", +".......++.....+", +".......++.....+", +".......++.....+", +".......++.....+", +".......++.....+", +".......++.....+", +".......++.....+", +".......++.....+", +".......++.....+", +".......++.....+", +".......++.....+", +"..............+", +"+++++++++++++++"}; diff --git a/symbols/stereo.xpm b/symbols/stereo.xpm new file mode 100644 index 0000000..83345d5 --- /dev/null +++ b/symbols/stereo.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * stereo_xpm[] = { +"17 18 2 1", +". c #FFFFFF", +"+ c #000000", +"+++++++++++++++++", +"+................", +"+..............++", +"+............++++", +"+..........+++.++", +"+........+++...++", +"+...+++++++....++", +"+...++++++.....++", +"+...++..++.....++", +"+...++..++.....++", +"+...++++++.....++", +"+...+++++++....++", +"+........+++...++", +"+..........+++.++", +"+............++++", +"+.............+++", +"+................", +"+++++++++++++++++"}; diff --git a/symbols/three.xpm b/symbols/three.xpm new file mode 100644 index 0000000..f8622a0 --- /dev/null +++ b/symbols/three.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * three_xpm[] = { +"15 18 2 1", +". c #FFFFFF", +"+ c #000000", +"+++++++++++++++", +"..............+", +".....+++++....+", +"....+++++++...+", +"...++....++...+", +"...++....++...+", +".........++...+", +"........++....+", +"......+++.....+", +"......++++....+", +"........+++...+", +".........++...+", +"...++....++...+", +"...++...+++...+", +"....++++++....+", +".....++++.....+", +"..............+", +"+++++++++++++++"}; diff --git a/symbols/two.xpm b/symbols/two.xpm new file mode 100644 index 0000000..37245e7 --- /dev/null +++ b/symbols/two.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * two_xpm[] = { +"15 18 2 1", +". c #FFFFFF", +"+ c #000000", +"+++++++++++++++", +"..............+", +".....++++.....+", +"...+++++++....+", +"...++....++...+", +".........++...+", +".........++...+", +"........+++...+", +".......+++....+", +"......+++.....+", +".....+++......+", +"....+++.......+", +"...+++........+", +"...++.........+", +"...++++++++...+", +"...++++++++...+", +"..............+", +"+++++++++++++++"}; diff --git a/symbols/zero.xpm b/symbols/zero.xpm new file mode 100644 index 0000000..8cc290b --- /dev/null +++ b/symbols/zero.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * zero_xpm[] = { +"15 18 2 1", +". c #FFFFFF", +"+ c #000000", +"+++++++++++++++", +"..............+", +".....++++.....+", +"....++++++....+", +"....++..++....+", +"...++....++...+", +"...++....++...+", +"...++....++...+", +"...++....++...+", +"...++....++...+", +"...++....++...+", +"...++....++...+", +"...++....++...+", +"....++..++....+", +"....++++++....+", +".....++++.....+", +"..............+", +"+++++++++++++++"};