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_IMPL_H_ |
6 #define CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_ | 6 #define CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_IMPL_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 "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
17 #include "media/base/android/media_player_bridge.h" | 17 #include "media/base/android/media_player_bridge.h" |
18 #include "media/base/android/media_player_bridge_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 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 class WebContents; | 23 class WebContents; |
24 | 24 |
25 // This class manages all the MediaPlayerBridge objects. It receives | 25 // This class manages all the MediaPlayerBridge objects. It receives |
scherkus (not reviewing)
2013/04/30 05:05:49
update docs? (should they still mention MediaPlaye
qinmin
2013/04/30 16:38:02
will update this once I add the MediaPlayerAndroid
| |
26 // control operations from the the render process, and forwards | 26 // control operations from the the render process, and forwards |
27 // them to corresponding MediaPlayerBridge object. Callbacks from | 27 // them to corresponding MediaPlayerBridge object. Callbacks from |
28 // MediaPlayerBridge objects are converted to IPCs and then sent to the | 28 // MediaPlayerBridge objects are converted to IPCs and then sent to the |
29 // render process. | 29 // render process. |
30 class MediaPlayerManagerAndroid | 30 class MediaPlayerManagerImpl |
31 : public RenderViewHostObserver, | 31 : public RenderViewHostObserver, |
32 public media::MediaPlayerBridgeManager { | 32 public media::MediaPlayerManager { |
33 public: | 33 public: |
34 // Create a MediaPlayerManagerAndroid object for the |render_view_host|. | 34 // Create a MediaPlayerManagerImpl object for the |render_view_host|. |
35 explicit MediaPlayerManagerAndroid(RenderViewHost* render_view_host); | 35 explicit MediaPlayerManagerImpl(RenderViewHost* render_view_host); |
36 virtual ~MediaPlayerManagerAndroid(); | 36 virtual ~MediaPlayerManagerImpl(); |
37 | 37 |
38 // RenderViewHostObserver overrides. | 38 // RenderViewHostObserver overrides. |
39 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 39 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
40 | 40 |
41 // Fullscreen video playback controls. | 41 // Fullscreen video playback controls. |
42 void FullscreenPlayerPlay(); | 42 void FullscreenPlayerPlay(); |
43 void FullscreenPlayerPause(); | 43 void FullscreenPlayerPause(); |
44 void FullscreenPlayerSeek(int msec); | 44 void FullscreenPlayerSeek(int msec); |
45 void ExitFullscreen(bool release_media_player); | 45 void ExitFullscreen(bool release_media_player); |
46 void SetVideoSurface(jobject surface); | 46 void SetVideoSurface(jobject surface); |
47 | 47 |
48 // An internal method that checks for current time routinely and generates | 48 // An internal method that checks for current time routinely and generates |
49 // time update events. | 49 // time update events. |
50 void OnTimeUpdate(int player_id, base::TimeDelta current_time); | 50 void OnTimeUpdate(int player_id, base::TimeDelta current_time); |
51 | 51 |
52 // Callbacks needed by media::MediaPlayerBridge. | 52 // Callbacks needed by media::MediaPlayerBridge. |
53 void OnMediaMetadataChanged(int player_id, base::TimeDelta duration, | 53 void OnMediaMetadataChanged(int player_id, base::TimeDelta duration, |
54 int width, int height, bool success); | 54 int width, int height, bool success); |
55 void OnPlaybackComplete(int player_id); | 55 void OnPlaybackComplete(int player_id); |
56 void OnMediaInterrupted(int player_id); | 56 void OnMediaInterrupted(int player_id); |
57 void OnBufferingUpdate(int player_id, int percentage); | 57 void OnBufferingUpdate(int player_id, int percentage); |
58 void OnSeekComplete(int player_id, base::TimeDelta current_time); | 58 void OnSeekComplete(int player_id, base::TimeDelta current_time); |
59 void OnError(int player_id, int error); | 59 void OnError(int player_id, int error); |
60 void OnVideoSizeChanged(int player_id, int width, int height); | 60 void OnVideoSizeChanged(int player_id, int width, int height); |
61 | 61 |
62 // media::MediaPlayerBridgeManager overrides. | 62 // media::MediaPlayerManager overrides. |
63 virtual void RequestMediaResources(media::MediaPlayerBridge* player) OVERRIDE; | 63 virtual void RequestMediaResources(media::MediaPlayerBridge* player) OVERRIDE; |
64 virtual void ReleaseMediaResources(media::MediaPlayerBridge* player) OVERRIDE; | 64 virtual void ReleaseMediaResources(media::MediaPlayerBridge* player) OVERRIDE; |
65 virtual media::MediaResourceGetter* GetMediaResourceGetter() OVERRIDE; | |
65 | 66 |
66 // Release all the players managed by this object. | 67 // Release all the players managed by this object. |
67 void DestroyAllMediaPlayers(); | 68 void DestroyAllMediaPlayers(); |
68 | 69 |
69 #if defined(GOOGLE_TV) | 70 #if defined(GOOGLE_TV) |
70 void AttachExternalVideoSurface(int player_id, jobject surface); | 71 void AttachExternalVideoSurface(int player_id, jobject surface); |
71 void DetachExternalVideoSurface(int player_id); | 72 void DetachExternalVideoSurface(int player_id); |
72 #endif | 73 #endif |
73 | 74 |
74 media::MediaPlayerBridge* GetFullscreenPlayer(); | 75 media::MediaPlayerBridge* GetFullscreenPlayer(); |
(...skipping 19 matching lines...) Expand all Loading... | |
94 ScopedVector<media::MediaPlayerBridge> players_; | 95 ScopedVector<media::MediaPlayerBridge> players_; |
95 | 96 |
96 // The fullscreen video view object. | 97 // The fullscreen video view object. |
97 ContentVideoView video_view_; | 98 ContentVideoView video_view_; |
98 | 99 |
99 // Player ID of the fullscreen media player. | 100 // Player ID of the fullscreen media player. |
100 int fullscreen_player_id_; | 101 int fullscreen_player_id_; |
101 | 102 |
102 WebContents* web_contents_; | 103 WebContents* web_contents_; |
103 | 104 |
104 DISALLOW_COPY_AND_ASSIGN(MediaPlayerManagerAndroid); | 105 // Object for retrieving resources media players. |
106 scoped_ptr<media::MediaResourceGetter> media_resource_getter_; | |
107 | |
108 DISALLOW_COPY_AND_ASSIGN(MediaPlayerManagerImpl); | |
105 }; | 109 }; |
106 | 110 |
107 } // namespace content | 111 } // namespace content |
108 | 112 |
109 #endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_ANDROID_H_ | 113 #endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYER_MANAGER_IMPL_H_ |
OLD | NEW |