Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: media/filters/ffmpeg_audio_decoder.h

Issue 297553002: Add callback in VideoDecoder and AudioDecoder to return decoded frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 19 matching lines...) Expand all
30 30
31 class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder { 31 class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder {
32 public: 32 public:
33 FFmpegAudioDecoder( 33 FFmpegAudioDecoder(
34 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 34 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
35 const LogCB& log_cb); 35 const LogCB& log_cb);
36 virtual ~FFmpegAudioDecoder(); 36 virtual ~FFmpegAudioDecoder();
37 37
38 // AudioDecoder implementation. 38 // AudioDecoder implementation.
39 virtual void Initialize(const AudioDecoderConfig& config, 39 virtual void Initialize(const AudioDecoderConfig& config,
40 const PipelineStatusCB& status_cb) OVERRIDE; 40 const PipelineStatusCB& status_cb,
41 const OutputCB& output_cb) OVERRIDE;
41 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, 42 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer,
42 const DecodeCB& decode_cb) OVERRIDE; 43 const DecodeCB& decode_cb) OVERRIDE;
43 virtual scoped_refptr<AudioBuffer> GetDecodeOutput() OVERRIDE;
44 virtual void Reset(const base::Closure& closure) OVERRIDE; 44 virtual void Reset(const base::Closure& closure) OVERRIDE;
45 virtual void Stop() OVERRIDE; 45 virtual void Stop() OVERRIDE;
46 46
47 private: 47 private:
48 enum DecoderState { 48 enum DecoderState {
49 kUninitialized, 49 kUninitialized,
50 kNormal, 50 kNormal,
51 kFlushCodec, 51 kFlushCodec,
52 kDecodeFinished, 52 kDecodeFinished,
53 kError 53 kError
(...skipping 11 matching lines...) Expand all
65 // Returns true if initialization was successful. 65 // Returns true if initialization was successful.
66 bool ConfigureDecoder(); 66 bool ConfigureDecoder();
67 67
68 // Releases resources associated with |codec_context_| and |av_frame_| 68 // Releases resources associated with |codec_context_| and |av_frame_|
69 // and resets them to NULL. 69 // and resets them to NULL.
70 void ReleaseFFmpegResources(); 70 void ReleaseFFmpegResources();
71 void ResetTimestampState(); 71 void ResetTimestampState();
72 72
73 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 73 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
74 74
75 OutputCB output_cb_;
76
75 DecoderState state_; 77 DecoderState state_;
76 78
77 // FFmpeg structures owned by this object. 79 // FFmpeg structures owned by this object.
78 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; 80 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_;
79 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; 81 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_;
80 82
81 AudioDecoderConfig config_; 83 AudioDecoderConfig config_;
82 84
83 // AVSampleFormat initially requested; not Chrome's SampleFormat. 85 // AVSampleFormat initially requested; not Chrome's SampleFormat.
84 int av_sample_format_; 86 int av_sample_format_;
85 87
86 scoped_ptr<AudioDiscardHelper> discard_helper_; 88 scoped_ptr<AudioDiscardHelper> discard_helper_;
87 89
88 // Since multiple frames may be decoded from the same packet we need to queue
89 // them up.
90 std::list<scoped_refptr<AudioBuffer> > queued_audio_;
91
92 LogCB log_cb_; 90 LogCB log_cb_;
93 91
94 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); 92 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder);
95 }; 93 };
96 94
97 } // namespace media 95 } // namespace media
98 96
99 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ 97 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698