| 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 <list> |
| 9 |
| 8 #include "base/callback.h" | 10 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 10 #include "base/time.h" | 12 #include "base/time.h" |
| 11 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
| 12 #include "media/base/pipeline_status.h" | 14 #include "media/base/pipeline_status.h" |
| 13 | 15 |
| 14 namespace gfx { | 16 namespace gfx { |
| 15 class Size; | 17 class Size; |
| 16 } | 18 } |
| 17 | 19 |
| 18 namespace media { | 20 namespace media { |
| 19 | 21 |
| 20 class DemuxerStream; | 22 class DemuxerStream; |
| 21 class VideoDecoder; | 23 class VideoDecoder; |
| 22 | 24 |
| 23 class MEDIA_EXPORT VideoRenderer { | 25 class MEDIA_EXPORT VideoRenderer { |
| 24 public: | 26 public: |
| 27 typedef std::list<scoped_refptr<VideoDecoder> > VideoDecoderList; |
| 28 |
| 25 // Used to update the pipeline's clock time. The parameter is the time that | 29 // Used to update the pipeline's clock time. The parameter is the time that |
| 26 // the clock should not exceed. | 30 // the clock should not exceed. |
| 27 typedef base::Callback<void(base::TimeDelta)> TimeCB; | 31 typedef base::Callback<void(base::TimeDelta)> TimeCB; |
| 28 | 32 |
| 29 // Executed when the natural size of the video has changed. | 33 // Executed when the natural size of the video has changed. |
| 30 typedef base::Callback<void(const gfx::Size& size)> NaturalSizeChangedCB; | 34 typedef base::Callback<void(const gfx::Size& size)> NaturalSizeChangedCB; |
| 31 | 35 |
| 32 // Used to query the current time or duration of the media. | 36 // Used to query the current time or duration of the media. |
| 33 typedef base::Callback<base::TimeDelta()> TimeDeltaCB; | 37 typedef base::Callback<base::TimeDelta()> TimeDeltaCB; |
| 34 | 38 |
| 35 VideoRenderer(); | 39 VideoRenderer(); |
| 36 virtual ~VideoRenderer(); | 40 virtual ~VideoRenderer(); |
| 37 | 41 |
| 38 // Initialize a VideoRenderer with |stream|, executing |init_cb| upon | 42 // Initialize a VideoRenderer with the given DemuxerStream and |
| 39 // completion. | 43 // VideoDecoderList, executing |init_cb| callback upon completion. |
| 40 // | 44 // |
| 41 // |statistics_cb| is executed periodically with video rendering stats, such | 45 // |statistics_cb| is executed periodically with video rendering stats, such |
| 42 // as dropped frames. | 46 // as dropped frames. |
| 43 // | 47 // |
| 44 // |time_cb| is executed whenever time has advanced by way of video rendering. | 48 // |time_cb| is executed whenever time has advanced by way of video rendering. |
| 45 // | 49 // |
| 46 // |size_changed_cb| is executed whenever the dimensions of the video has | 50 // |size_changed_cb| is executed whenever the dimensions of the video has |
| 47 // changed. | 51 // changed. |
| 48 // | 52 // |
| 49 // |ended_cb| is executed when video rendering has reached the end of stream. | 53 // |ended_cb| is executed when video rendering has reached the end of stream. |
| 50 // | 54 // |
| 51 // |error_cb| is executed if an error was encountered. | 55 // |error_cb| is executed if an error was encountered. |
| 52 // | 56 // |
| 53 // |get_time_cb| is used to query the current media playback time. | 57 // |get_time_cb| is used to query the current media playback time. |
| 54 // | 58 // |
| 55 // |get_duration_cb| is used to query the media duration. | 59 // |get_duration_cb| is used to query the media duration. |
| 56 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, | 60 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, |
| 61 const VideoDecoderList& decoders, |
| 57 const PipelineStatusCB& init_cb, | 62 const PipelineStatusCB& init_cb, |
| 58 const StatisticsCB& statistics_cb, | 63 const StatisticsCB& statistics_cb, |
| 59 const TimeCB& time_cb, | 64 const TimeCB& time_cb, |
| 60 const NaturalSizeChangedCB& size_changed_cb, | 65 const NaturalSizeChangedCB& size_changed_cb, |
| 61 const base::Closure& ended_cb, | 66 const base::Closure& ended_cb, |
| 62 const PipelineStatusCB& error_cb, | 67 const PipelineStatusCB& error_cb, |
| 63 const TimeDeltaCB& get_time_cb, | 68 const TimeDeltaCB& get_time_cb, |
| 64 const TimeDeltaCB& get_duration_cb) = 0; | 69 const TimeDeltaCB& get_duration_cb) = 0; |
| 65 | 70 |
| 66 // Start audio decoding and rendering at the current playback rate, executing | 71 // Start audio decoding and rendering at the current playback rate, executing |
| (...skipping 21 matching lines...) Expand all Loading... |
| 88 // Updates the current playback rate. | 93 // Updates the current playback rate. |
| 89 virtual void SetPlaybackRate(float playback_rate) = 0; | 94 virtual void SetPlaybackRate(float playback_rate) = 0; |
| 90 | 95 |
| 91 private: | 96 private: |
| 92 DISALLOW_COPY_AND_ASSIGN(VideoRenderer); | 97 DISALLOW_COPY_AND_ASSIGN(VideoRenderer); |
| 93 }; | 98 }; |
| 94 | 99 |
| 95 } // namespace media | 100 } // namespace media |
| 96 | 101 |
| 97 #endif // MEDIA_BASE_VIDEO_RENDERER_H_ | 102 #endif // MEDIA_BASE_VIDEO_RENDERER_H_ |
| OLD | NEW |