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