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 |
11 struct AVCodecContext; | 11 struct AVCodecContext; |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 | 14 |
15 // Forward declaration for scoped_ptr_malloc. | 15 // Forward declaration for scoped_ptr_malloc. |
16 class ScopedPtrAVFree; | 16 void ScopedPtrAVFree(void*); |
17 | 17 |
18 class FFmpegAudioDecoder : public DecoderBase<AudioDecoder, Buffer> { | 18 class FFmpegAudioDecoder : public DecoderBase<AudioDecoder, Buffer> { |
19 public: | 19 public: |
20 static FilterFactory* CreateFactory() { | 20 static FilterFactory* CreateFactory() { |
21 return new FilterFactoryImpl0<FFmpegAudioDecoder>(); | 21 return new FilterFactoryImpl0<FFmpegAudioDecoder>(); |
22 } | 22 } |
23 | 23 |
24 static bool IsMediaFormatSupported(const MediaFormat& media_format); | 24 static bool IsMediaFormatSupported(const MediaFormat& media_format); |
25 | 25 |
26 protected: | 26 protected: |
(...skipping 15 matching lines...) Expand all Loading... |
42 | 42 |
43 // A FFmpeg defined structure that holds decoder information, this variable | 43 // A FFmpeg defined structure that holds decoder information, this variable |
44 // is initialized in OnInitialize(). | 44 // is initialized in OnInitialize(). |
45 AVCodecContext* codec_context_; | 45 AVCodecContext* codec_context_; |
46 | 46 |
47 // Estimated timestamp for next packet. Useful for packets without timestamps. | 47 // Estimated timestamp for next packet. Useful for packets without timestamps. |
48 base::TimeDelta estimated_next_timestamp_; | 48 base::TimeDelta estimated_next_timestamp_; |
49 | 49 |
50 // Data buffer to carry decoded raw PCM samples. This buffer is created by | 50 // Data buffer to carry decoded raw PCM samples. This buffer is created by |
51 // av_malloc() and is used throughout the lifetime of this class. | 51 // av_malloc() and is used throughout the lifetime of this class. |
52 scoped_ptr_malloc<uint8, ScopedPtrAVFree> output_buffer_; | 52 scoped_ptr_malloc<uint8, FreeFnAdapter<ScopedPtrAVFree> > output_buffer_; |
53 | 53 |
54 static const size_t kOutputBufferSize; | 54 static const size_t kOutputBufferSize; |
55 | 55 |
56 DISALLOW_COPY_AND_ASSIGN(FFmpegAudioDecoder); | 56 DISALLOW_COPY_AND_ASSIGN(FFmpegAudioDecoder); |
57 }; | 57 }; |
58 | 58 |
59 } // namespace media | 59 } // namespace media |
60 | 60 |
61 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ | 61 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ |
OLD | NEW |