OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BASE_COMPOSITE_FILTER_H_ | 5 #ifndef MEDIA_BASE_COMPOSITE_FILTER_H_ |
6 #define MEDIA_BASE_COMPOSITE_FILTER_H_ | 6 #define MEDIA_BASE_COMPOSITE_FILTER_H_ |
7 | 7 |
8 #include "base/task.h" | 8 #include "base/task.h" |
9 #include "media/base/filter_host.h" | 9 #include "media/base/filter_host.h" |
10 #include "media/base/filters.h" | 10 #include "media/base/filters.h" |
(...skipping 14 matching lines...) Expand all Loading... | |
25 bool AddFilter(scoped_refptr<Filter> filter); | 25 bool AddFilter(scoped_refptr<Filter> filter); |
26 | 26 |
27 // media::Filter methods. | 27 // media::Filter methods. |
28 virtual void set_host(FilterHost* host); | 28 virtual void set_host(FilterHost* host); |
29 virtual FilterHost* host(); | 29 virtual FilterHost* host(); |
30 virtual void Play(FilterCallback* play_callback); | 30 virtual void Play(FilterCallback* play_callback); |
31 virtual void Pause(FilterCallback* pause_callback); | 31 virtual void Pause(FilterCallback* pause_callback); |
32 virtual void Flush(FilterCallback* flush_callback); | 32 virtual void Flush(FilterCallback* flush_callback); |
33 virtual void Stop(FilterCallback* stop_callback); | 33 virtual void Stop(FilterCallback* stop_callback); |
34 virtual void SetPlaybackRate(float playback_rate); | 34 virtual void SetPlaybackRate(float playback_rate); |
35 virtual void Seek(base::TimeDelta time, FilterCallback* seek_callback); | 35 virtual void Seek(base::TimeDelta time, const FilterStatusCB& seek_cb); |
36 virtual void OnAudioRendererDisabled(); | 36 virtual void OnAudioRendererDisabled(); |
37 | 37 |
38 protected: | 38 protected: |
39 virtual ~CompositeFilter(); | 39 virtual ~CompositeFilter(); |
40 | 40 |
41 void SetError(PipelineStatus error); | 41 void SetError(PipelineStatus error); |
42 | 42 |
43 private: | 43 private: |
44 class FilterHostImpl; | 44 class FilterHostImpl; |
45 | 45 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 | 100 |
101 // Helper function used by NewThreadSafeCallback() to make sure the | 101 // Helper function used by NewThreadSafeCallback() to make sure the |
102 // method gets called on the right thread. | 102 // method gets called on the right thread. |
103 static void OnCallback(MessageLoop* message_loop, | 103 static void OnCallback(MessageLoop* message_loop, |
104 CancelableTask* task); | 104 CancelableTask* task); |
105 | 105 |
106 // Helper function that indicates whether SetError() calls can be forwarded | 106 // Helper function that indicates whether SetError() calls can be forwarded |
107 // to the host of this filter. | 107 // to the host of this filter. |
108 bool CanForwardError(); | 108 bool CanForwardError(); |
109 | 109 |
110 bool IsOperationPending() const; | |
Ami GONE FROM CHROMIUM
2011/05/12 20:42:16
doco
acolwell GONE FROM CHROMIUM
2011/05/12 22:30:40
Done.
| |
111 | |
112 // Called by operations that take a FilterStatusCB instead of a | |
113 // FilterCallback. | |
Ami GONE FROM CHROMIUM
2011/05/12 20:42:16
TODO to remove when FilterCallback goes away?
acolwell GONE FROM CHROMIUM
2011/05/12 22:30:40
Done.
| |
114 void OnStatusCB(FilterCallback* callback, PipelineStatus status); | |
115 | |
110 // Vector of the filters added to the composite. | 116 // Vector of the filters added to the composite. |
111 typedef std::vector<scoped_refptr<Filter> > FilterVector; | 117 typedef std::vector<scoped_refptr<Filter> > FilterVector; |
112 FilterVector filters_; | 118 FilterVector filters_; |
113 | 119 |
114 // Callback for the pending request. | 120 // Callback for the pending request. |
115 scoped_ptr<FilterCallback> callback_; | 121 scoped_ptr<FilterCallback> callback_; |
122 FilterStatusCB status_cb_; | |
Ami GONE FROM CHROMIUM
2011/05/12 20:42:16
Yowza; either can be non-null? Seems like a TODO
acolwell GONE FROM CHROMIUM
2011/05/12 22:30:40
Yes. One or the other will be non-null, but not bo
| |
116 | 123 |
117 // Time parameter for the pending Seek() request. | 124 // Time parameter for the pending Seek() request. |
118 base::TimeDelta pending_seek_time_; | 125 base::TimeDelta pending_seek_time_; |
119 | 126 |
120 // Current state of this filter. | 127 // Current state of this filter. |
121 State state_; | 128 State state_; |
122 | 129 |
123 // The index of the filter currently processing a request. | 130 // The index of the filter currently processing a request. |
124 unsigned int sequence_index_; | 131 unsigned int sequence_index_; |
125 | 132 |
126 // Message loop passed into the constructor. | 133 // Message loop passed into the constructor. |
127 MessageLoop* message_loop_; | 134 MessageLoop* message_loop_; |
128 | 135 |
129 // FilterHost implementation passed to Filters owned by this | 136 // FilterHost implementation passed to Filters owned by this |
130 // object. | 137 // object. |
131 scoped_ptr<FilterHostImpl> host_impl_; | 138 scoped_ptr<FilterHostImpl> host_impl_; |
132 | 139 |
133 // PIPELINE_OK, or last error passed to SetError(). | 140 // PIPELINE_OK, or last error passed to SetError(). |
134 PipelineStatus status_; | 141 PipelineStatus status_; |
135 | 142 |
136 scoped_ptr<ScopedRunnableMethodFactory<CompositeFilter> > runnable_factory_; | 143 scoped_ptr<ScopedRunnableMethodFactory<CompositeFilter> > runnable_factory_; |
137 | 144 |
138 DISALLOW_COPY_AND_ASSIGN(CompositeFilter); | 145 DISALLOW_COPY_AND_ASSIGN(CompositeFilter); |
139 }; | 146 }; |
140 | 147 |
141 } // namespace media | 148 } // namespace media |
142 | 149 |
143 #endif // MEDIA_BASE_COMPOSITE_FILTER_H_ | 150 #endif // MEDIA_BASE_COMPOSITE_FILTER_H_ |
OLD | NEW |