diff --git a/statistics.c b/statistics.c index 247d6e6..1e2e7e5 100644 --- a/statistics.c +++ b/statistics.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: statistics.c,v 1.10 2007/10/07 22:54:09 rahrenbe Exp $ + * $Id: statistics.c,v 1.11 2007/10/08 12:25:30 rahrenbe Exp $ */ #include @@ -93,9 +93,9 @@ cString cIptvDeviceStatistics::GetStatistic() return info; } -static int SortFunc(const void* data1, const void* data2) +int cIptvDeviceStatistics::SortPids(const void* data1, const void* data2) { - //debug("cIptvDeviceStatistics::SortFunc()\n"); + //debug("cIptvDeviceStatistics::SortPids()\n"); pidStruct *comp1 = (pidStruct*)data1; pidStruct *comp2 = (pidStruct*)data2; if (comp1->DataAmount > comp2->DataAmount) @@ -114,7 +114,7 @@ void cIptvDeviceStatistics::UpdateActivePids(u_short pid, long payload) if (mostActivePids[i].pid == pid) { mostActivePids[i].DataAmount += payload; // Now re-sort the array and quit - qsort(&mostActivePids, numberOfElements, sizeof(pidStruct), SortFunc); + qsort(&mostActivePids, numberOfElements, sizeof(pidStruct), SortPids); return; } } @@ -124,7 +124,7 @@ void cIptvDeviceStatistics::UpdateActivePids(u_short pid, long payload) mostActivePids[numberOfElements - 1].pid = pid; mostActivePids[numberOfElements - 1].DataAmount = payload; // Re-sort - qsort(&mostActivePids, numberOfElements, sizeof(pidStruct), SortFunc); + qsort(&mostActivePids, numberOfElements, sizeof(pidStruct), SortPids); } } diff --git a/statistics.h b/statistics.h index a647397..aaa518c 100644 --- a/statistics.h +++ b/statistics.h @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: statistics.h,v 1.5 2007/10/07 22:54:09 rahrenbe Exp $ + * $Id: statistics.h,v 1.6 2007/10/08 12:25:30 rahrenbe Exp $ */ #ifndef __IPTV_STATISTICS_H @@ -11,11 +11,6 @@ #include "statisticif.h" -struct pidStruct { - u_short pid; - long DataAmount; -}; - // Section statistics class cIptvSectionStatistics : public cIptvStatisticIf { protected: @@ -47,8 +42,14 @@ protected: void UpdateActivePids(u_short pid, long payload); private: + struct pidStruct { + u_short pid; + long DataAmount; + }; pidStruct mostActivePids[IPTV_STATS_ACTIVE_PIDS_COUNT]; cTimeMs timer; + + static int SortPids(const void* data1, const void* data2); }; // Streamer statistics