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

Unified Diff: media/base/bit_reader.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/bit_reader.h ('k') | media/base/test_data_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/bit_reader.cc
diff --git a/media/base/bit_reader.cc b/media/base/bit_reader.cc
index 83ca40e315bdba854f385816019a8c28c114f82f..7f198552706cef85c1d5d939283bb917e2bcc2f4 100644
--- a/media/base/bit_reader.cc
+++ b/media/base/bit_reader.cc
@@ -17,6 +17,20 @@ BitReader::BitReader(const uint8_t* data, int size)
BitReader::~BitReader() {}
+bool BitReader::ReadString(int num_bits, std::string* str) {
+ DCHECK_EQ(num_bits % 8, 0);
+ DCHECK_GT(num_bits, 0);
+ DCHECK(str);
+ int num_bytes = num_bits / 8;
+ str->resize(num_bytes);
+ char* ptr = &str->front();
+ while (num_bytes--) {
+ if (!ReadBits(8, ptr++))
+ return false;
+ }
+ return true;
+}
+
int BitReader::GetBytes(int max_nbytes, const uint8_t** out) {
DCHECK_GE(max_nbytes, 0);
DCHECK(out);
« no previous file with comments | « media/base/bit_reader.h ('k') | media/base/test_data_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698