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

Side by Side Diff: media/mp4/box_reader.cc

Issue 10651006: Add Common Encryption support to BMFF, including subsample decryption. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add wrong subsample size test Created 8 years, 5 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 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/mp4/box_reader.h" 5 #include "media/mp4/box_reader.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 if (!reader.ReadHeader(err)) return false; 116 if (!reader.ReadHeader(err)) return false;
117 *type = reader.type(); 117 *type = reader.type();
118 *box_size = reader.size(); 118 *box_size = reader.size();
119 return true; 119 return true;
120 } 120 }
121 121
122 bool BoxReader::ScanChildren() { 122 bool BoxReader::ScanChildren() {
123 DCHECK(!scanned_); 123 DCHECK(!scanned_);
124 scanned_ = true; 124 scanned_ = true;
125 125
126 bool err; 126 bool err = false;
127 // TODO(strobe): Check or correct for multimap not inserting elements in 127 // TODO(strobe): Check or correct for multimap not inserting elements in
128 // consistent order. 128 // consistent order.
129 while (pos() < size()) { 129 while (pos() < size()) {
130 BoxReader child(&buf_[pos_], size_ - pos_); 130 BoxReader child(&buf_[pos_], size_ - pos_);
131 if (!child.ReadHeader(&err)) break; 131 if (!child.ReadHeader(&err)) break;
132 132
133 children_.insert(std::pair<FourCC, BoxReader>(child.type(), child)); 133 children_.insert(std::pair<FourCC, BoxReader>(child.type(), child));
134 pos_ += child.size(); 134 pos_ += child.size();
135 } 135 }
136 136
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 188 }
189 189
190 // Note that the pos_ head has advanced to the byte immediately after the 190 // Note that the pos_ head has advanced to the byte immediately after the
191 // header, which is where we want it. 191 // header, which is where we want it.
192 size_ = size; 192 size_ = size;
193 return true; 193 return true;
194 } 194 }
195 195
196 } // namespace mp4 196 } // namespace mp4
197 } // namespace media 197 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698