| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // Implementation of FilterHost. | 5 // Implementation of FilterHost. |
| 6 | 6 |
| 7 #ifndef MEDIA_BASE_FILTER_HOST_IMPL_H_ | 7 #ifndef MEDIA_BASE_FILTER_HOST_IMPL_H_ |
| 8 #define MEDIA_BASE_FILTER_HOST_IMPL_H_ | 8 #define MEDIA_BASE_FILTER_HOST_IMPL_H_ |
| 9 | 9 |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 FilterHostImpl(PipelineThread* pipeline_thread, Filter* filter) | 40 FilterHostImpl(PipelineThread* pipeline_thread, Filter* filter) |
| 41 : pipeline_thread_(pipeline_thread), | 41 : pipeline_thread_(pipeline_thread), |
| 42 filter_type_(Filter::filter_type()), | 42 filter_type_(Filter::filter_type()), |
| 43 filter_(filter), | 43 filter_(filter), |
| 44 scheduled_time_update_task_(NULL), | 44 scheduled_time_update_task_(NULL), |
| 45 stopped_(false) { | 45 stopped_(false) { |
| 46 } | 46 } |
| 47 ~FilterHostImpl() {} | 47 ~FilterHostImpl() {} |
| 48 | 48 |
| 49 // If this FilterHost contains a filter of the specifed Filter class, then | 49 // If this FilterHost contains a filter of the specifed Filter class, then |
| 50 // this method returns a pointer to the interface, otherwise it returns NULL. | 50 // this method returns a pointer to the interface, otherwise it returns NULL |
| 51 // in |*filter_out|. |
| 51 template <class Filter> | 52 template <class Filter> |
| 52 Filter* GetFilter() const { | 53 void GetFilter(scoped_refptr<Filter>* filter_out) const { |
| 53 Filter* filter = NULL; | 54 *filter_out = (Filter::filter_type() == filter_type_) ? |
| 54 if (Filter::filter_type() == filter_type_) { | 55 reinterpret_cast<Filter*>(media_filter()) : NULL; |
| 55 filter = reinterpret_cast<Filter*>(media_filter()); | |
| 56 } | |
| 57 return filter; | |
| 58 } | 56 } |
| 59 | 57 |
| 60 // Call the filter if it has registered a time update callback if the filter | 58 // Call the filter if it has registered a time update callback if the filter |
| 61 // has registered one though the FilterHost::SetTimeUpdateCallback method. | 59 // has registered one though the FilterHost::SetTimeUpdateCallback method. |
| 62 void RunTimeUpdateCallback(base::TimeDelta time); | 60 void RunTimeUpdateCallback(base::TimeDelta time); |
| 63 | 61 |
| 64 // Stops the filter. | 62 // Stops the filter. |
| 65 void Stop(); | 63 void Stop(); |
| 66 | 64 |
| 67 // Used by the PipelineThread to call Seek and SetRate methods on filters. | 65 // Used by the PipelineThread to call Seek and SetRate methods on filters. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // Used to avoid calling Filter's Stop method multiplie times. It is also | 133 // Used to avoid calling Filter's Stop method multiplie times. It is also |
| 136 // used to prevent a filter that has been stopped from calling PostTask. | 134 // used to prevent a filter that has been stopped from calling PostTask. |
| 137 bool stopped_; | 135 bool stopped_; |
| 138 | 136 |
| 139 DISALLOW_COPY_AND_ASSIGN(FilterHostImpl); | 137 DISALLOW_COPY_AND_ASSIGN(FilterHostImpl); |
| 140 }; | 138 }; |
| 141 | 139 |
| 142 } // namespace media | 140 } // namespace media |
| 143 | 141 |
| 144 #endif // MEDIA_BASE_FILTER_HOST_IMPL_H_ | 142 #endif // MEDIA_BASE_FILTER_HOST_IMPL_H_ |
| OLD | NEW |