mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Added some real data into IPTV info menu.
This commit is contained in:
parent
d857378616
commit
9af7bd84bc
10
device.c
10
device.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: device.c,v 1.52 2007/10/06 20:57:53 rahrenbe Exp $
|
||||
* $Id: device.c,v 1.53 2007/10/06 22:15:02 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
@ -98,11 +98,9 @@ cIptvDevice *cIptvDevice::GetIptvDevice(int CardIndex)
|
||||
|
||||
cString cIptvDevice::GetInformation(void)
|
||||
{
|
||||
char Text[25];
|
||||
struct tm tm_r;
|
||||
time_t t = time(NULL);
|
||||
strftime(Text, sizeof(Text), "%T", localtime_r(&t, &tm_r));
|
||||
return cString::sprintf("IPTV device: %d\nTime: %s\n", deviceIndex, Text);
|
||||
return cString::sprintf("Device:\n%s\nStreamer:\n%s\nSection Filter:\n%s\n", *GetStatistic(),
|
||||
pIptvStreamer ? *pIptvStreamer->GetStatistic() : "",
|
||||
secfilters[0] ? *secfilters[0]->GetStatistic() : "");
|
||||
}
|
||||
|
||||
cString cIptvDevice::GetChannelSettings(const char *Param, int *IpPort, cIptvProtocolIf* *Protocol)
|
||||
|
16
po/fi_FI.po
16
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-06 23:51+0300\n"
|
||||
"POT-Creation-Date: 2007-10-07 01:11+0300\n"
|
||||
"PO-Revision-Date: 2007-08-12 23:22+0300\n"
|
||||
"Last-Translator: Rolf Ahrenberg\n"
|
||||
"Language-Team: <vdr@linuxtv.org>\n"
|
||||
@ -91,31 +91,31 @@ msgstr "IPTV-kanavat"
|
||||
msgid "IPTV Information"
|
||||
msgstr "IPTV-tiedot"
|
||||
|
||||
#: setup.c:509
|
||||
#: setup.c:507
|
||||
msgid "IPTV information not available!"
|
||||
msgstr "IPTV-tietoja ei saatavilla!"
|
||||
|
||||
#: setup.c:578
|
||||
#: setup.c:574
|
||||
msgid "TS buffer size [MB]"
|
||||
msgstr "TS-puskurin koko [MB]"
|
||||
|
||||
#: setup.c:579
|
||||
#: setup.c:575
|
||||
msgid "TS buffer prefill ratio [%]"
|
||||
msgstr "TS-puskurin esitäyttöaste [%]"
|
||||
|
||||
#: setup.c:580
|
||||
#: setup.c:576
|
||||
msgid "Use section filtering"
|
||||
msgstr "Käytä sektioiden suodatusta"
|
||||
|
||||
#: setup.c:582
|
||||
#: setup.c:578
|
||||
msgid "Scan Sid automatically"
|
||||
msgstr "Etsi palvelu-ID automaattisesti"
|
||||
|
||||
#: setup.c:583
|
||||
#: setup.c:579
|
||||
msgid "Disable filters"
|
||||
msgstr "Poista suodattimia käytöstä"
|
||||
|
||||
#. TRANSLATORS: note the singular!
|
||||
#: setup.c:586
|
||||
#: setup.c:582
|
||||
msgid "Disable filter"
|
||||
msgstr "Poista suodatin käytöstä"
|
||||
|
14
setup.c
14
setup.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: setup.c,v 1.21 2007/10/06 20:57:53 rahrenbe Exp $
|
||||
* $Id: setup.c,v 1.22 2007/10/06 22:15:02 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
@ -477,7 +477,7 @@ private:
|
||||
enum {
|
||||
INFO_TIMEOUT = 2000
|
||||
};
|
||||
char *text;
|
||||
cString text;
|
||||
cTimeMs timeout;
|
||||
void UpdateInfo();
|
||||
|
||||
@ -489,26 +489,22 @@ public:
|
||||
};
|
||||
|
||||
cIptvMenuInfo::cIptvMenuInfo()
|
||||
:cOsdMenu(tr("IPTV Information")), text(NULL), timeout(INFO_TIMEOUT)
|
||||
:cOsdMenu(tr("IPTV Information")), text(""), timeout(INFO_TIMEOUT)
|
||||
{
|
||||
UpdateInfo();
|
||||
}
|
||||
|
||||
cIptvMenuInfo::~cIptvMenuInfo()
|
||||
{
|
||||
free(text);
|
||||
}
|
||||
|
||||
void cIptvMenuInfo::UpdateInfo(void)
|
||||
{
|
||||
cIptvDevice *device = cIptvDevice::GetIptvDevice(cDevice::ActualDevice()->CardIndex());
|
||||
char Text[64];
|
||||
if (device)
|
||||
snprintf(Text, sizeof(Text), "%s", *device->GetInformation());
|
||||
text = device->GetInformation();
|
||||
else
|
||||
snprintf(Text, sizeof(Text), "%s", tr("IPTV information not available!"));
|
||||
free(text);
|
||||
text = Text ? strdup(Text) : NULL;
|
||||
text = cString(tr("IPTV information not available!"));
|
||||
Display();
|
||||
timeout.Set(INFO_TIMEOUT);
|
||||
}
|
||||
|
@ -3,17 +3,19 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: statisticif.h,v 1.1 2007/10/05 19:00:44 ajhseppa Exp $
|
||||
* $Id: statisticif.h,v 1.2 2007/10/06 22:15:02 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_STATISTICIF_H
|
||||
#define __IPTV_STATISTICIF_H
|
||||
|
||||
#include <vdr/tools.h>
|
||||
|
||||
class cIptvStatisticIf {
|
||||
public:
|
||||
cIptvStatisticIf() {}
|
||||
virtual ~cIptvStatisticIf() {}
|
||||
virtual char* GetStatistic() = 0;
|
||||
virtual cString GetStatistic() = 0;
|
||||
|
||||
private:
|
||||
cIptvStatisticIf(const cIptvStatisticIf&);
|
||||
|
77
statistics.c
77
statistics.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: statistics.c,v 1.3 2007/10/05 22:30:14 ajhseppa Exp $
|
||||
* $Id: statistics.c,v 1.4 2007/10/06 22:15:02 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
@ -11,8 +11,8 @@
|
||||
|
||||
// Section statistic class
|
||||
cIptvSectionStatistics::cIptvSectionStatistics()
|
||||
: filteredData(0),
|
||||
numberOfCalls(0)
|
||||
: filteredData(0),
|
||||
numberOfCalls(0)
|
||||
{
|
||||
//debug("cIptvSectionStatistics::cIptvSectionStatistics()\n");
|
||||
}
|
||||
@ -22,21 +22,20 @@ cIptvSectionStatistics::~cIptvSectionStatistics()
|
||||
//debug("cIptvSectionStatistics::~cIptvSectionStatistics()\n");
|
||||
}
|
||||
|
||||
char* cIptvSectionStatistics::GetStatistic()
|
||||
cString cIptvSectionStatistics::GetStatistic()
|
||||
{
|
||||
debug("cIptvSectionStatistics::GetStatistic()\n");
|
||||
char* retval;
|
||||
asprintf(&retval, "Filtered data: %ld Data packets passed: %ld",
|
||||
filteredData, numberOfCalls);
|
||||
|
||||
long tmpFilteredData = filteredData;
|
||||
long tmpNumberOfCalls = numberOfCalls;
|
||||
filteredData = numberOfCalls = 0;
|
||||
|
||||
return retval;
|
||||
return cString::sprintf("Filtered data: %ld\nData packets passed: %ld\n", tmpFilteredData, tmpNumberOfCalls);
|
||||
}
|
||||
|
||||
// --- cIptvDeviceStatistics -------------------------------------------------
|
||||
|
||||
// Device statistic class
|
||||
cIptvDeviceStatistics::cIptvDeviceStatistics()
|
||||
: dataBytes(0)
|
||||
: dataBytes(0)
|
||||
{
|
||||
debug("cIptvDeviceStatistics::cIptvDeviceStatistics()\n");
|
||||
memset(mostActivePids, '\0', sizeof(mostActivePids));
|
||||
@ -47,68 +46,61 @@ cIptvDeviceStatistics::~cIptvDeviceStatistics()
|
||||
debug("cIptvDeviceStatistics::~cIptvDeviceStatistics()\n");
|
||||
}
|
||||
|
||||
char* cIptvDeviceStatistics::GetStatistic()
|
||||
cString cIptvDeviceStatistics::GetStatistic(void)
|
||||
{
|
||||
debug("cIptvDeviceStatistics::GetStatistic()\n");
|
||||
char* retval;
|
||||
asprintf(&retval, "Stream data bytes: %ld, Active Pids: 1: Pid %d %ld 2: Pid %d %ld 3: %d %ld", dataBytes, mostActivePids[0].pid,
|
||||
mostActivePids[0].DataAmount, mostActivePids[1].pid,
|
||||
mostActivePids[1].DataAmount, mostActivePids[2].pid,
|
||||
mostActivePids[2].DataAmount);
|
||||
|
||||
pidStruct tmpMostActivePids[10];
|
||||
long tmpDataBytes = dataBytes;
|
||||
dataBytes = 0;
|
||||
memcpy(&tmpMostActivePids, &mostActivePids, sizeof(tmpMostActivePids));
|
||||
memset(&mostActivePids, '\0', sizeof(mostActivePids));
|
||||
|
||||
return retval;
|
||||
return cString::sprintf("Stream data bytes: %ld\n1. Active Pid: %d %ld\n2. Active Pid: %d %ld\n3. Active Pid: %d %ld\n",
|
||||
tmpDataBytes,
|
||||
tmpMostActivePids[0].pid, tmpMostActivePids[0].DataAmount,
|
||||
tmpMostActivePids[1].pid, tmpMostActivePids[1].DataAmount,
|
||||
tmpMostActivePids[2].pid, tmpMostActivePids[2].DataAmount);
|
||||
}
|
||||
|
||||
int SortFunc(const void* data1, const void* data2)
|
||||
{
|
||||
//debug("cIptvDeviceStatistics::SortFunc()\n");
|
||||
|
||||
pidStruct *comp1 = (pidStruct*)data1;
|
||||
pidStruct *comp2 = (pidStruct*)data2;
|
||||
|
||||
if (comp1->DataAmount > comp2->DataAmount)
|
||||
return 1;
|
||||
|
||||
if (comp1->DataAmount < comp2->DataAmount)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cIptvDeviceStatistics::UpdateActivePids(u_short pid, long payload)
|
||||
{
|
||||
//debug("cIptvDeviceStatistics::UpdateActivePids()\n");
|
||||
|
||||
const int numberOfElements = sizeof(mostActivePids) / sizeof(pidStruct);
|
||||
|
||||
// If our statistic already is in the array, update it and quit
|
||||
for (int i = 0; i < numberOfElements; ++i) {
|
||||
if (mostActivePids[i].pid == pid) {
|
||||
mostActivePids[i].DataAmount += payload;
|
||||
// Now re-sort the array and quit
|
||||
qsort(&mostActivePids, numberOfElements, sizeof(pidStruct), SortFunc);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (mostActivePids[i].pid == pid) {
|
||||
mostActivePids[i].DataAmount += payload;
|
||||
// Now re-sort the array and quit
|
||||
qsort(&mostActivePids, numberOfElements, sizeof(pidStruct), SortFunc);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Apparently our pid isn't in the array. Replace the last element with this
|
||||
// one if new payload is greater
|
||||
if (mostActivePids[numberOfElements - 1].DataAmount < payload) {
|
||||
mostActivePids[numberOfElements - 1].pid = pid;
|
||||
mostActivePids[numberOfElements - 1].DataAmount = payload;
|
||||
|
||||
mostActivePids[numberOfElements - 1].pid = pid;
|
||||
mostActivePids[numberOfElements - 1].DataAmount = payload;
|
||||
// Re-sort
|
||||
qsort(&mostActivePids, numberOfElements, sizeof(pidStruct), SortFunc);
|
||||
}
|
||||
}
|
||||
|
||||
// --- cIptvStreamerStatistics -----------------------------------------------
|
||||
|
||||
// Streamer statistic class
|
||||
cIptvStreamerStatistics::cIptvStreamerStatistics()
|
||||
: dataBytes(0)
|
||||
: dataBytes(0)
|
||||
{
|
||||
debug("cIptvStreamerStatistics::cIptvStreamerStatistics()\n");
|
||||
}
|
||||
@ -118,13 +110,10 @@ cIptvStreamerStatistics::~cIptvStreamerStatistics()
|
||||
debug("cIptvStreamerStatistics::~cIptvStreamerStatistics()\n");
|
||||
}
|
||||
|
||||
char* cIptvStreamerStatistics::GetStatistic()
|
||||
cString cIptvStreamerStatistics::GetStatistic(void)
|
||||
{
|
||||
debug("cIptvStreamerStatistics::GetStatistic()\n");
|
||||
char* retval;
|
||||
asprintf(&retval, "Stream data bytes: %ld", dataBytes);
|
||||
|
||||
long tmpDataBytes = dataBytes;
|
||||
dataBytes = 0;
|
||||
|
||||
return retval;
|
||||
return cString::sprintf("Stream data bytes: %ld\n", tmpDataBytes);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: statistics.h,v 1.1 2007/10/05 19:00:44 ajhseppa Exp $
|
||||
* $Id: statistics.h,v 1.2 2007/10/06 22:15:02 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_STATISTICS_H
|
||||
@ -26,7 +26,7 @@ public:
|
||||
cIptvSectionStatistics();
|
||||
virtual ~cIptvSectionStatistics();
|
||||
|
||||
char* GetStatistic();
|
||||
cString GetStatistic();
|
||||
};
|
||||
|
||||
// Device statistics
|
||||
@ -38,14 +38,13 @@ public:
|
||||
cIptvDeviceStatistics();
|
||||
virtual ~cIptvDeviceStatistics();
|
||||
|
||||
char* GetStatistic();
|
||||
cString GetStatistic();
|
||||
|
||||
protected:
|
||||
void UpdateActivePids(u_short pid, long payload);
|
||||
|
||||
private:
|
||||
pidStruct mostActivePids[10];
|
||||
|
||||
};
|
||||
|
||||
// Streamer statistics
|
||||
@ -57,7 +56,7 @@ public:
|
||||
cIptvStreamerStatistics();
|
||||
virtual ~cIptvStreamerStatistics();
|
||||
|
||||
char* GetStatistic();
|
||||
cString GetStatistic();
|
||||
};
|
||||
|
||||
#endif // __IPTV_STATISTICS_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user