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

Side by Side Diff: media/formats/mp4/mp4_stream_parser.cc

Issue 254473006: Add media::StreamParser::StreamParameter struct. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
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/mp4/mp4_stream_parser.h" 5 #include "media/formats/mp4/mp4_stream_parser.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 // No decoder-specific buffer needed for AVC; 281 // No decoder-specific buffer needed for AVC;
282 // SPS/PPS are embedded in the video stream 282 // SPS/PPS are embedded in the video stream
283 NULL, 0, is_video_track_encrypted_, false); 283 NULL, 0, is_video_track_encrypted_, false);
284 has_video_ = true; 284 has_video_ = true;
285 video_track_id_ = track->header.track_id; 285 video_track_id_ = track->header.track_id;
286 } 286 }
287 } 287 }
288 288
289 RCHECK(config_cb_.Run(audio_config, video_config, TextTrackConfigMap())); 289 RCHECK(config_cb_.Run(audio_config, video_config, TextTrackConfigMap()));
290 290
291 base::TimeDelta duration; 291 StreamParser::InitParameters params(kInfiniteDuration());
292 if (moov_->extends.header.fragment_duration > 0) { 292 if (moov_->extends.header.fragment_duration > 0) {
293 duration = TimeDeltaFromRational(moov_->extends.header.fragment_duration, 293 params.duration = TimeDeltaFromRational(
294 moov_->header.timescale); 294 moov_->extends.header.fragment_duration, moov_->header.timescale);
295 } else if (moov_->header.duration > 0 && 295 } else if (moov_->header.duration > 0 &&
296 moov_->header.duration != kuint64max) { 296 moov_->header.duration != kuint64max) {
297 duration = TimeDeltaFromRational(moov_->header.duration, 297 params.duration =
298 moov_->header.timescale); 298 TimeDeltaFromRational(moov_->header.duration, moov_->header.timescale);
299 } else {
300 duration = kInfiniteDuration();
301 } 299 }
302 300
303 if (!init_cb_.is_null()) 301 if (!init_cb_.is_null())
304 base::ResetAndReturn(&init_cb_).Run(true, duration, base::Time(), false); 302 base::ResetAndReturn(&init_cb_).Run(true, params);
305 303
306 EmitNeedKeyIfNecessary(moov_->pssh); 304 EmitNeedKeyIfNecessary(moov_->pssh);
307 return true; 305 return true;
308 } 306 }
309 307
310 bool MP4StreamParser::ParseMoof(BoxReader* reader) { 308 bool MP4StreamParser::ParseMoof(BoxReader* reader) {
311 RCHECK(moov_.get()); // Must already have initialization segment 309 RCHECK(moov_.get()); // Must already have initialization segment
312 MovieFragment moof; 310 MovieFragment moof;
313 RCHECK(moof.Parse(reader)); 311 RCHECK(moof.Parse(reader));
314 if (!runs_) 312 if (!runs_)
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 return !err; 573 return !err;
576 } 574 }
577 575
578 void MP4StreamParser::ChangeState(State new_state) { 576 void MP4StreamParser::ChangeState(State new_state) {
579 DVLOG(2) << "Changing state: " << new_state; 577 DVLOG(2) << "Changing state: " << new_state;
580 state_ = new_state; 578 state_ = new_state;
581 } 579 }
582 580
583 } // namespace mp4 581 } // namespace mp4
584 } // namespace media 582 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mp2t/mp2t_stream_parser_unittest.cc ('k') | media/formats/mp4/mp4_stream_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698