| OLD | NEW |
| 1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008-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 Pipeline. | 5 // Implementation of Pipeline. |
| 6 | 6 |
| 7 #ifndef MEDIA_BASE_PIPELINE_IMPL_H_ | 7 #ifndef MEDIA_BASE_PIPELINE_IMPL_H_ |
| 8 #define MEDIA_BASE_PIPELINE_IMPL_H_ | 8 #define MEDIA_BASE_PIPELINE_IMPL_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 PipelineCallback* start_callback); | 38 PipelineCallback* start_callback); |
| 39 virtual void Stop(PipelineCallback* stop_callback); | 39 virtual void Stop(PipelineCallback* stop_callback); |
| 40 virtual void Seek(base::TimeDelta time, PipelineCallback* seek_callback); | 40 virtual void Seek(base::TimeDelta time, PipelineCallback* seek_callback); |
| 41 virtual bool IsRunning() const; | 41 virtual bool IsRunning() const; |
| 42 virtual bool IsInitialized() const; | 42 virtual bool IsInitialized() const; |
| 43 virtual bool IsRendered(const std::string& major_mime_type) const; | 43 virtual bool IsRendered(const std::string& major_mime_type) const; |
| 44 virtual float GetPlaybackRate() const; | 44 virtual float GetPlaybackRate() const; |
| 45 virtual void SetPlaybackRate(float playback_rate); | 45 virtual void SetPlaybackRate(float playback_rate); |
| 46 virtual float GetVolume() const; | 46 virtual float GetVolume() const; |
| 47 virtual void SetVolume(float volume); | 47 virtual void SetVolume(float volume); |
| 48 virtual base::TimeDelta GetTime() const; | 48 virtual base::TimeDelta GetCurrentTime() const; |
| 49 virtual base::TimeDelta GetBufferedTime() const; | 49 virtual base::TimeDelta GetBufferedTime() const; |
| 50 virtual base::TimeDelta GetDuration() const; | 50 virtual base::TimeDelta GetDuration() const; |
| 51 virtual int64 GetBufferedBytes() const; | 51 virtual int64 GetBufferedBytes() const; |
| 52 virtual int64 GetTotalBytes() const; | 52 virtual int64 GetTotalBytes() const; |
| 53 virtual void GetVideoSize(size_t* width_out, size_t* height_out) const; | 53 virtual void GetVideoSize(size_t* width_out, size_t* height_out) const; |
| 54 virtual PipelineError GetError() const; | 54 virtual PipelineError GetError() const; |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 friend class FilterHostImpl; | 57 friend class FilterHostImpl; |
| 58 friend class PipelineInternal; | 58 friend class PipelineInternal; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 void PlaybackRateChanged(float playback_rate); | 188 void PlaybackRateChanged(float playback_rate); |
| 189 void VolumeChanged(float volume); | 189 void VolumeChanged(float volume); |
| 190 | 190 |
| 191 // Methods called by a FilterHostImpl object. These methods may be called | 191 // Methods called by a FilterHostImpl object. These methods may be called |
| 192 // on any thread, either the pipeline's thread or any other. | 192 // on any thread, either the pipeline's thread or any other. |
| 193 | 193 |
| 194 // Sets the pipeline time and schedules a task to call back to any filters | 194 // Sets the pipeline time and schedules a task to call back to any filters |
| 195 // that have registered a time update callback. | 195 // that have registered a time update callback. |
| 196 void SetTime(base::TimeDelta time); | 196 void SetTime(base::TimeDelta time); |
| 197 | 197 |
| 198 // Called by a FilterHostImpl on behalf of a filter calling FilterHost::Error. | 198 // Called by a FilterHostImpl on behalf of a filter calling |
| 199 // If the pipeline is running a nested message loop, it will be exited. | 199 // FilterHost::SetError(). If the pipeline is running a nested message loop, |
| 200 void Error(PipelineError error); | 200 // it will be exited. |
| 201 void SetError(PipelineError error); |
| 201 | 202 |
| 202 // Simple accessor used by the FilterHostImpl class to get access to the | 203 // Simple accessor used by the FilterHostImpl class to get access to the |
| 203 // pipeline object. | 204 // pipeline object. |
| 204 // | 205 // |
| 205 // TODO(scherkus): I think FilterHostImpl should not be talking to | 206 // TODO(scherkus): I think FilterHostImpl should not be talking to |
| 206 // PipelineImpl but rather PipelineInternal. | 207 // PipelineImpl but rather PipelineInternal. |
| 207 PipelineImpl* pipeline() const { return pipeline_; } | 208 PipelineImpl* pipeline() const { return pipeline_; } |
| 208 | 209 |
| 209 // Returns true if the pipeline has fully initialized. | 210 // Returns true if the pipeline has fully initialized. |
| 210 bool IsInitialized() { return state_ == kStarted; } | 211 bool IsInitialized() { return state_ == kStarted; } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 // initialization to the next state. It works as a hub of state transition for | 257 // initialization to the next state. It works as a hub of state transition for |
| 257 // initialization. | 258 // initialization. |
| 258 void InitializeTask(); | 259 void InitializeTask(); |
| 259 | 260 |
| 260 // StopTask() and ErrorTask() are similar but serve different purposes: | 261 // StopTask() and ErrorTask() are similar but serve different purposes: |
| 261 // - Both destroy the filter chain. | 262 // - Both destroy the filter chain. |
| 262 // - Both will execute |start_callback| if the pipeline was initializing. | 263 // - Both will execute |start_callback| if the pipeline was initializing. |
| 263 // - StopTask() resets the pipeline to a fresh state, where as ErrorTask() | 264 // - StopTask() resets the pipeline to a fresh state, where as ErrorTask() |
| 264 // leaves the pipeline as is for client inspection. | 265 // leaves the pipeline as is for client inspection. |
| 265 // - StopTask() can be scheduled by the client calling Stop(), where as | 266 // - StopTask() can be scheduled by the client calling Stop(), where as |
| 266 // ErrorTask() is scheduled as a result of a filter calling Error(). | 267 // ErrorTask() is scheduled as a result of a filter calling SetError(). |
| 267 void StopTask(PipelineCallback* stop_callback); | 268 void StopTask(PipelineCallback* stop_callback); |
| 268 void ErrorTask(PipelineError error); | 269 void ErrorTask(PipelineError error); |
| 269 | 270 |
| 270 // Carries out notifying filters that the playback rate/volume has changed, | 271 // Carries out notifying filters that the playback rate/volume has changed, |
| 271 void PlaybackRateChangedTask(float playback_rate); | 272 void PlaybackRateChangedTask(float playback_rate); |
| 272 void VolumeChangedTask(float volume); | 273 void VolumeChangedTask(float volume); |
| 273 | 274 |
| 274 // Carries out notifying filters that we are seeking to a new timestamp. | 275 // Carries out notifying filters that we are seeking to a new timestamp. |
| 275 void SeekTask(base::TimeDelta time, PipelineCallback* seek_callback); | 276 void SeekTask(base::TimeDelta time, PipelineCallback* seek_callback); |
| 276 | 277 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 374 |
| 374 typedef std::vector<base::Thread*> FilterThreadVector; | 375 typedef std::vector<base::Thread*> FilterThreadVector; |
| 375 FilterThreadVector filter_threads_; | 376 FilterThreadVector filter_threads_; |
| 376 | 377 |
| 377 DISALLOW_COPY_AND_ASSIGN(PipelineInternal); | 378 DISALLOW_COPY_AND_ASSIGN(PipelineInternal); |
| 378 }; | 379 }; |
| 379 | 380 |
| 380 } // namespace media | 381 } // namespace media |
| 381 | 382 |
| 382 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ | 383 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ |
| OLD | NEW |