Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/webm/webm_tracks_parser.h" | 5 #include "media/webm/webm_tracks_parser.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "media/base/buffers.h" | 9 #include "media/base/buffers.h" |
| 10 #include "media/webm/webm_constants.h" | 10 #include "media/webm/webm_constants.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 | 24 |
| 25 if (codec_id == kWebMCodecMetadata) | 25 if (codec_id == kWebMCodecMetadata) |
| 26 return kTextMetadata; | 26 return kTextMetadata; |
| 27 | 27 |
| 28 return kTextNone; | 28 return kTextNone; |
| 29 } | 29 } |
| 30 | 30 |
| 31 WebMTracksParser::WebMTracksParser(const LogCB& log_cb) | 31 WebMTracksParser::WebMTracksParser(const LogCB& log_cb) |
| 32 : track_type_(-1), | 32 : track_type_(-1), |
| 33 track_num_(-1), | 33 track_num_(-1), |
| 34 max_block_additional_id_(-1), | |
| 34 audio_track_num_(-1), | 35 audio_track_num_(-1), |
| 35 video_track_num_(-1), | 36 video_track_num_(-1), |
| 36 log_cb_(log_cb), | 37 log_cb_(log_cb), |
| 37 audio_client_(log_cb), | 38 audio_client_(log_cb), |
| 38 video_client_(log_cb) { | 39 video_client_(log_cb) { |
| 39 } | 40 } |
| 40 | 41 |
| 41 WebMTracksParser::~WebMTracksParser() {} | 42 WebMTracksParser::~WebMTracksParser() {} |
| 42 | 43 |
| 43 int WebMTracksParser::Parse(const uint8* buf, int size) { | 44 int WebMTracksParser::Parse(const uint8* buf, int size) { |
| 44 track_type_ =-1; | 45 track_type_ =-1; |
| 45 track_num_ = -1; | 46 track_num_ = -1; |
| 46 track_name_.clear(); | 47 track_name_.clear(); |
| 47 track_language_.clear(); | 48 track_language_.clear(); |
| 49 max_block_additional_id_ = -1; | |
|
acolwell GONE FROM CHROMIUM
2013/05/21 17:14:11
nit: Remove since this doesn't appear to be used a
vignesh
2013/05/21 18:57:56
Done.
| |
| 48 audio_track_num_ = -1; | 50 audio_track_num_ = -1; |
| 49 audio_decoder_config_ = AudioDecoderConfig(); | 51 audio_decoder_config_ = AudioDecoderConfig(); |
| 50 video_track_num_ = -1; | 52 video_track_num_ = -1; |
| 51 video_decoder_config_ = VideoDecoderConfig(); | 53 video_decoder_config_ = VideoDecoderConfig(); |
| 52 text_tracks_.clear(); | 54 text_tracks_.clear(); |
| 53 ignored_tracks_.clear(); | 55 ignored_tracks_.clear(); |
| 54 | 56 |
| 55 WebMListParser parser(kWebMIdTracks, this); | 57 WebMListParser parser(kWebMIdTracks, this); |
| 56 int result = parser.Parse(buf, size); | 58 int result = parser.Parse(buf, size); |
| 57 | 59 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 68 track_content_encodings_client_.reset( | 70 track_content_encodings_client_.reset( |
| 69 new WebMContentEncodingsClient(log_cb_)); | 71 new WebMContentEncodingsClient(log_cb_)); |
| 70 return track_content_encodings_client_->OnListStart(id); | 72 return track_content_encodings_client_->OnListStart(id); |
| 71 } | 73 } |
| 72 | 74 |
| 73 if (id == kWebMIdTrackEntry) { | 75 if (id == kWebMIdTrackEntry) { |
| 74 track_type_ = -1; | 76 track_type_ = -1; |
| 75 track_num_ = -1; | 77 track_num_ = -1; |
| 76 track_name_.clear(); | 78 track_name_.clear(); |
| 77 track_language_.clear(); | 79 track_language_.clear(); |
| 80 max_block_additional_id_ = -1; | |
| 78 codec_id_ = ""; | 81 codec_id_ = ""; |
| 79 codec_private_.clear(); | 82 codec_private_.clear(); |
| 80 audio_client_.Reset(); | 83 audio_client_.Reset(); |
| 81 video_client_.Reset(); | 84 video_client_.Reset(); |
| 82 return this; | 85 return this; |
| 83 } | 86 } |
| 84 | 87 |
| 85 if (id == kWebMIdAudio) | 88 if (id == kWebMIdAudio) |
| 86 return &audio_client_; | 89 return &audio_client_; |
| 87 | 90 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 text_track_info.language = track_language_; | 194 text_track_info.language = track_language_; |
| 192 } else { | 195 } else { |
| 193 MEDIA_LOG(log_cb_) << "Unexpected TrackType " << track_type_; | 196 MEDIA_LOG(log_cb_) << "Unexpected TrackType " << track_type_; |
| 194 return false; | 197 return false; |
| 195 } | 198 } |
| 196 | 199 |
| 197 track_type_ = -1; | 200 track_type_ = -1; |
| 198 track_num_ = -1; | 201 track_num_ = -1; |
| 199 track_name_.clear(); | 202 track_name_.clear(); |
| 200 track_language_.clear(); | 203 track_language_.clear(); |
| 204 max_block_additional_id_ = -1; | |
| 201 codec_id_ = ""; | 205 codec_id_ = ""; |
| 202 codec_private_.clear(); | 206 codec_private_.clear(); |
| 203 track_content_encodings_client_.reset(); | 207 track_content_encodings_client_.reset(); |
| 204 | 208 |
| 205 audio_client_.Reset(); | 209 audio_client_.Reset(); |
| 206 video_client_.Reset(); | 210 video_client_.Reset(); |
| 207 return true; | 211 return true; |
| 208 } | 212 } |
| 209 | 213 |
| 210 return true; | 214 return true; |
| 211 } | 215 } |
| 212 | 216 |
| 213 bool WebMTracksParser::OnUInt(int id, int64 val) { | 217 bool WebMTracksParser::OnUInt(int id, int64 val) { |
| 214 int64* dst = NULL; | 218 int64* dst = NULL; |
| 215 | 219 |
| 216 switch (id) { | 220 switch (id) { |
| 217 case kWebMIdTrackNumber: | 221 case kWebMIdTrackNumber: |
| 218 dst = &track_num_; | 222 dst = &track_num_; |
| 219 break; | 223 break; |
| 220 case kWebMIdTrackType: | 224 case kWebMIdTrackType: |
| 221 dst = &track_type_; | 225 dst = &track_type_; |
| 222 break; | 226 break; |
| 227 case kWebMIdMaxBlockAdditionId: | |
| 228 dst = &max_block_additional_id_; | |
| 229 break; | |
| 223 default: | 230 default: |
| 224 return true; | 231 return true; |
| 225 } | 232 } |
| 226 | 233 |
| 227 if (*dst != -1) { | 234 if (*dst != -1) { |
| 228 MEDIA_LOG(log_cb_) << "Multiple values for id " << std::hex << id | 235 MEDIA_LOG(log_cb_) << "Multiple values for id " << std::hex << id |
| 229 << " specified"; | 236 << " specified"; |
| 230 return false; | 237 return false; |
| 231 } | 238 } |
| 232 | 239 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 269 | 276 |
| 270 if (id == kWebMIdLanguage) { | 277 if (id == kWebMIdLanguage) { |
| 271 track_language_ = str; | 278 track_language_ = str; |
| 272 return true; | 279 return true; |
| 273 } | 280 } |
| 274 | 281 |
| 275 return true; | 282 return true; |
| 276 } | 283 } |
| 277 | 284 |
| 278 } // namespace media | 285 } // namespace media |
| OLD | NEW |