OLD | NEW |
---|---|
(Empty) | |
1 // 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.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MEDIA_BASE_BIT_READER_H264_H_ | |
6 #define MEDIA_BASE_BIT_READER_H264_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/compiler_specific.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "media/base/bit_reader_core.h" | |
12 #include "media/base/media_export.h" | |
13 | |
14 namespace media { | |
15 | |
16 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
| |
17 : NON_EXPORTED_BASE(private BitReaderCore::ByteStreamProvider) { | |
18 public: | |
19 // Initialize the reader to start reading at |data|, |size| being size | |
20 // of |data| in bytes. | |
21 BitReaderH264(const uint8* data, int size); | |
22 virtual ~BitReaderH264(); | |
23 | |
24 template<typename T> bool ReadBits(int num_bits, T* out) { | |
25 return bit_reader_core_.ReadBits(num_bits, out); | |
26 } | |
27 | |
28 bool ReadFlag(bool* flag) { | |
29 return bit_reader_core_.ReadFlag(flag); | |
30 } | |
31 | |
32 bool SkipBits(int num_bits) { | |
33 return bit_reader_core_.SkipBits(num_bits); | |
34 } | |
35 | |
36 int bits_read() const { | |
37 return bit_reader_core_.bits_read(); | |
38 } | |
39 | |
40 // Read an unsigned exp-golomb value and optionaly return the Exp-Golomb | |
41 // code size in |*code_size|. | |
42 // Return false if not successful, that can be the case: | |
43 // - if the end of stream has been reached, the code size is set to -1, | |
44 // - if the Exp-Glomb code size is too long, | |
45 // i.e greater than |kMaxExpGolombCodeSize|. | |
46 bool ReadUE(uint32* out, int* code_size = NULL); | |
47 | |
48 // See the definition of more_rbsp_data() in spec. | |
49 bool HasMoreRBSPData(); | |
50 | |
51 static const int kMaxExpGolombCodeSize; | |
52 | |
53 private: | |
54 // BitReaderCore::ByteStreamProvider implementation. | |
55 virtual int GetBytes(int max_n, const uint8** out) OVERRIDE; | |
56 | |
57 int ReadUEInternal(uint32* out); | |
58 | |
59 // Pointer to the next unread byte in the stream. | |
60 const uint8* data_; | |
61 | |
62 // Bytes left in the stream. | |
63 int bytes_left_; | |
64 | |
65 // Array used to return some bytes when some start code emulation prevention | |
66 // bytes are detected. | |
67 uint8 data_window_[8]; | |
68 | |
69 // Last two bytes read from the stream. | |
70 uint32 prev_two_bytes_; | |
71 | |
72 BitReaderCore bit_reader_core_; | |
73 | |
74 DISALLOW_COPY_AND_ASSIGN(BitReaderH264); | |
75 }; | |
76 | |
77 } // namespace media | |
78 | |
79 #endif // MEDIA_BASE_BIT_READER_H264_H_ | |
OLD | NEW |