Index: media/base/bit_reader_h264.h |
diff --git a/media/base/bit_reader_h264.h b/media/base/bit_reader_h264.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9cc526139a5fdb727bd5decef986a55f6dabb20f |
--- /dev/null |
+++ b/media/base/bit_reader_h264.h |
@@ -0,0 +1,79 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
acolwell GONE FROM CHROMIUM
2014/01/11 00:24:37
s/2013/2014
damienv1
2014/01/13 22:41:06
Done.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MEDIA_BASE_BIT_READER_H264_H_ |
+#define MEDIA_BASE_BIT_READER_H264_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/compiler_specific.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "media/base/bit_reader_core.h" |
+#include "media/base/media_export.h" |
+ |
+namespace media { |
+ |
+class MEDIA_EXPORT BitReaderH264 |
acolwell GONE FROM CHROMIUM
2014/01/11 00:24:37
I'm assuming you're removing this before landing s
damienv1
2014/01/13 22:41:06
Correct. Will fix the nits and remove it after tha
|
+ : NON_EXPORTED_BASE(private BitReaderCore::ByteStreamProvider) { |
+ public: |
+ // Initialize the reader to start reading at |data|, |size| being size |
+ // of |data| in bytes. |
+ BitReaderH264(const uint8* data, int size); |
+ virtual ~BitReaderH264(); |
+ |
+ template<typename T> bool ReadBits(int num_bits, T* out) { |
+ return bit_reader_core_.ReadBits(num_bits, out); |
+ } |
+ |
+ bool ReadFlag(bool* flag) { |
+ return bit_reader_core_.ReadFlag(flag); |
+ } |
+ |
+ bool SkipBits(int num_bits) { |
+ return bit_reader_core_.SkipBits(num_bits); |
+ } |
+ |
+ int bits_read() const { |
+ return bit_reader_core_.bits_read(); |
+ } |
+ |
+ // Read an unsigned exp-golomb value and optionaly return the Exp-Golomb |
+ // code size in |*code_size|. |
+ // Return false if not successful, that can be the case: |
+ // - if the end of stream has been reached, the code size is set to -1, |
+ // - if the Exp-Glomb code size is too long, |
+ // i.e greater than |kMaxExpGolombCodeSize|. |
+ bool ReadUE(uint32* out, int* code_size = NULL); |
+ |
+ // See the definition of more_rbsp_data() in spec. |
+ bool HasMoreRBSPData(); |
+ |
+ static const int kMaxExpGolombCodeSize; |
+ |
+ private: |
+ // BitReaderCore::ByteStreamProvider implementation. |
+ virtual int GetBytes(int max_n, const uint8** out) OVERRIDE; |
+ |
+ int ReadUEInternal(uint32* out); |
+ |
+ // Pointer to the next unread byte in the stream. |
+ const uint8* data_; |
+ |
+ // Bytes left in the stream. |
+ int bytes_left_; |
+ |
+ // Array used to return some bytes when some start code emulation prevention |
+ // bytes are detected. |
+ uint8 data_window_[8]; |
+ |
+ // Last two bytes read from the stream. |
+ uint32 prev_two_bytes_; |
+ |
+ BitReaderCore bit_reader_core_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BitReaderH264); |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_BASE_BIT_READER_H264_H_ |