OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_ |
6 #define CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_ | 6 #define CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
14 #include "content/browser/android/content_video_view.h" | 14 #include "content/browser/android/content_video_view.h" |
15 #include "content/public/browser/render_view_host_observer.h" | 15 #include "content/public/browser/render_view_host_observer.h" |
16 #include "media/base/android/media_player_bridge.h" | 16 #include "media/base/android/media_player_bridge.h" |
17 #include "media/base/android/media_player_bridge_manager.h" | 17 #include "media/base/android/media_player_bridge_manager.h" |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 class ExternalVideoSurfaceViewHolder; | |
22 | |
21 // This class manages all the MediaPlayerBridge objects. It receives | 23 // This class manages all the MediaPlayerBridge objects. It receives |
22 // control operations from the the render process, and forwards | 24 // control operations from the the render process, and forwards |
23 // them to corresponding MediaPlayerBridge object. Callbacks from | 25 // them to corresponding MediaPlayerBridge object. Callbacks from |
24 // MediaPlayerBridge objects are converted to IPCs and then sent to the | 26 // MediaPlayerBridge objects are converted to IPCs and then sent to the |
25 // render process. | 27 // render process. |
26 class MediaPlayerManagerAndroid | 28 class MediaPlayerManagerAndroid |
27 : public RenderViewHostObserver, | 29 : public RenderViewHostObserver, |
28 public media::MediaPlayerBridgeManager { | 30 public media::MediaPlayerBridgeManager { |
29 public: | 31 public: |
30 // Create a MediaPlayerManagerAndroid object for the |render_view_host|. | 32 // Create a MediaPlayerManagerAndroid object for the |render_view_host|. |
(...skipping 23 matching lines...) Expand all Loading... | |
54 void OnError(int player_id, int error); | 56 void OnError(int player_id, int error); |
55 void OnVideoSizeChanged(int player_id, int width, int height); | 57 void OnVideoSizeChanged(int player_id, int width, int height); |
56 | 58 |
57 // media::MediaPlayerBridgeManager overrides. | 59 // media::MediaPlayerBridgeManager overrides. |
58 virtual void RequestMediaResources(media::MediaPlayerBridge* player) OVERRIDE; | 60 virtual void RequestMediaResources(media::MediaPlayerBridge* player) OVERRIDE; |
59 virtual void ReleaseMediaResources(media::MediaPlayerBridge* player) OVERRIDE; | 61 virtual void ReleaseMediaResources(media::MediaPlayerBridge* player) OVERRIDE; |
60 | 62 |
61 // Release all the players managed by this object. | 63 // Release all the players managed by this object. |
62 void DestroyAllMediaPlayers(); | 64 void DestroyAllMediaPlayers(); |
63 | 65 |
66 // External surface video rendering. | |
67 void SetExternalVideoSurfaceViewHolder( | |
68 ExternalVideoSurfaceViewHolder* holder); | |
69 | |
64 media::MediaPlayerBridge* GetFullscreenPlayer(); | 70 media::MediaPlayerBridge* GetFullscreenPlayer(); |
65 media::MediaPlayerBridge* GetPlayer(int player_id); | 71 media::MediaPlayerBridge* GetPlayer(int player_id); |
66 | 72 |
67 private: | 73 private: |
68 // Message handlers. | 74 // Message handlers. |
69 void OnEnterFullscreen(int player_id); | 75 void OnEnterFullscreen(int player_id); |
70 void OnExitFullscreen(int player_id); | 76 void OnExitFullscreen(int player_id); |
71 void OnInitialize(int player_id, const std::string& url, | 77 void OnInitialize(int player_id, const std::string& url, |
72 const std::string& first_party_for_cookies); | 78 const std::string& first_party_for_cookies); |
73 void OnStart(int player_id); | 79 void OnStart(int player_id); |
74 void OnSeek(int player_id, base::TimeDelta time); | 80 void OnSeek(int player_id, base::TimeDelta time); |
75 void OnPause(int player_id); | 81 void OnPause(int player_id); |
76 void OnReleaseResources(int player_id); | 82 void OnReleaseResources(int player_id); |
77 void OnDestroyPlayer(int player_id); | 83 void OnDestroyPlayer(int player_id); |
84 void OnRequestExternalSurface(int player_id); | |
78 | 85 |
79 // An array of managed players. | 86 // An array of managed players. |
80 ScopedVector<media::MediaPlayerBridge> players_; | 87 ScopedVector<media::MediaPlayerBridge> players_; |
81 | 88 |
82 // The fullscreen video view object. | 89 // The fullscreen video view object. |
83 ContentVideoView video_view_; | 90 ContentVideoView video_view_; |
84 | 91 |
85 // Player ID of the fullscreen media player. | 92 // Player ID of the fullscreen media player. |
86 int fullscreen_player_id_; | 93 int fullscreen_player_id_; |
87 | 94 |
95 // Player ID of the user of the external video surface. | |
96 int external_video_surface_user_id_; | |
ycheo
2013/03/14 09:45:52
IMO, it would be better that this variable is mana
wonsik
2013/03/14 10:57:01
Done.
| |
97 | |
98 ExternalVideoSurfaceViewHolder* external_video_surface_view_holder_; | |
99 | |
88 DISALLOW_COPY_AND_ASSIGN(MediaPlayerManagerAndroid); | 100 DISALLOW_COPY_AND_ASSIGN(MediaPlayerManagerAndroid); |
89 }; | 101 }; |
90 | 102 |
91 } // namespace content | 103 } // namespace content |
92 | 104 |
93 #endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_ | 105 #endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_ |
OLD | NEW |