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> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 int player_id, int width, int height) OVERRIDE; | 84 int player_id, int width, int height) OVERRIDE; |
85 virtual void RequestMediaResources(int player_id) OVERRIDE; | 85 virtual void RequestMediaResources(int player_id) OVERRIDE; |
86 virtual void ReleaseMediaResources(int player_id) OVERRIDE; | 86 virtual void ReleaseMediaResources(int player_id) OVERRIDE; |
87 virtual media::MediaResourceGetter* GetMediaResourceGetter() OVERRIDE; | 87 virtual media::MediaResourceGetter* GetMediaResourceGetter() OVERRIDE; |
88 virtual media::MediaPlayerAndroid* GetFullscreenPlayer() OVERRIDE; | 88 virtual media::MediaPlayerAndroid* GetFullscreenPlayer() OVERRIDE; |
89 virtual media::MediaPlayerAndroid* GetPlayer(int player_id) OVERRIDE; | 89 virtual media::MediaPlayerAndroid* GetPlayer(int player_id) OVERRIDE; |
90 virtual media::MediaDrmBridge* GetDrmBridge(int media_keys_id) OVERRIDE; | 90 virtual media::MediaDrmBridge* GetDrmBridge(int media_keys_id) OVERRIDE; |
91 virtual void DestroyAllMediaPlayers() OVERRIDE; | 91 virtual void DestroyAllMediaPlayers() OVERRIDE; |
92 virtual void OnProtectedSurfaceRequested(int player_id) OVERRIDE; | 92 virtual void OnProtectedSurfaceRequested(int player_id) OVERRIDE; |
93 virtual void OnSessionCreated(int media_keys_id, | 93 virtual void OnSessionCreated(int media_keys_id, |
94 uint32 reference_id, | 94 uint32 session_id, |
95 const std::string& session_id) OVERRIDE; | 95 const std::string& web_session_id) OVERRIDE; |
96 virtual void OnSessionMessage(int media_keys_id, | 96 virtual void OnSessionMessage(int media_keys_id, |
97 uint32 reference_id, | 97 uint32 session_id, |
98 const std::vector<uint8>& message, | 98 const std::vector<uint8>& message, |
99 const std::string& destination_url) OVERRIDE; | 99 const std::string& destination_url) OVERRIDE; |
100 virtual void OnSessionReady(int media_keys_id, uint32 reference_id) OVERRIDE; | 100 virtual void OnSessionReady(int media_keys_id, uint32 session_id) OVERRIDE; |
101 virtual void OnSessionClosed(int media_keys_id, uint32 reference_id) OVERRIDE; | 101 virtual void OnSessionClosed(int media_keys_id, uint32 session_id) OVERRIDE; |
102 virtual void OnSessionError(int media_keys_id, | 102 virtual void OnSessionError(int media_keys_id, |
103 uint32 reference_id, | 103 uint32 session_id, |
104 media::MediaKeys::KeyError error_code, | 104 media::MediaKeys::KeyError error_code, |
105 int system_code) OVERRIDE; | 105 int system_code) OVERRIDE; |
106 | 106 |
107 #if defined(GOOGLE_TV) | 107 #if defined(GOOGLE_TV) |
108 void AttachExternalVideoSurface(int player_id, jobject surface); | 108 void AttachExternalVideoSurface(int player_id, jobject surface); |
109 void DetachExternalVideoSurface(int player_id); | 109 void DetachExternalVideoSurface(int player_id); |
110 #endif | 110 #endif |
111 | 111 |
112 // Called to disble the current fullscreen playback if the video is encrypted. | 112 // Called to disble the current fullscreen playback if the video is encrypted. |
113 // TODO(qinmin): remove this once we have the new fullscreen mode. | 113 // TODO(qinmin): remove this once we have the new fullscreen mode. |
(...skipping 15 matching lines...) Expand all Loading... |
129 virtual void OnStart(int player_id); | 129 virtual void OnStart(int player_id); |
130 virtual void OnSeek(int player_id, const base::TimeDelta& time); | 130 virtual void OnSeek(int player_id, const base::TimeDelta& time); |
131 virtual void OnPause(int player_id, bool is_media_related_action); | 131 virtual void OnPause(int player_id, bool is_media_related_action); |
132 virtual void OnSetVolume(int player_id, double volume); | 132 virtual void OnSetVolume(int player_id, double volume); |
133 virtual void OnReleaseResources(int player_id); | 133 virtual void OnReleaseResources(int player_id); |
134 virtual void OnDestroyPlayer(int player_id); | 134 virtual void OnDestroyPlayer(int player_id); |
135 void OnInitializeCDM(int media_keys_id, | 135 void OnInitializeCDM(int media_keys_id, |
136 const std::vector<uint8>& uuid, | 136 const std::vector<uint8>& uuid, |
137 const GURL& frame_url); | 137 const GURL& frame_url); |
138 void OnGenerateKeyRequest(int media_keys_id, | 138 void OnGenerateKeyRequest(int media_keys_id, |
139 uint32 reference_id, | 139 uint32 session_id, |
140 const std::string& type, | 140 const std::string& type, |
141 const std::vector<uint8>& init_data); | 141 const std::vector<uint8>& init_data); |
142 void OnAddKey(int media_keys_id, | 142 void OnAddKey(int media_keys_id, |
143 uint32 reference_id, | 143 uint32 session_id, |
144 const std::vector<uint8>& key, | 144 const std::vector<uint8>& key, |
145 const std::vector<uint8>& init_data); | 145 const std::vector<uint8>& init_data); |
146 void OnCancelKeyRequest(int media_keys_id, uint32 reference_id); | 146 void OnCancelKeyRequest(int media_keys_id, uint32 session_id); |
147 void OnSetMediaKeys(int player_id, int media_keys_id); | 147 void OnSetMediaKeys(int player_id, int media_keys_id); |
148 | 148 |
149 #if defined(GOOGLE_TV) | 149 #if defined(GOOGLE_TV) |
150 virtual void OnNotifyExternalSurface( | 150 virtual void OnNotifyExternalSurface( |
151 int player_id, bool is_request, const gfx::RectF& rect); | 151 int player_id, bool is_request, const gfx::RectF& rect); |
152 #endif | 152 #endif |
153 | 153 |
154 // Adds a given player to the list. | 154 // Adds a given player to the list. |
155 void AddPlayer(media::MediaPlayerAndroid* player); | 155 void AddPlayer(media::MediaPlayerAndroid* player); |
156 | 156 |
(...skipping 11 matching lines...) Expand all Loading... |
168 // |frame_url|. | 168 // |frame_url|. |
169 void AddDrmBridge(int media_keys_id, | 169 void AddDrmBridge(int media_keys_id, |
170 const std::vector<uint8>& uuid, | 170 const std::vector<uint8>& uuid, |
171 const GURL& frame_url); | 171 const GURL& frame_url); |
172 | 172 |
173 // Removes the DRM bridge with the specified id. | 173 // Removes the DRM bridge with the specified id. |
174 void RemoveDrmBridge(int media_keys_id); | 174 void RemoveDrmBridge(int media_keys_id); |
175 | 175 |
176 private: | 176 private: |
177 void GenerateKeyIfAllowed(int media_keys_id, | 177 void GenerateKeyIfAllowed(int media_keys_id, |
178 uint32 reference_id, | 178 uint32 session_id, |
179 const std::string& type, | 179 const std::string& type, |
180 const std::vector<uint8>& init_data, | 180 const std::vector<uint8>& init_data, |
181 bool allowed); | 181 bool allowed); |
182 | 182 |
183 // Constructs a MediaPlayerAndroid object. Declared static to permit embedders | 183 // Constructs a MediaPlayerAndroid object. Declared static to permit embedders |
184 // to override functionality. | 184 // to override functionality. |
185 // | 185 // |
186 // Objects must call |manager->RequestMediaResources()| before decoding | 186 // Objects must call |manager->RequestMediaResources()| before decoding |
187 // and |manager->ReleaseMediaSources()| after finishing. This allows the | 187 // and |manager->ReleaseMediaSources()| after finishing. This allows the |
188 // manager to track decoding resources across the process and free them as | 188 // manager to track decoding resources across the process and free them as |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 scoped_ptr<media::MediaResourceGetter> media_resource_getter_; | 229 scoped_ptr<media::MediaResourceGetter> media_resource_getter_; |
230 | 230 |
231 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; | 231 base::WeakPtrFactory<BrowserMediaPlayerManager> weak_ptr_factory_; |
232 | 232 |
233 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); | 233 DISALLOW_COPY_AND_ASSIGN(BrowserMediaPlayerManager); |
234 }; | 234 }; |
235 | 235 |
236 } // namespace content | 236 } // namespace content |
237 | 237 |
238 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ | 238 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_PLAYER_MANAGER_H_ |
OLD | NEW |