1 #ifndef BITSTREAM_STATS__H__
2 #define BITSTREAM_STATS__H__
5 * Copyright (C) 2005-2013 Team XBMC
8 * This Program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
13 * This Program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with XBMC; see the file COPYING. If not, see
20 * <http://www.gnu.org/licenses/>.
26 #include "linux/PlatformDefs.h"
32 // in order not to cause a performance hit, we should only check the clock when
33 // we reach m_nEstimatedBitrate bits.
34 // if this value is 1, we will calculate bitrate on every sample.
35 BitstreamStats(unsigned int nEstimatedBitrate=(10240*8) /*10Kbit*/);
36 virtual ~BitstreamStats();
38 void AddSampleBytes(unsigned int nBytes);
39 void AddSampleBits(unsigned int nBits);
41 inline double GetBitrate() const { return m_dBitrate; }
42 inline double GetMaxBitrate() const { return m_dMaxBitrate; }
43 inline double GetMinBitrate() const { return m_dMinBitrate; }
46 void CalculateBitrate();
52 unsigned int m_nBitCount;
53 unsigned int m_nEstimatedBitrate; // when we reach this amount of bits we check current bitrate.
55 static int64_t m_tmFreq;