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/logging.h" | 8 #include "base/logging.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "media/base/audio_decoder_config.h" | 10 #include "media/base/audio_decoder_config.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 has_audio_(false), | 24 has_audio_(false), |
25 has_video_(false) { | 25 has_video_(false) { |
26 } | 26 } |
27 | 27 |
28 MP4StreamParser::~MP4StreamParser() {} | 28 MP4StreamParser::~MP4StreamParser() {} |
29 | 29 |
30 void MP4StreamParser::Init(const InitCB& init_cb, | 30 void MP4StreamParser::Init(const InitCB& init_cb, |
31 const NewConfigCB& config_cb, | 31 const NewConfigCB& config_cb, |
32 const NewBuffersCB& audio_cb, | 32 const NewBuffersCB& audio_cb, |
33 const NewBuffersCB& video_cb, | 33 const NewBuffersCB& video_cb, |
34 const KeyNeededCB& key_needed_cb, | 34 const NeedKeyCB& need_key_cb, |
35 const NewMediaSegmentCB& new_segment_cb) { | 35 const NewMediaSegmentCB& new_segment_cb) { |
36 DCHECK_EQ(state_, kWaitingForInit); | 36 DCHECK_EQ(state_, kWaitingForInit); |
37 DCHECK(init_cb_.is_null()); | 37 DCHECK(init_cb_.is_null()); |
38 DCHECK(!init_cb.is_null()); | 38 DCHECK(!init_cb.is_null()); |
39 DCHECK(!config_cb.is_null()); | 39 DCHECK(!config_cb.is_null()); |
40 DCHECK(!audio_cb.is_null() || !video_cb.is_null()); | 40 DCHECK(!audio_cb.is_null() || !video_cb.is_null()); |
41 DCHECK(!key_needed_cb.is_null()); | 41 DCHECK(!need_key_cb.is_null()); |
42 | 42 |
43 ChangeState(kParsingBoxes); | 43 ChangeState(kParsingBoxes); |
44 init_cb_ = init_cb; | 44 init_cb_ = init_cb; |
45 config_cb_ = config_cb; | 45 config_cb_ = config_cb; |
46 audio_cb_ = audio_cb; | 46 audio_cb_ = audio_cb; |
47 video_cb_ = video_cb; | 47 video_cb_ = video_cb; |
48 key_needed_cb_ = key_needed_cb; | 48 need_key_cb_ = need_key_cb; |
49 new_segment_cb_ = new_segment_cb; | 49 new_segment_cb_ = new_segment_cb; |
50 } | 50 } |
51 | 51 |
52 void MP4StreamParser::Flush() { | 52 void MP4StreamParser::Flush() { |
53 DCHECK_NE(state_, kWaitingForInit); | 53 DCHECK_NE(state_, kWaitingForInit); |
54 | 54 |
55 queue_.Reset(); | 55 queue_.Reset(); |
56 moof_head_ = 0; | 56 moof_head_ = 0; |
57 mdat_tail_ = 0; | 57 mdat_tail_ = 0; |
58 } | 58 } |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 return true; | 332 return true; |
333 } | 333 } |
334 | 334 |
335 void MP4StreamParser::ChangeState(State new_state) { | 335 void MP4StreamParser::ChangeState(State new_state) { |
336 DVLOG(2) << "Changing state: " << new_state; | 336 DVLOG(2) << "Changing state: " << new_state; |
337 state_ = new_state; | 337 state_ = new_state; |
338 } | 338 } |
339 | 339 |
340 } // namespace mp4 | 340 } // namespace mp4 |
341 } // namespace media | 341 } // namespace media |
OLD | NEW |