OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BLINK_WEBMEDIAPLAYER_PARAMS_H_ | 5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_ |
6 #define MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_ | 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace blink { | 21 namespace blink { |
22 class WebContentDecryptionModule; | 22 class WebContentDecryptionModule; |
23 class WebMediaPlayerClient; | 23 class WebMediaPlayerClient; |
24 class WebMediaSession; | 24 class WebMediaSession; |
25 } | 25 } |
26 | 26 |
27 namespace media { | 27 namespace media { |
28 | 28 |
29 class RestartableAudioRendererSink; | 29 class RestartableAudioRendererSink; |
30 class MediaLog; | 30 class MediaLog; |
31 class MediaPermission; | |
32 class SurfaceManager; | 31 class SurfaceManager; |
33 | 32 |
34 // Holds parameters for constructing WebMediaPlayerImpl without having | 33 // Holds parameters for constructing WebMediaPlayerImpl without having |
35 // to plumb arguments through various abstraction layers. | 34 // to plumb arguments through various abstraction layers. |
36 class MEDIA_BLINK_EXPORT WebMediaPlayerParams { | 35 class MEDIA_BLINK_EXPORT WebMediaPlayerParams { |
37 public: | 36 public: |
38 typedef base::Callback<void(const base::Closure&)> DeferLoadCB; | 37 typedef base::Callback<void(const base::Closure&)> DeferLoadCB; |
39 typedef base::Callback<Context3D()> Context3DCB; | 38 typedef base::Callback<Context3D()> Context3DCB; |
40 | 39 |
41 // Callback to tell V8 about the amount of memory used by the WebMediaPlayer | 40 // Callback to tell V8 about the amount of memory used by the WebMediaPlayer |
42 // instance. The input parameter is the delta in bytes since the last call to | 41 // instance. The input parameter is the delta in bytes since the last call to |
43 // AdjustAllocatedMemoryCB and the return value is the total number of bytes | 42 // AdjustAllocatedMemoryCB and the return value is the total number of bytes |
44 // used by objects external to V8. Note: this value includes things that are | 43 // used by objects external to V8. Note: this value includes things that are |
45 // not the WebMediaPlayer! | 44 // not the WebMediaPlayer! |
46 typedef base::Callback<int64_t(int64_t)> AdjustAllocatedMemoryCB; | 45 typedef base::Callback<int64_t(int64_t)> AdjustAllocatedMemoryCB; |
47 | 46 |
48 // |defer_load_cb|, |audio_renderer_sink|, |compositor_task_runner|, and | 47 // |defer_load_cb|, |audio_renderer_sink|, |compositor_task_runner|, and |
49 // |context_3d_cb| may be null. | 48 // |context_3d_cb| may be null. |
50 WebMediaPlayerParams( | 49 WebMediaPlayerParams( |
51 const DeferLoadCB& defer_load_cb, | 50 const DeferLoadCB& defer_load_cb, |
52 const scoped_refptr<RestartableAudioRendererSink>& audio_renderer_sink, | 51 const scoped_refptr<RestartableAudioRendererSink>& audio_renderer_sink, |
53 const scoped_refptr<MediaLog>& media_log, | 52 const scoped_refptr<MediaLog>& media_log, |
54 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, | 53 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, |
55 const scoped_refptr<base::TaskRunner>& worker_task_runner, | 54 const scoped_refptr<base::TaskRunner>& worker_task_runner, |
56 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner, | 55 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner, |
57 const Context3DCB& context_3d, | 56 const Context3DCB& context_3d, |
58 const AdjustAllocatedMemoryCB& adjust_allocated_memory_cb, | 57 const AdjustAllocatedMemoryCB& adjust_allocated_memory_cb, |
59 MediaPermission* media_permission, | |
60 blink::WebContentDecryptionModule* initial_cdm, | 58 blink::WebContentDecryptionModule* initial_cdm, |
61 SurfaceManager* surface_manager, | 59 SurfaceManager* surface_manager, |
62 blink::WebMediaSession* media_session); | 60 blink::WebMediaSession* media_session); |
63 | 61 |
64 ~WebMediaPlayerParams(); | 62 ~WebMediaPlayerParams(); |
65 | 63 |
66 DeferLoadCB defer_load_cb() const { return defer_load_cb_; } | 64 DeferLoadCB defer_load_cb() const { return defer_load_cb_; } |
67 | 65 |
68 const scoped_refptr<RestartableAudioRendererSink>& audio_renderer_sink() | 66 const scoped_refptr<RestartableAudioRendererSink>& audio_renderer_sink() |
69 const { | 67 const { |
(...skipping 12 matching lines...) Expand all Loading... |
82 return worker_task_runner_; | 80 return worker_task_runner_; |
83 } | 81 } |
84 | 82 |
85 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner() | 83 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner() |
86 const { | 84 const { |
87 return compositor_task_runner_; | 85 return compositor_task_runner_; |
88 } | 86 } |
89 | 87 |
90 Context3DCB context_3d_cb() const { return context_3d_cb_; } | 88 Context3DCB context_3d_cb() const { return context_3d_cb_; } |
91 | 89 |
92 MediaPermission* media_permission() const { return media_permission_; } | |
93 | |
94 blink::WebContentDecryptionModule* initial_cdm() const { | 90 blink::WebContentDecryptionModule* initial_cdm() const { |
95 return initial_cdm_; | 91 return initial_cdm_; |
96 } | 92 } |
97 | 93 |
98 AdjustAllocatedMemoryCB adjust_allocated_memory_cb() const { | 94 AdjustAllocatedMemoryCB adjust_allocated_memory_cb() const { |
99 return adjust_allocated_memory_cb_; | 95 return adjust_allocated_memory_cb_; |
100 } | 96 } |
101 | 97 |
102 SurfaceManager* surface_manager() const { return surface_manager_; } | 98 SurfaceManager* surface_manager() const { return surface_manager_; } |
103 | 99 |
104 const blink::WebMediaSession* media_session() const { return media_session_; } | 100 const blink::WebMediaSession* media_session() const { return media_session_; } |
105 | 101 |
106 private: | 102 private: |
107 DeferLoadCB defer_load_cb_; | 103 DeferLoadCB defer_load_cb_; |
108 scoped_refptr<RestartableAudioRendererSink> audio_renderer_sink_; | 104 scoped_refptr<RestartableAudioRendererSink> audio_renderer_sink_; |
109 scoped_refptr<MediaLog> media_log_; | 105 scoped_refptr<MediaLog> media_log_; |
110 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; | 106 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; |
111 scoped_refptr<base::TaskRunner> worker_task_runner_; | 107 scoped_refptr<base::TaskRunner> worker_task_runner_; |
112 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; | 108 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
113 Context3DCB context_3d_cb_; | 109 Context3DCB context_3d_cb_; |
114 AdjustAllocatedMemoryCB adjust_allocated_memory_cb_; | 110 AdjustAllocatedMemoryCB adjust_allocated_memory_cb_; |
115 | 111 |
116 // TODO(xhwang): Remove after prefixed EME API support is removed. | |
117 MediaPermission* media_permission_; | |
118 blink::WebContentDecryptionModule* initial_cdm_; | 112 blink::WebContentDecryptionModule* initial_cdm_; |
119 SurfaceManager* surface_manager_; | 113 SurfaceManager* surface_manager_; |
120 | 114 |
121 blink::WebMediaSession* media_session_; | 115 blink::WebMediaSession* media_session_; |
122 | 116 |
123 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerParams); | 117 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerParams); |
124 }; | 118 }; |
125 | 119 |
126 } // namespace media | 120 } // namespace media |
127 | 121 |
128 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_ | 122 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_PARAMS_H_ |
OLD | NEW |