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 16 matching lines...) Expand all Loading... |
27 class DecoderBuffer; | 27 class DecoderBuffer; |
28 struct QueuedAudioBuffer; | 28 struct QueuedAudioBuffer; |
29 | 29 |
30 class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder { | 30 class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder { |
31 public: | 31 public: |
32 explicit FFmpegAudioDecoder( | 32 explicit FFmpegAudioDecoder( |
33 const scoped_refptr<base::MessageLoopProxy>& message_loop); | 33 const scoped_refptr<base::MessageLoopProxy>& message_loop); |
34 virtual ~FFmpegAudioDecoder(); | 34 virtual ~FFmpegAudioDecoder(); |
35 | 35 |
36 // AudioDecoder implementation. | 36 // AudioDecoder implementation. |
37 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, | 37 virtual void Initialize(DemuxerStream* stream, |
38 const PipelineStatusCB& status_cb, | 38 const PipelineStatusCB& status_cb, |
39 const StatisticsCB& statistics_cb) OVERRIDE; | 39 const StatisticsCB& statistics_cb) OVERRIDE; |
40 virtual void Read(const ReadCB& read_cb) OVERRIDE; | 40 virtual void Read(const ReadCB& read_cb) OVERRIDE; |
41 virtual int bits_per_channel() OVERRIDE; | 41 virtual int bits_per_channel() OVERRIDE; |
42 virtual ChannelLayout channel_layout() OVERRIDE; | 42 virtual ChannelLayout channel_layout() OVERRIDE; |
43 virtual int samples_per_second() OVERRIDE; | 43 virtual int samples_per_second() OVERRIDE; |
44 virtual void Reset(const base::Closure& closure) OVERRIDE; | 44 virtual void Reset(const base::Closure& closure) OVERRIDE; |
45 | 45 |
46 private: | 46 private: |
47 // Reads from the demuxer stream with corresponding callback method. | 47 // Reads from the demuxer stream with corresponding callback method. |
48 void ReadFromDemuxerStream(); | 48 void ReadFromDemuxerStream(); |
49 void BufferReady(DemuxerStream::Status status, | 49 void BufferReady(DemuxerStream::Status status, |
50 const scoped_refptr<DecoderBuffer>& input); | 50 const scoped_refptr<DecoderBuffer>& input); |
51 | 51 |
52 bool ConfigureDecoder(); | 52 bool ConfigureDecoder(); |
53 void ReleaseFFmpegResources(); | 53 void ReleaseFFmpegResources(); |
54 void ResetTimestampState(); | 54 void ResetTimestampState(); |
55 void RunDecodeLoop(const scoped_refptr<DecoderBuffer>& input, | 55 void RunDecodeLoop(const scoped_refptr<DecoderBuffer>& input, |
56 bool skip_eos_append); | 56 bool skip_eos_append); |
57 | 57 |
58 scoped_refptr<base::MessageLoopProxy> message_loop_; | 58 scoped_refptr<base::MessageLoopProxy> message_loop_; |
59 base::WeakPtrFactory<FFmpegAudioDecoder> weak_factory_; | 59 base::WeakPtrFactory<FFmpegAudioDecoder> weak_factory_; |
60 base::WeakPtr<FFmpegAudioDecoder> weak_this_; | 60 base::WeakPtr<FFmpegAudioDecoder> weak_this_; |
61 | 61 |
62 scoped_refptr<DemuxerStream> demuxer_stream_; | 62 DemuxerStream* demuxer_stream_; |
63 StatisticsCB statistics_cb_; | 63 StatisticsCB statistics_cb_; |
64 AVCodecContext* codec_context_; | 64 AVCodecContext* codec_context_; |
65 | 65 |
66 // Decoded audio format. | 66 // Decoded audio format. |
67 int bits_per_channel_; | 67 int bits_per_channel_; |
68 ChannelLayout channel_layout_; | 68 ChannelLayout channel_layout_; |
69 int channels_; | 69 int channels_; |
70 int samples_per_second_; | 70 int samples_per_second_; |
71 | 71 |
72 // AVSampleFormat initially requested; not Chrome's SampleFormat. | 72 // AVSampleFormat initially requested; not Chrome's SampleFormat. |
(...skipping 20 matching lines...) Expand all Loading... |
93 // We may need to convert the audio data coming out of FFmpeg from planar | 93 // We may need to convert the audio data coming out of FFmpeg from planar |
94 // float to integer. | 94 // float to integer. |
95 scoped_ptr<AudioBus> converter_bus_; | 95 scoped_ptr<AudioBus> converter_bus_; |
96 | 96 |
97 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); | 97 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); |
98 }; | 98 }; |
99 | 99 |
100 } // namespace media | 100 } // namespace media |
101 | 101 |
102 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ | 102 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ |
OLD | NEW |