| 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" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 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, |
| 38 const PipelineStatusCB& status_cb) OVERRIDE; | 38 const PipelineStatusCB& status_cb) OVERRIDE; |
| 39 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 39 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
| 40 const DecodeCB& decode_cb) OVERRIDE; | 40 const DecodeCB& decode_cb) OVERRIDE; |
| 41 virtual scoped_refptr<AudioBuffer> GetDecodeOutput() OVERRIDE; | 41 virtual scoped_refptr<AudioBuffer> GetDecodeOutput() OVERRIDE; |
| 42 virtual int bits_per_channel() OVERRIDE; | |
| 43 virtual ChannelLayout channel_layout() OVERRIDE; | |
| 44 virtual int samples_per_second() OVERRIDE; | |
| 45 virtual void Reset(const base::Closure& closure) OVERRIDE; | 42 virtual void Reset(const base::Closure& closure) OVERRIDE; |
| 46 virtual void Stop(const base::Closure& closure) OVERRIDE; | 43 virtual void Stop(const base::Closure& closure) OVERRIDE; |
| 47 | 44 |
| 48 private: | 45 private: |
| 49 enum DecoderState { | 46 enum DecoderState { |
| 50 kUninitialized, | 47 kUninitialized, |
| 51 kNormal, | 48 kNormal, |
| 52 kFlushCodec, | 49 kFlushCodec, |
| 53 kDecodeFinished, | 50 kDecodeFinished, |
| 54 kError | 51 kError |
| (...skipping 17 matching lines...) Expand all Loading... |
| 72 void ResetTimestampState(); | 69 void ResetTimestampState(); |
| 73 | 70 |
| 74 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 71 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 75 | 72 |
| 76 DecoderState state_; | 73 DecoderState state_; |
| 77 | 74 |
| 78 // FFmpeg structures owned by this object. | 75 // FFmpeg structures owned by this object. |
| 79 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; | 76 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; |
| 80 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; | 77 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; |
| 81 | 78 |
| 82 // Decoded audio format. | 79 AudioDecoderConfig config_; |
| 83 int bytes_per_channel_; | |
| 84 ChannelLayout channel_layout_; | |
| 85 int channels_; | |
| 86 int samples_per_second_; | |
| 87 | 80 |
| 88 // AVSampleFormat initially requested; not Chrome's SampleFormat. | 81 // AVSampleFormat initially requested; not Chrome's SampleFormat. |
| 89 int av_sample_format_; | 82 int av_sample_format_; |
| 90 SampleFormat sample_format_; | |
| 91 | |
| 92 AudioDecoderConfig config_; | |
| 93 | 83 |
| 94 // Used for computing output timestamps. | 84 // Used for computing output timestamps. |
| 95 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_; | 85 scoped_ptr<AudioTimestampHelper> output_timestamp_helper_; |
| 96 base::TimeDelta last_input_timestamp_; | 86 base::TimeDelta last_input_timestamp_; |
| 97 | 87 |
| 98 // Number of frames to drop before generating output buffers. | 88 // Number of frames to drop before generating output buffers. |
| 99 int output_frames_to_drop_; | 89 int output_frames_to_drop_; |
| 100 | 90 |
| 101 // Since multiple frames may be decoded from the same packet we need to queue | 91 // Since multiple frames may be decoded from the same packet we need to queue |
| 102 // them up. | 92 // them up. |
| 103 std::list<scoped_refptr<AudioBuffer> > queued_audio_; | 93 std::list<scoped_refptr<AudioBuffer> > queued_audio_; |
| 104 | 94 |
| 105 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); | 95 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); |
| 106 }; | 96 }; |
| 107 | 97 |
| 108 } // namespace media | 98 } // namespace media |
| 109 | 99 |
| 110 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ | 100 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ |
| OLD | NEW |