mirror of
				https://github.com/rofafor/vdr-plugin-iptv.git
				synced 2023-10-10 11:37:03 +00:00 
			
		
		
		
	Separated information/statistics into several color button pages.
This commit is contained in:
		
							
								
								
									
										17
									
								
								common.h
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								common.h
									
									
									
									
									
								
							@@ -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: common.h,v 1.6 2007/10/07 22:54:09 rahrenbe Exp $
 | 
					 * $Id: common.h,v 1.7 2007/10/08 23:51:58 rahrenbe Exp $
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __IPTV_COMMON_H
 | 
					#ifndef __IPTV_COMMON_H
 | 
				
			||||||
@@ -22,15 +22,16 @@ uint8_t payload(const uint8_t *tsp);
 | 
				
			|||||||
#define error(x...) esyslog("IPTV: " x);
 | 
					#define error(x...) esyslog("IPTV: " x);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define IPTV_STATS_UNIT_IN_BYTES     0
 | 
					#define IPTV_DEVICE_INFO_ALL            0
 | 
				
			||||||
#define IPTV_STATS_UNIT_IN_KBYTES    1
 | 
					#define IPTV_DEVICE_INFO_GENERAL        1
 | 
				
			||||||
#define IPTV_STATS_UNIT_IN_BITS      2
 | 
					#define IPTV_DEVICE_INFO_PIDS           2
 | 
				
			||||||
#define IPTV_STATS_UNIT_IN_KBITS     3
 | 
					#define IPTV_DEVICE_INFO_FILTERS        3
 | 
				
			||||||
