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

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, 9 months 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.cc
diff --git a/media/base/bit_reader.cc b/media/base/bit_reader.cc
index 83ca40e315bdba854f385816019a8c28c114f82f..4e27af3f87785c175c7d5a12e0cbcda9b99bbe7c 100644
--- a/media/base/bit_reader.cc
+++ b/media/base/bit_reader.cc
@@ -17,6 +17,18 @@ BitReader::BitReader(const uint8_t* data, int size)
BitReader::~BitReader() {}
+bool BitReader::ReadString(int num_bits, std::string* str) {
+ int num_bytes = num_bits / 8;
+ DCHECK_EQ(num_bits % 8, 0);
+ DCHECK(str);
+ 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);

Powered by Google App Engine
This is Rietveld 408576698