// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this // source code is governed by a BSD-style license that can be found in the // LICENSE file. #ifndef MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ #define MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ #include "media/filters/decoder_base.h" struct AVCodecContext; namespace media { // Forward declaration for scoped_ptr_malloc. class ScopedPtrAVFree; class FFmpegAudioDecoder : public DecoderBase { public: FFmpegAudioDecoder(); virtual ~FFmpegAudioDecoder(); protected: virtual void DoInitialize(DemuxerStream* demuxer_stream, bool* success, Task* done_cb); virtual void DoSeek(base::TimeDelta time, Task* done_cb); virtual void DoDecode(Buffer* input); private: // Calculates the duration of an audio buffer based on the sample rate, // channels and bits per sample given the size in bytes. base::TimeDelta CalculateDuration(size_t size); // A FFmpeg defined structure that holds decoder information, this variable // is initialized in OnInitialize(). AVCodecContext* codec_context_; // Estimated timestamp for next packet. Useful for packets without timestamps. base::TimeDelta estimated_next_timestamp_; // Data buffer to carry decoded raw PCM samples. This buffer is created by // av_malloc() and is used throughout the lifetime of this class. scoped_ptr_malloc output_buffer_; static const size_t kOutputBufferSize; DISALLOW_COPY_AND_ASSIGN(FFmpegAudioDecoder); }; } // namespace media #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_