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" | |
13 #include "base/time/time.h" | 12 #include "base/time/time.h" |
14 #include "media/base/audio_decoder.h" | 13 #include "media/base/audio_decoder.h" |
15 #include "media/base/demuxer_stream.h" | 14 #include "media/base/demuxer_stream.h" |
16 #include "media/base/sample_format.h" | 15 #include "media/base/sample_format.h" |
17 #include "media/ffmpeg/ffmpeg_deleters.h" | 16 #include "media/ffmpeg/ffmpeg_deleters.h" |
18 | 17 |
19 struct AVCodecContext; | 18 struct AVCodecContext; |
20 struct AVFrame; | 19 struct AVFrame; |
21 | 20 |
22 namespace base { | 21 namespace base { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // Handles (re-)initializing the decoder with a (new) config. | 65 // Handles (re-)initializing the decoder with a (new) config. |
67 // Returns true if initialization was successful. | 66 // Returns true if initialization was successful. |
68 bool ConfigureDecoder(); | 67 bool ConfigureDecoder(); |
69 | 68 |
70 // Releases resources associated with |codec_context_| and |av_frame_| | 69 // Releases resources associated with |codec_context_| and |av_frame_| |
71 // and resets them to NULL. | 70 // and resets them to NULL. |
72 void ReleaseFFmpegResources(); | 71 void ReleaseFFmpegResources(); |
73 void ResetTimestampState(); | 72 void ResetTimestampState(); |
74 | 73 |
75 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 74 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
76 base::WeakPtrFactory<FFmpegAudioDecoder> weak_factory_; | |
77 base::WeakPtr<FFmpegAudioDecoder> weak_this_; | |
78 | 75 |
79 DecoderState state_; | 76 DecoderState state_; |
80 | 77 |
81 // FFmpeg structures owned by this object. | 78 // FFmpeg structures owned by this object. |
82 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; | 79 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; |
83 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; | 80 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; |
84 | 81 |
85 // Decoded audio format. | 82 // Decoded audio format. |
86 int bytes_per_channel_; | 83 int bytes_per_channel_; |
87 ChannelLayout channel_layout_; | 84 ChannelLayout channel_layout_; |
(...skipping 16 matching lines...) Expand all Loading... |
104 // Since multiple frames may be decoded from the same packet we need to queue | 101 // Since multiple frames may be decoded from the same packet we need to queue |
105 // them up. | 102 // them up. |
106 std::list<scoped_refptr<AudioBuffer> > queued_audio_; | 103 std::list<scoped_refptr<AudioBuffer> > queued_audio_; |
107 | 104 |
108 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); | 105 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); |
109 }; | 106 }; |
110 | 107 |
111 } // namespace media | 108 } // namespace media |
112 | 109 |
113 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ | 110 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ |
OLD | NEW |