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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 | 212 |
213 // Get approximate time ranges of buffered media. | 213 // Get approximate time ranges of buffered media. |
214 Ranges<base::TimeDelta> GetBufferedTimeRanges(); | 214 Ranges<base::TimeDelta> GetBufferedTimeRanges(); |
215 | 215 |
216 // Get the duration of the media in microseconds. If the duration has not | 216 // Get the duration of the media in microseconds. If the duration has not |
217 // been determined yet, then returns 0. | 217 // been determined yet, then returns 0. |
218 base::TimeDelta GetMediaDuration() const; | 218 base::TimeDelta GetMediaDuration() const; |
219 | 219 |
220 // Get the total number of bytes that are buffered on the client and ready to | 220 // Get the total number of bytes that are buffered on the client and ready to |
221 // be played. | 221 // be played. |
222 // TODO(fischman): this interface is only needed so WMPI can provide | |
223 // bytesLoaded() which is only present so that HTMLMediaElement can decide | |
224 // whether progress has been made. Bogus! http://webk.it/86113 | |
222 int64 GetBufferedBytes() const; | 225 int64 GetBufferedBytes() const; |
223 | 226 |
224 // Get the total size of the media file. If the size has not yet been | 227 // Get the total size of the media file. If the size has not yet been |
225 // determined or can not be determined, this value is 0. | 228 // determined or can not be determined, this value is 0. |
226 int64 GetTotalBytes() const; | 229 int64 GetTotalBytes() const; |
227 | 230 |
228 // Gets the natural size of the video output in pixel units. If there is no | 231 // Gets the natural size of the video output in pixel units. If there is no |
229 // video or the video has not been rendered yet, the width and height will | 232 // video or the video has not been rendered yet, the width and height will |
230 // be 0. | 233 // be 0. |
231 void GetNaturalVideoSize(gfx::Size* out_size) const; | 234 void GetNaturalVideoSize(gfx::Size* out_size) const; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 | 295 |
293 // Returns true if the given state is one that transitions to a new state | 296 // Returns true if the given state is one that transitions to a new state |
294 // after iterating through each filter. | 297 // after iterating through each filter. |
295 static bool TransientState(State state); | 298 static bool TransientState(State state); |
296 | 299 |
297 // Given the current state, returns the next state. | 300 // Given the current state, returns the next state. |
298 State FindNextState(State current); | 301 State FindNextState(State current); |
299 | 302 |
300 // DataSourceHost (by way of DemuxerHost) implementation. | 303 // DataSourceHost (by way of DemuxerHost) implementation. |
301 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE; | 304 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE; |
302 virtual void SetBufferedBytes(int64 buffered_bytes) OVERRIDE; | 305 virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE; |
303 virtual void SetNetworkActivity(bool is_downloading_data) OVERRIDE; | 306 virtual void SetNetworkActivity(bool is_downloading_data) OVERRIDE; |
304 | 307 |
305 // DemuxerHost implementaion. | 308 // DemuxerHost implementaion. |
306 virtual void SetDuration(base::TimeDelta duration) OVERRIDE; | 309 virtual void SetDuration(base::TimeDelta duration) OVERRIDE; |
307 virtual void SetCurrentReadPosition(int64 offset) OVERRIDE; | 310 virtual void SetCurrentReadPosition(int64 offset) OVERRIDE; |
308 virtual void OnDemuxerError(PipelineStatus error) OVERRIDE; | 311 virtual void OnDemuxerError(PipelineStatus error) OVERRIDE; |
309 | 312 |
310 // FilterHost implementation. | 313 // FilterHost implementation. |
311 virtual void SetError(PipelineStatus error) OVERRIDE; | 314 virtual void SetError(PipelineStatus error) OVERRIDE; |
312 virtual base::TimeDelta GetTime() const OVERRIDE; | 315 virtual base::TimeDelta GetTime() const OVERRIDE; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
416 // state first. | 419 // state first. |
417 // 2. when pipeline has been initialized, we will first transit to pausing | 420 // 2. when pipeline has been initialized, we will first transit to pausing |
418 // => flushing => stopping => stopped state. | 421 // => flushing => stopping => stopped state. |
419 // This will remove the race condition during stop between filters. | 422 // This will remove the race condition during stop between filters. |
420 void TearDownPipeline(); | 423 void TearDownPipeline(); |
421 | 424 |
422 // Compute the current time. Assumes that the lock has been acquired by the | 425 // Compute the current time. Assumes that the lock has been acquired by the |
423 // caller. | 426 // caller. |
424 base::TimeDelta GetCurrentTime_Locked() const; | 427 base::TimeDelta GetCurrentTime_Locked() const; |
425 | 428 |
426 // Update internal records of which time ranges are buffered. | 429 // Compute the time corresponding to a byte offset. |
427 void UpdateBufferedTimeRanges_Locked(); | 430 base::TimeDelta TimeForByteOffset_Locked(int64 byte_offset) const; |
428 | 431 |
429 // Initiates a Stop() on |demuxer_| & |pipeline_filter_|. |callback| | 432 // Initiates a Stop() on |demuxer_| & |pipeline_filter_|. |callback| |
430 // is called once both objects have been stopped. | 433 // is called once both objects have been stopped. |
431 void DoStop(const base::Closure& callback); | 434 void DoStop(const base::Closure& callback); |
432 | 435 |
433 // Called when |demuxer_| has stopped. This method calls Stop() | 436 // Called when |demuxer_| has stopped. This method calls Stop() |
434 // on |pipeline_filter_|. | 437 // on |pipeline_filter_|. |
435 void OnDemuxerStopDone(const base::Closure& callback); | 438 void OnDemuxerStopDone(const base::Closure& callback); |
436 | 439 |
437 // Initiates a Seek() on the |demuxer_| & |pipeline_filter_|. | 440 // Initiates a Seek() on the |demuxer_| & |pipeline_filter_|. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
469 | 472 |
470 // Whether or not the pipeline is perform a stop operation. | 473 // Whether or not the pipeline is perform a stop operation. |
471 bool tearing_down_; | 474 bool tearing_down_; |
472 | 475 |
473 // Whether or not an error triggered the teardown. | 476 // Whether or not an error triggered the teardown. |
474 bool error_caused_teardown_; | 477 bool error_caused_teardown_; |
475 | 478 |
476 // Whether or not a playback rate change should be done once seeking is done. | 479 // Whether or not a playback rate change should be done once seeking is done. |
477 bool playback_rate_change_pending_; | 480 bool playback_rate_change_pending_; |
478 | 481 |
479 // Amount of available buffered data. Set by filters. | 482 // Amount of available buffered data. Set by filters. |
scherkus (not reviewing)
2012/05/29 18:13:29
s/filters/data source/?
technically it's the demu
Ami GONE FROM CHROMIUM
2012/05/29 20:45:44
Just removed that part of the comment (pointers to
| |
480 int64 buffered_bytes_; | 483 Ranges<int64> buffered_byte_ranges_; |
481 | 484 |
482 // Approximate time ranges of buffered media. | 485 // Approximate time ranges of buffered media. |
483 Ranges<base::TimeDelta> buffered_time_ranges_; | 486 Ranges<base::TimeDelta> buffered_time_ranges_; |
484 | 487 |
485 // Total size of the media. Set by filters. | 488 // Total size of the media. Set by filters. |
486 int64 total_bytes_; | 489 int64 total_bytes_; |
487 | 490 |
488 // Video's natural width and height. Set by filters. | 491 // Video's natural width and height. Set by filters. |
489 gfx::Size natural_size_; | 492 gfx::Size natural_size_; |
490 | 493 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
580 // Time of pipeline creation; is non-zero only until the pipeline first | 583 // Time of pipeline creation; is non-zero only until the pipeline first |
581 // reaches "kStarted", at which point it is used & zeroed out. | 584 // reaches "kStarted", at which point it is used & zeroed out. |
582 base::Time creation_time_; | 585 base::Time creation_time_; |
583 | 586 |
584 DISALLOW_COPY_AND_ASSIGN(Pipeline); | 587 DISALLOW_COPY_AND_ASSIGN(Pipeline); |
585 }; | 588 }; |
586 | 589 |
587 } // namespace media | 590 } // namespace media |
588 | 591 |
589 #endif // MEDIA_BASE_PIPELINE_H_ | 592 #endif // MEDIA_BASE_PIPELINE_H_ |
OLD | NEW |