OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/formats/webm/webm_content_encodings_client.h" | 5 #include "media/formats/webm/webm_content_encodings_client.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "media/formats/webm/webm_constants.h" | 9 #include "media/formats/webm/webm_constants.h" |
10 | 10 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 return true; | 135 return true; |
136 } | 136 } |
137 | 137 |
138 // This should not happen if WebMListParser is working properly. | 138 // This should not happen if WebMListParser is working properly. |
139 DCHECK(false); | 139 DCHECK(false); |
140 return false; | 140 return false; |
141 } | 141 } |
142 | 142 |
143 // Multiple occurrence restriction and range are checked in this function. | 143 // Multiple occurrence restriction and range are checked in this function. |
144 // Mandatory occurrence restriction is checked in OnListEnd. | 144 // Mandatory occurrence restriction is checked in OnListEnd. |
145 bool WebMContentEncodingsClient::OnUInt(int id, int64 val) { | 145 bool WebMContentEncodingsClient::OnUInt(int id, int64_t val) { |
146 DCHECK(cur_content_encoding_.get()); | 146 DCHECK(cur_content_encoding_.get()); |
147 | 147 |
148 if (id == kWebMIdContentEncodingOrder) { | 148 if (id == kWebMIdContentEncodingOrder) { |
149 if (cur_content_encoding_->order() != ContentEncoding::kOrderInvalid) { | 149 if (cur_content_encoding_->order() != ContentEncoding::kOrderInvalid) { |
150 MEDIA_LOG(ERROR, media_log_) | 150 MEDIA_LOG(ERROR, media_log_) |
151 << "Unexpected multiple ContentEncodingOrder."; | 151 << "Unexpected multiple ContentEncodingOrder."; |
152 return false; | 152 return false; |
153 } | 153 } |
154 | 154 |
155 if (val != static_cast<int64>(content_encodings_.size())) { | 155 if (val != static_cast<int64_t>(content_encodings_.size())) { |
156 // According to the spec, encoding order starts with 0 and counts upwards. | 156 // According to the spec, encoding order starts with 0 and counts upwards. |
157 MEDIA_LOG(ERROR, media_log_) << "Unexpected ContentEncodingOrder."; | 157 MEDIA_LOG(ERROR, media_log_) << "Unexpected ContentEncodingOrder."; |
158 return false; | 158 return false; |
159 } | 159 } |
160 | 160 |
161 cur_content_encoding_->set_order(val); | 161 cur_content_encoding_->set_order(val); |
162 return true; | 162 return true; |
163 } | 163 } |
164 | 164 |
165 if (id == kWebMIdContentEncodingScope) { | 165 if (id == kWebMIdContentEncodingScope) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 return true; | 245 return true; |
246 } | 246 } |
247 | 247 |
248 // This should not happen if WebMListParser is working properly. | 248 // This should not happen if WebMListParser is working properly. |
249 DCHECK(false); | 249 DCHECK(false); |
250 return false; | 250 return false; |
251 } | 251 } |
252 | 252 |
253 // Multiple occurrence restriction is checked in this function. Mandatory | 253 // Multiple occurrence restriction is checked in this function. Mandatory |
254 // restriction is checked in OnListEnd. | 254 // restriction is checked in OnListEnd. |
255 bool WebMContentEncodingsClient::OnBinary(int id, const uint8* data, int size) { | 255 bool WebMContentEncodingsClient::OnBinary(int id, |
| 256 const uint8_t* data, |
| 257 int size) { |
256 DCHECK(cur_content_encoding_.get()); | 258 DCHECK(cur_content_encoding_.get()); |
257 DCHECK(data); | 259 DCHECK(data); |
258 DCHECK_GT(size, 0); | 260 DCHECK_GT(size, 0); |
259 | 261 |
260 if (id == kWebMIdContentEncKeyID) { | 262 if (id == kWebMIdContentEncKeyID) { |
261 if (!cur_content_encoding_->encryption_key_id().empty()) { | 263 if (!cur_content_encoding_->encryption_key_id().empty()) { |
262 MEDIA_LOG(ERROR, media_log_) << "Unexpected multiple ContentEncKeyID"; | 264 MEDIA_LOG(ERROR, media_log_) << "Unexpected multiple ContentEncKeyID"; |
263 return false; | 265 return false; |
264 } | 266 } |
265 cur_content_encoding_->SetEncryptionKeyId(data, size); | 267 cur_content_encoding_->SetEncryptionKeyId(data, size); |
266 return true; | 268 return true; |
267 } | 269 } |
268 | 270 |
269 // This should not happen if WebMListParser is working properly. | 271 // This should not happen if WebMListParser is working properly. |
270 DCHECK(false); | 272 DCHECK(false); |
271 return false; | 273 return false; |
272 } | 274 } |
273 | 275 |
274 } // namespace media | 276 } // namespace media |
OLD | NEW |