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