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 CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
6 #define CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 6 #define CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "content/browser/android/content_video_view.h" | 18 #include "content/browser/android/content_video_view.h" |
19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
20 #include "content/common/media/cdm_messages_enums.h" | 20 #include "content/common/media/cdm_messages_enums.h" |
21 #include "content/common/media/media_player_messages_enums_android.h" | 21 #include "content/common/media/media_player_messages_enums_android.h" |
22 #include "ipc/ipc_message.h" | 22 #include "ipc/ipc_message.h" |
23 #include "media/base/android/media_player_android.h" | 23 #include "media/base/android/media_player_android.h" |
24 #include "media/base/android/media_player_manager.h" | 24 #include "media/base/android/media_player_manager.h" |
25 #include "ui/gfx/rect_f.h" | 25 #include "ui/gfx/rect_f.h" |
26 #include "url/gurl.h" | 26 #include "url/gurl.h" |
27 | 27 |
28 namespace media { | 28 namespace media { |
| 29 class BrowserCdm; |
29 class DemuxerAndroid; | 30 class DemuxerAndroid; |
30 class MediaKeys; | |
31 } | 31 } |
32 | 32 |
33 namespace content { | 33 namespace content { |
34 class BrowserDemuxerAndroid; | 34 class BrowserDemuxerAndroid; |
35 class ContentViewCoreImpl; | 35 class ContentViewCoreImpl; |
36 class ExternalVideoSurfaceContainer; | 36 class ExternalVideoSurfaceContainer; |
37 class RenderFrameHost; | 37 class RenderFrameHost; |
38 class WebContents; | 38 class WebContents; |
39 | 39 |
40 // This class manages all the MediaPlayerAndroid and CDM objects. | 40 // This class manages all the MediaPlayerAndroid and CDM objects. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 virtual void OnBufferingUpdate(int player_id, int percentage) OVERRIDE; | 84 virtual void OnBufferingUpdate(int player_id, int percentage) OVERRIDE; |
85 virtual void OnSeekComplete( | 85 virtual void OnSeekComplete( |
86 int player_id, | 86 int player_id, |
87 const base::TimeDelta& current_time) OVERRIDE; | 87 const base::TimeDelta& current_time) OVERRIDE; |
88 virtual void OnError(int player_id, int error) OVERRIDE; | 88 virtual void OnError(int player_id, int error) OVERRIDE; |
89 virtual void OnVideoSizeChanged( | 89 virtual void OnVideoSizeChanged( |
90 int player_id, int width, int height) OVERRIDE; | 90 int player_id, int width, int height) OVERRIDE; |
91 virtual media::MediaResourceGetter* GetMediaResourceGetter() OVERRIDE; | 91 virtual media::MediaResourceGetter* GetMediaResourceGetter() OVERRIDE; |
92 virtual media::MediaPlayerAndroid* GetFullscreenPlayer() OVERRIDE; | 92 virtual media::MediaPlayerAndroid* GetFullscreenPlayer() OVERRIDE; |
93 virtual media::MediaPlayerAndroid* GetPlayer(int player_id) OVERRIDE; | 93 virtual media::MediaPlayerAndroid* GetPlayer(int player_id) OVERRIDE; |
94 virtual media::MediaKeys* GetCdm(int cdm_id) OVERRIDE; | 94 virtual media::BrowserCdm* GetCdm(int cdm_id) OVERRIDE; |
95 virtual void DestroyAllMediaPlayers() OVERRIDE; | 95 virtual void DestroyAllMediaPlayers() OVERRIDE; |
96 virtual void RequestFullScreen(int player_id) OVERRIDE; | 96 virtual void RequestFullScreen(int player_id) OVERRIDE; |
97 virtual void OnSessionCreated(int cdm_id, | 97 virtual void OnSessionCreated(int cdm_id, |
98 uint32 session_id, | 98 uint32 session_id, |
99 const std::string& web_session_id) OVERRIDE; | 99 const std::string& web_session_id) OVERRIDE; |
100 virtual void OnSessionMessage(int cdm_id, | 100 virtual void OnSessionMessage(int cdm_id, |
101 uint32 session_id, | 101 uint32 session_id, |
102 const std::vector<uint8>& message, | 102 const std::vector<uint8>& message, |
103 const GURL& destination_url) OVERRIDE; | 103 const GURL& destination_url) OVERRIDE; |
104 virtual void OnSessionReady(int cdm_id, uint32 session_id) OVERRIDE; | 104 virtual void OnSessionReady(int cdm_id, uint32 session_id) OVERRIDE; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 #if defined(VIDEO_HOLE) | 222 #if defined(VIDEO_HOLE) |
223 void OnRequestExternalSurface(int player_id, const gfx::RectF& rect); | 223 void OnRequestExternalSurface(int player_id, const gfx::RectF& rect); |
224 #endif // defined(VIDEO_HOLE) | 224 #endif // defined(VIDEO_HOLE) |
225 | 225 |
226 RenderFrameHost* const render_frame_host_; | 226 RenderFrameHost* const render_frame_host_; |
227 | 227 |
228 // An array of managed players. | 228 // An array of managed players. |
229 ScopedVector<media::MediaPlayerAndroid> players_; | 229 ScopedVector<media::MediaPlayerAndroid> players_; |
230 | 230 |
231 // A map from CDM IDs to managed CDMs. | 231 // A map from CDM IDs to managed CDMs. |
232 typedef std::map<int, media::MediaKeys*> CdmMap; | 232 typedef std::map<int, media::BrowserCdm*> CdmMap; |
233 CdmMap cdm_map_; | 233 CdmMap cdm_map_; |
234 | 234 |
235 // Map from CDM ID to MediaPlayerAndroid player ID to indicate that | |
236 // the CDM is set on the MediaPlayerAndroid object. | |
237 // TODO(xhwang): Register a callback in the CDM to resume playback so that we | |
238 // can remove this map. See http://crbug.com/373327 | |
239 typedef std::map<int, int> CdmToPlayerMap; | |
240 CdmToPlayerMap cdm_to_player_map_; | |
241 | |
242 // Map from CDM ID to CDM's security origin. | 235 // Map from CDM ID to CDM's security origin. |
243 std::map<int, GURL> cdm_security_origin_map_; | 236 std::map<int, GURL> cdm_security_origin_map_; |
244 | 237 |
245 // The fullscreen video view object or NULL if video is not played in | 238 // The fullscreen video view object or NULL if video is not played in |
246 // fullscreen. | 239 // fullscreen. |
247 scoped_ptr<ContentVideoView> video_view_; | 240 scoped_ptr<ContentVideoView> video_view_; |
248 | 241 |
249 #if defined(VIDEO_HOLE) | 242 #if defined(VIDEO_HOLE) |
250 scoped_ptr<ExternalVideoSurfaceContainer> external_video_surface_container_; | 243 scoped_ptr<ExternalVideoSurfaceContainer> external_video_surface_container_; |
251 #endif | 244 #endif |
(...skipping 11 matching lines...) Expand all Loading... |
263 | 256 |
264 // NOTE: Weak pointers must be invalidated before all other member variables. | 257 // NOTE: Weak pointers must be invalidated before all other member variables. |
265 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; | 258 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; |
266 | 259 |
267 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); | 260 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); |
268 }; | 261 }; |
269 | 262 |
270 } // namespace content | 263 } // namespace content |
271 | 264 |
272 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 265 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
OLD | NEW |