OLD | NEW |
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 #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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 // media::Filter methods. | 33 // media::Filter methods. |
34 virtual void set_host(FilterHost* host) OVERRIDE; | 34 virtual void set_host(FilterHost* host) OVERRIDE; |
35 virtual FilterHost* host() OVERRIDE; | 35 virtual FilterHost* host() OVERRIDE; |
36 virtual void Play(const base::Closure& play_cb) OVERRIDE; | 36 virtual void Play(const base::Closure& play_cb) OVERRIDE; |
37 virtual void Pause(const base::Closure& pause_cb) OVERRIDE; | 37 virtual void Pause(const base::Closure& pause_cb) OVERRIDE; |
38 virtual void Flush(const base::Closure& flush_cb) OVERRIDE; | 38 virtual void Flush(const base::Closure& flush_cb) OVERRIDE; |
39 virtual void Stop(const base::Closure& stop_cb) OVERRIDE; | 39 virtual void Stop(const base::Closure& stop_cb) OVERRIDE; |
40 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; | 40 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; |
41 virtual void Seek( | 41 virtual void Seek( |
42 base::TimeDelta time, const FilterStatusCB& seek_cb) OVERRIDE; | 42 base::TimeDelta time, const PipelineStatusCB& seek_cb) OVERRIDE; |
43 virtual void OnAudioRendererDisabled() OVERRIDE; | 43 virtual void OnAudioRendererDisabled() OVERRIDE; |
44 | 44 |
45 protected: | 45 protected: |
46 virtual ~CompositeFilter(); | 46 virtual ~CompositeFilter(); |
47 | 47 |
48 void SetError(PipelineStatus error); | 48 void SetError(PipelineStatus error); |
49 | 49 |
50 private: | 50 private: |
51 class FilterHostImpl; | 51 class FilterHostImpl; |
52 | 52 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 base::Closure NewThreadSafeCallback(void (CompositeFilter::*method)()); | 103 base::Closure NewThreadSafeCallback(void (CompositeFilter::*method)()); |
104 | 104 |
105 // Helper function that indicates whether SetError() calls can be forwarded | 105 // Helper function that indicates whether SetError() calls can be forwarded |
106 // to the host of this filter. | 106 // to the host of this filter. |
107 bool CanForwardError(); | 107 bool CanForwardError(); |
108 | 108 |
109 // Checks to see if a Play(), Pause(), Flush(), Stop(), or Seek() operation is | 109 // Checks to see if a Play(), Pause(), Flush(), Stop(), or Seek() operation is |
110 // pending. | 110 // pending. |
111 bool IsOperationPending() const; | 111 bool IsOperationPending() const; |
112 | 112 |
113 // Called by operations that take a FilterStatusCB instead of a Closure. | 113 // Called by operations that take a PipelineStatusCB instead of a Closure. |
114 // TODO: Remove when Closures are replaced by FilterStatusCB. | 114 // TODO: Remove when Closures are replaced by PipelineStatusCB. |
115 void OnStatusCB(const base::Closure& callback, PipelineStatus status); | 115 void OnStatusCB(const base::Closure& callback, PipelineStatus status); |
116 | 116 |
117 // Vector of the filters added to the composite. | 117 // Vector of the filters added to the composite. |
118 typedef std::vector<scoped_refptr<Filter> > FilterVector; | 118 typedef std::vector<scoped_refptr<Filter> > FilterVector; |
119 FilterVector filters_; | 119 FilterVector filters_; |
120 | 120 |
121 // Callback for the pending request. | 121 // Callback for the pending request. |
122 // TODO: Remove callback_ when Closures are replaced by FilterStatusCB. | 122 // TODO: Remove callback_ when Closures are replaced by PipelineStatusCB. |
123 base::Closure callback_; | 123 base::Closure callback_; |
124 FilterStatusCB status_cb_; | 124 PipelineStatusCB status_cb_; |
125 | 125 |
126 // Time parameter for the pending Seek() request. | 126 // Time parameter for the pending Seek() request. |
127 base::TimeDelta pending_seek_time_; | 127 base::TimeDelta pending_seek_time_; |
128 | 128 |
129 // Current state of this filter. | 129 // Current state of this filter. |
130 State state_; | 130 State state_; |
131 | 131 |
132 // The index of the filter currently processing a request. | 132 // The index of the filter currently processing a request. |
133 unsigned int sequence_index_; | 133 unsigned int sequence_index_; |
134 | 134 |
135 // Message loop passed into the constructor. | 135 // Message loop passed into the constructor. |
136 MessageLoop* message_loop_; | 136 MessageLoop* message_loop_; |
137 | 137 |
138 // FilterHost implementation passed to Filters owned by this | 138 // FilterHost implementation passed to Filters owned by this |
139 // object. | 139 // object. |
140 scoped_ptr<FilterHostImpl> host_impl_; | 140 scoped_ptr<FilterHostImpl> host_impl_; |
141 | 141 |
142 // PIPELINE_OK, or last error passed to SetError(). | 142 // PIPELINE_OK, or last error passed to SetError(). |
143 PipelineStatus status_; | 143 PipelineStatus status_; |
144 | 144 |
145 base::WeakPtrFactory<CompositeFilter> weak_ptr_factory_; | 145 base::WeakPtrFactory<CompositeFilter> weak_ptr_factory_; |
146 | 146 |
147 DISALLOW_COPY_AND_ASSIGN(CompositeFilter); | 147 DISALLOW_COPY_AND_ASSIGN(CompositeFilter); |
148 }; | 148 }; |
149 | 149 |
150 } // namespace media | 150 } // namespace media |
151 | 151 |
152 #endif // MEDIA_BASE_COMPOSITE_FILTER_H_ | 152 #endif // MEDIA_BASE_COMPOSITE_FILTER_H_ |
OLD | NEW |