#define IPTV_STATS_UNIT_COUNT        4
 | 
					#define IPTV_DEVICE_INFO_BUFFERS        4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define IPTV_STATS_ACTIVE_PIDS_COUNT 10
 | 
					#define IPTV_STATS_ACTIVE_PIDS_COUNT    10
 | 
				
			||||||
 | 
					#define IPTV_STATS_ACTIVE_FILTERS_COUNT 10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define SECTION_FILTER_TABLE_SIZE    7
 | 
					#define SECTION_FILTER_TABLE_SIZE       7
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct _section_filter_table_type {
 | 
					typedef struct _section_filter_table_type {
 | 
				
			||||||
  const char *description;
 | 
					  const char *description;
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								config.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								config.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: config.c,v 1.14 2007/10/07 20:08:44 rahrenbe Exp $
 | 
					 * $Id: config.c,v 1.15 2007/10/08 23:51:58 rahrenbe Exp $
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "config.h"
 | 
					#include "config.h"
 | 
				
			||||||
@@ -14,7 +14,7 @@ cIptvConfig::cIptvConfig(void)
 | 
				
			|||||||
: readBufferTsCount(48),
 | 
					: readBufferTsCount(48),
 | 
				
			||||||
  tsBufferSize(2),
 | 
					  tsBufferSize(2),
 | 
				
			||||||
  tsBufferPrefillRatio(0),
 | 
					  tsBufferPrefillRatio(0),
 | 
				
			||||||
  statsUnit(IPTV_STATS_UNIT_IN_KBYTES),
 | 
					  useBytes(1),
 | 
				
			||||||
  sectionFiltering(1),
 | 
					  sectionFiltering(1),
 | 
				
			||||||
  sidScanning(1)
 | 
					  sidScanning(1)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										12
									
								
								config.h
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								config.h
									
									
									
									
									
								
							@@ -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: config.h,v 1.12 2007/10/07 20:08:44 rahrenbe Exp $
 | 
					 * $Id: config.h,v 1.13 2007/10/08 23:51:58 rahrenbe Exp $
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __IPTV_CONFIG_H
 | 
					#ifndef __IPTV_CONFIG_H
 | 
				
			||||||
@@ -19,7 +19,7 @@ protected:
 | 
				
			|||||||
  unsigned int readBufferTsCount;
 | 
					  unsigned int readBufferTsCount;
 | 
				
			||||||
  unsigned int tsBufferSize;
 | 
					  unsigned int tsBufferSize;
 | 
				
			||||||
  unsigned int tsBufferPrefillRatio;
 | 
					  unsigned int tsBufferPrefillRatio;
 | 
				
			||||||
  unsigned int statsUnit;
 | 
					  unsigned int useBytes;
 | 
				
			||||||
  unsigned int sectionFiltering;
 | 
					  unsigned int sectionFiltering;
 | 
				
			||||||
  unsigned int sidScanning;
 | 
					  unsigned int sidScanning;
 | 
				
			||||||
  int disabledFilters[SECTION_FILTER_TABLE_SIZE];
 | 
					  int disabledFilters[SECTION_FILTER_TABLE_SIZE];
 | 
				
			||||||
@@ -29,18 +29,14 @@ public:
 | 
				
			|||||||
  unsigned int GetReadBufferTsCount(void) { return readBufferTsCount; }
 | 
					  unsigned int GetReadBufferTsCount(void) { return readBufferTsCount; }
 | 
				
			||||||
  unsigned int GetTsBufferSize(void) { return tsBufferSize; }
 | 
					  unsigned int GetTsBufferSize(void) { return tsBufferSize; }
 | 
				
			||||||
  unsigned int GetTsBufferPrefillRatio(void) { return tsBufferPrefillRatio; }
 | 
					  unsigned int GetTsBufferPrefillRatio(void) { return tsBufferPrefillRatio; }
 | 
				
			||||||
  unsigned int GetStatsUnit(void) { return statsUnit; }
 | 
					  unsigned int GetUseBytes(void) { return useBytes; }
 | 
				
			||||||
  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 GetSectionFiltering(void) { return sectionFiltering; }
 | 
				
			||||||
  unsigned int GetSidScanning(void) { return sidScanning; }
 | 
					  unsigned int GetSidScanning(void) { return sidScanning; }
 | 
				
			||||||
  unsigned int GetDisabledFiltersCount(void);
 | 
					  unsigned int GetDisabledFiltersCount(void);
 | 
				
			||||||
  int GetDisabledFilters(unsigned int Index);
 | 
					  int GetDisabledFilters(unsigned int Index);
 | 
				
			||||||
  void SetTsBufferSize(unsigned int Size) { tsBufferSize = Size; }
 | 
					  void SetTsBufferSize(unsigned int Size) { tsBufferSize = Size; }
 | 
				
			||||||
  void SetTsBufferPrefillRatio(unsigned int Ratio) { tsBufferPrefillRatio = Ratio; }
 | 
					  void SetTsBufferPrefillRatio(unsigned int Ratio) { tsBufferPrefillRatio = Ratio; }
 | 
				
			||||||
  void SetStatsUnit(unsigned int Unit) { statsUnit = Unit; }
 | 
					  void SetUseBytes(unsigned int On) { useBytes = On; }
 | 
				
			||||||
  void SetSectionFiltering(unsigned int On) { sectionFiltering = On; }
 | 
					  void SetSectionFiltering(unsigned int On) { sectionFiltering = On; }
 | 
				
			||||||
  void SetSidScanning(unsigned int On) { sidScanning = On; }
 | 
					  void SetSidScanning(unsigned int On) { sidScanning = On; }
 | 
				
			||||||
  void SetDisabledFilters(unsigned int Index, int Number);
 | 
					  void SetDisabledFilters(unsigned int Index, int Number);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										80
									
								
								device.c
									
									
									
									
									
								
							
							
						
						
									
										80
									
								
								device.c
									
									
									
									
									
								
							@@ -3,13 +3,11 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * 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.60 2007/10/08 18:35:10 rahrenbe Exp $
 | 
					 * $Id: device.c,v 1.61 2007/10/08 23:51:58 rahrenbe Exp $
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "common.h"
 | 
					 | 
				
			||||||
#include "config.h"
 | 
					#include "config.h"
 | 
				
			||||||
#include "device.h"
 | 
					#include "device.h"
 | 
				
			||||||
#include "sectionfilter.h"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define IPTV_MAX_DEVICES 8
 | 
					#define IPTV_MAX_DEVICES 8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -96,25 +94,73 @@ cIptvDevice *cIptvDevice::GetIptvDevice(int CardIndex)
 | 
				
			|||||||
  return NULL;
 | 
					  return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cString cIptvDevice::GetInformation()
 | 
					cString cIptvDevice::GetGeneralInformation(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  //debug("cIptvDevice::GetGeneralInformation(%d)\n", deviceIndex);
 | 
				
			||||||
 | 
					  return cString::sprintf("IPTV device #%d (CardIndex: %d)\n%s\n%s",
 | 
				
			||||||
 | 
					                          deviceIndex, CardIndex(), pIptvStreamer ?
 | 
				
			||||||
 | 
					                          *pIptvStreamer->GetInformation() : "",
 | 
				
			||||||
 | 
					                          pIptvStreamer ? *pIptvStreamer->GetStatistic() : "");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cString cIptvDevice::GetPidsInformation(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  //debug("cIptvDevice::GetPidsInformation(%d)\n", deviceIndex);
 | 
				
			||||||
 | 
					  cString info("Most active pids:\n");
 | 
				
			||||||
 | 
					  info = cString::sprintf("%s%s", *info, *GetStatistic());
 | 
				
			||||||
 | 
					  return info;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cString cIptvDevice::GetFiltersInformation(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  //debug("cIptvDevice::GetFiltersInformation(%d)\n", deviceIndex);
 | 
				
			||||||
 | 
					  unsigned int count = 0;
 | 
				
			||||||
 | 
					  cString info("Active section filters:\n");
 | 
				
			||||||
  // loop through active section filters
 | 
					  // loop through active section filters
 | 
				
			||||||
  cString filterInfo("\n");
 | 
					 | 
				
			||||||
  for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
 | 
					  for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
 | 
				
			||||||
      if (secfilters[i])
 | 
					      if (secfilters[i]) {
 | 
				
			||||||
         filterInfo = cString::sprintf("%sSec %d: %s%c", *filterInfo, i,
 | 
					         info = cString::sprintf("%sFilter %d: %s Pid=%d\n", *info, i,
 | 
				
			||||||
                                       *secfilters[i]->GetStatistic(),
 | 
					                                 *secfilters[i]->GetStatistic(), secfilters[i]->GetPid());
 | 
				
			||||||
                                       ((i + 1) % 2) ? '\t' : '\n');
 | 
					         if (++count > IPTV_STATS_ACTIVE_FILTERS_COUNT)
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					         }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
  // make sure it ends with linefeed
 | 
					  return info;
 | 
				
			||||||
  if (!endswith(*filterInfo, "\n"))
 | 
					}
 | 
				
			||||||
     filterInfo = cString::sprintf("%s%c", *filterInfo, '\n');
 | 
					
 | 
				
			||||||
 | 
					cString cIptvDevice::GetBuffersInformation(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  //debug("cIptvDevice::GetBuffersInformation(%d)\n", deviceIndex);
 | 
				
			||||||
 | 
					  cString info("Buffers information is not yet implemented!\n");
 | 
				
			||||||
 | 
					  return info;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cString cIptvDevice::GetInformation(unsigned int Page)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
  // generate information string
 | 
					  // generate information string
 | 
				
			||||||
  return cString::sprintf("IPTV device #%d (CardIndex: %d)\nSource: %s\n%s%s%s",
 | 
					  cString info;
 | 
				
			||||||
                          deviceIndex, CardIndex(), pIptvStreamer ? 
 | 
					  switch (Page) {
 | 
				
			||||||
                          *pIptvStreamer->GetInformation() : "", *GetStatistic(),
 | 
					    case IPTV_DEVICE_INFO_GENERAL:
 | 
				
			||||||
                          pIptvStreamer ? *pIptvStreamer->GetStatistic() : "",
 | 
					         info = GetGeneralInformation();
 | 
				
			||||||
                          *filterInfo);
 | 
					         break;
 | 
				
			||||||
 | 
					    case IPTV_DEVICE_INFO_PIDS:
 | 
				
			||||||
 | 
					         info = GetPidsInformation();
 | 
				
			||||||
 | 
					         break;
 | 
				
			||||||
 | 
					    case IPTV_DEVICE_INFO_FILTERS:
 | 
				
			||||||
 | 
					         info = GetFiltersInformation();
 | 
				
			||||||
 | 
					         break;
 | 
				
			||||||
 | 
					    case IPTV_DEVICE_INFO_BUFFERS:
 | 
				
			||||||
 | 
					         info = GetBuffersInformation();
 | 
				
			||||||
 | 
					         break;
 | 
				
			||||||
 | 
					    default:
 | 
				
			||||||
 | 
					         info = cString::sprintf("%s%s%s%s",
 | 
				
			||||||
 | 
					                                 *GetGeneralInformation(),
 | 
				
			||||||
 | 
					                                 *GetPidsInformation(),
 | 
				
			||||||
 | 
					                                 *GetFiltersInformation(),
 | 
				
			||||||
 | 
					                                 *GetBuffersInformation());
 | 
				
			||||||
 | 
					         break;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  return info;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cString cIptvDevice::GetChannelSettings(const char *Param, int *IpPort, cIptvProtocolIf* *Protocol)
 | 
					cString cIptvDevice::GetChannelSettings(const char *Param, int *IpPort, cIptvProtocolIf* *Protocol)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										12
									
								
								device.h
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								device.h
									
									
									
									
									
								
							@@ -3,13 +3,14 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * 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.h,v 1.27 2007/10/07 19:06:33 ajhseppa Exp $
 | 
					 * $Id: device.h,v 1.28 2007/10/08 23:51:58 rahrenbe Exp $
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __IPTV_DEVICE_H
 | 
					#ifndef __IPTV_DEVICE_H
 | 
				
			||||||
#define __IPTV_DEVICE_H
 | 
					#define __IPTV_DEVICE_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <vdr/device.h>
 | 
					#include <vdr/device.h>
 | 
				
			||||||
 | 
					#include "common.h"
 | 
				
			||||||
#include "protocoludp.h"
 | 
					#include "protocoludp.h"
 | 
				
			||||||
#include "protocolhttp.h"
 | 
					#include "protocolhttp.h"
 | 
				
			||||||
#include "protocolfile.h"
 | 
					#include "protocolfile.h"
 | 
				
			||||||
@@ -48,7 +49,14 @@ private:
 | 
				
			|||||||
public:
 | 
					public:
 | 
				
			||||||
  cIptvDevice(unsigned int DeviceIndex);
 | 
					  cIptvDevice(unsigned int DeviceIndex);
 | 
				
			||||||
  virtual ~cIptvDevice();
 | 
					  virtual ~cIptvDevice();
 | 
				
			||||||
  cString GetInformation();
 | 
					  cString GetInformation(unsigned int Page = IPTV_DEVICE_INFO_ALL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // for statistics and general information
 | 
				
			||||||
 | 
					private:
 | 
				
			||||||
 | 
					  cString GetGeneralInformation(void);
 | 
				
			||||||
 | 
					  cString GetPidsInformation(void);
 | 
				
			||||||
 | 
					  cString GetFiltersInformation(void);
 | 
				
			||||||
 | 
					  cString GetBuffersInformation(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // for channel parsing & buffering
 | 
					  // for channel parsing & buffering
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										6
									
								
								iptv.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								iptv.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: iptv.c,v 1.14 2007/10/07 20:08:44 rahrenbe Exp $
 | 
					 * $Id: iptv.c,v 1.15 2007/10/08 23:51:58 rahrenbe Exp $
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <getopt.h>
 | 
					#include <getopt.h>
 | 
				
			||||||
@@ -175,8 +175,8 @@ bool cPluginIptv::SetupParse(const char *Name, const char *Value)
 | 
				
			|||||||
     IptvConfig.SetTsBufferSize(atoi(Value));
 | 
					     IptvConfig.SetTsBufferSize(atoi(Value));
 | 
				
			||||||
  else if (!strcasecmp(Name, "TsBufferPrefill"))
 | 
					  else if (!strcasecmp(Name, "TsBufferPrefill"))
 | 
				
			||||||
     IptvConfig.SetTsBufferPrefillRatio(atoi(Value));
 | 
					     IptvConfig.SetTsBufferPrefillRatio(atoi(Value));
 | 
				
			||||||
  else if (!strcasecmp(Name, "StatsUnit"))
 | 
					  else if (!strcasecmp(Name, "UseBytes"))
 | 
				
			||||||
     IptvConfig.SetStatsUnit(atoi(Value));
 | 
					     IptvConfig.SetUseBytes(atoi(Value));
 | 
				
			||||||
  else if (!strcasecmp(Name, "SectionFiltering"))
 | 
					  else if (!strcasecmp(Name, "SectionFiltering"))
 | 
				
			||||||
     IptvConfig.SetSectionFiltering(atoi(Value));
 | 
					     IptvConfig.SetSectionFiltering(atoi(Value));
 | 
				
			||||||
  else if (!strcasecmp(Name, "SidScanning"))
 | 
					  else if (!strcasecmp(Name, "SidScanning"))
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										56
									
								
								po/fi_FI.po
									
									
									
									
									
								
							
							
						
						
									
										56
									
								
								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-07 22:51+0300\n"
 | 
					"POT-Creation-Date: 2007-10-09 02:46+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"
 | 
				
			||||||
@@ -87,55 +87,55 @@ msgstr "Yksil
 | 
				
			|||||||
msgid "IPTV Channels"
 | 
					msgid "IPTV Channels"
 | 
				
			||||||
msgstr "IPTV-kanavat"
 | 
					msgstr "IPTV-kanavat"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: setup.c:492
 | 
					#: setup.c:493
 | 
				
			||||||
msgid "IPTV Information"
 | 
					msgid "IPTV Information"
 | 
				
			||||||
msgstr "IPTV-tiedot"
 | 
					msgstr "IPTV-tiedot"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: setup.c:507
 | 
					#: setup.c:496
 | 
				
			||||||
 | 
					msgid "Buffers"
 | 
				
			||||||
 | 
					msgstr "Puskurit"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#: setup.c:496
 | 
				
			||||||
 | 
					msgid "Filters"
 | 
				
			||||||
 | 
					msgstr "Suodattimet"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#: setup.c:496
 | 
				
			||||||
 | 
					msgid "General"
 | 
				
			||||||
 | 
					msgstr "Yleiset"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#: setup.c:496
 | 
				
			||||||
 | 
					msgid "Pids"
 | 
				
			||||||
 | 
					msgstr "Pidit"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#: setup.c:509
 | 
				
			||||||
msgid "IPTV information not available!"
 | 
					msgid "IPTV information not available!"
 | 
				
			||||||
msgstr "IPTV-tietoja ei saatavilla!"
 | 
					msgstr "IPTV-tietoja ei saatavilla!"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: setup.c:560
 | 
					#: setup.c:590
 | 
				
			||||||
msgid "bytes"
 | 
					 | 
				
			||||||
msgstr "tavuina"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#: setup.c:561
 | 
					 | 
				
			||||||
msgid "kbytes"
 | 
					 | 
				
			||||||
msgstr "kilotavuina"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#: setup.c:562
 | 
					 | 
				
			||||||
msgid "bits"
 | 
					 | 
				
			||||||
msgstr "bittein<69>"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#: setup.c:563
 | 
					 | 
				
			||||||
msgid "kbits"
 | 
					 | 
				
			||||||
msgstr "kilobittein<69>"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#: setup.c:581
 | 
					 | 
				
			||||||
msgid "TS buffer size [MB]"
 | 
					msgid "TS buffer size [MB]"
 | 
				
			||||||
msgstr "TS-puskurin koko [MB]"
 | 
					msgstr "TS-puskurin koko [MB]"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: setup.c:582
 | 
					#: setup.c:591
 | 
				
			||||||
msgid "TS buffer prefill ratio [%]"
 | 
					msgid "TS buffer prefill ratio [%]"
 | 
				
			||||||
msgstr "TS-puskurin esit<69>ytt<74>aste [%]"
 | 
					msgstr "TS-puskurin esit<69>ytt<74>aste [%]"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: setup.c:583
 | 
					#: setup.c:592
 | 
				
			||||||
msgid "Show statistics in"
 | 
					msgid "Use bytes in statistics"
 | 
				
			||||||
msgstr "N<EFBFBD>yt<EFBFBD> tilastotiedot"
 | 
					msgstr "K<EFBFBD>yt<EFBFBD> tavuja tilastotiedoissa"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: setup.c:584
 | 
					#: setup.c:593
 | 
				
			||||||
msgid "Use section filtering"
 | 
					msgid "Use section filtering"
 | 
				
			||||||
msgstr "K<>yt<79> sektioiden suodatusta"
 | 
					msgstr "K<>yt<79> sektioiden suodatusta"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: setup.c:586
 | 
					#: setup.c:595
 | 
				
			||||||
msgid "Scan Sid automatically"
 | 
					msgid "Scan Sid automatically"
 | 
				
			||||||
msgstr "Etsi palvelu-ID automaattisesti"
 | 
					msgstr "Etsi palvelu-ID automaattisesti"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#: setup.c:587
 | 
					#: setup.c:596
 | 
				
			||||||
msgid "Disable filters"
 | 
					msgid "Disable filters"
 | 
				
			||||||
msgstr "Poista suodattimia k<>yt<79>st<73>"
 | 
					msgstr "Poista suodattimia k<>yt<79>st<73>"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#. TRANSLATORS: note the singular!
 | 
					#. TRANSLATORS: note the singular!
 | 
				
			||||||
#: setup.c:590
 | 
					#: setup.c:599
 | 
				
			||||||
msgid "Disable filter"
 | 
					msgid "Disable filter"
 | 
				
			||||||
msgstr "Poista suodatin k<>yt<79>st<73>"
 | 
					msgstr "Poista suodatin k<>yt<79>st<73>"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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: sectionfilter.h,v 1.6 2007/10/05 21:56:02 ajhseppa Exp $
 | 
					 * $Id: sectionfilter.h,v 1.7 2007/10/08 23:51:58 rahrenbe Exp $
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __IPTV_SECTIONFILTER_H
 | 
					#ifndef __IPTV_SECTIONFILTER_H
 | 
				
			||||||
@@ -98,6 +98,7 @@ public:
 | 
				
			|||||||
  void ProcessData(const uint8_t* buf);
 | 
					  void ProcessData(const uint8_t* buf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  int GetReadDesc();
 | 
					  int GetReadDesc();
 | 
				
			||||||
 | 
					  uint16_t GetPid() { return pid; }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // __IPTV_SECTIONFILTER_H
 | 
					#endif // __IPTV_SECTIONFILTER_H
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										45
									
								
								setup.c
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								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.26 2007/10/07 20:08:44 rahrenbe Exp $
 | 
					 * $Id: setup.c,v 1.27 2007/10/08 23:51:58 rahrenbe Exp $
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
@@ -479,6 +479,7 @@ private:
 | 
				
			|||||||
  };
 | 
					  };
 | 
				
			||||||
  cString text;
 | 
					  cString text;
 | 
				
			||||||
  cTimeMs timeout;
 | 
					  cTimeMs timeout;
 | 
				
			||||||
 | 
					  unsigned int page;
 | 
				
			||||||
  void UpdateInfo();
 | 
					  void UpdateInfo();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
@@ -489,9 +490,10 @@ public:
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cIptvMenuInfo::cIptvMenuInfo()
 | 
					cIptvMenuInfo::cIptvMenuInfo()
 | 
				
			||||||
:cOsdMenu(tr("IPTV Information")), text(""), timeout(INFO_TIMEOUT_MS)
 | 
					:cOsdMenu(tr("IPTV Information")), text(""), timeout(INFO_TIMEOUT_MS), page(IPTV_DEVICE_INFO_GENERAL)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  UpdateInfo();
 | 
					  UpdateInfo();
 | 
				
			||||||
 | 
					  SetHelp(tr("General"), tr("Pids"), tr("Filters"), tr("Buffers"));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cIptvMenuInfo::~cIptvMenuInfo()
 | 
					cIptvMenuInfo::~cIptvMenuInfo()
 | 
				
			||||||
@@ -502,7 +504,7 @@ void cIptvMenuInfo::UpdateInfo()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  cIptvDevice *device = cIptvDevice::GetIptvDevice(cDevice::ActualDevice()->CardIndex());
 | 
					  cIptvDevice *device = cIptvDevice::GetIptvDevice(cDevice::ActualDevice()->CardIndex());
 | 
				
			||||||
  if (device)
 | 
					  if (device)
 | 
				
			||||||
     text = device->GetInformation();
 | 
					     text = device->GetInformation(page);
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
     text = cString(tr("IPTV information not available!"));
 | 
					     text = cString(tr("IPTV information not available!"));
 | 
				
			||||||
  Display();
 | 
					  Display();
 | 
				
			||||||
@@ -538,10 +540,23 @@ eOSState cIptvMenuInfo::ProcessKey(eKeys Key)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  if (state == osUnknown) {
 | 
					  if (state == osUnknown) {
 | 
				
			||||||
     switch (Key) {
 | 
					     switch (Key) {
 | 
				
			||||||
       case kOk: return osBack;
 | 
					       case kOk:     return osBack;
 | 
				
			||||||
       default:  if (timeout.TimedOut())
 | 
					       case kRed:    page = IPTV_DEVICE_INFO_GENERAL;
 | 
				
			||||||
                    UpdateInfo();
 | 
					                     UpdateInfo();
 | 
				
			||||||
                 return osContinue;
 | 
					                     break;
 | 
				
			||||||
 | 
					       case kGreen:  page = IPTV_DEVICE_INFO_PIDS;
 | 
				
			||||||
 | 
					                     UpdateInfo();
 | 
				
			||||||
 | 
					                     break;
 | 
				
			||||||
 | 
					       case kYellow: page = IPTV_DEVICE_INFO_FILTERS;
 | 
				
			||||||
 | 
					                     UpdateInfo();
 | 
				
			||||||
 | 
					                     break;
 | 
				
			||||||
 | 
					       case kBlue:   page = IPTV_DEVICE_INFO_BUFFERS;
 | 
				
			||||||
 | 
					                     UpdateInfo();
 | 
				
			||||||
 | 
					                     break;
 | 
				
			||||||
 | 
					       default:      if (timeout.TimedOut())
 | 
				
			||||||
 | 
					                        UpdateInfo();
 | 
				
			||||||
 | 
					                     state = osContinue;
 | 
				
			||||||
 | 
					                     break;
 | 
				
			||||||
       }
 | 
					       }
 | 
				
			||||||
     }
 | 
					     }
 | 
				
			||||||
  return state;
 | 
					  return state;
 | 
				
			||||||
@@ -554,13 +569,7 @@ cIptvPluginSetup::cIptvPluginSetup()
 | 
				
			|||||||
  debug("cIptvPluginSetup::cIptvPluginSetup()\n");
 | 
					  debug("cIptvPluginSetup::cIptvPluginSetup()\n");
 | 
				
			||||||
  tsBufferSize = IptvConfig.GetTsBufferSize();
 | 
					  tsBufferSize = IptvConfig.GetTsBufferSize();
 | 
				
			||||||
  tsBufferPrefill = IptvConfig.GetTsBufferPrefillRatio();
 | 
					  tsBufferPrefill = IptvConfig.GetTsBufferPrefillRatio();
 | 
				
			||||||
  statsUnit = IptvConfig.GetStatsUnit();
 | 
					  useBytes = IptvConfig.GetUseBytes();
 | 
				
			||||||
  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();
 | 
					  sectionFiltering = IptvConfig.GetSectionFiltering();
 | 
				
			||||||
  sidScanning = IptvConfig.GetSidScanning();
 | 
					  sidScanning = IptvConfig.GetSidScanning();
 | 
				
			||||||
  numDisabledFilters = IptvConfig.GetDisabledFiltersCount();
 | 
					  numDisabledFilters = IptvConfig.GetDisabledFiltersCount();
 | 
				
			||||||
@@ -580,8 +589,8 @@ void cIptvPluginSetup::Setup(void)
 | 
				
			|||||||
  Clear();
 | 
					  Clear();
 | 
				
			||||||
  Add(new cMenuEditIntItem( tr("TS buffer size [MB]"),         &tsBufferSize, 2, 16));
 | 
					  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 prefill ratio [%]"), &tsBufferPrefill, 0, 40));
 | 
				
			||||||
  Add(new cMenuEditStraItem(tr("Show statistics in"),          &statsUnit, IPTV_STATS_UNIT_COUNT, statsUnitNames));
 | 
					  Add(new cMenuEditBoolItem(tr("Use bytes in statistics"),     &useBytes));
 | 
				
			||||||
  Add(new cMenuEditBoolItem(tr("Use section filtering"),       §ionFiltering));  
 | 
					  Add(new cMenuEditBoolItem(tr("Use section filtering"),       §ionFiltering));
 | 
				
			||||||
  if (sectionFiltering) {
 | 
					  if (sectionFiltering) {
 | 
				
			||||||
     Add(new cMenuEditBoolItem(tr("Scan Sid automatically"),   &sidScanning));
 | 
					     Add(new cMenuEditBoolItem(tr("Scan Sid automatically"),   &sidScanning));
 | 
				
			||||||
     Add(new cMenuEditIntItem( tr("Disable filters"),          &numDisabledFilters, 0, SECTION_FILTER_TABLE_SIZE));
 | 
					     Add(new cMenuEditIntItem( tr("Disable filters"),          &numDisabledFilters, 0, SECTION_FILTER_TABLE_SIZE));
 | 
				
			||||||
@@ -654,14 +663,14 @@ void cIptvPluginSetup::Store(void)
 | 
				
			|||||||
  // Store values into setup.conf
 | 
					  // Store values into setup.conf
 | 
				
			||||||
  SetupStore("TsBufferSize", tsBufferSize);
 | 
					  SetupStore("TsBufferSize", tsBufferSize);
 | 
				
			||||||
  SetupStore("TsBufferPrefill", tsBufferPrefill);
 | 
					  SetupStore("TsBufferPrefill", tsBufferPrefill);
 | 
				
			||||||
  SetupStore("StatsUnit", statsUnit);
 | 
					  SetupStore("UseBytes", useBytes);
 | 
				
			||||||
  SetupStore("SectionFiltering", sectionFiltering);
 | 
					  SetupStore("SectionFiltering", sectionFiltering);
 | 
				
			||||||
  SetupStore("SidScanning", sidScanning);
 | 
					  SetupStore("SidScanning", sidScanning);
 | 
				
			||||||
  StoreFilters("DisabledFilters", disabledFilterIndexes);
 | 
					  StoreFilters("DisabledFilters", disabledFilterIndexes);
 | 
				
			||||||
  // Update global config
 | 
					  // Update global config
 | 
				
			||||||
  IptvConfig.SetTsBufferSize(tsBufferSize);
 | 
					  IptvConfig.SetTsBufferSize(tsBufferSize);
 | 
				
			||||||
  IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefill);
 | 
					  IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefill);
 | 
				
			||||||
  IptvConfig.SetStatsUnit(statsUnit);
 | 
					  IptvConfig.SetUseBytes(useBytes);
 | 
				
			||||||
  IptvConfig.SetSectionFiltering(sectionFiltering);
 | 
					  IptvConfig.SetSectionFiltering(sectionFiltering);
 | 
				
			||||||
  IptvConfig.SetSidScanning(sidScanning);
 | 
					  IptvConfig.SetSidScanning(sidScanning);
 | 
				
			||||||
  for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i)
 | 
					  for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								setup.h
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								setup.h
									
									
									
									
									
								
							@@ -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.h,v 1.13 2007/10/07 20:08:45 rahrenbe Exp $
 | 
					 * $Id: setup.h,v 1.14 2007/10/08 23:51:58 rahrenbe Exp $
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __IPTV_SETUP_H
 | 
					#ifndef __IPTV_SETUP_H
 | 
				
			||||||
@@ -17,10 +17,9 @@ class cIptvPluginSetup : public cMenuSetupPage
 | 
				
			|||||||
private:
 | 
					private:
 | 
				
			||||||
  int tsBufferSize;
 | 
					  int tsBufferSize;
 | 
				
			||||||
  int tsBufferPrefill;
 | 
					  int tsBufferPrefill;
 | 
				
			||||||
 | 
					  int useBytes;
 | 
				
			||||||
  int sectionFiltering;
 | 
					  int sectionFiltering;
 | 
				
			||||||
  int sidScanning;
 | 
					  int sidScanning;
 | 
				
			||||||
  int statsUnit;
 | 
					 | 
				
			||||||
  const char *statsUnitNames[IPTV_STATS_UNIT_COUNT];
 | 
					 | 
				
			||||||
  int numDisabledFilters;
 | 
					  int numDisabledFilters;
 | 
				
			||||||
  int disabledFilterIndexes[SECTION_FILTER_TABLE_SIZE];
 | 
					  int disabledFilterIndexes[SECTION_FILTER_TABLE_SIZE];
 | 
				
			||||||
  const char *disabledFilterNames[SECTION_FILTER_TABLE_SIZE];
 | 
					  const char *disabledFilterNames[SECTION_FILTER_TABLE_SIZE];
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										114
									
								
								statistics.c
									
									
									
									
									
								
							
							
						
						
									
										114
									
								
								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.14 2007/10/08 18:31:44 ajhseppa Exp $
 | 
					 * $Id: statistics.c,v 1.15 2007/10/08 23:51:58 rahrenbe Exp $
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <limits.h>
 | 
					#include <limits.h>
 | 
				
			||||||
@@ -30,35 +30,27 @@ cIptvSectionStatistics::~cIptvSectionStatistics()
 | 
				
			|||||||
cString cIptvSectionStatistics::GetStatistic()
 | 
					cString cIptvSectionStatistics::GetStatistic()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  //debug("cIptvSectionStatistics::GetStatistic()\n");
 | 
					  //debug("cIptvSectionStatistics::GetStatistic()\n");
 | 
				
			||||||
  mutex.Lock();
 | 
					  cMutexLock MutexLock(&mutex);
 | 
				
			||||||
  long tmpNumberOfCalls = numberOfCalls;
 | 
					  long bitrate = 0;
 | 
				
			||||||
  long tmpFilteredData = filteredData;
 | 
					  uint64_t elapsed = timer.Elapsed(); /* in milliseconds */
 | 
				
			||||||
  filteredData = numberOfCalls = 0;
 | 
					 | 
				
			||||||
  uint64_t elapsed = timer.Elapsed();
 | 
					 | 
				
			||||||
  timer.Set();
 | 
					  timer.Set();
 | 
				
			||||||
  mutex.Unlock();
 | 
					  if (elapsed)
 | 
				
			||||||
  float divider = elapsed / 1000;
 | 
					     bitrate = (long)(1000.0 * filteredData / elapsed / KILOBYTE(1));
 | 
				
			||||||
  char unit[] = { ' ', 'B', '/', 's', '\0' };
 | 
					  if (!IptvConfig.GetUseBytes())
 | 
				
			||||||
  if (IptvConfig.IsStatsUnitInKilos()) {
 | 
					     bitrate *= 8;
 | 
				
			||||||
     divider *= KILOBYTE(1);
 | 
					  // no trailing linefeed here!
 | 
				
			||||||
     unit[0] = 'k';
 | 
					  cString info = cString::sprintf("%4ld (%4ld k%s/s)", numberOfCalls, bitrate,
 | 
				
			||||||
     }
 | 
					                                  IptvConfig.GetUseBytes() ? "B" : "bit");
 | 
				
			||||||
  if (!IptvConfig.IsStatsUnitInBytes()) {
 | 
					  filteredData = numberOfCalls = 0;
 | 
				
			||||||
     divider /= sizeof(unsigned short) * 8;
 | 
					 | 
				
			||||||
     unit[1] = 'b';
 | 
					 | 
				
			||||||
     }
 | 
					 | 
				
			||||||
  cString info = cString::sprintf("%4ld (%4ld %s)", tmpNumberOfCalls, divider ?
 | 
					 | 
				
			||||||
                                  (long)(tmpFilteredData / divider) : 0L, unit);
 | 
					 | 
				
			||||||
  return info;
 | 
					  return info;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void cIptvSectionStatistics::AddStatistic(long Bytes, long Calls)
 | 
					void cIptvSectionStatistics::AddStatistic(long Bytes, long Calls)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  //debug("cIptvSectionStatistics::AddStatistic(Bytes=%ld, Calls=%ld)\n", Bytes, Calls); 
 | 
					  //debug("cIptvSectionStatistics::AddStatistic(Bytes=%ld, Calls=%ld)\n", Bytes, Calls); 
 | 
				
			||||||
  mutex.Lock();
 | 
					  cMutexLock MutexLock(&mutex);
 | 
				
			||||||
  filteredData += Bytes;
 | 
					  filteredData += Bytes;
 | 
				
			||||||
  numberOfCalls += Calls;
 | 
					  numberOfCalls += Calls;
 | 
				
			||||||
  mutex.Unlock();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// --- cIptvDeviceStatistics -------------------------------------------------
 | 
					// --- cIptvDeviceStatistics -------------------------------------------------
 | 
				
			||||||
@@ -81,36 +73,28 @@ cIptvDeviceStatistics::~cIptvDeviceStatistics()
 | 
				
			|||||||
cString cIptvDeviceStatistics::GetStatistic()
 | 
					cString cIptvDeviceStatistics::GetStatistic()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  //debug("cIptvDeviceStatistics::GetStatistic()\n");
 | 
					  //debug("cIptvDeviceStatistics::GetStatistic()\n");
 | 
				
			||||||
  mutex.Lock();
 | 
					  cMutexLock MutexLock(&mutex);
 | 
				
			||||||
  long tmpDataBytes = dataBytes;
 | 
					  long bitrate = 0L;
 | 
				
			||||||
  dataBytes = 0;
 | 
					  uint64_t elapsed = timer.Elapsed(); /* in milliseconds */
 | 
				
			||||||
  pidStruct tmpMostActivePids[IPTV_STATS_ACTIVE_PIDS_COUNT];
 | 
					 | 
				
			||||||
  memcpy(&tmpMostActivePids, &mostActivePids, sizeof(tmpMostActivePids));
 | 
					 | 
				
			||||||
  memset(&mostActivePids, '\0', sizeof(mostActivePids));
 | 
					 | 
				
			||||||
  uint64_t elapsed = timer.Elapsed();
 | 
					 | 
				
			||||||
  timer.Set();
 | 
					  timer.Set();
 | 
				
			||||||
  mutex.Unlock();
 | 
					  if (elapsed)
 | 
				
			||||||
  float divider = elapsed / 1000;
 | 
					     bitrate = (long)(1000.0 * dataBytes / elapsed / KILOBYTE(1));
 | 
				
			||||||
  char unit[] = { ' ', 'B', '/', 's', '\0' };
 | 
					  if (!IptvConfig.GetUseBytes())
 | 
				
			||||||
  if (IptvConfig.IsStatsUnitInKilos()) {
 | 
					     bitrate *= 8;
 | 
				
			||||||
     divider *= KILOBYTE(1);
 | 
					  cString info = cString::sprintf("Bitrate: %ld k%s/s\n", bitrate,
 | 
				
			||||||
     unit[0] = 'k';
 | 
					                                  IptvConfig.GetUseBytes() ? "B" : "bit");
 | 
				
			||||||
     }
 | 
					 | 
				
			||||||
  if (!IptvConfig.IsStatsUnitInBytes()) {
 | 
					 | 
				
			||||||
     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) {
 | 
					  for (unsigned int i = 0; i < IPTV_STATS_ACTIVE_PIDS_COUNT; ++i) {
 | 
				
			||||||
      if (tmpMostActivePids[i].pid)
 | 
					      if (mostActivePids[i].pid) {
 | 
				
			||||||
         info = cString::sprintf("%sPid %d: %4d (%4ld %s)%c", *info, i,
 | 
					         bitrate = (long)(1000.0 * mostActivePids[i].DataAmount / elapsed / KILOBYTE(1));
 | 
				
			||||||
                                 tmpMostActivePids[i].pid,
 | 
					         if (!IptvConfig.GetUseBytes())
 | 
				
			||||||
                                 (long)(tmpMostActivePids[i].DataAmount / divider),
 | 
					            bitrate *= 8;
 | 
				
			||||||
                                 unit, ((i + 1) % 2) ? '\t' : '\n');
 | 
					         info = cString::sprintf("%sPid %d: %4d (%4ld k%s/s)\n", *info, i,
 | 
				
			||||||
 | 
					                                 mostActivePids[i].pid, bitrate,
 | 
				
			||||||
 | 
					                                 IptvConfig.GetUseBytes() ? "B" : "bit");
 | 
				
			||||||
 | 
					         }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
  if (!endswith(*info, "\n"))
 | 
					  dataBytes = 0;
 | 
				
			||||||
     info = cString::sprintf("%s%c", *info, '\n');
 | 
					  memset(&mostActivePids, '\0', sizeof(mostActivePids));
 | 
				
			||||||
  return info;
 | 
					  return info;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -129,7 +113,7 @@ int cIptvDeviceStatistics::SortPids(const void* data1, const void* data2)
 | 
				
			|||||||
void cIptvDeviceStatistics::AddStatistic(long Bytes, u_short pid, long payload)
 | 
					void cIptvDeviceStatistics::AddStatistic(long Bytes, u_short pid, long payload)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  //debug("cIptvDeviceStatistics::AddStatistic(Bytes=%ld, pid=%ld, payload=%ld)\n", Bytes, pid, payload);
 | 
					  //debug("cIptvDeviceStatistics::AddStatistic(Bytes=%ld, pid=%ld, payload=%ld)\n", Bytes, pid, payload);
 | 
				
			||||||
  mutex.Lock();
 | 
					  cMutexLock MutexLock(&mutex);
 | 
				
			||||||
  dataBytes += Bytes;
 | 
					  dataBytes += Bytes;
 | 
				
			||||||
  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
 | 
				
			||||||
@@ -138,7 +122,6 @@ void cIptvDeviceStatistics::AddStatistic(long Bytes, u_short pid, long payload)
 | 
				
			|||||||
         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), SortPids);
 | 
					         qsort(&mostActivePids, numberOfElements, sizeof(pidStruct), SortPids);
 | 
				
			||||||
         mutex.Unlock();
 | 
					 | 
				
			||||||
         return;
 | 
					         return;
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@@ -150,7 +133,6 @@ void cIptvDeviceStatistics::AddStatistic(long Bytes, u_short pid, long payload)
 | 
				
			|||||||
     // Re-sort
 | 
					     // Re-sort
 | 
				
			||||||
     qsort(&mostActivePids, numberOfElements, sizeof(pidStruct), SortPids);
 | 
					     qsort(&mostActivePids, numberOfElements, sizeof(pidStruct), SortPids);
 | 
				
			||||||
     }
 | 
					     }
 | 
				
			||||||
  mutex.Unlock();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// --- cIptvStreamerStatistics -----------------------------------------------
 | 
					// --- cIptvStreamerStatistics -----------------------------------------------
 | 
				
			||||||
@@ -172,30 +154,22 @@ cIptvStreamerStatistics::~cIptvStreamerStatistics()
 | 
				
			|||||||
cString cIptvStreamerStatistics::GetStatistic()
 | 
					cString cIptvStreamerStatistics::GetStatistic()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  //debug("cIptvStreamerStatistics::GetStatistic()\n");
 | 
					  //debug("cIptvStreamerStatistics::GetStatistic()\n");
 | 
				
			||||||
  mutex.Lock();
 | 
					  cMutexLock MutexLock(&mutex);
 | 
				
			||||||
  long tmpDataBytes = dataBytes;
 | 
					  long bitrate = 0;
 | 
				
			||||||
  dataBytes = 0;
 | 
					  uint64_t elapsed = timer.Elapsed(); /* in milliseconds */
 | 
				
			||||||
  uint64_t elapsed = timer.Elapsed();
 | 
					 | 
				
			||||||
  timer.Set();
 | 
					  timer.Set();
 | 
				
			||||||
  mutex.Unlock();
 | 
					  if (elapsed)
 | 
				
			||||||
  float divider = elapsed / 1000;
 | 
					     bitrate = (long)(1000.0 * dataBytes / elapsed / KILOBYTE(1));
 | 
				
			||||||
  char unit[] = { ' ', 'B', '/', 's', '\0' };
 | 
					  if (!IptvConfig.GetUseBytes())
 | 
				
			||||||
  if (IptvConfig.IsStatsUnitInKilos()) {
 | 
					     bitrate *= 8;
 | 
				
			||||||
     divider *= KILOBYTE(1);
 | 
					  cString info = cString::sprintf("Streamer: %ld k%s/s\n", bitrate, IptvConfig.GetUseBytes() ? "B" : "bit");
 | 
				
			||||||
     unit[0] = 'k';
 | 
					  dataBytes = 0;
 | 
				
			||||||
     }
 | 
					  return info;
 | 
				
			||||||
  if (!IptvConfig.IsStatsUnitInBytes()) {
 | 
					 | 
				
			||||||
     divider /= sizeof(unsigned short) * 8;
 | 
					 | 
				
			||||||
     unit[1] = 'b';
 | 
					 | 
				
			||||||
     }
 | 
					 | 
				
			||||||
  return cString::sprintf("Streamer: %ld %s", divider ?
 | 
					 | 
				
			||||||
                          (long)(tmpDataBytes / divider) : 0L, unit);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void cIptvStreamerStatistics::AddStatistic(long Bytes)
 | 
					void cIptvStreamerStatistics::AddStatistic(long Bytes)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  //debug("cIptvStreamerStatistics::AddStatistic(Bytes=%ld)\n", Bytes);
 | 
					  //debug("cIptvStreamerStatistics::AddStatistic(Bytes=%ld)\n", Bytes);
 | 
				
			||||||
  mutex.Lock();
 | 
					  cMutexLock MutexLock(&mutex);
 | 
				
			||||||
  dataBytes += Bytes;
 | 
					  dataBytes += Bytes;
 | 
				
			||||||
  mutex.Unlock();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user