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