Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: media/base/android/media_player_bridge.h

Issue 14314020: Rename MediaPlayerBridgeManager to MediaPlayerManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: additional rebase conflict Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | media/base/android/media_player_bridge.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ 6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/android/scoped_java_ref.h" 12 #include "base/android/scoped_java_ref.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/time.h" 16 #include "base/time.h"
17 #include "base/timer.h" 17 #include "base/timer.h"
18 #include "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
19 #include "media/base/media_export.h" 19 #include "media/base/media_export.h"
20 #if defined(GOOGLE_TV) 20 #if defined(GOOGLE_TV)
21 #include "media/base/android/demuxer_stream_player_params.h" 21 #include "media/base/android/demuxer_stream_player_params.h"
22 #endif 22 #endif
23 #include "media/base/android/media_player_listener.h" 23 #include "media/base/android/media_player_listener.h"
24 24
25 namespace media { 25 namespace media {
26 26
27 class MediaResourceGetter; 27 class MediaPlayerManager;
28 class MediaPlayerBridgeManager;
29 28
30 // This class serves as a bridge for native code to call java functions inside 29 // This class serves as a bridge for native code to call java functions inside
31 // android mediaplayer class. For more information on android mediaplayer, check 30 // android mediaplayer class. For more information on android mediaplayer, check
32 // http://developer.android.com/reference/android/media/MediaPlayer.html 31 // http://developer.android.com/reference/android/media/MediaPlayer.html
33 // The actual android mediaplayer instance is created lazily when Start(), 32 // The actual android mediaplayer instance is created lazily when Start(),
34 // Pause(), SeekTo() gets called. As a result, media information may not 33 // Pause(), SeekTo() gets called. As a result, media information may not
35 // be available until one of those operations is performed. After that, we 34 // be available until one of those operations is performed. After that, we
36 // will cache those information in case the mediaplayer gets released. 35 // will cache those information in case the mediaplayer gets released.
37 class MEDIA_EXPORT MediaPlayerBridge { 36 class MEDIA_EXPORT MediaPlayerBridge {
38 public: 37 public:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 ReadFromDemuxerCB; 76 ReadFromDemuxerCB;
78 #endif 77 #endif
79 78
80 static bool RegisterMediaPlayerBridge(JNIEnv* env); 79 static bool RegisterMediaPlayerBridge(JNIEnv* env);
81 80
82 static MediaPlayerBridge* Create( 81 static MediaPlayerBridge* Create(
83 int player_id, 82 int player_id,
84 const GURL& url, 83 const GURL& url,
85 bool is_media_source, 84 bool is_media_source,
86 const GURL& first_party_for_cookies, 85 const GURL& first_party_for_cookies,
87 MediaResourceGetter* resource_getter,
88 bool hide_url_log, 86 bool hide_url_log,
89 MediaPlayerBridgeManager* manager, 87 MediaPlayerManager* manager,
90 #if defined(GOOGLE_TV) 88 #if defined(GOOGLE_TV)
91 const ReadFromDemuxerCB read_from_demuxer_cb, 89 const ReadFromDemuxerCB read_from_demuxer_cb,
92 #endif 90 #endif
93 const MediaErrorCB& media_error_cb, 91 const MediaErrorCB& media_error_cb,
94 const VideoSizeChangedCB& video_size_changed_cb, 92 const VideoSizeChangedCB& video_size_changed_cb,
95 const BufferingUpdateCB& buffering_update_cb, 93 const BufferingUpdateCB& buffering_update_cb,
96 const MediaMetadataChangedCB& media_prepared_cb, 94 const MediaMetadataChangedCB& media_prepared_cb,
97 const PlaybackCompleteCB& playback_complete_cb, 95 const PlaybackCompleteCB& playback_complete_cb,
98 const SeekCompleteCB& seek_complete_cb, 96 const SeekCompleteCB& seek_complete_cb,
99 const TimeUpdateCB& time_update_cb, 97 const TimeUpdateCB& time_update_cb,
100 const MediaInterruptedCB& media_interrupted_cb); 98 const MediaInterruptedCB& media_interrupted_cb);
101 99
102 // Construct a MediaPlayerBridge object with all the needed media player 100 // Construct a MediaPlayerBridge object with all the needed media player
103 // callbacks. This object needs to call |manager|'s RequestMediaResources() 101 // callbacks. This object needs to call |manager|'s RequestMediaResources()
104 // before decoding the media stream. This allows |manager| to track 102 // before decoding the media stream. This allows |manager| to track
105 // unused resources and free them when needed. On the other hand, it needs 103 // unused resources and free them when needed. On the other hand, it needs
106 // to call ReleaseMediaResources() when it is done with decoding. 104 // to call ReleaseMediaResources() when it is done with decoding.
107 MediaPlayerBridge(int player_id, 105 MediaPlayerBridge(int player_id,
108 const GURL& url, 106 const GURL& url,
109 const GURL& first_party_for_cookies, 107 const GURL& first_party_for_cookies,
110 MediaResourceGetter* resource_getter,
111 bool hide_url_log, 108 bool hide_url_log,
112 MediaPlayerBridgeManager* manager, 109 MediaPlayerManager* manager,
113 const MediaErrorCB& media_error_cb, 110 const MediaErrorCB& media_error_cb,
114 const VideoSizeChangedCB& video_size_changed_cb, 111 const VideoSizeChangedCB& video_size_changed_cb,
115 const BufferingUpdateCB& buffering_update_cb, 112 const BufferingUpdateCB& buffering_update_cb,
116 const MediaMetadataChangedCB& media_prepared_cb, 113 const MediaMetadataChangedCB& media_prepared_cb,
117 const PlaybackCompleteCB& playback_complete_cb, 114 const PlaybackCompleteCB& playback_complete_cb,
118 const SeekCompleteCB& seek_complete_cb, 115 const SeekCompleteCB& seek_complete_cb,
119 const TimeUpdateCB& time_update_cb, 116 const TimeUpdateCB& time_update_cb,
120 const MediaInterruptedCB& media_interrupted_cb); 117 const MediaInterruptedCB& media_interrupted_cb);
121 virtual ~MediaPlayerBridge(); 118 virtual ~MediaPlayerBridge();
122 119
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 254
258 // Meta data about actions can be taken. 255 // Meta data about actions can be taken.
259 bool can_pause_; 256 bool can_pause_;
260 bool can_seek_forward_; 257 bool can_seek_forward_;
261 bool can_seek_backward_; 258 bool can_seek_backward_;
262 259
263 // Cookies for |url_|. 260 // Cookies for |url_|.
264 std::string cookies_; 261 std::string cookies_;
265 262
266 // Resource manager for all the media players. 263 // Resource manager for all the media players.
267 MediaPlayerBridgeManager* manager_; 264 MediaPlayerManager* manager_;
268
269 // Object for retrieving resources for this media player.
270 scoped_ptr<MediaResourceGetter> resource_getter_;
271 265
272 // Java MediaPlayer instance. 266 // Java MediaPlayer instance.
273 base::android::ScopedJavaGlobalRef<jobject> j_media_player_; 267 base::android::ScopedJavaGlobalRef<jobject> j_media_player_;
274 268
275 base::RepeatingTimer<MediaPlayerBridge> time_update_timer_; 269 base::RepeatingTimer<MediaPlayerBridge> time_update_timer_;
276 270
277 // Weak pointer passed to |listener_| for callbacks. 271 // Weak pointer passed to |listener_| for callbacks.
278 base::WeakPtrFactory<MediaPlayerBridge> weak_this_; 272 base::WeakPtrFactory<MediaPlayerBridge> weak_this_;
279 273
280 // Listener object that listens to all the media player events. 274 // Listener object that listens to all the media player events.
281 MediaPlayerListener listener_; 275 MediaPlayerListener listener_;
282 276
283 DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge); 277 DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge);
284 }; 278 };
285 279
286 } // namespace media 280 } // namespace media
287 281
288 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ 282 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | media/base/android/media_player_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698