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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "content/browser/android/content_video_view.h" | 13 #include "content/browser/android/content_video_view.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/common/media/media_player_messages_enums_android.h" | 15 #include "content/common/media/media_player_messages_enums_android.h" |
16 #include "ipc/ipc_message.h" | 16 #include "ipc/ipc_message.h" |
17 #include "media/base/android/media_player_android.h" | 17 #include "media/base/android/media_player_android.h" |
18 #include "media/base/android/media_player_manager.h" | 18 #include "media/base/android/media_player_manager.h" |
19 #include "ui/gfx/rect_f.h" | 19 #include "ui/gfx/rect_f.h" |
20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
21 | 21 |
22 namespace media { | 22 namespace media { |
23 class DemuxerAndroid; | 23 class DemuxerAndroid; |
24 } | 24 } |
25 | 25 |
26 struct MediaPlayerHostMsg_Initialize_Params; | |
27 | |
28 namespace content { | 26 namespace content { |
29 class BrowserDemuxerAndroid; | 27 class BrowserDemuxerAndroid; |
30 class ContentViewCoreImpl; | 28 class ContentViewCoreImpl; |
31 class ExternalVideoSurfaceContainer; | 29 class ExternalVideoSurfaceContainer; |
32 class RenderFrameHost; | 30 class RenderFrameHost; |
33 class WebContents; | 31 class WebContents; |
34 | 32 |
35 // This class manages all the MediaPlayerAndroid objects. | 33 // This class manages all the MediaPlayerAndroid objects. |
36 // It receives control operations from the the render process, and forwards | 34 // It receives control operations from the the render process, and forwards |
37 // them to corresponding MediaPlayerAndroid object. Callbacks from | 35 // them to corresponding MediaPlayerAndroid object. Callbacks from |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 #if defined(VIDEO_HOLE) | 89 #if defined(VIDEO_HOLE) |
92 void AttachExternalVideoSurface(int player_id, jobject surface); | 90 void AttachExternalVideoSurface(int player_id, jobject surface); |
93 void DetachExternalVideoSurface(int player_id); | 91 void DetachExternalVideoSurface(int player_id); |
94 void OnFrameInfoUpdated(); | 92 void OnFrameInfoUpdated(); |
95 #endif // defined(VIDEO_HOLE) | 93 #endif // defined(VIDEO_HOLE) |
96 | 94 |
97 // Message handlers. | 95 // Message handlers. |
98 virtual void OnEnterFullscreen(int player_id); | 96 virtual void OnEnterFullscreen(int player_id); |
99 virtual void OnExitFullscreen(int player_id); | 97 virtual void OnExitFullscreen(int player_id); |
100 virtual void OnInitialize( | 98 virtual void OnInitialize( |
101 const MediaPlayerHostMsg_Initialize_Params& media_player_params); | 99 MediaPlayerHostMsg_Initialize_Type type, |
| 100 int player_id, |
| 101 const GURL& url, |
| 102 const GURL& first_party_for_cookies, |
| 103 int demuxer_client_id); |
102 virtual void OnStart(int player_id); | 104 virtual void OnStart(int player_id); |
103 virtual void OnSeek(int player_id, const base::TimeDelta& time); | 105 virtual void OnSeek(int player_id, const base::TimeDelta& time); |
104 virtual void OnPause(int player_id, bool is_media_related_action); | 106 virtual void OnPause(int player_id, bool is_media_related_action); |
105 virtual void OnSetVolume(int player_id, double volume); | 107 virtual void OnSetVolume(int player_id, double volume); |
106 virtual void OnSetPoster(int player_id, const GURL& poster); | 108 virtual void OnSetPoster(int player_id, const GURL& poster); |
107 virtual void OnReleaseResources(int player_id); | 109 virtual void OnReleaseResources(int player_id); |
108 virtual void OnDestroyPlayer(int player_id); | 110 virtual void OnDestroyPlayer(int player_id); |
109 virtual void ReleaseFullscreenPlayer(media::MediaPlayerAndroid* player); | 111 virtual void ReleaseFullscreenPlayer(media::MediaPlayerAndroid* player); |
110 #if defined(VIDEO_HOLE) | 112 #if defined(VIDEO_HOLE) |
111 void OnNotifyExternalSurface( | 113 void OnNotifyExternalSurface( |
(...skipping 20 matching lines...) Expand all Loading... |
132 media::MediaPlayerAndroid* player); | 134 media::MediaPlayerAndroid* player); |
133 | 135 |
134 int RoutingID(); | 136 int RoutingID(); |
135 | 137 |
136 // Helper function to send messages to RenderFrameObserver. | 138 // Helper function to send messages to RenderFrameObserver. |
137 bool Send(IPC::Message* msg); | 139 bool Send(IPC::Message* msg); |
138 | 140 |
139 private: | 141 private: |
140 // Constructs a MediaPlayerAndroid object. | 142 // Constructs a MediaPlayerAndroid object. |
141 media::MediaPlayerAndroid* CreateMediaPlayer( | 143 media::MediaPlayerAndroid* CreateMediaPlayer( |
142 const MediaPlayerHostMsg_Initialize_Params& media_player_params, | 144 MediaPlayerHostMsg_Initialize_Type type, |
| 145 int player_id, |
| 146 const GURL& url, |
| 147 const GURL& first_party_for_cookies, |
| 148 int demuxer_client_id, |
143 bool hide_url_log, | 149 bool hide_url_log, |
144 media::MediaPlayerManager* manager, | 150 media::MediaPlayerManager* manager, |
145 BrowserDemuxerAndroid* demuxer); | 151 BrowserDemuxerAndroid* demuxer); |
146 | 152 |
147 // MediaPlayerAndroid must call this before it is going to decode | 153 // MediaPlayerAndroid must call this before it is going to decode |
148 // media streams. This helps the manager object maintain an array | 154 // media streams. This helps the manager object maintain an array |
149 // of active MediaPlayerAndroid objects and release the resources | 155 // of active MediaPlayerAndroid objects and release the resources |
150 // when needed. Currently we only count video resources as they are | 156 // when needed. Currently we only count video resources as they are |
151 // constrained by hardware and memory limits. | 157 // constrained by hardware and memory limits. |
152 virtual void OnMediaResourcesRequested(int player_id); | 158 virtual void OnMediaResourcesRequested(int player_id); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 191 |
186 // NOTE: Weak pointers must be invalidated before all other member variables. | 192 // NOTE: Weak pointers must be invalidated before all other member variables. |
187 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; | 193 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; |
188 | 194 |
189 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); | 195 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); |
190 }; | 196 }; |
191 | 197 |
192 } // namespace content | 198 } // namespace content |
193 | 199 |
194 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 200 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
OLD | NEW |