| 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 #ifndef MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ | 5 #ifndef MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ |
| 6 #define MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ | 6 #define MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "media/base/audio_decoder.h" | 13 #include "media/base/audio_decoder.h" |
| 14 #include "media/base/demuxer_stream.h" | 14 #include "media/base/demuxer_stream.h" |
| 15 #include "media/base/sample_format.h" | 15 #include "media/base/sample_format.h" |
| 16 #include "media/ffmpeg/ffmpeg_deleters.h" | 16 #include "media/ffmpeg/ffmpeg_deleters.h" |
| 17 | 17 |
| 18 struct AVCodecContext; | 18 struct AVCodecContext; |
| 19 struct AVFrame; | 19 struct AVFrame; |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 class SingleThreadTaskRunner; | 22 class SingleThreadTaskRunner; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace media { | 25 namespace media { |
| 26 | 26 |
| 27 class AudioTimestampHelper; | 27 class AudioDiscardHelper; |
| 28 class DecoderBuffer; | 28 class DecoderBuffer; |
| 29 | 29 |
| 30 class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder { | 30 class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder { |
| 31 public: | 31 public: |
| 32 explicit FFmpegAudioDecoder( | 32 explicit FFmpegAudioDecoder( |
| 33 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 33 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
| 34 virtual ~FFmpegAudioDecoder(); | 34 virtual ~FFmpegAudioDecoder(); |
| 35 | 35 |
| 36 // AudioDecoder implementation. | 36 // AudioDecoder implementation. |
| 37 virtual void Initialize(const AudioDecoderConfig& config, | 37 virtual void Initialize(const AudioDecoderConfig& config, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // FFmpeg structures owned by this object. | 75 // FFmpeg structures owned by this object. |
| 76 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; | 76 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; |
| 77 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; | 77 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; |
| 78 | 78 |
| 79 AudioDecoderConfig config_; | 79 AudioDecoderConfig config_; |
| 80 | 80 |
| 81 // AVSampleFormat initially requested; not Chrome's SampleFormat. | 81 // AVSampleFormat initially requested; not Chrome's SampleFormat. |
| 82 int av_sample_format_; | 82 int av_sample_format_; |
| 83 | 83 |
| 84 // Used for computing output timestamps. | 84 // Used for computing output timestamps. |
| 85 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_; | 85 scoped_ptr<AudioDiscardHelper> discard_helper_; |
| 86 base::TimeDelta last_input_timestamp_; | |
| 87 | |
| 88 // Number of frames to drop before generating output buffers. | |
| 89 int output_frames_to_drop_; | |
| 90 | 86 |
| 91 // Since multiple frames may be decoded from the same packet we need to queue | 87 // Since multiple frames may be decoded from the same packet we need to queue |
| 92 // them up. | 88 // them up. |
| 93 std::list<scoped_refptr<AudioBuffer> > queued_audio_; | 89 std::list<scoped_refptr<AudioBuffer> > queued_audio_; |
| 94 | 90 |
| 95 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); | 91 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); |
| 96 }; | 92 }; |
| 97 | 93 |
| 98 } // namespace media | 94 } // namespace media |
| 99 | 95 |
| 100 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ | 96 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ |
| OLD | NEW |