| 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> |
| 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 "media/base/media_export.h" |
| 18 #include "media/base/android/media_player_listener.h" | 19 #include "media/base/android/media_player_listener.h" |
| 19 | 20 |
| 20 namespace media { | 21 namespace media { |
| 21 | 22 |
| 22 class CookieGetter; | 23 class CookieGetter; |
| 23 class MediaPlayerBridgeManager; | 24 class MediaPlayerBridgeManager; |
| 24 | 25 |
| 25 // This class serves as a bridge for native code to call java functions inside | 26 // This class serves as a bridge for native code to call java functions inside |
| 26 // android mediaplayer class. For more information on android mediaplayer, check | 27 // android mediaplayer class. For more information on android mediaplayer, check |
| 27 // http://developer.android.com/reference/android/media/MediaPlayer.html | 28 // http://developer.android.com/reference/android/media/MediaPlayer.html |
| 28 // The actual android mediaplayer instance is created lazily when Start(), | 29 // The actual android mediaplayer instance is created lazily when Start(), |
| 29 // Pause(), SeekTo() gets called. As a result, media information may not | 30 // Pause(), SeekTo() gets called. As a result, media information may not |
| 30 // be available until one of those operations is performed. After that, we | 31 // be available until one of those operations is performed. After that, we |
| 31 // will cache those information in case the mediaplayer gets released. | 32 // will cache those information in case the mediaplayer gets released. |
| 32 class MediaPlayerBridge { | 33 class MEDIA_EXPORT MediaPlayerBridge { |
| 33 public: | 34 public: |
| 34 // Error types for MediaErrorCB. | 35 // Error types for MediaErrorCB. |
| 35 enum MediaErrorType { | 36 enum MediaErrorType { |
| 36 MEDIA_ERROR_UNKNOWN, | 37 MEDIA_ERROR_UNKNOWN, |
| 37 MEDIA_ERROR_SERVER_DIED, | 38 MEDIA_ERROR_SERVER_DIED, |
| 38 MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK, | 39 MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK, |
| 39 MEDIA_ERROR_INVALID_CODE, | 40 MEDIA_ERROR_INVALID_CODE, |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 // Callback when error happens. Args: player ID, error type. | 43 // Callback when error happens. Args: player ID, error type. |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 215 |
| 215 // Listener object that listens to all the media player events. | 216 // Listener object that listens to all the media player events. |
| 216 MediaPlayerListener listener_; | 217 MediaPlayerListener listener_; |
| 217 | 218 |
| 218 DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge); | 219 DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge); |
| 219 }; | 220 }; |
| 220 | 221 |
| 221 } // namespace media | 222 } // namespace media |
| 222 | 223 |
| 223 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ | 224 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ |
| OLD | NEW |