MythTV  master
tsstats.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 // This file, "tsstats.h" is in the public domain, written by Daniel Kristjansson, 2004 CE
3 #ifndef __TS_STATS__
4 #define __TS_STATS__
5 
6 #include <QString>
7 #include <QMap>
8 
14 class TSStats
15 {
16  public:
17  TSStats() : _tspacket_count(0) { ; }
18  void IncrPIDCount(int pid) { _pid_counts[pid]++; }
20  long long TSPacketCount() { return _tspacket_count; }
21  void Reset() { _tspacket_count = 0; _pid_counts.clear(); }
22  inline QString toString();
23  private:
24  long long _tspacket_count;
25  QMap<int, long long> _pid_counts;
26 };
27 
28 inline QString TSStats::toString() {
29  QString str("Transport Stream Statistics\n");
30  str.append(QString("TSPacket Count: %1").arg((long)_tspacket_count));
31  QMapIterator<int, long long> it = _pid_counts.begin();
32  for (; it != _pid_counts.end(); it++)
33  str.append(QString("\nPID 0x%1 Count: %2").
34  arg((int)it.key(),0,16).arg((long)it.data(),10,10));
35  return str;
36 }
37 
38 #endif // __TS_STATS__
void IncrPIDCount(int pid)
Definition: tsstats.h:18
TSStats()
Definition: tsstats.h:17
void IncrTSPacketCount()
Definition: tsstats.h:19
long long _tspacket_count
Definition: tsstats.h:24
QMap< int, long long > _pid_counts
Definition: tsstats.h:25
long long TSPacketCount()
Definition: tsstats.h:20
void Reset()
Definition: tsstats.h:21
Collects statistics on the number of TSPacket's seen on each PID.
Definition: tsstats.h:14
QString toString()
Definition: tsstats.h:28