| 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 |
| 11 namespace media { | 11 namespace media { |
| 12 | 12 |
| 13 WebMContentEncodingsClient::WebMContentEncodingsClient( | 13 WebMContentEncodingsClient::WebMContentEncodingsClient( |
| 14 const scoped_refptr<MediaLog>& media_log) | 14 const scoped_refptr<MediaLog>& media_log) |
| 15 : media_log_(media_log), | 15 : media_log_(media_log), |
| 16 content_encryption_encountered_(false), | 16 content_encryption_encountered_(false), |
| 17 content_encodings_ready_(false) { | 17 content_encodings_ready_(false) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 WebMContentEncodingsClient::~WebMContentEncodingsClient() { | 20 WebMContentEncodingsClient::~WebMContentEncodingsClient() { |
| 21 STLDeleteElements(&content_encodings_); | 21 base::STLDeleteElements(&content_encodings_); |
| 22 } | 22 } |
| 23 | 23 |
| 24 const ContentEncodings& WebMContentEncodingsClient::content_encodings() const { | 24 const ContentEncodings& WebMContentEncodingsClient::content_encodings() const { |
| 25 DCHECK(content_encodings_ready_); | 25 DCHECK(content_encodings_ready_); |
| 26 return content_encodings_; | 26 return content_encodings_; |
| 27 } | 27 } |
| 28 | 28 |
| 29 WebMParserClient* WebMContentEncodingsClient::OnListStart(int id) { | 29 WebMParserClient* WebMContentEncodingsClient::OnListStart(int id) { |
| 30 if (id == kWebMIdContentEncodings) { | 30 if (id == kWebMIdContentEncodings) { |
| 31 DCHECK(!cur_content_encoding_.get()); | 31 DCHECK(!cur_content_encoding_.get()); |
| 32 DCHECK(!content_encryption_encountered_); | 32 DCHECK(!content_encryption_encountered_); |
| 33 STLDeleteElements(&content_encodings_); | 33 base::STLDeleteElements(&content_encodings_); |
| 34 content_encodings_ready_ = false; | 34 content_encodings_ready_ = false; |
| 35 return this; | 35 return this; |
| 36 } | 36 } |
| 37 | 37 |
| 38 if (id == kWebMIdContentEncoding) { | 38 if (id == kWebMIdContentEncoding) { |
| 39 DCHECK(!cur_content_encoding_.get()); | 39 DCHECK(!cur_content_encoding_.get()); |
| 40 DCHECK(!content_encryption_encountered_); | 40 DCHECK(!content_encryption_encountered_); |
| 41 cur_content_encoding_.reset(new ContentEncoding()); | 41 cur_content_encoding_.reset(new ContentEncoding()); |
| 42 return this; | 42 return this; |
| 43 } | 43 } |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 cur_content_encoding_->SetEncryptionKeyId(data, size); | 267 cur_content_encoding_->SetEncryptionKeyId(data, size); |
| 268 return true; | 268 return true; |
| 269 } | 269 } |
| 270 | 270 |
| 271 // This should not happen if WebMListParser is working properly. | 271 // This should not happen if WebMListParser is working properly. |
| 272 DCHECK(false); | 272 DCHECK(false); |
| 273 return false; | 273 return false; |
| 274 } | 274 } |
| 275 | 275 |
| 276 } // namespace media | 276 } // namespace media |
| OLD | NEW |