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

Side by Side Diff: media/webm/webm_tracks_parser.cc

Issue 23014009: media: Opus support for WebM in Media Source (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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
« media/webm/webm_parser.cc ('K') | « media/webm/webm_tracks_parser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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/strings/string_util.h" 8 #include "base/strings/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
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, bool ignore_text_tracks) 31 WebMTracksParser::WebMTracksParser(const LogCB& log_cb, bool ignore_text_tracks)
32 : track_type_(-1), 32 : track_type_(-1),
33 track_num_(-1), 33 track_num_(-1),
34 seek_pre_roll_(-1),
35 codec_delay_(-1),
34 audio_track_num_(-1), 36 audio_track_num_(-1),
35 video_track_num_(-1), 37 video_track_num_(-1),
36 ignore_text_tracks_(ignore_text_tracks), 38 ignore_text_tracks_(ignore_text_tracks),
37 log_cb_(log_cb), 39 log_cb_(log_cb),
38 audio_client_(log_cb), 40 audio_client_(log_cb),
39 video_client_(log_cb) { 41 video_client_(log_cb) {
40 } 42 }
41 43
42 WebMTracksParser::~WebMTracksParser() {} 44 WebMTracksParser::~WebMTracksParser() {}
43 45
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 content_encodings()[0]->encryption_key_id(); 156 content_encodings()[0]->encryption_key_id();
155 } 157 }
156 158
157 if (track_type_ == kWebMTrackTypeAudio) { 159 if (track_type_ == kWebMTrackTypeAudio) {
158 if (audio_track_num_ == -1) { 160 if (audio_track_num_ == -1) {
159 audio_track_num_ = track_num_; 161 audio_track_num_ = track_num_;
160 audio_encryption_key_id_ = encryption_key_id; 162 audio_encryption_key_id_ = encryption_key_id;
161 163
162 DCHECK(!audio_decoder_config_.IsValidConfig()); 164 DCHECK(!audio_decoder_config_.IsValidConfig());
163 if (!audio_client_.InitializeConfig( 165 if (!audio_client_.InitializeConfig(
164 codec_id_, codec_private_, !audio_encryption_key_id_.empty(), 166 codec_id_, codec_private_, seek_pre_roll_, codec_delay_,
165 &audio_decoder_config_)) { 167 !audio_encryption_key_id_.empty(), &audio_decoder_config_)) {
166 return false; 168 return false;
167 } 169 }
168 } else { 170 } else {
169 MEDIA_LOG(log_cb_) << "Ignoring audio track " << track_num_; 171 MEDIA_LOG(log_cb_) << "Ignoring audio track " << track_num_;
170 ignored_tracks_.insert(track_num_); 172 ignored_tracks_.insert(track_num_);
171 } 173 }
172 } else if (track_type_ == kWebMTrackTypeVideo) { 174 } else if (track_type_ == kWebMTrackTypeVideo) {
173 if (video_track_num_ == -1) { 175 if (video_track_num_ == -1) {
174 video_track_num_ = track_num_; 176 video_track_num_ = track_num_;
175 video_encryption_key_id_ = encryption_key_id; 177 video_encryption_key_id_ = encryption_key_id;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 bool WebMTracksParser::OnUInt(int id, int64 val) { 221 bool WebMTracksParser::OnUInt(int id, int64 val) {
220 int64* dst = NULL; 222 int64* dst = NULL;
221 223
222 switch (id) { 224 switch (id) {
223 case kWebMIdTrackNumber: 225 case kWebMIdTrackNumber:
224 dst = &track_num_; 226 dst = &track_num_;
225 break; 227 break;
226 case kWebMIdTrackType: 228 case kWebMIdTrackType:
227 dst = &track_type_; 229 dst = &track_type_;
228 break; 230 break;
231 case kWebMIdSeekPreRoll:
232 dst = &seek_pre_roll_;
233 break;
234 case kWebMIdCodecDelay:
235 dst = &codec_delay_;
236 break;
229 default: 237 default:
230 return true; 238 return true;
231 } 239 }
232 240
233 if (*dst != -1) { 241 if (*dst != -1) {
234 MEDIA_LOG(log_cb_) << "Multiple values for id " << std::hex << id 242 MEDIA_LOG(log_cb_) << "Multiple values for id " << std::hex << id
235 << " specified"; 243 << " specified";
236 return false; 244 return false;
237 } 245 }
238 246
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 283
276 if (id == kWebMIdLanguage) { 284 if (id == kWebMIdLanguage) {
277 track_language_ = str; 285 track_language_ = str;
278 return true; 286 return true;
279 } 287 }
280 288
281 return true; 289 return true;
282 } 290 }
283 291
284 } // namespace media 292 } // namespace media
OLDNEW
« media/webm/webm_parser.cc ('K') | « media/webm/webm_tracks_parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698