| 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/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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 gfx::Rect visible_rect(coded_size); | 273 gfx::Rect visible_rect(coded_size); |
| 274 gfx::Size natural_size = GetNaturalSize(visible_rect.size(), | 274 gfx::Size natural_size = GetNaturalSize(visible_rect.size(), |
| 275 entry.pixel_aspect.h_spacing, | 275 entry.pixel_aspect.h_spacing, |
| 276 entry.pixel_aspect.v_spacing); | 276 entry.pixel_aspect.v_spacing); |
| 277 is_video_track_encrypted_ = entry.sinf.info.track_encryption.is_encrypted; | 277 is_video_track_encrypted_ = entry.sinf.info.track_encryption.is_encrypted; |
| 278 DVLOG(1) << "is_video_track_encrypted_: " << is_video_track_encrypted_; | 278 DVLOG(1) << "is_video_track_encrypted_: " << is_video_track_encrypted_; |
| 279 video_config.Initialize(kCodecH264, H264PROFILE_MAIN, VideoFrame::YV12, | 279 video_config.Initialize(kCodecH264, H264PROFILE_MAIN, VideoFrame::YV12, |
| 280 coded_size, visible_rect, natural_size, | 280 coded_size, visible_rect, natural_size, |
| 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, 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 base::TimeDelta duration; |
| 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 duration = TimeDeltaFromRational(moov_->extends.header.fragment_duration, |
| 294 moov_->header.timescale); | 294 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 duration = TimeDeltaFromRational(moov_->header.duration, |
| 298 moov_->header.timescale); | 298 moov_->header.timescale); |
| 299 } else { | 299 } else { |
| 300 duration = kInfiniteDuration(); | 300 duration = kInfiniteDuration(); |
| 301 } | 301 } |
| 302 | 302 |
| 303 if (!init_cb_.is_null()) | 303 if (!init_cb_.is_null()) { |
| 304 base::ResetAndReturn(&init_cb_).Run(true, duration, base::Time(), false); | 304 base::ResetAndReturn(&init_cb_) |
| 305 .Run(true, duration, base::Time(), false, false); |
| 306 } |
| 305 | 307 |
| 306 EmitNeedKeyIfNecessary(moov_->pssh); | 308 EmitNeedKeyIfNecessary(moov_->pssh); |
| 307 return true; | 309 return true; |
| 308 } | 310 } |
| 309 | 311 |
| 310 bool MP4StreamParser::ParseMoof(BoxReader* reader) { | 312 bool MP4StreamParser::ParseMoof(BoxReader* reader) { |
| 311 RCHECK(moov_.get()); // Must already have initialization segment | 313 RCHECK(moov_.get()); // Must already have initialization segment |
| 312 MovieFragment moof; | 314 MovieFragment moof; |
| 313 RCHECK(moof.Parse(reader)); | 315 RCHECK(moof.Parse(reader)); |
| 314 if (!runs_) | 316 if (!runs_) |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 return !err; | 577 return !err; |
| 576 } | 578 } |
| 577 | 579 |
| 578 void MP4StreamParser::ChangeState(State new_state) { | 580 void MP4StreamParser::ChangeState(State new_state) { |
| 579 DVLOG(2) << "Changing state: " << new_state; | 581 DVLOG(2) << "Changing state: " << new_state; |
| 580 state_ = new_state; | 582 state_ = new_state; |
| 581 } | 583 } |
| 582 | 584 |
| 583 } // namespace mp4 | 585 } // namespace mp4 |
| 584 } // namespace media | 586 } // namespace media |
| OLD | NEW |