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 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 void DoReset(); | 84 void DoReset(); |
85 | 85 |
86 // Handles decoding an unencrypted encoded buffer. | 86 // Handles decoding an unencrypted encoded buffer. |
87 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer, | 87 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer, |
88 const DecodeCB& decode_cb); | 88 const DecodeCB& decode_cb); |
89 bool FFmpegDecode(const scoped_refptr<DecoderBuffer>& buffer, | 89 bool FFmpegDecode(const scoped_refptr<DecoderBuffer>& buffer, |
90 bool* has_produced_frame); | 90 bool* has_produced_frame); |
91 | 91 |
92 // Handles (re-)initializing the decoder with a (new) config. | 92 // Handles (re-)initializing the decoder with a (new) config. |
93 // Returns true if initialization was successful. | 93 // Returns true if initialization was successful. |
94 bool ConfigureDecoder(); | 94 bool ConfigureDecoder(const AudioDecoderConfig& config); |
95 | 95 |
96 // Releases resources associated with |codec_context_| and |av_frame_| | 96 // Releases resources associated with |codec_context_| and |av_frame_| |
97 // and resets them to NULL. | 97 // and resets them to NULL. |
98 void ReleaseFFmpegResources(); | 98 void ReleaseFFmpegResources(); |
99 void ResetTimestampState(); | 99 void ResetTimestampState(const AudioDecoderConfig& config); |
100 | 100 |
101 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 101 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
102 | 102 |
103 OutputCB output_cb_; | 103 OutputCB output_cb_; |
104 | 104 |
105 DecoderState state_; | 105 DecoderState state_; |
106 | 106 |
107 // FFmpeg structures owned by this object. | 107 // FFmpeg structures owned by this object. |
108 std::unique_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; | 108 std::unique_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; |
109 std::unique_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; | 109 std::unique_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; |
110 | 110 |
111 AudioDecoderConfig config_; | 111 AudioDecoderConfig config_; |
112 | 112 |
113 // AVSampleFormat initially requested; not Chrome's SampleFormat. | 113 // AVSampleFormat initially requested; not Chrome's SampleFormat. |
114 int av_sample_format_; | 114 int av_sample_format_; |
115 | 115 |
116 std::unique_ptr<AudioDiscardHelper> discard_helper_; | 116 std::unique_ptr<AudioDiscardHelper> discard_helper_; |
117 | 117 |
118 MediaLog* media_log_; | 118 MediaLog* media_log_; |
119 | 119 |
120 scoped_refptr<AudioBufferMemoryPool> pool_; | 120 scoped_refptr<AudioBufferMemoryPool> pool_; |
121 | 121 |
122 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); | 122 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); |
123 }; | 123 }; |
124 | 124 |
125 } // namespace media | 125 } // namespace media |
126 | 126 |
127 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ | 127 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ |
OLD | NEW |