| 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_VIDEO_RENDERER_H_ | 5 #ifndef MEDIA_BASE_VIDEO_RENDERER_H_ |
| 6 #define MEDIA_BASE_VIDEO_RENDERER_H_ | 6 #define MEDIA_BASE_VIDEO_RENDERER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 VideoRenderer(); | 29 VideoRenderer(); |
| 30 virtual ~VideoRenderer(); | 30 virtual ~VideoRenderer(); |
| 31 | 31 |
| 32 // Initialize a VideoRenderer with |stream|, executing |init_cb| upon | 32 // Initialize a VideoRenderer with |stream|, executing |init_cb| upon |
| 33 // completion. | 33 // completion. |
| 34 // | 34 // |
| 35 // |statistics_cb| is executed periodically with video rendering stats, such | 35 // |statistics_cb| is executed periodically with video rendering stats, such |
| 36 // as dropped frames. | 36 // as dropped frames. |
| 37 // | 37 // |
| 38 // |time_cb| is executed whenever time has advanced by way of video rendering. | |
| 39 // | |
| 40 // |buffering_state_cb| is executed when video rendering has either run out of | 38 // |buffering_state_cb| is executed when video rendering has either run out of |
| 41 // data or has enough data to continue playback. | 39 // data or has enough data to continue playback. |
| 42 // | 40 // |
| 43 // |ended_cb| is executed when video rendering has reached the end of stream. | 41 // |ended_cb| is executed when video rendering has reached the end of stream. |
| 44 // | 42 // |
| 45 // |error_cb| is executed if an error was encountered. | 43 // |error_cb| is executed if an error was encountered. |
| 46 // | 44 // |
| 47 // |get_time_cb| is used to query the current media playback time. | 45 // |get_time_cb| is used to query the current media playback time. |
| 48 // | 46 // |
| 49 // |get_duration_cb| is used to query the media duration. | 47 // |get_duration_cb| is used to query the media duration. |
| 50 virtual void Initialize(DemuxerStream* stream, | 48 virtual void Initialize(DemuxerStream* stream, |
| 51 bool low_delay, | 49 bool low_delay, |
| 52 const PipelineStatusCB& init_cb, | 50 const PipelineStatusCB& init_cb, |
| 53 const StatisticsCB& statistics_cb, | 51 const StatisticsCB& statistics_cb, |
| 54 const TimeCB& time_cb, | |
| 55 const BufferingStateCB& buffering_state_cb, | 52 const BufferingStateCB& buffering_state_cb, |
| 56 const base::Closure& ended_cb, | 53 const base::Closure& ended_cb, |
| 57 const PipelineStatusCB& error_cb, | 54 const PipelineStatusCB& error_cb, |
| 58 const TimeDeltaCB& get_time_cb, | 55 const TimeDeltaCB& get_time_cb, |
| 59 const TimeDeltaCB& get_duration_cb) = 0; | 56 const TimeDeltaCB& get_duration_cb) = 0; |
| 60 | 57 |
| 61 // Discard any video data and stop reading from |stream|, executing |callback| | 58 // Discard any video data and stop reading from |stream|, executing |callback| |
| 62 // when completed. | 59 // when completed. |
| 63 // | 60 // |
| 64 // Clients should expect |buffering_state_cb| to be called with | 61 // Clients should expect |buffering_state_cb| to be called with |
| 65 // BUFFERING_HAVE_NOTHING while flushing is in progress. | 62 // BUFFERING_HAVE_NOTHING while flushing is in progress. |
| 66 virtual void Flush(const base::Closure& callback) = 0; | 63 virtual void Flush(const base::Closure& callback) = 0; |
| 67 | 64 |
| 68 // Starts playback by reading from |stream| and decoding and rendering video. | 65 // Starts playback by reading from |stream| and decoding and rendering video. |
| 69 // |timestamp| is the media timestamp playback should start rendering from. | |
| 70 // | 66 // |
| 71 // Only valid to call after a successful Initialize() or Flush(). | 67 // Only valid to call after a successful Initialize() or Flush(). |
| 72 virtual void StartPlayingFrom(base::TimeDelta timestamp) = 0; | 68 virtual void StartPlaying() = 0; |
| 73 | 69 |
| 74 // Stop all operations in preparation for being deleted, executing |callback| | 70 // Stop all operations in preparation for being deleted, executing |callback| |
| 75 // when complete. | 71 // when complete. |
| 76 virtual void Stop(const base::Closure& callback) = 0; | 72 virtual void Stop(const base::Closure& callback) = 0; |
| 77 | 73 |
| 78 private: | 74 private: |
| 79 DISALLOW_COPY_AND_ASSIGN(VideoRenderer); | 75 DISALLOW_COPY_AND_ASSIGN(VideoRenderer); |
| 80 }; | 76 }; |
| 81 | 77 |
| 82 } // namespace media | 78 } // namespace media |
| 83 | 79 |
| 84 #endif // MEDIA_BASE_VIDEO_RENDERER_H_ | 80 #endif // MEDIA_BASE_VIDEO_RENDERER_H_ |
| OLD | NEW |