Chromium Code Reviews| Index: media/filters/ffmpeg_audio_decoder.h |
| diff --git a/media/filters/ffmpeg_audio_decoder.h b/media/filters/ffmpeg_audio_decoder.h |
| index 72978bc8d7c5603cc1a3cb1bff681bfc0a34ba78..dc1561669dcbbbc5006fbfccaa048e87a2983064 100644 |
| --- a/media/filters/ffmpeg_audio_decoder.h |
| +++ b/media/filters/ffmpeg_audio_decoder.h |
| @@ -5,53 +5,68 @@ |
| #ifndef MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ |
| #define MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ |
| -#include "media/filters/decoder_base.h" |
| +#include <list> |
| + |
| +#include "base/message_loop.h" |
| +#include "media/base/filters.h" |
| +#include "media/base/data_buffer.h" |
| struct AVCodecContext; |
| namespace media { |
| -// Forward declaration for scoped_ptr_malloc. |
| -class ScopedPtrAVFree; |
| - |
| -class FFmpegAudioDecoder : public DecoderBase<AudioDecoder, Buffer> { |
| +class FFmpegAudioDecoder : public AudioDecoder { |
| public: |
| explicit FFmpegAudioDecoder(MessageLoop* message_loop); |
| virtual ~FFmpegAudioDecoder(); |
| + // Filter implementation. |
| + virtual void Play(FilterCallback* callback); |
|
acolwell GONE FROM CHROMIUM
2011/05/13 19:35:37
Remove because it isn't used. I envision AudioDeco
scherkus (not reviewing)
2011/09/11 14:49:22
Done.
|
| + virtual void Pause(FilterCallback* callback); |
|
acolwell GONE FROM CHROMIUM
2011/05/13 19:35:37
ditto
scherkus (not reviewing)
2011/09/11 14:49:22
Done.
|
| + virtual void Flush(FilterCallback* callback); |
| + virtual void Stop(FilterCallback* callback); |
| + virtual void Seek(base::TimeDelta time, FilterCallback* callback); |
|
acolwell GONE FROM CHROMIUM
2011/05/13 19:35:37
ditto
scherkus (not reviewing)
2011/09/11 14:49:22
Done.
|
| + |
| // AudioDecoder implementation. |
| + virtual void Initialize(DemuxerStream* stream, FilterCallback* callback, |
| + StatisticsCallback* stats_callback); |
| virtual AudioDecoderConfig config(); |
| - virtual void ProduceAudioSamples(scoped_refptr<Buffer> output); |
| + virtual void ProduceAudioSamples(scoped_refptr<Buffer> buffer); |
| - protected: |
| - virtual void DoInitialize(DemuxerStream* demuxer_stream, bool* success, |
| - Task* done_cb); |
| + private: |
| + void DoInitialize(DemuxerStream* stream, FilterCallback* callback, |
|
acolwell GONE FROM CHROMIUM
2011/05/13 19:35:37
Add comments for methods.
scherkus (not reviewing)
2011/09/11 14:49:22
Done.
|
| + StatisticsCallback* stats_callback); |
| + void DoQueueOutputBuffer(scoped_refptr<Buffer> output); |
| + void DoDecodeInputBuffer(scoped_refptr<Buffer> input); |
| - virtual void DoSeek(base::TimeDelta time, Task* done_cb); |
| + void DecodeFinished(scoped_refptr<Buffer> output, |
| + const PipelineStatistics& statistics); |
| - virtual void DoDecode(Buffer* input); |
| + void ReadFromDemuxerStream(); |
| + void OnReadComplete(Buffer* buffer); |
| + void UpdateDurationAndTimestamp(Buffer* input, DataBuffer* output); |
| + base::TimeDelta CalculateDuration(int size); |
| - 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); |
| + MessageLoop* message_loop_; |
| - // A FFmpeg defined structure that holds decoder information, this variable |
| - // is initialized in OnInitialize(). |
| + DemuxerStream* demuxer_stream_; |
|
acolwell GONE FROM CHROMIUM
2011/05/13 19:35:37
scoped_refptr?
scherkus (not reviewing)
2011/09/11 14:49:22
Done.
|
| + scoped_ptr<StatisticsCallback> stats_callback_; |
| AVCodecContext* codec_context_; |
| AudioDecoderConfig config_; |
| - // 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<uint8, ScopedPtrAVFree> output_buffer_; |
| + // Holds decoded audio. |
| + scoped_ptr<int16_t> decoded_audio_; |
| + |
| + // Holds downstream-provided buffers. |
| + std::list<scoped_refptr<Buffer> > output_buffers_; |
| - static const size_t kOutputBufferSize; |
| + // Tracks reads issued for compressed data. |
| + int pending_reads_; |
| - DISALLOW_COPY_AND_ASSIGN(FFmpegAudioDecoder); |
| + DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); |
| }; |
| } // namespace media |