| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // 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 "media/base/factory.h" | 8 #include "media/base/factory.h" |
| 9 #include "media/filters/decoder_base.h" | 9 #include "media/filters/decoder_base.h" |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 virtual void OnStop(); | 28 virtual void OnStop(); |
| 29 | 29 |
| 30 virtual void OnDecode(Buffer* input); | 30 virtual void OnDecode(Buffer* input); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 friend class FilterFactoryImpl0<FFmpegAudioDecoder>; | 33 friend class FilterFactoryImpl0<FFmpegAudioDecoder>; |
| 34 FFmpegAudioDecoder(); | 34 FFmpegAudioDecoder(); |
| 35 virtual ~FFmpegAudioDecoder(); | 35 virtual ~FFmpegAudioDecoder(); |
| 36 | 36 |
| 37 // Calculates the duration of an audio buffer based on the sample rate, |
| 38 // channels and bits per sample given the size in bytes. |
| 39 base::TimeDelta CalculateDuration(size_t size); |
| 40 |
| 37 // A FFmpeg defined structure that holds decoder information, this variable | 41 // A FFmpeg defined structure that holds decoder information, this variable |
| 38 // is initialized in OnInitialize(). | 42 // is initialized in OnInitialize(). |
| 39 AVCodecContext* codec_context_; | 43 AVCodecContext* codec_context_; |
| 40 | 44 |
| 41 // Data buffer to carry decoded raw PCM samples. This buffer is created by | 45 // Data buffer to carry decoded raw PCM samples. This buffer is created by |
| 42 // av_malloc() and is used throughout the lifetime of this class. | 46 // av_malloc() and is used throughout the lifetime of this class. |
| 43 scoped_ptr_malloc<uint8, ScopedPtrAVFree> output_buffer_; | 47 scoped_ptr_malloc<uint8, ScopedPtrAVFree> output_buffer_; |
| 44 | 48 |
| 45 static const size_t kOutputBufferSize; | 49 static const size_t kOutputBufferSize; |
| 46 | 50 |
| 47 DISALLOW_COPY_AND_ASSIGN(FFmpegAudioDecoder); | 51 DISALLOW_COPY_AND_ASSIGN(FFmpegAudioDecoder); |
| 48 }; | 52 }; |
| 49 | 53 |
| 50 } // namespace media | 54 } // namespace media |
| 51 | 55 |
| 52 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ | 56 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ |
| OLD | NEW |