diff options
| author | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
| commit | be933ef2241d79558f91796cc5b3a161f72ebf9c (patch) | |
| tree | fe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/utils/BitstreamStats.h | |
| parent | 5f8335c1e49ce108ef3481863833c98efa00411b (diff) | |
| download | kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2 kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip | |
sync with upstream
Diffstat (limited to 'xbmc/utils/BitstreamStats.h')
| -rw-r--r-- | xbmc/utils/BitstreamStats.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/xbmc/utils/BitstreamStats.h b/xbmc/utils/BitstreamStats.h new file mode 100644 index 0000000..13413c6 --- /dev/null +++ b/xbmc/utils/BitstreamStats.h | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2018 Team Kodi | ||
| 3 | * This file is part of Kodi - https://kodi.tv | ||
| 4 | * | ||
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later | ||
| 6 | * See LICENSES/README.md for more information. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #pragma once | ||
| 10 | |||
| 11 | #include <stdint.h> | ||
| 12 | |||
| 13 | class BitstreamStats final | ||
| 14 | { | ||
| 15 | public: | ||
| 16 | // in order not to cause a performance hit, we should only check the clock when | ||
| 17 | // we reach m_nEstimatedBitrate bits. | ||
| 18 | // if this value is 1, we will calculate bitrate on every sample. | ||
| 19 | explicit BitstreamStats(unsigned int nEstimatedBitrate=(10240*8) /*10Kbit*/); | ||
| 20 | |||
| 21 | void AddSampleBytes(unsigned int nBytes); | ||
| 22 | void AddSampleBits(unsigned int nBits); | ||
| 23 | |||
| 24 | inline double GetBitrate() const { return m_dBitrate; } | ||
| 25 | inline double GetMaxBitrate() const { return m_dMaxBitrate; } | ||
| 26 | inline double GetMinBitrate() const { return m_dMinBitrate; } | ||
| 27 | |||
| 28 | void Start(); | ||
| 29 | void CalculateBitrate(); | ||
| 30 | |||
| 31 | private: | ||
| 32 | double m_dBitrate; | ||
| 33 | double m_dMaxBitrate; | ||
| 34 | double m_dMinBitrate; | ||
| 35 | unsigned int m_nBitCount; | ||
| 36 | unsigned int m_nEstimatedBitrate; // when we reach this amount of bits we check current bitrate. | ||
| 37 | int64_t m_tmStart; | ||
| 38 | static int64_t m_tmFreq; | ||
| 39 | }; | ||
| 40 | |||
