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

Side by Side Diff: media/base/bit_reader.h

Issue 1517473002: Support HLS MPEG2 TS with SAMPLE-AES encryption. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@encryption_scheme
Patch Set: rebase Created 4 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 unified diff | Download patch
« no previous file with comments | « media/BUILD.gn ('k') | media/base/bit_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BASE_BIT_READER_H_ 5 #ifndef MEDIA_BASE_BIT_READER_H_
6 #define MEDIA_BASE_BIT_READER_H_ 6 #define MEDIA_BASE_BIT_READER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string>
9 10
10 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "media/base/bit_reader_core.h" 13 #include "media/base/bit_reader_core.h"
13 #include "media/base/media_export.h" 14 #include "media/base/media_export.h"
14 15
15 namespace media { 16 namespace media {
16 17
17 class MEDIA_EXPORT BitReader 18 class MEDIA_EXPORT BitReader
18 : NON_EXPORTED_BASE(private BitReaderCore::ByteStreamProvider) { 19 : NON_EXPORTED_BASE(private BitReaderCore::ByteStreamProvider) {
19 public: 20 public:
20 // Initialize the reader to start reading at |data|, |size| being size 21 // Initialize the reader to start reading at |data|, |size| being size
21 // of |data| in bytes. 22 // of |data| in bytes.
22 BitReader(const uint8_t* data, int size); 23 BitReader(const uint8_t* data, int size);
23 ~BitReader() override; 24 ~BitReader() override;
24 25
25 template<typename T> bool ReadBits(int num_bits, T* out) { 26 template<typename T> bool ReadBits(int num_bits, T* out) {
26 return bit_reader_core_.ReadBits(num_bits, out); 27 return bit_reader_core_.ReadBits(num_bits, out);
27 } 28 }
28 29
29 bool ReadFlag(bool* flag) { 30 bool ReadFlag(bool* flag) {
30 return bit_reader_core_.ReadFlag(flag); 31 return bit_reader_core_.ReadFlag(flag);
31 } 32 }
32 33
34 // Read |num_bits| of binary data into |str|. |num_bits| must be a positive
35 // multiple of 8. This is not efficient for extracting large strings.
36 // If false is returned, |str| may not be valid.
37 bool ReadString(int num_bits, std::string* str);
38
33 bool SkipBits(int num_bits) { 39 bool SkipBits(int num_bits) {
34 return bit_reader_core_.SkipBits(num_bits); 40 return bit_reader_core_.SkipBits(num_bits);
35 } 41 }
36 42
37 int bits_available() const { 43 int bits_available() const {
38 return initial_size_ * 8 - bits_read(); 44 return initial_size_ * 8 - bits_read();
39 } 45 }
40 46
41 int bits_read() const { 47 int bits_read() const {
42 return bit_reader_core_.bits_read(); 48 return bit_reader_core_.bits_read();
(...skipping 13 matching lines...) Expand all
56 int bytes_left_; 62 int bytes_left_;
57 63
58 BitReaderCore bit_reader_core_; 64 BitReaderCore bit_reader_core_;
59 65
60 DISALLOW_COPY_AND_ASSIGN(BitReader); 66 DISALLOW_COPY_AND_ASSIGN(BitReader);
61 }; 67 };
62 68
63 } // namespace media 69 } // namespace media
64 70
65 #endif // MEDIA_BASE_BIT_READER_H_ 71 #endif // MEDIA_BASE_BIT_READER_H_
OLDNEW
« no previous file with comments | « media/BUILD.gn ('k') | media/base/bit_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698