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

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

Issue 3030013: preparation for recycling buffer, patch 2 (Closed)
Patch Set: fix layout test Created 10 years, 4 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
« no previous file with comments | « no previous file | media/base/mock_filters.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 DCHECK(!message_loop_); 85 DCHECK(!message_loop_);
86 message_loop_ = message_loop; 86 message_loop_ = message_loop;
87 } 87 }
88 88
89 virtual MessageLoop* message_loop() { 89 virtual MessageLoop* message_loop() {
90 return message_loop_; 90 return message_loop_;
91 } 91 }
92 92
93 // The pipeline has resumed playback. Filters can continue requesting reads. 93 // The pipeline has resumed playback. Filters can continue requesting reads.
94 // Filters may implement this method if they need to respond to this call. 94 // Filters may implement this method if they need to respond to this call.
95 // TODO(boliu): Check that callback is not NULL in sublcasses. 95 // TODO(boliu): Check that callback is not NULL in subclasses.
96 virtual void Play(FilterCallback* callback) { 96 virtual void Play(FilterCallback* callback) {
97 DCHECK(callback); 97 DCHECK(callback);
98 if (callback) { 98 if (callback) {
99 callback->Run(); 99 callback->Run();
100 delete callback; 100 delete callback;
101 } 101 }
102 } 102 }
103 103
104 // The pipeline has paused playback. Filters should fulfill any existing read 104 // The pipeline has paused playback. Filters should stop buffer exchange.
105 // requests and then idle. Filters may implement this method if they need to 105 // Filters may implement this method if they need to respond to this call.
106 // respond to this call. 106 // TODO(boliu): Check that callback is not NULL in subclasses.
107 // TODO(boliu): Check that callback is not NULL in sublcasses.
108 virtual void Pause(FilterCallback* callback) { 107 virtual void Pause(FilterCallback* callback) {
109 DCHECK(callback); 108 DCHECK(callback);
110 if (callback) { 109 if (callback) {
111 callback->Run(); 110 callback->Run();
112 delete callback; 111 delete callback;
113 } 112 }
114 } 113 }
115 114
115 // The pipeline has been flushed. Filters should return buffer to owners.
116 // Filters may implement this method if they need to respond to this call.
117 // TODO(boliu): Check that callback is not NULL in subclasses.
118 virtual void Flush(FilterCallback* callback) {
119 DCHECK(callback);
120 if (callback) {
121 callback->Run();
122 delete callback;
123 }
124 }
125
116 // The pipeline is being stopped either as a result of an error or because 126 // The pipeline is being stopped either as a result of an error or because
117 // the client called Stop(). 127 // the client called Stop().
118 // TODO(boliu): Check that callback is not NULL in sublcasses. 128 // TODO(boliu): Check that callback is not NULL in subclasses.
119 virtual void Stop(FilterCallback* callback) { 129 virtual void Stop(FilterCallback* callback) {
120 DCHECK(callback); 130 DCHECK(callback);
121 if (callback) { 131 if (callback) {
122 callback->Run(); 132 callback->Run();
123 delete callback; 133 delete callback;
124 } 134 }
125 } 135 }
126 136
127 // The pipeline playback rate has been changed. Filters may implement this 137 // The pipeline playback rate has been changed. Filters may implement this
128 // method if they need to respond to this call. 138 // method if they need to respond to this call.
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } 296 }
287 FillBufferDoneCallback* fill_buffer_done_callback() { 297 FillBufferDoneCallback* fill_buffer_done_callback() {
288 return fill_buffer_done_callback_.get(); 298 return fill_buffer_done_callback_.get();
289 } 299 }
290 300
291 // Render provides an output buffer for Decoder to write to. These buffers 301 // Render provides an output buffer for Decoder to write to. These buffers
292 // will be recycled to renderer by fill_buffer_done_callback_; 302 // will be recycled to renderer by fill_buffer_done_callback_;
293 // We could also pass empty pointer here to let decoder provide buffers pool. 303 // We could also pass empty pointer here to let decoder provide buffers pool.
294 virtual void FillThisBuffer(scoped_refptr<VideoFrame> frame) = 0; 304 virtual void FillThisBuffer(scoped_refptr<VideoFrame> frame) = 0;
295 305
306 // Indicate whether decoder provides its own output buffers
307 virtual bool ProvidesBuffer() = 0;
308
296 private: 309 private:
297 scoped_ptr<FillBufferDoneCallback> fill_buffer_done_callback_; 310 scoped_ptr<FillBufferDoneCallback> fill_buffer_done_callback_;
298 }; 311 };
299 312
300 313
301 class AudioDecoder : public MediaFilter { 314 class AudioDecoder : public MediaFilter {
302 public: 315 public:
303 static FilterType filter_type() { 316 static FilterType filter_type() {
304 return FILTER_AUDIO_DECODER; 317 return FILTER_AUDIO_DECODER;
305 } 318 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 // buffer. 387 // buffer.
375 virtual bool HasEnded() = 0; 388 virtual bool HasEnded() = 0;
376 389
377 // Sets the output volume. 390 // Sets the output volume.
378 virtual void SetVolume(float volume) = 0; 391 virtual void SetVolume(float volume) = 0;
379 }; 392 };
380 393
381 } // namespace media 394 } // namespace media
382 395
383 #endif // MEDIA_BASE_FILTERS_H_ 396 #endif // MEDIA_BASE_FILTERS_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/mock_filters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698