| 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 #ifndef MEDIA_FORMATS_MPEG_MPEG_AUDIO_STREAM_PARSER_BASE_H_ | 5 #ifndef MEDIA_FORMATS_MPEG_MPEG_AUDIO_STREAM_PARSER_BASE_H_ |
| 6 #define MEDIA_FORMATS_MPEG_MPEG_AUDIO_STREAM_PARSER_BASE_H_ | 6 #define MEDIA_FORMATS_MPEG_MPEG_AUDIO_STREAM_PARSER_BASE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "media/base/audio_decoder_config.h" | 13 #include "media/base/audio_decoder_config.h" |
| 14 #include "media/base/audio_timestamp_helper.h" | 14 #include "media/base/audio_timestamp_helper.h" |
| 15 #include "media/base/bit_reader.h" | 15 #include "media/base/bit_reader.h" |
| 16 #include "media/base/byte_queue.h" | 16 #include "media/base/byte_queue.h" |
| 17 #include "media/base/media_export.h" | 17 #include "media/base/media_export.h" |
| 18 #include "media/base/stream_parser.h" | 18 #include "media/base/stream_parser.h" |
| 19 | 19 |
| 20 namespace media { | 20 namespace media { |
| 21 | 21 |
| 22 class MEDIA_EXPORT MPEGAudioStreamParserBase : public StreamParser { | 22 class MEDIA_EXPORT MPEGAudioStreamParserBase : public StreamParser { |
| 23 public: | 23 public: |
| 24 // |start_code_mask| is used to find the start of each frame header. Also | 24 // |start_code_mask| is used to find the start of each frame header. Also |
| 25 // referred to as the sync code in the MP3 and ADTS header specifications. | 25 // referred to as the sync code in the MP3 and ADTS header specifications. |
| 26 MPEGAudioStreamParserBase(uint32 start_code_mask, AudioCodec audio_codec); | 26 // |codec_delay_in_frames| is the number of silent samples the decoder will |
| 27 // output before the first real frame. |
| 28 MPEGAudioStreamParserBase(uint32 start_code_mask, |
| 29 AudioCodec audio_codec, |
| 30 int codec_delay_in_frames); |
| 27 virtual ~MPEGAudioStreamParserBase(); | 31 virtual ~MPEGAudioStreamParserBase(); |
| 28 | 32 |
| 29 // StreamParser implementation. | 33 // StreamParser implementation. |
| 30 virtual void Init(const InitCB& init_cb, | 34 virtual void Init(const InitCB& init_cb, |
| 31 const NewConfigCB& config_cb, | 35 const NewConfigCB& config_cb, |
| 32 const NewBuffersCB& new_buffers_cb, | 36 const NewBuffersCB& new_buffers_cb, |
| 33 bool ignore_text_tracks, | 37 bool ignore_text_tracks, |
| 34 const NeedKeyCB& need_key_cb, | 38 const NeedKeyCB& need_key_cb, |
| 35 const NewMediaSegmentCB& new_segment_cb, | 39 const NewMediaSegmentCB& new_segment_cb, |
| 36 const base::Closure& end_of_segment_cb, | 40 const base::Closure& end_of_segment_cb, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 base::Closure end_of_segment_cb_; | 131 base::Closure end_of_segment_cb_; |
| 128 LogCB log_cb_; | 132 LogCB log_cb_; |
| 129 | 133 |
| 130 ByteQueue queue_; | 134 ByteQueue queue_; |
| 131 | 135 |
| 132 AudioDecoderConfig config_; | 136 AudioDecoderConfig config_; |
| 133 scoped_ptr<AudioTimestampHelper> timestamp_helper_; | 137 scoped_ptr<AudioTimestampHelper> timestamp_helper_; |
| 134 bool in_media_segment_; | 138 bool in_media_segment_; |
| 135 const uint32 start_code_mask_; | 139 const uint32 start_code_mask_; |
| 136 const AudioCodec audio_codec_; | 140 const AudioCodec audio_codec_; |
| 141 const int codec_delay_in_frames_; |
| 137 | 142 |
| 138 DISALLOW_COPY_AND_ASSIGN(MPEGAudioStreamParserBase); | 143 DISALLOW_COPY_AND_ASSIGN(MPEGAudioStreamParserBase); |
| 139 }; | 144 }; |
| 140 | 145 |
| 141 } // namespace media | 146 } // namespace media |
| 142 | 147 |
| 143 #endif // MEDIA_FORMATS_MPEG_MPEG_AUDIO_STREAM_PARSER_BASE_H_ | 148 #endif // MEDIA_FORMATS_MPEG_MPEG_AUDIO_STREAM_PARSER_BASE_H_ |
| OLD | NEW |