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/mp4/mp4_stream_parser.h" | 5 #include "media/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 27 matching lines...) Expand all Loading... |
38 is_video_track_encrypted_(false) { | 38 is_video_track_encrypted_(false) { |
39 } | 39 } |
40 | 40 |
41 MP4StreamParser::~MP4StreamParser() {} | 41 MP4StreamParser::~MP4StreamParser() {} |
42 | 42 |
43 void MP4StreamParser::Init(const InitCB& init_cb, | 43 void MP4StreamParser::Init(const InitCB& init_cb, |
44 const NewConfigCB& config_cb, | 44 const NewConfigCB& config_cb, |
45 const NewBuffersCB& new_buffers_cb, | 45 const NewBuffersCB& new_buffers_cb, |
46 const NewTextBuffersCB& /* text_cb */ , | 46 const NewTextBuffersCB& /* text_cb */ , |
47 const NeedKeyCB& need_key_cb, | 47 const NeedKeyCB& need_key_cb, |
48 const AddTextTrackCB& /* add_text_track_cb */ , | 48 bool /* enable_text_tracks */ , |
49 const NewMediaSegmentCB& new_segment_cb, | 49 const NewMediaSegmentCB& new_segment_cb, |
50 const base::Closure& end_of_segment_cb, | 50 const base::Closure& end_of_segment_cb, |
51 const LogCB& log_cb) { | 51 const LogCB& log_cb) { |
52 DCHECK_EQ(state_, kWaitingForInit); | 52 DCHECK_EQ(state_, kWaitingForInit); |
53 DCHECK(init_cb_.is_null()); | 53 DCHECK(init_cb_.is_null()); |
54 DCHECK(!init_cb.is_null()); | 54 DCHECK(!init_cb.is_null()); |
55 DCHECK(!config_cb.is_null()); | 55 DCHECK(!config_cb.is_null()); |
56 DCHECK(!new_buffers_cb.is_null()); | 56 DCHECK(!new_buffers_cb.is_null()); |
57 DCHECK(!need_key_cb.is_null()); | 57 DCHECK(!need_key_cb.is_null()); |
58 DCHECK(!end_of_segment_cb.is_null()); | 58 DCHECK(!end_of_segment_cb.is_null()); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 video_config.Initialize(kCodecH264, H264PROFILE_MAIN, VideoFrame::YV12, | 287 video_config.Initialize(kCodecH264, H264PROFILE_MAIN, VideoFrame::YV12, |
288 coded_size, visible_rect, natural_size, | 288 coded_size, visible_rect, natural_size, |
289 // No decoder-specific buffer needed for AVC; | 289 // No decoder-specific buffer needed for AVC; |
290 // SPS/PPS are embedded in the video stream | 290 // SPS/PPS are embedded in the video stream |
291 NULL, 0, is_video_track_encrypted_, true); | 291 NULL, 0, is_video_track_encrypted_, true); |
292 has_video_ = true; | 292 has_video_ = true; |
293 video_track_id_ = track->header.track_id; | 293 video_track_id_ = track->header.track_id; |
294 } | 294 } |
295 } | 295 } |
296 | 296 |
297 RCHECK(config_cb_.Run(audio_config, video_config)); | 297 RCHECK(config_cb_.Run(audio_config, video_config, TextTrackConfigMap())); |
298 | 298 |
299 base::TimeDelta duration; | 299 base::TimeDelta duration; |
300 if (moov_->extends.header.fragment_duration > 0) { | 300 if (moov_->extends.header.fragment_duration > 0) { |
301 duration = TimeDeltaFromRational(moov_->extends.header.fragment_duration, | 301 duration = TimeDeltaFromRational(moov_->extends.header.fragment_duration, |
302 moov_->header.timescale); | 302 moov_->header.timescale); |
303 } else if (moov_->header.duration > 0 && | 303 } else if (moov_->header.duration > 0 && |
304 moov_->header.duration != kuint64max) { | 304 moov_->header.duration != kuint64max) { |
305 duration = TimeDeltaFromRational(moov_->header.duration, | 305 duration = TimeDeltaFromRational(moov_->header.duration, |
306 moov_->header.timescale); | 306 moov_->header.timescale); |
307 } else { | 307 } else { |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 return !err; | 569 return !err; |
570 } | 570 } |
571 | 571 |
572 void MP4StreamParser::ChangeState(State new_state) { | 572 void MP4StreamParser::ChangeState(State new_state) { |
573 DVLOG(2) << "Changing state: " << new_state; | 573 DVLOG(2) << "Changing state: " << new_state; |
574 state_ = new_state; | 574 state_ = new_state; |
575 } | 575 } |
576 | 576 |
577 } // namespace mp4 | 577 } // namespace mp4 |
578 } // namespace media | 578 } // namespace media |
OLD | NEW |