OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 // Filter implementation. | 24 // Filter implementation. |
25 virtual void Flush(FilterCallback* callback) OVERRIDE; | 25 virtual void Flush(FilterCallback* callback) OVERRIDE; |
26 | 26 |
27 // AudioDecoder implementation. | 27 // AudioDecoder implementation. |
28 virtual void Initialize(DemuxerStream* stream, FilterCallback* callback, | 28 virtual void Initialize(DemuxerStream* stream, FilterCallback* callback, |
29 StatisticsCallback* stats_callback) OVERRIDE; | 29 StatisticsCallback* stats_callback) OVERRIDE; |
30 virtual void ProduceAudioSamples(scoped_refptr<Buffer> output) OVERRIDE; | 30 virtual void ProduceAudioSamples(scoped_refptr<Buffer> output) OVERRIDE; |
31 virtual int bits_per_channel() OVERRIDE; | 31 virtual int bits_per_channel() OVERRIDE; |
32 virtual ChannelLayout channel_layout() OVERRIDE; | 32 virtual ChannelLayout channel_layout() OVERRIDE; |
33 virtual int sample_rate() OVERRIDE; | 33 virtual int samples_per_second() OVERRIDE; |
34 | 34 |
35 private: | 35 private: |
36 // Methods running on decoder thread. | 36 // Methods running on decoder thread. |
37 void DoInitialize(const scoped_refptr<DemuxerStream>& stream, | 37 void DoInitialize(const scoped_refptr<DemuxerStream>& stream, |
38 FilterCallback* callback, | 38 FilterCallback* callback, |
39 StatisticsCallback* stats_callback); | 39 StatisticsCallback* stats_callback); |
40 void DoFlush(FilterCallback* callback); | 40 void DoFlush(FilterCallback* callback); |
41 void DoProduceAudioSamples(const scoped_refptr<Buffer>& output); | 41 void DoProduceAudioSamples(const scoped_refptr<Buffer>& output); |
42 void DoDecodeBuffer(const scoped_refptr<Buffer>& input); | 42 void DoDecodeBuffer(const scoped_refptr<Buffer>& input); |
43 | 43 |
(...skipping 11 matching lines...) Expand all Loading... |
55 | 55 |
56 MessageLoop* message_loop_; | 56 MessageLoop* message_loop_; |
57 | 57 |
58 scoped_refptr<DemuxerStream> demuxer_stream_; | 58 scoped_refptr<DemuxerStream> demuxer_stream_; |
59 scoped_ptr<StatisticsCallback> stats_callback_; | 59 scoped_ptr<StatisticsCallback> stats_callback_; |
60 AVCodecContext* codec_context_; | 60 AVCodecContext* codec_context_; |
61 | 61 |
62 // Decoded audio format. | 62 // Decoded audio format. |
63 int bits_per_channel_; | 63 int bits_per_channel_; |
64 ChannelLayout channel_layout_; | 64 ChannelLayout channel_layout_; |
65 int sample_rate_; | 65 int samples_per_second_; |
66 | 66 |
67 base::TimeDelta estimated_next_timestamp_; | 67 base::TimeDelta estimated_next_timestamp_; |
68 | 68 |
69 // Holds decoded audio. As required by FFmpeg, input/output buffers should | 69 // Holds decoded audio. As required by FFmpeg, input/output buffers should |
70 // be allocated with suitable padding and alignment. av_malloc() provides | 70 // be allocated with suitable padding and alignment. av_malloc() provides |
71 // us that guarantee. | 71 // us that guarantee. |
72 const int decoded_audio_size_; | 72 const int decoded_audio_size_; |
73 uint8* decoded_audio_; // Allocated via av_malloc(). | 73 uint8* decoded_audio_; // Allocated via av_malloc(). |
74 | 74 |
75 // Holds downstream-provided buffers. | 75 // Holds downstream-provided buffers. |
76 std::list<scoped_refptr<Buffer> > output_buffers_; | 76 std::list<scoped_refptr<Buffer> > output_buffers_; |
77 | 77 |
78 // Tracks reads issued for compressed data. | 78 // Tracks reads issued for compressed data. |
79 int pending_reads_; | 79 int pending_reads_; |
80 | 80 |
81 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); | 81 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); |
82 }; | 82 }; |
83 | 83 |
84 } // namespace media | 84 } // namespace media |
85 | 85 |
86 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ | 86 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ |
OLD | NEW |