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

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

Issue 15342004: Adding VP8 Alpha support in Media Source (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing comments and adding pipeline integration test Created 7 years, 7 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/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
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) {
(...skipping 24 matching lines...) Expand all
68 track_content_encodings_client_.reset( 69 track_content_encodings_client_.reset(
69 new WebMContentEncodingsClient(log_cb_)); 70 new WebMContentEncodingsClient(log_cb_));
70 return track_content_encodings_client_->OnListStart(id); 71 return track_content_encodings_client_->OnListStart(id);
71 } 72 }
72 73
73 if (id == kWebMIdTrackEntry) { 74 if (id == kWebMIdTrackEntry) {
74 track_type_ = -1; 75 track_type_ = -1;
75 track_num_ = -1; 76 track_num_ = -1;
76 track_name_.clear(); 77 track_name_.clear();
77 track_language_.clear(); 78 track_language_.clear();
79 max_block_additional_id_ = -1;
78 codec_id_ = ""; 80 codec_id_ = "";
79 codec_private_.clear(); 81 codec_private_.clear();
80 audio_client_.Reset(); 82 audio_client_.Reset();
81 video_client_.Reset(); 83 video_client_.Reset();
82 return this; 84 return this;
83 } 85 }
84 86
85 if (id == kWebMIdAudio) 87 if (id == kWebMIdAudio)
86 return &audio_client_; 88 return &audio_client_;
87 89
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 text_track_info.language = track_language_; 193 text_track_info.language = track_language_;
192 } else { 194 } else {
193 MEDIA_LOG(log_cb_) << "Unexpected TrackType " << track_type_; 195 MEDIA_LOG(log_cb_) << "Unexpected TrackType " << track_type_;
194 return false; 196 return false;
195 } 197 }
196 198
197 track_type_ = -1; 199 track_type_ = -1;
198 track_num_ = -1; 200 track_num_ = -1;
199 track_name_.clear(); 201 track_name_.clear();
200 track_language_.clear(); 202 track_language_.clear();
203 max_block_additional_id_ = -1;
201 codec_id_ = ""; 204 codec_id_ = "";
202 codec_private_.clear(); 205 codec_private_.clear();
203 track_content_encodings_client_.reset(); 206 track_content_encodings_client_.reset();
204 207
205 audio_client_.Reset(); 208 audio_client_.Reset();
206 video_client_.Reset(); 209 video_client_.Reset();
207 return true; 210 return true;
208 } 211 }
209 212
210 return true; 213 return true;
211 } 214 }
212 215
213 bool WebMTracksParser::OnUInt(int id, int64 val) { 216 bool WebMTracksParser::OnUInt(int id, int64 val) {
214 int64* dst = NULL; 217 int64* dst = NULL;
215 218
216 switch (id) { 219 switch (id) {
217 case kWebMIdTrackNumber: 220 case kWebMIdTrackNumber:
218 dst = &track_num_; 221 dst = &track_num_;
219 break; 222 break;
220 case kWebMIdTrackType: 223 case kWebMIdTrackType:
221 dst = &track_type_; 224 dst = &track_type_;
222 break; 225 break;
226 case kWebMIdMaxBlockAdditionId:
227 dst = &max_block_additional_id_;
228 break;
223 default: 229 default:
224 return true; 230 return true;
225 } 231 }
226 232
227 if (*dst != -1) { 233 if (*dst != -1) {
228 MEDIA_LOG(log_cb_) << "Multiple values for id " << std::hex << id 234 MEDIA_LOG(log_cb_) << "Multiple values for id " << std::hex << id
229 << " specified"; 235 << " specified";
230 return false; 236 return false;
231 } 237 }
232 238
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 275
270 if (id == kWebMIdLanguage) { 276 if (id == kWebMIdLanguage) {
271 track_language_ = str; 277 track_language_ = str;
272 return true; 278 return true;
273 } 279 }
274 280
275 return true; 281 return true;
276 } 282 }
277 283
278 } // namespace media 284 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698