mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Reformated info menu.
This commit is contained in:
parent
a4ba034795
commit
382e575cb5
4
common.h
4
common.h
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: common.h,v 1.5 2007/10/07 20:08:44 rahrenbe Exp $
|
||||
* $Id: common.h,v 1.6 2007/10/07 22:54:09 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_COMMON_H
|
||||
@ -28,6 +28,8 @@ uint8_t payload(const uint8_t *tsp);
|
||||
#define IPTV_STATS_UNIT_IN_KBITS 3
|
||||
#define IPTV_STATS_UNIT_COUNT 4
|
||||
|
||||
#define IPTV_STATS_ACTIVE_PIDS_COUNT 10
|
||||
|
||||
#define SECTION_FILTER_TABLE_SIZE 7
|
||||
|
||||
typedef struct _section_filter_table_type {
|
||||
|
17
device.c
17
device.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: device.c,v 1.56 2007/10/07 19:06:33 ajhseppa Exp $
|
||||
* $Id: device.c,v 1.57 2007/10/07 22:54:09 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
@ -98,9 +98,20 @@ cIptvDevice *cIptvDevice::GetIptvDevice(int CardIndex)
|
||||
|
||||
cString cIptvDevice::GetInformation()
|
||||
{
|
||||
return cString::sprintf("Device:\n%s\nStreamer:\n%s\nSection Filter 0:\n%s", *GetStatistic(),
|
||||
// loop through active section filters
|
||||
cString filterInfo("\n");
|
||||
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
|
||||
if (secfilters[i])
|
||||
filterInfo = cString::sprintf("%sSec %d: %s%c", *filterInfo, i,
|
||||
*secfilters[i]->GetStatistic(),
|
||||
((i + 1) % 2) ? '\t' : '\n');
|
||||
}
|
||||
// generate information string
|
||||
return cString::sprintf("IPTV device #%d (CardIndex: %d)\nSource: %s\n%s\n%s%s",
|
||||
deviceIndex, CardIndex(), pIptvStreamer ?
|
||||
*pIptvStreamer->GetInformation() : "", *GetStatistic(),
|
||||
pIptvStreamer ? *pIptvStreamer->GetStatistic() : "",
|
||||
secfilters[0] ? *secfilters[0]->GetStatistic() : "");
|
||||
*filterInfo);
|
||||
}
|
||||
|
||||
cString cIptvDevice::GetChannelSettings(const char *Param, int *IpPort, cIptvProtocolIf* *Protocol)
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocolfile.c,v 1.9 2007/09/29 18:15:31 rahrenbe Exp $
|
||||
* $Id: protocolfile.c,v 1.10 2007/10/07 22:54:09 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
@ -119,3 +119,9 @@ bool cIptvProtocolFile::Set(const char* Address, const int Port)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
cString cIptvProtocolFile::GetInformation(void)
|
||||
{
|
||||
//debug("cIptvProtocolFile::GetInformation()");
|
||||
return cString::sprintf("file://%s:%d", streamAddr, streamPort);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocolfile.h,v 1.4 2007/09/28 16:44:59 rahrenbe Exp $
|
||||
* $Id: protocolfile.h,v 1.5 2007/10/07 22:54:09 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_PROTOCOLFILE_H
|
||||
@ -32,6 +32,7 @@ public:
|
||||
virtual bool Set(const char* Address, const int Port);
|
||||
virtual bool Open(void);
|
||||
virtual bool Close(void);
|
||||
virtual cString GetInformation(void);
|
||||
};
|
||||
|
||||
#endif // __IPTV_PROTOCOLFILE_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocolhttp.c,v 1.9 2007/09/29 16:21:05 rahrenbe Exp $
|
||||
* $Id: protocolhttp.c,v 1.10 2007/10/07 22:54:09 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -365,9 +365,15 @@ bool cIptvProtocolHttp::Set(const char* Address, const int Port)
|
||||
else
|
||||
streamPath = strcpyrealloc(streamPath, "/");
|
||||
streamPort = Port;
|
||||
debug("iptv://%s:%d%s\n", streamAddr, streamPort, streamPath);
|
||||
debug("http://%s:%d%s\n", streamAddr, streamPort, streamPath);
|
||||
// Re-connect the socket
|
||||
Connect();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
cString cIptvProtocolHttp::GetInformation(void)
|
||||
{
|
||||
//debug("cIptvProtocolHttp::GetInformation()");
|
||||
return cString::sprintf("http://%s:%d%s", streamAddr, streamPort, streamPath);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocolhttp.h,v 1.6 2007/09/29 10:55:14 ajhseppa Exp $
|
||||
* $Id: protocolhttp.h,v 1.7 2007/10/07 22:54:09 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_PROTOCOLHTTP_H
|
||||
@ -39,6 +39,7 @@ public:
|
||||
virtual bool Set(const char* Address, const int Port);
|
||||
virtual bool Open(void);
|
||||
virtual bool Close(void);
|
||||
virtual cString GetInformation(void);
|
||||
};
|
||||
|
||||
#endif // __IPTV_PROTOCOLHTTP_H
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocolif.h,v 1.4 2007/09/29 16:21:05 rahrenbe Exp $
|
||||
* $Id: protocolif.h,v 1.5 2007/10/07 22:54:09 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_PROTOCOLIF_H
|
||||
@ -17,6 +17,7 @@ public:
|
||||
virtual bool Set(const char* Address, const int Port) = 0;
|
||||
virtual bool Open(void) = 0;
|
||||
virtual bool Close(void) = 0;
|
||||
virtual cString GetInformation(void) = 0;
|
||||
|
||||
private:
|
||||
cIptvProtocolIf(const cIptvProtocolIf&);
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocoludp.c,v 1.10 2007/09/29 16:21:05 rahrenbe Exp $
|
||||
* $Id: protocoludp.c,v 1.11 2007/10/07 22:54:09 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -246,3 +246,9 @@ bool cIptvProtocolUdp::Set(const char* Address, const int Port)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
cString cIptvProtocolUdp::GetInformation(void)
|
||||
{
|
||||
//debug("cIptvProtocolUdp::GetInformation()");
|
||||
return cString::sprintf("udp://%s:%d", streamAddr, streamPort);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: protocoludp.h,v 1.7 2007/09/29 16:21:05 rahrenbe Exp $
|
||||
* $Id: protocoludp.h,v 1.8 2007/10/07 22:54:09 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_PROTOCOLUDP_H
|
||||
@ -35,6 +35,7 @@ public:
|
||||
virtual bool Set(const char* Address, const int Port);
|
||||
virtual bool Open(void);
|
||||
virtual bool Close(void);
|
||||
virtual cString GetInformation(void);
|
||||
};
|
||||
|
||||
#endif // __IPTV_PROTOCOLUDP_H
|
||||
|
50
statistics.c
50
statistics.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: statistics.c,v 1.9 2007/10/07 20:08:45 rahrenbe Exp $
|
||||
* $Id: statistics.c,v 1.10 2007/10/07 22:54:09 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
@ -28,11 +28,9 @@ cIptvSectionStatistics::~cIptvSectionStatistics()
|
||||
|
||||
cString cIptvSectionStatistics::GetStatistic()
|
||||
{
|
||||
debug("cIptvSectionStatistics::GetStatistic()\n");
|
||||
//debug("cIptvSectionStatistics::GetStatistic()\n");
|
||||
uint64_t elapsed = timer.Elapsed();
|
||||
timer.Set();
|
||||
// Prevent a divide-by-zero error
|
||||
elapsed ? : elapsed = 1;
|
||||
float divider = elapsed / 1000;
|
||||
char unit[] = { ' ', 'B', '/', 's', '\0' };
|
||||
if (IptvConfig.IsStatsUnitInKilos()) {
|
||||
@ -43,10 +41,10 @@ cString cIptvSectionStatistics::GetStatistic()
|
||||
divider /= sizeof(unsigned short) * 8;
|
||||
unit[1] = 'b';
|
||||
}
|
||||
long tmpFilteredData = filteredData;
|
||||
long tmpNumberOfCalls = numberOfCalls;
|
||||
cString info = cString::sprintf("%4ld (%4ld %s)", numberOfCalls, divider ?
|
||||
(long)(filteredData / divider) : 0L, unit);
|
||||
filteredData = numberOfCalls = 0;
|
||||
return cString::sprintf("Filtered data: %ld %s\nData packets passed: %ld\n", (long)(tmpFilteredData / divider), unit, tmpNumberOfCalls);
|
||||
return info;
|
||||
}
|
||||
|
||||
// --- cIptvDeviceStatistics -------------------------------------------------
|
||||
@ -67,13 +65,10 @@ cIptvDeviceStatistics::~cIptvDeviceStatistics()
|
||||
|
||||
cString cIptvDeviceStatistics::GetStatistic()
|
||||
{
|
||||
debug("cIptvDeviceStatistics::GetStatistic()\n");
|
||||
pidStruct tmpMostActivePids[10];
|
||||
//debug("cIptvDeviceStatistics::GetStatistic()\n");
|
||||
long tmpDataBytes = dataBytes;
|
||||
uint64_t elapsed = timer.Elapsed();
|
||||
timer.Set();
|
||||
// Prevent a divide-by-zero error
|
||||
elapsed ? : elapsed = 1;
|
||||
float divider = elapsed / 1000;
|
||||
char unit[] = { ' ', 'B', '/', 's', '\0' };
|
||||
if (IptvConfig.IsStatsUnitInKilos()) {
|
||||
@ -84,24 +79,21 @@ cString cIptvDeviceStatistics::GetStatistic()
|
||||
divider /= sizeof(unsigned short) * 8;
|
||||
unit[1] = 'b';
|
||||
}
|
||||
cString info = cString::sprintf("Bitrate: %ld %s\n", divider ?
|
||||
(long)(tmpDataBytes / divider) : 0L, unit);
|
||||
for (unsigned int i = 0; i < IPTV_STATS_ACTIVE_PIDS_COUNT; ++i) {
|
||||
if (mostActivePids[i].pid)
|
||||
info = cString::sprintf("%sPid %d: %4d (%4ld %s)%c", *info, i,
|
||||
mostActivePids[i].pid,
|
||||
(long)(mostActivePids[i].DataAmount / divider),
|
||||
unit, ((i + 1) % 2) ? '\t' : '\n');
|
||||
}
|
||||
dataBytes = 0;
|
||||
memcpy(&tmpMostActivePids, &mostActivePids, sizeof(tmpMostActivePids));
|
||||
memset(&mostActivePids, '\0', sizeof(mostActivePids));
|
||||
return cString::sprintf("Stream data bytes: %ld %s\n"
|
||||
" 1. Active Pid: %d %ld %s\n"
|
||||
" 2. Active Pid: %d %ld %s\n"
|
||||
" 3. Active Pid: %d %ld %s\n"
|
||||
" 4. Active Pid: %d %ld %s\n"
|
||||
" 5. Active Pid: %d %ld %s\n",
|
||||
(long)(tmpDataBytes / divider), unit,
|
||||
tmpMostActivePids[0].pid, (long)(tmpMostActivePids[0].DataAmount / divider), unit,
|
||||
tmpMostActivePids[1].pid, (long)(tmpMostActivePids[1].DataAmount / divider), unit,
|
||||
tmpMostActivePids[2].pid, (long)(tmpMostActivePids[2].DataAmount / divider), unit,
|
||||
tmpMostActivePids[3].pid, (long)(tmpMostActivePids[3].DataAmount / divider), unit,
|
||||
tmpMostActivePids[4].pid, (long)(tmpMostActivePids[4].DataAmount / divider), unit);
|
||||
return info;
|
||||
}
|
||||
|
||||
int SortFunc(const void* data1, const void* data2)
|
||||
static int SortFunc(const void* data1, const void* data2)
|
||||
{
|
||||
//debug("cIptvDeviceStatistics::SortFunc()\n");
|
||||
pidStruct *comp1 = (pidStruct*)data1;
|
||||
@ -153,11 +145,9 @@ cIptvStreamerStatistics::~cIptvStreamerStatistics()
|
||||
|
||||
cString cIptvStreamerStatistics::GetStatistic()
|
||||
{
|
||||
debug("cIptvStreamerStatistics::GetStatistic()\n");
|
||||
//debug("cIptvStreamerStatistics::GetStatistic()\n");
|
||||
uint64_t elapsed = timer.Elapsed();
|
||||
timer.Set();
|
||||
// Prevent a divide-by-zero error
|
||||
elapsed ? : elapsed = 1;
|
||||
float divider = elapsed / 1000;
|
||||
char unit[] = { ' ', 'B', '/', 's', '\0' };
|
||||
if (IptvConfig.IsStatsUnitInKilos()) {
|
||||
@ -168,7 +158,7 @@ cString cIptvStreamerStatistics::GetStatistic()
|
||||
divider /= sizeof(unsigned short) * 8;
|
||||
unit[1] = 'b';
|
||||
}
|
||||
long tmpDataBytes = (long)(dataBytes / divider);
|
||||
long tmpDataBytes = divider ? (long)(dataBytes / divider) : 0L;
|
||||
dataBytes = 0;
|
||||
return cString::sprintf("Stream data bytes: %ld %s\n", tmpDataBytes, unit);
|
||||
return cString::sprintf("Streamer: %ld %s", tmpDataBytes, unit);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: statistics.h,v 1.4 2007/10/07 19:06:33 ajhseppa Exp $
|
||||
* $Id: statistics.h,v 1.5 2007/10/07 22:54:09 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_STATISTICS_H
|
||||
@ -47,7 +47,7 @@ protected:
|
||||
void UpdateActivePids(u_short pid, long payload);
|
||||
|
||||
private:
|
||||
pidStruct mostActivePids[10];
|
||||
pidStruct mostActivePids[IPTV_STATS_ACTIVE_PIDS_COUNT];
|
||||
cTimeMs timer;
|
||||
};
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: streamer.c,v 1.17 2007/10/05 19:00:44 ajhseppa Exp $
|
||||
* $Id: streamer.c,v 1.18 2007/10/07 22:54:09 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#include <vdr/thread.h>
|
||||
@ -96,3 +96,10 @@ bool cIptvStreamer::Set(const char* Address, const int Port, cIptvProtocolIf* Pr
|
||||
return true;
|
||||
}
|
||||
|
||||
cString cIptvStreamer::GetInformation(void)
|
||||
{
|
||||
//debug("cIptvStreamer::GetInformation()");
|
||||
if (protocol)
|
||||
return protocol->GetInformation();
|
||||
return NULL;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* $Id: streamer.h,v 1.8 2007/10/05 19:00:44 ajhseppa Exp $
|
||||
* $Id: streamer.h,v 1.9 2007/10/07 22:54:09 rahrenbe Exp $
|
||||
*/
|
||||
|
||||
#ifndef __IPTV_STREAMER_H
|
||||
@ -32,6 +32,7 @@ public:
|
||||
bool Set(const char* Address, const int Port, cIptvProtocolIf* Protocol);
|
||||
bool Open(void);
|
||||
bool Close(void);
|
||||
cString GetInformation(void);
|
||||
};
|
||||
|
||||
#endif // __IPTV_STREAMER_H
|
||||
|
Loading…
Reference in New Issue
Block a user