Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: media/base/bit_reader_h264.h

Issue 112343011: Split the bit reader functionalities from the byte stream provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test for the removal of the emulation prevention byte. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..6240e45eadb2cc41bfaca91008ac584ba6f3233f
--- /dev/null
+++ b/media/base/bit_reader_h264.h
@@ -0,0 +1,63 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// 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 <sys/types.h>
+
+#include "base/basictypes.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 2013/12/28 01:54:42 Why create this? I thought you'd just be moving co
damienv1 2013/12/28 04:02:23 I was planning to do another CL which: - remove th
+ public:
+ // Initialize the reader to start reading at |data|, |size| being size
+ // of |data| in bytes.
+ BitReaderH264(const uint8* data, off_t size);
+ ~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 ReadUE(uint32* out) {
+ return bit_reader_core_.ReadUE(out);
+ }
+
+ bool SkipBits(int num_bits) {
+ return bit_reader_core_.SkipBits(num_bits);
+ }
+
+ int NumBitsLeft() const {
damienv1 2013/12/28 01:32:25 This method should not be exposed. This is confusi
damienv1 2013/12/28 02:26:17 Will do.
+ return bit_reader_core_.bits_available();
+ }
+
+ int GetBitCount() {
+ return bit_reader_core_.GetBitCount();
+ }
+
+ // See the definition of more_rbsp_data() in spec.
+ bool HasMoreRBSPData() {
+ return bit_reader_core_.HasMoreRBSPData();
+ }
+
+ private:
+ scoped_ptr<BitReaderCore::ByteStreamProvider> byte_stream_provider_;
acolwell GONE FROM CHROMIUM 2013/12/28 01:54:42 nit: Since this can't be changed and has the same
damienv1 2013/12/28 04:02:23 Done: now derives from ByteStreamProvider.
+
+ BitReaderCore bit_reader_core_;
+
+ DISALLOW_COPY_AND_ASSIGN(BitReaderH264);
+};
+
+} // namespace media
+
+#endif // MEDIA_BASE_BIT_READER_H264_H_

Powered by Google App Engine
This is Rietveld 408576698