| 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" |
| 11 #include "media/base/buffering_state.h" | 11 #include "media/base/buffering_state.h" |
| 12 #include "media/base/decryptor.h" | 12 #include "media/base/cdm_context.h" |
| 13 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
| 14 #include "media/base/pipeline_status.h" | 14 #include "media/base/pipeline_status.h" |
| 15 #include "media/base/time_source.h" | 15 #include "media/base/time_source.h" |
| 16 | 16 |
| 17 namespace media { | 17 namespace media { |
| 18 | 18 |
| 19 class DemuxerStream; | 19 class DemuxerStream; |
| 20 class VideoDecoder; | 20 class VideoDecoder; |
| 21 class VideoFrame; | 21 class VideoFrame; |
| 22 | 22 |
| 23 class MEDIA_EXPORT VideoRenderer { | 23 class MEDIA_EXPORT VideoRenderer { |
| 24 public: | 24 public: |
| 25 // Used to paint VideoFrame. | 25 // Used to paint VideoFrame. |
| 26 typedef base::Callback<void(const scoped_refptr<VideoFrame>&)> PaintCB; | 26 typedef base::Callback<void(const scoped_refptr<VideoFrame>&)> PaintCB; |
| 27 | 27 |
| 28 VideoRenderer(); | 28 VideoRenderer(); |
| 29 | 29 |
| 30 // Stops all operations and fires all pending callbacks. | 30 // Stops all operations and fires all pending callbacks. |
| 31 virtual ~VideoRenderer(); | 31 virtual ~VideoRenderer(); |
| 32 | 32 |
| 33 // Initializes a VideoRenderer with |stream|, executing |init_cb| upon | 33 // Initializes a VideoRenderer with |stream|, executing |init_cb| upon |
| 34 // completion. If initialization fails, only |init_cb| (not |error_cb|) will | 34 // completion. If initialization fails, only |init_cb| (not |error_cb|) will |
| 35 // be called. | 35 // be called. |
| 36 // | 36 // |
| 37 // |set_decryptor_ready_cb| is fired when a Decryptor is needed, i.e. when the | 37 // |set_cdm_ready_cb| is fired when a CDM is needed, i.e. when the |stream| is |
| 38 // |stream| is encrypted. | 38 // encrypted. |
| 39 // | 39 // |
| 40 // |statistics_cb| is executed periodically with video rendering stats, such | 40 // |statistics_cb| is executed periodically with video rendering stats, such |
| 41 // as dropped frames. | 41 // as dropped frames. |
| 42 // | 42 // |
| 43 // |buffering_state_cb| is executed when video rendering has either run out of | 43 // |buffering_state_cb| is executed when video rendering has either run out of |
| 44 // data or has enough data to continue playback. | 44 // data or has enough data to continue playback. |
| 45 // | 45 // |
| 46 // |ended_cb| is executed when video rendering has reached the end of stream. | 46 // |ended_cb| is executed when video rendering has reached the end of stream. |
| 47 // | 47 // |
| 48 // |error_cb| is executed if an error was encountered after initialization. | 48 // |error_cb| is executed if an error was encountered after initialization. |
| 49 // | 49 // |
| 50 // |wall_clock_time_cb| is used to convert media timestamps into wallclock | 50 // |wall_clock_time_cb| is used to convert media timestamps into wallclock |
| 51 // timestamps. | 51 // timestamps. |
| 52 // | 52 // |
| 53 // |waiting_for_decryption_key_cb| is executed whenever the key needed to | 53 // |waiting_for_decryption_key_cb| is executed whenever the key needed to |
| 54 // decrypt the stream is not available. | 54 // decrypt the stream is not available. |
| 55 virtual void Initialize( | 55 virtual void Initialize( |
| 56 DemuxerStream* stream, | 56 DemuxerStream* stream, |
| 57 const PipelineStatusCB& init_cb, | 57 const PipelineStatusCB& init_cb, |
| 58 const SetDecryptorReadyCB& set_decryptor_ready_cb, | 58 const SetCdmReadyCB& set_cdm_ready_cb, |
| 59 const StatisticsCB& statistics_cb, | 59 const StatisticsCB& statistics_cb, |
| 60 const BufferingStateCB& buffering_state_cb, | 60 const BufferingStateCB& buffering_state_cb, |
| 61 const base::Closure& ended_cb, | 61 const base::Closure& ended_cb, |
| 62 const PipelineStatusCB& error_cb, | 62 const PipelineStatusCB& error_cb, |
| 63 const TimeSource::WallClockTimeCB& wall_clock_time_cb, | 63 const TimeSource::WallClockTimeCB& wall_clock_time_cb, |
| 64 const base::Closure& waiting_for_decryption_key_cb) = 0; | 64 const base::Closure& waiting_for_decryption_key_cb) = 0; |
| 65 | 65 |
| 66 // Discards any video data and stops reading from |stream|, executing | 66 // Discards any video data and stops reading from |stream|, executing |
| 67 // |callback| when completed. | 67 // |callback| when completed. |
| 68 // | 68 // |
| (...skipping 12 matching lines...) Expand all Loading... |
| 81 // |time_progressing| will be false. | 81 // |time_progressing| will be false. |
| 82 virtual void OnTimeStateChanged(bool time_progressing) = 0; | 82 virtual void OnTimeStateChanged(bool time_progressing) = 0; |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 DISALLOW_COPY_AND_ASSIGN(VideoRenderer); | 85 DISALLOW_COPY_AND_ASSIGN(VideoRenderer); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace media | 88 } // namespace media |
| 89 | 89 |
| 90 #endif // MEDIA_BASE_VIDEO_RENDERER_H_ | 90 #endif // MEDIA_BASE_VIDEO_RENDERER_H_ |
| OLD | NEW |