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

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

Issue 9700006: Move VideoDecoder out of media pipeline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revised on fischman's comments. Created 8 years, 9 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 // Filters are connected in a strongly typed manner, with downstream filters 5 // Filters are connected in a strongly typed manner, with downstream filters
6 // always reading data from upstream filters. Upstream filters have no clue 6 // always reading data from upstream filters. Upstream filters have no clue
7 // who is actually reading from them, and return the results via callbacks. 7 // who is actually reading from them, and return the results via callbacks.
8 // 8 //
9 // DemuxerStream(Video) <- VideoDecoder <- VideoRenderer 9 // DemuxerStream(Video) <- VideoDecoder <- VideoRenderer
10 // DataSource <- Demuxer < 10 // DataSource <- Demuxer <
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // PipelineImpl::Stop() goes through a Pause/Flush/Stop dance to all its 157 // PipelineImpl::Stop() goes through a Pause/Flush/Stop dance to all its
158 // filters, waiting for each state transition to complete before starting the 158 // filters, waiting for each state transition to complete before starting the
159 // next, but WebMediaPlayerImpl::Destroy() holds the renderer loop hostage for 159 // next, but WebMediaPlayerImpl::Destroy() holds the renderer loop hostage for
160 // the duration. Default implementation does nothing; derived decoders may 160 // the duration. Default implementation does nothing; derived decoders may
161 // override as needed. http://crbug.com/110228 tracks removing this. 161 // override as needed. http://crbug.com/110228 tracks removing this.
162 virtual void PrepareForShutdownHack(); 162 virtual void PrepareForShutdownHack();
163 163
164 protected: 164 protected:
165 VideoDecoder(); 165 VideoDecoder();
166 virtual ~VideoDecoder(); 166 virtual ~VideoDecoder();
167
168 private:
169 // These functions will be removed later. Declare here to make sure they are
170 // not called from VideoDecoder interface anymore.
171 // TODO(xhwang): Remove them when VideoDecoder is not a Filter any more.
Ami GONE FROM CHROMIUM 2012/03/14 22:42:50 Include the crbug # in the TODO
xhwang 2012/03/14 22:59:42 Done.
172 virtual void Play(const base::Closure& callback) OVERRIDE;
173 virtual void Pause(const base::Closure& callback) OVERRIDE;
174 virtual void Seek(base::TimeDelta time,
175 const FilterStatusCB& callback) OVERRIDE;
167 }; 176 };
168 177
169
170 class MEDIA_EXPORT VideoRenderer : public Filter { 178 class MEDIA_EXPORT VideoRenderer : public Filter {
171 public: 179 public:
172 // Used to update the pipeline's clock time. The parameter is the time that 180 // Used to update the pipeline's clock time. The parameter is the time that
173 // the clock should not exceed. 181 // the clock should not exceed.
174 typedef base::Callback<void(base::TimeDelta)> VideoTimeCB; 182 typedef base::Callback<void(base::TimeDelta)> VideoTimeCB;
175 183
176 // Initialize a VideoRenderer with the given VideoDecoder, executing the 184 // Initialize a VideoRenderer with the given VideoDecoder, executing the
177 // callback upon completion. 185 // callback upon completion.
178 virtual void Initialize(VideoDecoder* decoder, 186 virtual void Initialize(const scoped_refptr<VideoDecoder>& decoder,
179 const PipelineStatusCB& callback, 187 const PipelineStatusCB& pipeline_status_cb,
180 const StatisticsCB& statistics_cb, 188 const StatisticsCB& statistics_cb,
181 const VideoTimeCB& time_cb) = 0; 189 const VideoTimeCB& time_cb) = 0;
182 190
183 // Returns true if this filter has received and processed an end-of-stream 191 // Returns true if this filter has received and processed an end-of-stream
184 // buffer. 192 // buffer.
185 virtual bool HasEnded() = 0; 193 virtual bool HasEnded() = 0;
186 }; 194 };
187 195
188
189 class MEDIA_EXPORT AudioRenderer : public Filter { 196 class MEDIA_EXPORT AudioRenderer : public Filter {
190 public: 197 public:
191 // Used to update the pipeline's clock time. The first parameter is the 198 // Used to update the pipeline's clock time. The first parameter is the
192 // current time, and the second parameter is the time that the clock must not 199 // current time, and the second parameter is the time that the clock must not
193 // exceed. 200 // exceed.
194 typedef base::Callback<void(base::TimeDelta, base::TimeDelta)> AudioTimeCB; 201 typedef base::Callback<void(base::TimeDelta, base::TimeDelta)> AudioTimeCB;
195 202
196 // Initialize a AudioRenderer with the given AudioDecoder, executing the 203 // Initialize a AudioRenderer with the given AudioDecoder, executing the
197 // |init_callback| upon completion. |underflow_callback| is called when the 204 // |init_callback| upon completion. |underflow_callback| is called when the
198 // renderer runs out of data to pass to the audio card during playback. 205 // renderer runs out of data to pass to the audio card during playback.
(...skipping 14 matching lines...) Expand all
213 220
214 // Resumes playback after underflow occurs. 221 // Resumes playback after underflow occurs.
215 // |buffer_more_audio| is set to true if you want to increase the size of the 222 // |buffer_more_audio| is set to true if you want to increase the size of the
216 // decoded audio buffer. 223 // decoded audio buffer.
217 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0; 224 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0;
218 }; 225 };
219 226
220 } // namespace media 227 } // namespace media
221 228
222 #endif // MEDIA_BASE_FILTERS_H_ 229 #endif // MEDIA_BASE_FILTERS_H_
OLDNEW
« no previous file with comments | « media/base/filter_collection.cc ('k') | media/base/filters.cc » ('j') | media/base/filters.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698