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

Side by Side 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: tidying up prior to review Created 5 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
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 #include "media/base/bit_reader.h" 5 #include "media/base/bit_reader.h"
6 6
7 namespace media { 7 namespace media {
8 8
9 BitReader::BitReader(const uint8* data, int size) 9 BitReader::BitReader(const uint8* data, int size)
10 : initial_size_(size), 10 : initial_size_(size),
(...skipping 13 matching lines...) Expand all
24 int nbytes = max_nbytes; 24 int nbytes = max_nbytes;
25 if (nbytes > bytes_left_) 25 if (nbytes > bytes_left_)
26 nbytes = bytes_left_; 26 nbytes = bytes_left_;
27 27
28 *out = data_; 28 *out = data_;
29 data_ += nbytes; 29 data_ += nbytes;
30 bytes_left_ -= nbytes; 30 bytes_left_ -= nbytes;
31 return nbytes; 31 return nbytes;
32 } 32 }
33 33
34 bool BitReader::ReadString(int num_bits, std::string* str) {
ddorwin 2015/12/10 20:10:58 nit: move above previous function.
dougsteed 2015/12/14 22:51:46 Done.
35 int num_bytes = num_bits / 8;
36 DCHECK_EQ(num_bits % 8, 0);
37 str->resize(num_bytes);
38 char* ptr = &str->front();
39 while (num_bytes--)
40 if (!ReadBits(8, ptr++))
41 return false;
42 return true;
43 }
44
34 } // namespace media 45 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698