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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // | 122 // |
123 // These callbacks are only executed after Start() has been called and until | 123 // These callbacks are only executed after Start() has been called and until |
124 // Stop() has completed. | 124 // Stop() has completed. |
125 // | 125 // |
126 // It is an error to call this method after the pipeline has already started. | 126 // It is an error to call this method after the pipeline has already started. |
127 // | 127 // |
128 // TODO(scherkus): remove IsInitialized() and force clients to use callbacks. | 128 // TODO(scherkus): remove IsInitialized() and force clients to use callbacks. |
129 void Start(scoped_ptr<FilterCollection> filter_collection, | 129 void Start(scoped_ptr<FilterCollection> filter_collection, |
130 const PipelineStatusCB& ended_cb, | 130 const PipelineStatusCB& ended_cb, |
131 const PipelineStatusCB& error_cb, | 131 const PipelineStatusCB& error_cb, |
132 const PipelineStatusCB& start_cb); | 132 const PipelineStatusCB& start_cb, |
| 133 const base::Closure& new_duration_cb); |
133 | 134 |
134 // Asynchronously stops the pipeline and resets it to an uninitialized state. | 135 // Asynchronously stops the pipeline and resets it to an uninitialized state. |
135 // | 136 // |
136 // If provided, |stop_cb| will be executed when the pipeline has been | 137 // If provided, |stop_cb| will be executed when the pipeline has been |
137 // completely torn down and reset to an uninitialized state. It is acceptable | 138 // completely torn down and reset to an uninitialized state. It is acceptable |
138 // to call Start() again once the callback has finished executing. | 139 // to call Start() again once the callback has finished executing. |
139 // | 140 // |
140 // Stop() must be called before destroying the pipeline. Clients can | 141 // Stop() must be called before destroying the pipeline. Clients can |
141 // determine whether Stop() must be called by checking IsRunning(). | 142 // determine whether Stop() must be called by checking IsRunning(). |
142 // | 143 // |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 // Returns true if the given state is one that transitions to a new state | 282 // Returns true if the given state is one that transitions to a new state |
282 // after iterating through each filter. | 283 // after iterating through each filter. |
283 static bool TransientState(State state); | 284 static bool TransientState(State state); |
284 | 285 |
285 // Given the current state, returns the next state. | 286 // Given the current state, returns the next state. |
286 State FindNextState(State current); | 287 State FindNextState(State current); |
287 | 288 |
288 // DataSourceHost (by way of DemuxerHost) implementation. | 289 // DataSourceHost (by way of DemuxerHost) implementation. |
289 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE; | 290 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE; |
290 virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE; | 291 virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE; |
291 virtual void AddBufferedTimeRange(base::TimeDelta start, | |
292 base::TimeDelta end) OVERRIDE; | |
293 | 292 |
294 // DemuxerHost implementaion. | 293 // DemuxerHost implementaion. |
295 virtual void SetDuration(base::TimeDelta duration) OVERRIDE; | 294 virtual void SetDuration(base::TimeDelta duration) OVERRIDE; |
296 virtual void OnDemuxerError(PipelineStatus error) OVERRIDE; | 295 virtual void OnDemuxerError(PipelineStatus error) OVERRIDE; |
| 296 virtual void AddBufferedTimeRange(base::TimeDelta start, |
| 297 base::TimeDelta end) OVERRIDE; |
297 | 298 |
298 // FilterHost implementation. | 299 // FilterHost implementation. |
299 virtual void SetError(PipelineStatus error) OVERRIDE; | 300 virtual void SetError(PipelineStatus error) OVERRIDE; |
300 virtual base::TimeDelta GetTime() const OVERRIDE; | 301 virtual base::TimeDelta GetTime() const OVERRIDE; |
301 virtual base::TimeDelta GetDuration() const OVERRIDE; | 302 virtual base::TimeDelta GetDuration() const OVERRIDE; |
302 virtual void SetNaturalVideoSize(const gfx::Size& size) OVERRIDE; | 303 virtual void SetNaturalVideoSize(const gfx::Size& size) OVERRIDE; |
303 virtual void NotifyEnded() OVERRIDE; | 304 virtual void NotifyEnded() OVERRIDE; |
304 virtual void DisableAudioRenderer() OVERRIDE; | 305 virtual void DisableAudioRenderer() OVERRIDE; |
305 | 306 |
306 // Callbacks executed by filters upon completing initialization. | 307 // Callbacks executed by filters upon completing initialization. |
(...skipping 16 matching lines...) Expand all Loading... |
323 | 324 |
324 // Callback executed by video renderer to update clock time. | 325 // Callback executed by video renderer to update clock time. |
325 void OnVideoTimeUpdate(base::TimeDelta max_time); | 326 void OnVideoTimeUpdate(base::TimeDelta max_time); |
326 | 327 |
327 // The following "task" methods correspond to the public methods, but these | 328 // The following "task" methods correspond to the public methods, but these |
328 // methods are run as the result of posting a task to the PipelineInternal's | 329 // methods are run as the result of posting a task to the PipelineInternal's |
329 // message loop. | 330 // message loop. |
330 void StartTask(scoped_ptr<FilterCollection> filter_collection, | 331 void StartTask(scoped_ptr<FilterCollection> filter_collection, |
331 const PipelineStatusCB& ended_cb, | 332 const PipelineStatusCB& ended_cb, |
332 const PipelineStatusCB& error_cb, | 333 const PipelineStatusCB& error_cb, |
333 const PipelineStatusCB& start_cb); | 334 const PipelineStatusCB& start_cb, |
| 335 const base::Closure& new_duration_cb); |
334 | 336 |
335 // InitializeTask() performs initialization in multiple passes. It is executed | 337 // InitializeTask() performs initialization in multiple passes. It is executed |
336 // as a result of calling Start() or InitializationComplete() that advances | 338 // as a result of calling Start() or InitializationComplete() that advances |
337 // initialization to the next state. It works as a hub of state transition for | 339 // initialization to the next state. It works as a hub of state transition for |
338 // initialization. One stage communicates its status to the next through | 340 // initialization. One stage communicates its status to the next through |
339 // |last_stage_status|. | 341 // |last_stage_status|. |
340 void InitializeTask(PipelineStatus last_stage_status); | 342 void InitializeTask(PipelineStatus last_stage_status); |
341 | 343 |
342 // Stops and destroys all filters, placing the pipeline in the kStopped state. | 344 // Stops and destroys all filters, placing the pipeline in the kStopped state. |
343 void StopTask(const base::Closure& stop_cb); | 345 void StopTask(const base::Closure& stop_cb); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 bool audio_disabled_; | 526 bool audio_disabled_; |
525 | 527 |
526 // Filter collection as passed in by Start(). | 528 // Filter collection as passed in by Start(). |
527 scoped_ptr<FilterCollection> filter_collection_; | 529 scoped_ptr<FilterCollection> filter_collection_; |
528 | 530 |
529 // Callbacks for various pipeline operations. | 531 // Callbacks for various pipeline operations. |
530 PipelineStatusCB seek_cb_; | 532 PipelineStatusCB seek_cb_; |
531 base::Closure stop_cb_; | 533 base::Closure stop_cb_; |
532 PipelineStatusCB ended_cb_; | 534 PipelineStatusCB ended_cb_; |
533 PipelineStatusCB error_cb_; | 535 PipelineStatusCB error_cb_; |
| 536 base::Closure new_duration_cb_; |
534 | 537 |
535 // Reference to the filter(s) that constitute the pipeline. | 538 // Reference to the filter(s) that constitute the pipeline. |
536 scoped_refptr<Filter> pipeline_filter_; | 539 scoped_refptr<Filter> pipeline_filter_; |
537 | 540 |
538 // Decoder reference used for signalling imminent shutdown. | 541 // Decoder reference used for signalling imminent shutdown. |
539 // This is a HACK necessary because WebMediaPlayerImpl::Destroy() holds the | 542 // This is a HACK necessary because WebMediaPlayerImpl::Destroy() holds the |
540 // renderer thread loop hostage for until PipelineImpl::Stop() calls its | 543 // renderer thread loop hostage for until PipelineImpl::Stop() calls its |
541 // callback. | 544 // callback. |
542 // This reference should only be used for this hack and no other purposes. | 545 // This reference should only be used for this hack and no other purposes. |
543 // http://crbug.com/110228 tracks removing this hack. | 546 // http://crbug.com/110228 tracks removing this hack. |
(...skipping 17 matching lines...) Expand all Loading... |
561 // Time of pipeline creation; is non-zero only until the pipeline first | 564 // Time of pipeline creation; is non-zero only until the pipeline first |
562 // reaches "kStarted", at which point it is used & zeroed out. | 565 // reaches "kStarted", at which point it is used & zeroed out. |
563 base::Time creation_time_; | 566 base::Time creation_time_; |
564 | 567 |
565 DISALLOW_COPY_AND_ASSIGN(Pipeline); | 568 DISALLOW_COPY_AND_ASSIGN(Pipeline); |
566 }; | 569 }; |
567 | 570 |
568 } // namespace media | 571 } // namespace media |
569 | 572 |
570 #endif // MEDIA_BASE_PIPELINE_H_ | 573 #endif // MEDIA_BASE_PIPELINE_H_ |
OLD | NEW |