Index: media/filters/ffmpeg_audio_decoder.h |
diff --git a/media/filters/ffmpeg_audio_decoder.h b/media/filters/ffmpeg_audio_decoder.h |
index 1025083598c29fba952380f309024c7c301a50cf..6c93aa0ea29f77502b04ac51ddd0c71e9ee3c128 100644 |
--- a/media/filters/ffmpeg_audio_decoder.h |
+++ b/media/filters/ffmpeg_audio_decoder.h |
@@ -5,54 +5,73 @@ |
#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" |
struct AVCodecContext; |
namespace media { |
-// Forward declaration for scoped_ptr_malloc. |
-class ScopedPtrAVFree; |
+class DataBuffer; |
-class MEDIA_EXPORT FFmpegAudioDecoder |
- : public DecoderBase<AudioDecoder, Buffer> { |
+class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder { |
public: |
explicit FFmpegAudioDecoder(MessageLoop* message_loop); |
virtual ~FFmpegAudioDecoder(); |
+ // Filter implementation. |
+ virtual void Flush(FilterCallback* callback); |
acolwell GONE FROM CHROMIUM
2011/09/13 22:09:28
OVERRIDE this and methods below.
scherkus (not reviewing)
2011/09/16 18:10:13
Done.
|
+ |
// AudioDecoder implementation. |
+ virtual void Initialize(DemuxerStream* stream, FilterCallback* callback, |
+ StatisticsCallback* stats_callback); |
virtual AudioDecoderConfig config(); |
acolwell GONE FROM CHROMIUM
2011/09/13 22:09:28
const AudioDecoderConfig& config() const?
scherkus (not reviewing)
2011/09/16 18:10:13
this is going away in follow up CL
|
- virtual void ProduceAudioSamples(scoped_refptr<Buffer> output); |
- |
- 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); |
+ virtual void ProduceAudioSamples(scoped_refptr<Buffer> buffer); |
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(). |
+ // Methods running on decoder thread. |
+ void DoInitialize(DemuxerStream* stream, |
+ FilterCallback* callback, |
+ StatisticsCallback* stats_callback); |
+ void DoFlush(FilterCallback* callback); |
+ void DoQueueOutput(scoped_refptr<Buffer> output); |
+ void DoDecodeInput(scoped_refptr<Buffer> input); |
+ |
+ // Reads from the demuxer stream with corresponding callback method. |
+ void ReadFromDemuxerStream(); |
+ void OnReadComplete(Buffer* buffer); |
+ |
+ // Updates the output buffer's duration and timestamp based on the input |
+ // buffer. Will fall back to an estimated timestamp if the input lacks a |
+ // valid timestamp. |
+ void UpdateDurationAndTimestamp(const Buffer* input, DataBuffer* output); |
+ |
+ // Calculates duration based on size of decoded audio bytes. |
+ base::TimeDelta CalculateDuration(int size); |
+ |
+ MessageLoop* message_loop_; |
+ |
+ scoped_refptr<DemuxerStream> demuxer_stream_; |
+ 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. |
+ const int decoded_audio_size_; |
+ scoped_array<uint8> 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 |