| 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 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 // Used to query the current time or duration of the media. | 27 // Used to query the current time or duration of the media. |
| 28 typedef base::Callback<base::TimeDelta()> TimeDeltaCB; | 28 typedef base::Callback<base::TimeDelta()> TimeDeltaCB; |
| 29 | 29 |
| 30 VideoRenderer(); | 30 VideoRenderer(); |
| 31 | 31 |
| 32 // Stops all operations and fires all pending callbacks. | 32 // Stops all operations and fires all pending callbacks. |
| 33 virtual ~VideoRenderer(); | 33 virtual ~VideoRenderer(); |
| 34 | 34 |
| 35 // Initializes a VideoRenderer with |stream|, executing |init_cb| upon | 35 // Initializes a VideoRenderer with |stream|, executing |init_cb| upon |
| 36 // completion. | 36 // completion. If initialization fails, only |init_cb| (not |error_cb|) will |
| 37 // be called. |
| 37 // | 38 // |
| 38 // |set_decryptor_ready_cb| is fired when a Decryptor is needed, i.e. when the | 39 // |set_decryptor_ready_cb| is fired when a Decryptor is needed, i.e. when the |
| 39 // |stream| is encrypted. | 40 // |stream| is encrypted. |
| 40 // | 41 // |
| 41 // |statistics_cb| is executed periodically with video rendering stats, such | 42 // |statistics_cb| is executed periodically with video rendering stats, such |
| 42 // as dropped frames. | 43 // as dropped frames. |
| 43 // | 44 // |
| 44 // |buffering_state_cb| is executed when video rendering has either run out of | 45 // |buffering_state_cb| is executed when video rendering has either run out of |
| 45 // data or has enough data to continue playback. | 46 // data or has enough data to continue playback. |
| 46 // | 47 // |
| 47 // |paint_cb| is executed on the video frame timing thread whenever a new | 48 // |paint_cb| is executed on the video frame timing thread whenever a new |
| 48 // frame is available for painting. Can be called from any thread. | 49 // frame is available for painting. Can be called from any thread. |
| 49 // | 50 // |
| 50 // |ended_cb| is executed when video rendering has reached the end of stream. | 51 // |ended_cb| is executed when video rendering has reached the end of stream. |
| 51 // | 52 // |
| 52 // |error_cb| is executed if an error was encountered. | 53 // |error_cb| is executed if an error was encountered after initialization. |
| 53 // | 54 // |
| 54 // |get_time_cb| is used to query the current media playback time. | 55 // |get_time_cb| is used to query the current media playback time. |
| 55 virtual void Initialize(DemuxerStream* stream, | 56 virtual void Initialize(DemuxerStream* stream, |
| 56 const PipelineStatusCB& init_cb, | 57 const PipelineStatusCB& init_cb, |
| 57 const SetDecryptorReadyCB& set_decryptor_ready_cb, | 58 const SetDecryptorReadyCB& set_decryptor_ready_cb, |
| 58 const StatisticsCB& statistics_cb, | 59 const StatisticsCB& statistics_cb, |
| 59 const BufferingStateCB& buffering_state_cb, | 60 const BufferingStateCB& buffering_state_cb, |
| 60 const PaintCB& paint_cb, | 61 const PaintCB& paint_cb, |
| 61 const base::Closure& ended_cb, | 62 const base::Closure& ended_cb, |
| 62 const PipelineStatusCB& error_cb, | 63 const PipelineStatusCB& error_cb, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 75 // Only valid to call after a successful Initialize() or Flush(). | 76 // Only valid to call after a successful Initialize() or Flush(). |
| 76 virtual void StartPlayingFrom(base::TimeDelta timestamp) = 0; | 77 virtual void StartPlayingFrom(base::TimeDelta timestamp) = 0; |
| 77 | 78 |
| 78 private: | 79 private: |
| 79 DISALLOW_COPY_AND_ASSIGN(VideoRenderer); | 80 DISALLOW_COPY_AND_ASSIGN(VideoRenderer); |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 } // namespace media | 83 } // namespace media |
| 83 | 84 |
| 84 #endif // MEDIA_BASE_VIDEO_RENDERER_H_ | 85 #endif // MEDIA_BASE_VIDEO_RENDERER_H_ |
| OLD | NEW |