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

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

Issue 2101015: Change MediaFilter::Stop() to accept a callback so that Stop() is asynchronous. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Revert filter changes. Going to make that another patch. Created 10 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
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // The pipeline has paused playback. Filters should fulfill any existing read 101 // The pipeline has paused playback. Filters should fulfill any existing read
102 // requests and then idle. Filters may implement this method if they need to 102 // requests and then idle. Filters may implement this method if they need to
103 // respond to this call. 103 // respond to this call.
104 virtual void Pause(FilterCallback* callback) { 104 virtual void Pause(FilterCallback* callback) {
105 if (callback) { 105 if (callback) {
106 callback->Run(); 106 callback->Run();
107 delete callback; 107 delete callback;
108 } 108 }
109 } 109 }
110 110
111 // TODO(boliu): Remove once Stop() is asynchronous in subclasses.
112 virtual void Stop() {}
113
111 // The pipeline is being stopped either as a result of an error or because 114 // The pipeline is being stopped either as a result of an error or because
112 // the client called Stop(). 115 // the client called Stop().
113 virtual void Stop() = 0; 116 // TODO(boliu): No implementation in subclasses yet.
117 virtual void Stop(FilterCallback* callback) {
118 // TODO(boliu): Call the synchronous version for now. Remove once
119 // all filters have asynchronous stop.
120 Stop();
121
122 if (callback) {
123 callback->Run();
124 delete callback;
125 }
126 }
114 127
115 // The pipeline playback rate has been changed. Filters may implement this 128 // The pipeline playback rate has been changed. Filters may implement this
116 // method if they need to respond to this call. 129 // method if they need to respond to this call.
117 virtual void SetPlaybackRate(float playback_rate) {} 130 virtual void SetPlaybackRate(float playback_rate) {}
118 131
119 // Carry out any actions required to seek to the given time, executing the 132 // Carry out any actions required to seek to the given time, executing the
120 // callback upon completion. 133 // callback upon completion.
121 virtual void Seek(base::TimeDelta time, FilterCallback* callback) { 134 virtual void Seek(base::TimeDelta time, FilterCallback* callback) {
122 scoped_ptr<FilterCallback> seek_callback(callback); 135 scoped_ptr<FilterCallback> seek_callback(callback);
123 if (seek_callback.get()) { 136 if (seek_callback.get()) {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 // buffer. 375 // buffer.
363 virtual bool HasEnded() = 0; 376 virtual bool HasEnded() = 0;
364 377
365 // Sets the output volume. 378 // Sets the output volume.
366 virtual void SetVolume(float volume) = 0; 379 virtual void SetVolume(float volume) = 0;
367 }; 380 };
368 381
369 } // namespace media 382 } // namespace media
370 383
371 #endif // MEDIA_BASE_FILTERS_H_ 384 #endif // MEDIA_BASE_FILTERS_H_
OLDNEW
« no previous file with comments | « media/base/filter_host.h ('k') | media/base/mock_filters.h » ('j') | media/base/pipeline_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698