| 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 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> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // be available until one of those operations is performed. After that, we | 32 // be available until one of those operations is performed. After that, we |
| 33 // will cache those information in case the mediaplayer gets released. | 33 // will cache those information in case the mediaplayer gets released. |
| 34 // The class uses the corresponding MediaPlayerBridge Java class to talk to | 34 // The class uses the corresponding MediaPlayerBridge Java class to talk to |
| 35 // the Android MediaPlayer instance. | 35 // the Android MediaPlayer instance. |
| 36 class MEDIA_EXPORT MediaPlayerBridge : public MediaPlayerAndroid { | 36 class MEDIA_EXPORT MediaPlayerBridge : public MediaPlayerAndroid { |
| 37 public: | 37 public: |
| 38 static bool RegisterMediaPlayerBridge(JNIEnv* env); | 38 static bool RegisterMediaPlayerBridge(JNIEnv* env); |
| 39 | 39 |
| 40 // Construct a MediaPlayerBridge object. This object needs to call |manager|'s | 40 // Construct a MediaPlayerBridge object. This object needs to call |manager|'s |
| 41 // RequestMediaResources() before decoding the media stream. This allows | 41 // RequestMediaResources() before decoding the media stream. This allows |
| 42 // |manager| to track unused resources and free them when needed. On the other | 42 // |manager| to track unused resources and free them when needed. |
| 43 // hand, it needs to call ReleaseMediaResources() when it is done with | 43 // MediaPlayerBridge also forwards Android MediaPlayer callbacks to |
| 44 // decoding. MediaPlayerBridge also forwards Android MediaPlayer callbacks to | |
| 45 // the |manager| when needed. | 44 // the |manager| when needed. |
| 46 MediaPlayerBridge(int player_id, | 45 MediaPlayerBridge(int player_id, |
| 47 const GURL& url, | 46 const GURL& url, |
| 48 const GURL& first_party_for_cookies, | 47 const GURL& first_party_for_cookies, |
| 49 const std::string& user_agent, | 48 const std::string& user_agent, |
| 50 bool hide_url_log, | 49 bool hide_url_log, |
| 51 MediaPlayerManager* manager, | 50 MediaPlayerManager* manager, |
| 52 const RequestMediaResourcesCB& request_media_resources_cb, | 51 const RequestMediaResourcesCB& request_media_resources_cb, |
| 53 const ReleaseMediaResourcesCB& release_media_resources_cb, | |
| 54 const GURL& frame_url, | 52 const GURL& frame_url, |
| 55 bool allow_credentials); | 53 bool allow_credentials); |
| 56 virtual ~MediaPlayerBridge(); | 54 virtual ~MediaPlayerBridge(); |
| 57 | 55 |
| 58 // Initialize this object and extract the metadata from the media. | 56 // Initialize this object and extract the metadata from the media. |
| 59 virtual void Initialize(); | 57 virtual void Initialize(); |
| 60 | 58 |
| 61 // MediaPlayerAndroid implementation. | 59 // MediaPlayerAndroid implementation. |
| 62 virtual void SetVideoSurface(gfx::ScopedJavaSurface surface) OVERRIDE; | 60 virtual void SetVideoSurface(gfx::ScopedJavaSurface surface) OVERRIDE; |
| 63 virtual void Start() OVERRIDE; | 61 virtual void Start() OVERRIDE; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // Weak pointer passed to |listener_| for callbacks. | 196 // Weak pointer passed to |listener_| for callbacks. |
| 199 // NOTE: Weak pointers must be invalidated before all other member variables. | 197 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 200 base::WeakPtrFactory<MediaPlayerBridge> weak_factory_; | 198 base::WeakPtrFactory<MediaPlayerBridge> weak_factory_; |
| 201 | 199 |
| 202 DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge); | 200 DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge); |
| 203 }; | 201 }; |
| 204 | 202 |
| 205 } // namespace media | 203 } // namespace media |
| 206 | 204 |
| 207 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ | 205 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ |
| OLD | NEW |