| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_MANAGER_ANDROID_H_ |
| 6 #define WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_MANAGER_ANDROID_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 #include <map> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 |
| 13 namespace webkit_media { |
| 14 |
| 15 class WebMediaPlayerAndroid; |
| 16 |
| 17 // Class for managing all the WebMediaPlayerAndroid objects in a renderer |
| 18 // process. |
| 19 class WebMediaPlayerManagerAndroid { |
| 20 public: |
| 21 WebMediaPlayerManagerAndroid(int32 routing_id); |
| 22 virtual ~WebMediaPlayerManagerAndroid(); |
| 23 |
| 24 // Register and unregister a WebMediaPlayerAndroid object. |
| 25 virtual int RegisterMediaPlayer(WebMediaPlayerAndroid* player); |
| 26 virtual void UnRegisterMediaPlayer(int player_id); |
| 27 |
| 28 // Release all the media resources on the renderer process. |
| 29 virtual void ReleaseMediaResources(); |
| 30 |
| 31 // Pass the video surface to a particular WebMediaPlayerAndroid object given |
| 32 // by the player_id. |
| 33 // TODO(qinmin): Upstream the code for passing Java surface object to the |
| 34 // renderer thread |
| 35 virtual void SetVideoSurface(jobject j_surface, int player_id); |
| 36 |
| 37 private: |
| 38 // Information needed to manage WebMediaPlayerAndroid. |
| 39 // TODO(qinmin): more informations will be added here for resource management. |
| 40 struct MediaPlayerInfo { |
| 41 webkit_media::WebMediaPlayerAndroid* player; |
| 42 }; |
| 43 |
| 44 // Info for all available WebMediaPlayerAndroid on a page; kept so that |
| 45 // we can enumerate them to send updates about tab focus and visibily. |
| 46 std::map<int32, MediaPlayerInfo> media_players_; |
| 47 |
| 48 // ID used to create the next media player for passing the Surface. |
| 49 int32 next_media_player_id_; |
| 50 |
| 51 int32 routing_id_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerManagerAndroid); |
| 54 }; |
| 55 |
| 56 } // namespace webkit_media |
| 57 |
| 58 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_MANAGER_ANDROID_H_ |
| OLD | NEW |