| 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "media/base/audio_decoder.h" | 14 #include "media/base/audio_decoder.h" |
| 15 #include "media/base/demuxer_stream.h" | 15 #include "media/base/demuxer_stream.h" |
| 16 #include "media/base/sample_format.h" | 16 #include "media/base/sample_format.h" |
| 17 #include "media/ffmpeg/ffmpeg_deleters.h" |
| 17 | 18 |
| 18 struct AVCodecContext; | 19 struct AVCodecContext; |
| 19 struct AVFrame; | 20 struct AVFrame; |
| 20 | 21 |
| 21 namespace base { | 22 namespace base { |
| 22 class SingleThreadTaskRunner; | 23 class SingleThreadTaskRunner; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace media { | 26 namespace media { |
| 26 | 27 |
| 27 class AudioTimestampHelper; | 28 class AudioTimestampHelper; |
| 28 class DecoderBuffer; | 29 class DecoderBuffer; |
| 29 class ScopedPtrAVFreeContext; | |
| 30 class ScopedPtrAVFreeFrame; | |
| 31 | 30 |
| 32 class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder { | 31 class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder { |
| 33 public: | 32 public: |
| 34 explicit FFmpegAudioDecoder( | 33 explicit FFmpegAudioDecoder( |
| 35 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 34 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
| 36 virtual ~FFmpegAudioDecoder(); | 35 virtual ~FFmpegAudioDecoder(); |
| 37 | 36 |
| 38 // AudioDecoder implementation. | 37 // AudioDecoder implementation. |
| 39 virtual void Initialize(const AudioDecoderConfig& config, | 38 virtual void Initialize(const AudioDecoderConfig& config, |
| 40 const PipelineStatusCB& status_cb) OVERRIDE; | 39 const PipelineStatusCB& status_cb) OVERRIDE; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 void ReleaseFFmpegResources(); | 72 void ReleaseFFmpegResources(); |
| 74 void ResetTimestampState(); | 73 void ResetTimestampState(); |
| 75 | 74 |
| 76 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 75 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 77 base::WeakPtrFactory<FFmpegAudioDecoder> weak_factory_; | 76 base::WeakPtrFactory<FFmpegAudioDecoder> weak_factory_; |
| 78 base::WeakPtr<FFmpegAudioDecoder> weak_this_; | 77 base::WeakPtr<FFmpegAudioDecoder> weak_this_; |
| 79 | 78 |
| 80 DecoderState state_; | 79 DecoderState state_; |
| 81 | 80 |
| 82 // FFmpeg structures owned by this object. | 81 // FFmpeg structures owned by this object. |
| 83 scoped_ptr_malloc<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; | 82 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; |
| 84 scoped_ptr_malloc<AVFrame, ScopedPtrAVFreeFrame> av_frame_; | 83 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; |
| 85 | 84 |
| 86 // Decoded audio format. | 85 // Decoded audio format. |
| 87 int bytes_per_channel_; | 86 int bytes_per_channel_; |
| 88 ChannelLayout channel_layout_; | 87 ChannelLayout channel_layout_; |
| 89 int channels_; | 88 int channels_; |
| 90 int samples_per_second_; | 89 int samples_per_second_; |
| 91 | 90 |
| 92 // AVSampleFormat initially requested; not Chrome's SampleFormat. | 91 // AVSampleFormat initially requested; not Chrome's SampleFormat. |
| 93 int av_sample_format_; | 92 int av_sample_format_; |
| 94 SampleFormat sample_format_; | 93 SampleFormat sample_format_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 105 // Since multiple frames may be decoded from the same packet we need to queue | 104 // Since multiple frames may be decoded from the same packet we need to queue |
| 106 // them up. | 105 // them up. |
| 107 std::list<scoped_refptr<AudioBuffer> > queued_audio_; | 106 std::list<scoped_refptr<AudioBuffer> > queued_audio_; |
| 108 | 107 |
| 109 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); | 108 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); |
| 110 }; | 109 }; |
| 111 | 110 |
| 112 } // namespace media | 111 } // namespace media |
| 113 | 112 |
| 114 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ | 113 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ |
| OLD | NEW |