Index: content/common/gpu/media/h264_parser.h |
diff --git a/content/common/gpu/media/h264_parser.h b/content/common/gpu/media/h264_parser.h |
index ed76f164750db134ab5498d134a35512f3b725f7..6e11149458404b002670f5cb7a91bd992899c554 100644 |
--- a/content/common/gpu/media/h264_parser.h |
+++ b/content/common/gpu/media/h264_parser.h |
@@ -12,7 +12,9 @@ |
#include <map> |
#include "base/basictypes.h" |
+#include "base/compiler_specific.h" |
#include "content/common/content_export.h" |
+#include "media/base/bit_reader.h" |
namespace content { |
@@ -302,58 +304,18 @@ class CONTENT_EXPORT H264Parser { |
private: |
// A class to provide bit-granularity reading of H.264 streams. |
- // This is not a generic bit reader class, as it takes into account |
- // H.264 stream-specific constraints, such as skipping emulation-prevention |
- // bytes and stop bits. See spec for more details. |
+ // This class takes into account H.264 stream-specific constraints, such as |
+ // skipping emulation-prevention bytes and stop bits. See spec for more |
+ // details. |
// TODO(posciak): need separate unittests for this class. |
- class H264BitReader { |
+ class H264BitReader : public media::BitReader { |
public: |
H264BitReader(); |
- ~H264BitReader(); |
- |
- // Initialize the reader to start reading at |data|, |size| being size |
- // of |data| in bytes. |
- // Return false on insufficient size of stream.. |
- // TODO(posciak,fischman): consider replacing Initialize() with |
- // heap-allocating and creating bit readers on demand instead. |
- bool Initialize(const uint8* data, off_t size); |
- |
- // Read |num_bits| next bits from stream and return in |*out|, first bit |
- // from the stream starting at |num_bits| position in |*out|. |
- // |num_bits| may be 1-32, inclusive. |
- // Return false if the given number of bits cannot be read (not enough |
- // bits in the stream), true otherwise. |
- bool ReadBits(int num_bits, int *out); |
- |
- // Return the number of bits left in the stream. |
- off_t NumBitsLeft(); |
- |
- // See the definition of more_rbsp_data() in spec. |
- bool HasMoreRBSPData(); |
+ virtual ~H264BitReader() OVERRIDE; |
private: |
- // Advance to the next byte, loading it into curr_byte_. |
- // Return false on end of stream. |
- bool UpdateCurrByte(); |
- |
- // Pointer to the next unread (not in curr_byte_) byte in the stream. |
- const uint8* data_; |
- |
- // Bytes left in the stream (without the curr_byte_). |
- off_t bytes_left_; |
- |
- // Contents of the current byte; first unread bit starting at position |
- // 8 - num_remaining_bits_in_curr_byte_ from MSB. |
- int curr_byte_; |
- |
- // Number of bits remaining in curr_byte_ |
- int num_remaining_bits_in_curr_byte_; |
- |
- // Used in emulation prevention three byte detection (see spec). |
- // Initially set to 0xffff to accept all initial two-byte sequences. |
- int prev_two_bytes_; |
- |
- DISALLOW_COPY_AND_ASSIGN(H264BitReader); |
acolwell GONE FROM CHROMIUM
2012/06/28 17:31:25
nit: You should keep the DISALLOW_COPY_AND_ASSIGN(
|
+ // This function handles the H.264 escape sequence and stop bit. |
+ virtual void UpdateCurrByte() OVERRIDE; |
}; |
// Exp-Golomb code parsing as specified in chapter 9.1 of the spec. |