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