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_PIPELINE_H_ | 5 #ifndef MEDIA_BASE_PIPELINE_H_ |
6 #define MEDIA_BASE_PIPELINE_H_ | 6 #define MEDIA_BASE_PIPELINE_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // | 137 // |
138 // It is an error to call this method if the pipeline has not started. | 138 // It is an error to call this method if the pipeline has not started. |
139 void Seek(base::TimeDelta time, const PipelineStatusCB& seek_cb); | 139 void Seek(base::TimeDelta time, const PipelineStatusCB& seek_cb); |
140 | 140 |
141 // Returns true if the pipeline has been started via Start(). If IsRunning() | 141 // Returns true if the pipeline has been started via Start(). If IsRunning() |
142 // returns true, it is expected that Stop() will be called before destroying | 142 // returns true, it is expected that Stop() will be called before destroying |
143 // the pipeline. | 143 // the pipeline. |
144 bool IsRunning() const; | 144 bool IsRunning() const; |
145 | 145 |
146 // Gets the current playback rate of the pipeline. When the pipeline is | 146 // Gets the current playback rate of the pipeline. When the pipeline is |
147 // started, the playback rate will be 0.0f. A rate of 1.0f indicates | 147 // started, the playback rate will be 0.0. A rate of 1.0 indicates |
148 // that the pipeline is rendering the media at the standard rate. Valid | 148 // that the pipeline is rendering the media at the standard rate. Valid |
149 // values for playback rate are >= 0.0f. | 149 // values for playback rate are >= 0.0. |
150 float GetPlaybackRate() const; | 150 double GetPlaybackRate() const; |
151 | 151 |
152 // Attempt to adjust the playback rate. Setting a playback rate of 0.0f pauses | 152 // Attempt to adjust the playback rate. Setting a playback rate of 0.0 pauses |
153 // all rendering of the media. A rate of 1.0f indicates a normal playback | 153 // all rendering of the media. A rate of 1.0 indicates a normal playback |
154 // rate. Values for the playback rate must be greater than or equal to 0.0f. | 154 // rate. Values for the playback rate must be greater than or equal to 0.0. |
155 // | 155 // |
156 // TODO(scherkus): What about maximum rate? Does HTML5 specify a max? | 156 // TODO(scherkus): What about maximum rate? Does HTML5 specify a max? |
157 void SetPlaybackRate(float playback_rate); | 157 void SetPlaybackRate(double playback_rate); |
158 | 158 |
159 // Gets the current volume setting being used by the audio renderer. When | 159 // Gets the current volume setting being used by the audio renderer. When |
160 // the pipeline is started, this value will be 1.0f. Valid values range | 160 // the pipeline is started, this value will be 1.0f. Valid values range |
161 // from 0.0f to 1.0f. | 161 // from 0.0f to 1.0f. |
162 float GetVolume() const; | 162 float GetVolume() const; |
163 | 163 |
164 // Attempt to set the volume of the audio renderer. Valid values for volume | 164 // Attempt to set the volume of the audio renderer. Valid values for volume |
165 // range from 0.0f (muted) to 1.0f (full volume). This value affects all | 165 // range from 0.0f (muted) to 1.0f (full volume). This value affects all |
166 // channels proportionately for multi-channel audio streams. | 166 // channels proportionately for multi-channel audio streams. |
167 void SetVolume(float volume); | 167 void SetVolume(float volume); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 void StartTask(); | 238 void StartTask(); |
239 | 239 |
240 // Stops and destroys all filters, placing the pipeline in the kStopped state. | 240 // Stops and destroys all filters, placing the pipeline in the kStopped state. |
241 void StopTask(const base::Closure& stop_cb); | 241 void StopTask(const base::Closure& stop_cb); |
242 | 242 |
243 // Carries out stopping and destroying all filters, placing the pipeline in | 243 // Carries out stopping and destroying all filters, placing the pipeline in |
244 // the kStopped state. | 244 // the kStopped state. |
245 void ErrorChangedTask(PipelineStatus error); | 245 void ErrorChangedTask(PipelineStatus error); |
246 | 246 |
247 // Carries out notifying filters that the playback rate has changed. | 247 // Carries out notifying filters that the playback rate has changed. |
248 void PlaybackRateChangedTask(float playback_rate); | 248 void PlaybackRateChangedTask(double playback_rate); |
249 | 249 |
250 // Carries out notifying filters that the volume has changed. | 250 // Carries out notifying filters that the volume has changed. |
251 void VolumeChangedTask(float volume); | 251 void VolumeChangedTask(float volume); |
252 | 252 |
253 // Carries out notifying filters that we are seeking to a new timestamp. | 253 // Carries out notifying filters that we are seeking to a new timestamp. |
254 void SeekTask(base::TimeDelta time, const PipelineStatusCB& seek_cb); | 254 void SeekTask(base::TimeDelta time, const PipelineStatusCB& seek_cb); |
255 | 255 |
256 // Carries out setting the |cdm_context| in |renderer_|, and then fires | 256 // Carries out setting the |cdm_context| in |renderer_|, and then fires |
257 // |cdm_attached_cb| with the result. If |renderer_| is null, | 257 // |cdm_attached_cb| with the result. If |renderer_| is null, |
258 // |cdm_attached_cb| will be fired immediately with true, and |cdm_context| | 258 // |cdm_attached_cb| will be fired immediately with true, and |cdm_context| |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 315 |
316 // True when AddBufferedTimeRange() has been called more recently than | 316 // True when AddBufferedTimeRange() has been called more recently than |
317 // DidLoadingProgress(). | 317 // DidLoadingProgress(). |
318 bool did_loading_progress_; | 318 bool did_loading_progress_; |
319 | 319 |
320 // Current volume level (from 0.0f to 1.0f). This value is set immediately | 320 // Current volume level (from 0.0f to 1.0f). This value is set immediately |
321 // via SetVolume() and a task is dispatched on the task runner to notify the | 321 // via SetVolume() and a task is dispatched on the task runner to notify the |
322 // filters. | 322 // filters. |
323 float volume_; | 323 float volume_; |
324 | 324 |
325 // Current playback rate (>= 0.0f). This value is set immediately via | 325 // Current playback rate (>= 0.0). This value is set immediately via |
326 // SetPlaybackRate() and a task is dispatched on the task runner to notify | 326 // SetPlaybackRate() and a task is dispatched on the task runner to notify |
327 // the filters. | 327 // the filters. |
328 float playback_rate_; | 328 double playback_rate_; |
329 | 329 |
330 // Current duration as reported by |demuxer_|. | 330 // Current duration as reported by |demuxer_|. |
331 base::TimeDelta duration_; | 331 base::TimeDelta duration_; |
332 | 332 |
333 // Status of the pipeline. Initialized to PIPELINE_OK which indicates that | 333 // Status of the pipeline. Initialized to PIPELINE_OK which indicates that |
334 // the pipeline is operating correctly. Any other value indicates that the | 334 // the pipeline is operating correctly. Any other value indicates that the |
335 // pipeline is stopped or is stopping. Clients can call the Stop() method to | 335 // pipeline is stopped or is stopping. Clients can call the Stop() method to |
336 // reset the pipeline state, and restore this to PIPELINE_OK. | 336 // reset the pipeline state, and restore this to PIPELINE_OK. |
337 PipelineStatus status_; | 337 PipelineStatus status_; |
338 | 338 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 386 |
387 // NOTE: Weak pointers must be invalidated before all other member variables. | 387 // NOTE: Weak pointers must be invalidated before all other member variables. |
388 base::WeakPtrFactory<Pipeline> weak_factory_; | 388 base::WeakPtrFactory<Pipeline> weak_factory_; |
389 | 389 |
390 DISALLOW_COPY_AND_ASSIGN(Pipeline); | 390 DISALLOW_COPY_AND_ASSIGN(Pipeline); |
391 }; | 391 }; |
392 | 392 |
393 } // namespace media | 393 } // namespace media |
394 | 394 |
395 #endif // MEDIA_BASE_PIPELINE_H_ | 395 #endif // MEDIA_BASE_PIPELINE_H_ |
OLD | NEW |