LCOV - code coverage report
Current view: top level - media/libstagefright/binding/include/mp4_demuxer - BitReader.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 2 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* This Source Code Form is subject to the terms of the Mozilla Public
       2             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       3             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       4             : 
       5             : #ifndef BIT_READER_H_
       6             : #define BIT_READER_H_
       7             : 
       8             : #include "MediaData.h"
       9             : 
      10             : namespace mp4_demuxer
      11             : {
      12             : 
      13             : class BitReader
      14             : {
      15             : public:
      16             :   explicit BitReader(const mozilla::MediaByteBuffer* aBuffer);
      17             :   BitReader(const mozilla::MediaByteBuffer* aBuffer, size_t aBits);
      18             :   BitReader(const uint8_t* aBuffer, size_t aBits);
      19             :   ~BitReader();
      20             :   uint32_t ReadBits(size_t aNum);
      21           0 :   uint32_t ReadBit() { return ReadBits(1); }
      22           0 :   uint32_t ReadU32() { return ReadBits(32); }
      23             :   uint64_t ReadU64();
      24             : 
      25             :   // Read the UTF-8 sequence and convert it to its 64-bit UCS-4 encoded form.
      26             :   // Return 0xfffffffffffffff if sequence was invalid.
      27             :   uint64_t ReadUTF8();
      28             :   // Read unsigned integer Exp-Golomb-coded.
      29             :   uint32_t ReadUE();
      30             :   // Read signed integer Exp-Golomb-coded.
      31             :   int32_t ReadSE();
      32             : 
      33             :   // Return the number of bits parsed so far;
      34             :   size_t BitCount() const;
      35             :   // Return the number of bits left.
      36             :   size_t BitsLeft() const;
      37             : 
      38             : private:
      39             :   void FillReservoir();
      40             :   const uint8_t* mData;
      41             :   const size_t mOriginalBitSize;
      42             :   size_t mTotalBitsLeft;
      43             :   size_t mSize;           // Size left in bytes
      44             :   uint32_t mReservoir;    // Left-aligned bits
      45             :   size_t mNumBitsLeft;    // Number of bits left in reservoir.
      46             : };
      47             : 
      48             : } // namespace mp4_demuxer
      49             : 
      50             : #endif // BIT_READER_H_

Generated by: LCOV version 1.13