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

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

Issue 9718013: Merge FilterStatusCB into PipelineStatusCB. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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
« no previous file with comments | « media/base/composite_filter_unittest.cc ('k') | media/base/filters.cc » ('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) 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 27 matching lines...) Expand all
38 38
39 namespace media { 39 namespace media {
40 40
41 class AudioDecoder; 41 class AudioDecoder;
42 class Buffer; 42 class Buffer;
43 class Decoder; 43 class Decoder;
44 class DemuxerStream; 44 class DemuxerStream;
45 class Filter; 45 class Filter;
46 class FilterHost; 46 class FilterHost;
47 47
48 struct PipelineStatistics;
49
50 // Used for completing asynchronous methods.
51 typedef base::Callback<void(PipelineStatus)> FilterStatusCB;
52
53 // These functions copy |*cb|, call Reset() on |*cb|, and then call Run() 48 // These functions copy |*cb|, call Reset() on |*cb|, and then call Run()
54 // on the copy. This is used in the common case where you need to clear 49 // on the copy. This is used in the common case where you need to clear
55 // a callback member variable before running the callback. 50 // a callback member variable before running the callback.
56 MEDIA_EXPORT void ResetAndRunCB(FilterStatusCB* cb, PipelineStatus status); 51 MEDIA_EXPORT void ResetAndRunCB(PipelineStatusCB* cb, PipelineStatus status);
57 MEDIA_EXPORT void ResetAndRunCB(base::Closure* cb); 52 MEDIA_EXPORT void ResetAndRunCB(base::Closure* cb);
58 53
59 class MEDIA_EXPORT Filter : public base::RefCountedThreadSafe<Filter> { 54 class MEDIA_EXPORT Filter : public base::RefCountedThreadSafe<Filter> {
60 public: 55 public:
61 Filter(); 56 Filter();
62 57
63 // Sets the private member |host_|. This is the first method called by 58 // Sets the private member |host_|. This is the first method called by
64 // the FilterHost after a filter is created. The host holds a strong 59 // the FilterHost after a filter is created. The host holds a strong
65 // reference to the filter. The reference held by the host is guaranteed 60 // reference to the filter. The reference held by the host is guaranteed
66 // to be released before the host object is destroyed by the pipeline. 61 // to be released before the host object is destroyed by the pipeline.
(...skipping 24 matching lines...) Expand all
91 // the client called Stop(). 86 // the client called Stop().
92 // TODO(boliu): Check that callback is not NULL in subclasses. 87 // TODO(boliu): Check that callback is not NULL in subclasses.
93 virtual void Stop(const base::Closure& callback); 88 virtual void Stop(const base::Closure& callback);
94 89
95 // The pipeline playback rate has been changed. Filters may implement this 90 // The pipeline playback rate has been changed. Filters may implement this
96 // method if they need to respond to this call. 91 // method if they need to respond to this call.
97 virtual void SetPlaybackRate(float playback_rate); 92 virtual void SetPlaybackRate(float playback_rate);
98 93
99 // Carry out any actions required to seek to the given time, executing the 94 // Carry out any actions required to seek to the given time, executing the
100 // callback upon completion. 95 // callback upon completion.
101 virtual void Seek(base::TimeDelta time, const FilterStatusCB& callback); 96 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& callback);
102 97
103 // This method is called from the pipeline when the audio renderer 98 // This method is called from the pipeline when the audio renderer
104 // is disabled. Filters can ignore the notification if they do not 99 // is disabled. Filters can ignore the notification if they do not
105 // need to react to this event. 100 // need to react to this event.
106 virtual void OnAudioRendererDisabled(); 101 virtual void OnAudioRendererDisabled();
107 102
108 protected: 103 protected:
109 // Only allow scoped_refptr<> to delete filters. 104 // Only allow scoped_refptr<> to delete filters.
110 friend class base::RefCountedThreadSafe<Filter>; 105 friend class base::RefCountedThreadSafe<Filter>;
111 virtual ~Filter(); 106 virtual ~Filter();
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 208
214 // Resumes playback after underflow occurs. 209 // Resumes playback after underflow occurs.
215 // |buffer_more_audio| is set to true if you want to increase the size of the 210 // |buffer_more_audio| is set to true if you want to increase the size of the
216 // decoded audio buffer. 211 // decoded audio buffer.
217 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0; 212 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0;
218 }; 213 };
219 214
220 } // namespace media 215 } // namespace media
221 216
222 #endif // MEDIA_BASE_FILTERS_H_ 217 #endif // MEDIA_BASE_FILTERS_H_
OLDNEW
« no previous file with comments | « media/base/composite_filter_unittest.cc ('k') | media/base/filters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698