| 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/mp2t/mp2t_stream_parser.h" | 5 #include "media/formats/mp2t/mp2t_stream_parser.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "media/base/audio_decoder_config.h" | 11 #include "media/base/audio_decoder_config.h" |
| 12 #include "media/base/buffers.h" | 12 #include "media/base/buffers.h" |
| 13 #include "media/base/stream_parser_buffer.h" | 13 #include "media/base/stream_parser_buffer.h" |
| 14 #include "media/base/text_track_config.h" | 14 #include "media/base/text_track_config.h" |
| 15 #include "media/base/video_decoder_config.h" | 15 #include "media/base/video_decoder_config.h" |
| 16 #include "media/formats/mp2t/es_parser.h" | 16 #include "media/formats/mp2t/es_parser.h" |
| 17 #include "media/formats/mp2t/es_parser_adts.h" | 17 #include "media/formats/mp2t/es_parser_adts.h" |
| 18 #include "media/formats/mp2t/es_parser_h264.h" | 18 #include "media/formats/mp2t/es_parser_h264.h" |
| 19 #include "media/formats/mp2t/es_parser_mpeg1audio.h" |
| 19 #include "media/formats/mp2t/mp2t_common.h" | 20 #include "media/formats/mp2t/mp2t_common.h" |
| 20 #include "media/formats/mp2t/ts_packet.h" | 21 #include "media/formats/mp2t/ts_packet.h" |
| 21 #include "media/formats/mp2t/ts_section.h" | 22 #include "media/formats/mp2t/ts_section.h" |
| 22 #include "media/formats/mp2t/ts_section_pat.h" | 23 #include "media/formats/mp2t/ts_section_pat.h" |
| 23 #include "media/formats/mp2t/ts_section_pes.h" | 24 #include "media/formats/mp2t/ts_section_pes.h" |
| 24 #include "media/formats/mp2t/ts_section_pmt.h" | 25 #include "media/formats/mp2t/ts_section_pmt.h" |
| 25 | 26 |
| 26 namespace media { | 27 namespace media { |
| 27 namespace mp2t { | 28 namespace mp2t { |
| 28 | 29 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 es_parser.reset( | 343 es_parser.reset( |
| 343 new EsParserAdts( | 344 new EsParserAdts( |
| 344 base::Bind(&Mp2tStreamParser::OnAudioConfigChanged, | 345 base::Bind(&Mp2tStreamParser::OnAudioConfigChanged, |
| 345 base::Unretained(this), | 346 base::Unretained(this), |
| 346 pes_pid), | 347 pes_pid), |
| 347 base::Bind(&Mp2tStreamParser::OnEmitAudioBuffer, | 348 base::Bind(&Mp2tStreamParser::OnEmitAudioBuffer, |
| 348 base::Unretained(this), | 349 base::Unretained(this), |
| 349 pes_pid), | 350 pes_pid), |
| 350 sbr_in_mimetype_)); | 351 sbr_in_mimetype_)); |
| 351 is_audio = true; | 352 is_audio = true; |
| 353 } else if (stream_type == kStreamTypeMpeg1Audio) { |
| 354 es_parser.reset( |
| 355 new EsParserMpeg1Audio( |
| 356 base::Bind(&Mp2tStreamParser::OnAudioConfigChanged, |
| 357 base::Unretained(this), |
| 358 pes_pid), |
| 359 base::Bind(&Mp2tStreamParser::OnEmitAudioBuffer, |
| 360 base::Unretained(this), |
| 361 pes_pid))); |
| 362 is_audio = true; |
| 352 } else { | 363 } else { |
| 353 return; | 364 return; |
| 354 } | 365 } |
| 355 | 366 |
| 356 // Create the PES state here. | 367 // Create the PES state here. |
| 357 DVLOG(1) << "Create a new PES state"; | 368 DVLOG(1) << "Create a new PES state"; |
| 358 scoped_ptr<TsSection> pes_section_parser( | 369 scoped_ptr<TsSection> pes_section_parser( |
| 359 new TsSectionPes(es_parser.Pass())); | 370 new TsSectionPes(es_parser.Pass())); |
| 360 PidState::PidType pid_type = | 371 PidState::PidType pid_type = |
| 361 is_audio ? PidState::kPidAudioPes : PidState::kPidVideoPes; | 372 is_audio ? PidState::kPidAudioPes : PidState::kPidVideoPes; |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 // so that buffers with the same config can be added later on. | 634 // so that buffers with the same config can be added later on. |
| 624 BufferQueueWithConfig queue_with_config( | 635 BufferQueueWithConfig queue_with_config( |
| 625 true, last_audio_config, last_video_config); | 636 true, last_audio_config, last_video_config); |
| 626 buffer_queue_chain_.push_back(queue_with_config); | 637 buffer_queue_chain_.push_back(queue_with_config); |
| 627 | 638 |
| 628 return true; | 639 return true; |
| 629 } | 640 } |
| 630 | 641 |
| 631 } // namespace mp2t | 642 } // namespace mp2t |
| 632 } // namespace media | 643 } // namespace media |
| OLD | NEW |