diff --git a/README b/README index 1e26047..a56cbbf 100644 --- a/README +++ b/README @@ -50,6 +50,9 @@ Setup parameters: stream ringbuffer before data is transferred to VDR. The valid range: 0...40 +- Show statistics in = 0 Defines unit (bytes, kbytes, bits, kbits) + used in statistics menu. + The valid range: 0...3 - Use section filtering = 1 Defines whether section filtering shall be used. The valid range: 0...1 diff --git a/common.h b/common.h index 7d71c12..e85e72d 100644 --- a/common.h +++ b/common.h @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: common.h,v 1.4 2007/10/06 00:02:50 rahrenbe Exp $ + * $Id: common.h,v 1.5 2007/10/07 20:08:44 rahrenbe Exp $ */ #ifndef __IPTV_COMMON_H @@ -22,6 +22,12 @@ uint8_t payload(const uint8_t *tsp); #define error(x...) esyslog("IPTV: " x); #endif +#define IPTV_STATS_UNIT_IN_BYTES 0 +#define IPTV_STATS_UNIT_IN_KBYTES 1 +#define IPTV_STATS_UNIT_IN_BITS 2 +#define IPTV_STATS_UNIT_IN_KBITS 3 +#define IPTV_STATS_UNIT_COUNT 4 + #define SECTION_FILTER_TABLE_SIZE 7 typedef struct _section_filter_table_type { diff --git a/config.c b/config.c index 2822252..c319eb2 100644 --- a/config.c +++ b/config.c @@ -3,10 +3,9 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: config.c,v 1.13 2007/10/07 19:06:33 ajhseppa Exp $ + * $Id: config.c,v 1.14 2007/10/07 20:08:44 rahrenbe Exp $ */ -#include "common.h" #include "config.h" cIptvConfig IptvConfig; @@ -15,10 +14,9 @@ cIptvConfig::cIptvConfig(void) : readBufferTsCount(48), tsBufferSize(2), tsBufferPrefillRatio(0), + statsUnit(IPTV_STATS_UNIT_IN_KBYTES), sectionFiltering(1), - sidScanning(1), - statsInKilos(1), - statsInBytes(1) + sidScanning(1) { for (unsigned int i = 0; i < sizeof(disabledFilters); ++i) disabledFilters[i] = -1; diff --git a/config.h b/config.h index df3bb46..ec6849d 100644 --- a/config.h +++ b/config.h @@ -3,13 +3,14 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: config.h,v 1.11 2007/10/07 19:06:33 ajhseppa Exp $ + * $Id: config.h,v 1.12 2007/10/07 20:08:44 rahrenbe Exp $ */ #ifndef __IPTV_CONFIG_H #define __IPTV_CONFIG_H #include +#include "common.h" #include "config.h" class cIptvConfig @@ -18,10 +19,9 @@ protected: unsigned int readBufferTsCount; unsigned int tsBufferSize; unsigned int tsBufferPrefillRatio; + unsigned int statsUnit; unsigned int sectionFiltering; unsigned int sidScanning; - unsigned int statsInKilos; - unsigned int statsInBytes; int disabledFilters[SECTION_FILTER_TABLE_SIZE]; public: @@ -29,18 +29,20 @@ public: unsigned int GetReadBufferTsCount(void) { return readBufferTsCount; } unsigned int GetTsBufferSize(void) { return tsBufferSize; } unsigned int GetTsBufferPrefillRatio(void) { return tsBufferPrefillRatio; } + unsigned int GetStatsUnit(void) { return statsUnit; } + unsigned int IsStatsUnitInBytes(void) { return ((statsUnit == IPTV_STATS_UNIT_IN_BYTES) || + (statsUnit == IPTV_STATS_UNIT_IN_KBYTES)); } + unsigned int IsStatsUnitInKilos(void) { return ((statsUnit == IPTV_STATS_UNIT_IN_KBYTES) || + (statsUnit == IPTV_STATS_UNIT_IN_KBITS)); } unsigned int GetSectionFiltering(void) { return sectionFiltering; } unsigned int GetSidScanning(void) { return sidScanning; } - unsigned int GetStatsInBytes(void) { return statsInBytes; } - unsigned int GetStatsInKilos(void) { return statsInKilos; } unsigned int GetDisabledFiltersCount(void); int GetDisabledFilters(unsigned int Index); void SetTsBufferSize(unsigned int Size) { tsBufferSize = Size; } void SetTsBufferPrefillRatio(unsigned int Ratio) { tsBufferPrefillRatio = Ratio; } + void SetStatsUnit(unsigned int Unit) { statsUnit = Unit; } void SetSectionFiltering(unsigned int On) { sectionFiltering = On; } void SetSidScanning(unsigned int On) { sidScanning = On; } - void SetStatsInBytes(unsigned int On) { statsInBytes = On; } - void SetStatsInKilos(unsigned int On) { statsInKilos = On; } void SetDisabledFilters(unsigned int Index, int Number); }; diff --git a/iptv.c b/iptv.c index 3e60b1a..0bd55bb 100644 --- a/iptv.c +++ b/iptv.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: iptv.c,v 1.13 2007/10/07 19:06:33 ajhseppa Exp $ + * $Id: iptv.c,v 1.14 2007/10/07 20:08:44 rahrenbe Exp $ */ #include @@ -175,6 +175,8 @@ bool cPluginIptv::SetupParse(const char *Name, const char *Value) IptvConfig.SetTsBufferSize(atoi(Value)); else if (!strcasecmp(Name, "TsBufferPrefill")) IptvConfig.SetTsBufferPrefillRatio(atoi(Value)); + else if (!strcasecmp(Name, "StatsUnit")) + IptvConfig.SetStatsUnit(atoi(Value)); else if (!strcasecmp(Name, "SectionFiltering")) IptvConfig.SetSectionFiltering(atoi(Value)); else if (!strcasecmp(Name, "SidScanning")) diff --git a/po/fi_FI.po b/po/fi_FI.po index ad474dc..7044a96 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: VDR 1.5.7\n" "Report-Msgid-Bugs-To: Rolf Ahrenberg\n" -"POT-Creation-Date: 2007-10-07 01:11+0300\n" +"POT-Creation-Date: 2007-10-07 22:51+0300\n" "PO-Revision-Date: 2007-08-12 23:22+0300\n" "Last-Translator: Rolf Ahrenberg\n" "Language-Team: \n" @@ -95,27 +95,47 @@ msgstr "IPTV-tiedot" msgid "IPTV information not available!" msgstr "IPTV-tietoja ei saatavilla!" -#: setup.c:574 +#: setup.c:560 +msgid "bytes" +msgstr "tavuina" + +#: setup.c:561 +msgid "kbytes" +msgstr "kilotavuina" + +#: setup.c:562 +msgid "bits" +msgstr "bitteinä" + +#: setup.c:563 +msgid "kbits" +msgstr "kilobitteinä" + +#: setup.c:581 msgid "TS buffer size [MB]" msgstr "TS-puskurin koko [MB]" -#: setup.c:575 +#: setup.c:582 msgid "TS buffer prefill ratio [%]" msgstr "TS-puskurin esitäyttöaste [%]" -#: setup.c:576 +#: setup.c:583 +msgid "Show statistics in" +msgstr "Näytä tilastotiedot" + +#: setup.c:584 msgid "Use section filtering" msgstr "Käytä sektioiden suodatusta" -#: setup.c:578 +#: setup.c:586 msgid "Scan Sid automatically" msgstr "Etsi palvelu-ID automaattisesti" -#: setup.c:579 +#: setup.c:587 msgid "Disable filters" msgstr "Poista suodattimia käytöstä" #. TRANSLATORS: note the singular! -#: setup.c:582 +#: setup.c:590 msgid "Disable filter" msgstr "Poista suodatin käytöstä" diff --git a/setup.c b/setup.c index 7db9eda..72f6c2a 100644 --- a/setup.c +++ b/setup.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: setup.c,v 1.25 2007/10/07 19:06:33 ajhseppa Exp $ + * $Id: setup.c,v 1.26 2007/10/07 20:08:44 rahrenbe Exp $ */ #include @@ -554,6 +554,13 @@ cIptvPluginSetup::cIptvPluginSetup() debug("cIptvPluginSetup::cIptvPluginSetup()\n"); tsBufferSize = IptvConfig.GetTsBufferSize(); tsBufferPrefill = IptvConfig.GetTsBufferPrefillRatio(); + statsUnit = IptvConfig.GetStatsUnit(); + if (statsUnit > IPTV_STATS_UNIT_COUNT) + statsUnit = IPTV_STATS_UNIT_IN_BYTES; + statsUnitNames[IPTV_STATS_UNIT_IN_BYTES] = tr("bytes"); + statsUnitNames[IPTV_STATS_UNIT_IN_KBYTES] = tr("kbytes"); + statsUnitNames[IPTV_STATS_UNIT_IN_BITS] = tr("bits"); + statsUnitNames[IPTV_STATS_UNIT_IN_KBITS] = tr("kbits"); sectionFiltering = IptvConfig.GetSectionFiltering(); sidScanning = IptvConfig.GetSidScanning(); numDisabledFilters = IptvConfig.GetDisabledFiltersCount(); @@ -563,8 +570,6 @@ cIptvPluginSetup::cIptvPluginSetup() disabledFilterIndexes[i] = IptvConfig.GetDisabledFilters(i); disabledFilterNames[i] = tr(section_filter_table[i].description); } - statsInKilos = IptvConfig.GetStatsInKilos(); - statsInBytes = IptvConfig.GetStatsInBytes(); Setup(); SetHelp(trVDR("Channels"), NULL, NULL, trVDR("Button$Info")); } @@ -573,8 +578,9 @@ void cIptvPluginSetup::Setup(void) { int current = Current(); Clear(); - Add(new cMenuEditIntItem( tr("TS buffer size [MB]"), &tsBufferSize, 2, 16)); - Add(new cMenuEditIntItem( tr("TS buffer prefill ratio [%]"), &tsBufferPrefill, 0, 40)); + Add(new cMenuEditIntItem( tr("TS buffer size [MB]"), &tsBufferSize, 2, 16)); + Add(new cMenuEditIntItem( tr("TS buffer prefill ratio [%]"), &tsBufferPrefill, 0, 40)); + Add(new cMenuEditStraItem(tr("Show statistics in"), &statsUnit, IPTV_STATS_UNIT_COUNT, statsUnitNames)); Add(new cMenuEditBoolItem(tr("Use section filtering"), §ionFiltering)); if (sectionFiltering) { Add(new cMenuEditBoolItem(tr("Scan Sid automatically"), &sidScanning)); @@ -584,8 +590,6 @@ void cIptvPluginSetup::Setup(void) Add(new cMenuEditStraItem(tr("Disable filter"), &disabledFilterIndexes[i], SECTION_FILTER_TABLE_SIZE, disabledFilterNames)); } } - Add(new cMenuEditBoolItem(tr("Show statistics in Kilos"), &statsInKilos)); - Add(new cMenuEditBoolItem(tr("Show statistics in Bytes"), &statsInBytes)); SetCurrent(Get(current)); Display(); } @@ -650,18 +654,16 @@ void cIptvPluginSetup::Store(void) // Store values into setup.conf SetupStore("TsBufferSize", tsBufferSize); SetupStore("TsBufferPrefill", tsBufferPrefill); + SetupStore("StatsUnit", statsUnit); SetupStore("SectionFiltering", sectionFiltering); SetupStore("SidScanning", sidScanning); - SetupStore("StatsInKilos", statsInKilos); - SetupStore("StatsInBytes", statsInBytes); StoreFilters("DisabledFilters", disabledFilterIndexes); // Update global config IptvConfig.SetTsBufferSize(tsBufferSize); IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefill); + IptvConfig.SetStatsUnit(statsUnit); IptvConfig.SetSectionFiltering(sectionFiltering); IptvConfig.SetSidScanning(sidScanning); - IptvConfig.SetStatsInKilos(statsInKilos); - IptvConfig.SetStatsInBytes(statsInBytes); for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i) IptvConfig.SetDisabledFilters(i, disabledFilterIndexes[i]); } diff --git a/setup.h b/setup.h index 5b7fb6d..de9a41b 100644 --- a/setup.h +++ b/setup.h @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: setup.h,v 1.12 2007/10/07 19:06:33 ajhseppa Exp $ + * $Id: setup.h,v 1.13 2007/10/07 20:08:45 rahrenbe Exp $ */ #ifndef __IPTV_SETUP_H @@ -19,8 +19,8 @@ private: int tsBufferPrefill; int sectionFiltering; int sidScanning; - int statsInKilos; - int statsInBytes; + int statsUnit; + const char *statsUnitNames[IPTV_STATS_UNIT_COUNT]; int numDisabledFilters; int disabledFilterIndexes[SECTION_FILTER_TABLE_SIZE]; const char *disabledFilterNames[SECTION_FILTER_TABLE_SIZE]; diff --git a/statistics.c b/statistics.c index f869ce9..5df789c 100644 --- a/statistics.c +++ b/statistics.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: statistics.c,v 1.8 2007/10/07 19:29:09 ajhseppa Exp $ + * $Id: statistics.c,v 1.9 2007/10/07 20:08:45 rahrenbe Exp $ */ #include @@ -35,14 +35,14 @@ cString cIptvSectionStatistics::GetStatistic() elapsed ? : elapsed = 1; float divider = elapsed / 1000; char unit[] = { ' ', 'B', '/', 's', '\0' }; - if (IptvConfig.GetStatsInKilos()) { + if (IptvConfig.IsStatsUnitInKilos()) { divider *= KILOBYTE(1); unit[0] = 'k'; - } - if (!IptvConfig.GetStatsInBytes()) { + } + if (!IptvConfig.IsStatsUnitInBytes()) { divider /= sizeof(unsigned short) * 8; unit[1] = 'b'; - } + } long tmpFilteredData = filteredData; long tmpNumberOfCalls = numberOfCalls; filteredData = numberOfCalls = 0; @@ -76,14 +76,14 @@ cString cIptvDeviceStatistics::GetStatistic() elapsed ? : elapsed = 1; float divider = elapsed / 1000; char unit[] = { ' ', 'B', '/', 's', '\0' }; - if (IptvConfig.GetStatsInKilos()) { + if (IptvConfig.IsStatsUnitInKilos()) { divider *= KILOBYTE(1); unit[0] = 'k'; - } - if (!IptvConfig.GetStatsInBytes()) { + } + if (!IptvConfig.IsStatsUnitInBytes()) { divider /= sizeof(unsigned short) * 8; unit[1] = 'b'; - } + } dataBytes = 0; memcpy(&tmpMostActivePids, &mostActivePids, sizeof(tmpMostActivePids)); memset(&mostActivePids, '\0', sizeof(mostActivePids)); @@ -160,14 +160,14 @@ cString cIptvStreamerStatistics::GetStatistic() elapsed ? : elapsed = 1; float divider = elapsed / 1000; char unit[] = { ' ', 'B', '/', 's', '\0' }; - if (IptvConfig.GetStatsInKilos()) { + if (IptvConfig.IsStatsUnitInKilos()) { divider *= KILOBYTE(1); unit[0] = 'k'; - } - if (!IptvConfig.GetStatsInBytes()) { + } + if (!IptvConfig.IsStatsUnitInBytes()) { divider /= sizeof(unsigned short) * 8; unit[1] = 'b'; - } + } long tmpDataBytes = (long)(dataBytes / divider); dataBytes = 0; return cString::sprintf("Stream data bytes: %ld %s\n", tmpDataBytes, unit);