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_LISTENER_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_LISTENER_H_ |
6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_LISTENER_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_LISTENER_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 // Called by the Java MediaPlayerListener and mirrored to corresponding | 34 // Called by the Java MediaPlayerListener and mirrored to corresponding |
35 // callbacks. | 35 // callbacks. |
36 void OnMediaError(JNIEnv* /* env */, jobject /* obj */, jint error_type); | 36 void OnMediaError(JNIEnv* /* env */, jobject /* obj */, jint error_type); |
37 void OnVideoSizeChanged(JNIEnv* /* env */, jobject /* obj */, | 37 void OnVideoSizeChanged(JNIEnv* /* env */, jobject /* obj */, |
38 jint width, jint height); | 38 jint width, jint height); |
39 void OnBufferingUpdate(JNIEnv* /* env */, jobject /* obj */, jint percent); | 39 void OnBufferingUpdate(JNIEnv* /* env */, jobject /* obj */, jint percent); |
40 void OnPlaybackComplete(JNIEnv* /* env */, jobject /* obj */); | 40 void OnPlaybackComplete(JNIEnv* /* env */, jobject /* obj */); |
41 void OnSeekComplete(JNIEnv* /* env */, jobject /* obj */); | 41 void OnSeekComplete(JNIEnv* /* env */, jobject /* obj */); |
42 void OnMediaPrepared(JNIEnv* /* env */, jobject /* obj */); | 42 void OnMediaPrepared(JNIEnv* /* env */, jobject /* obj */); |
| 43 void OnMediaInterrupted(JNIEnv* /* env */, jobject /* obj */); |
43 | 44 |
44 // Create a Java MediaPlayerListener object. | 45 // Create a Java MediaPlayerListener object. |
45 void CreateMediaPlayerListener(jobject context, jobject media_player); | 46 void CreateMediaPlayerListener(jobject context, jobject media_player); |
| 47 void ReleaseMediaPlayerListenerResources(); |
46 | 48 |
47 // Register MediaPlayerListener in the system library loader. | 49 // Register MediaPlayerListener in the system library loader. |
48 static bool RegisterMediaPlayerListener(JNIEnv* env); | 50 static bool RegisterMediaPlayerListener(JNIEnv* env); |
49 | 51 |
50 private: | 52 private: |
51 // The message loop where |media_player_| lives. | 53 // The message loop where |media_player_| lives. |
52 scoped_refptr<base::MessageLoopProxy> message_loop_; | 54 scoped_refptr<base::MessageLoopProxy> message_loop_; |
53 | 55 |
54 // The MediaPlayerBridge object all the callbacks should be send to. | 56 // The MediaPlayerBridge object all the callbacks should be send to. |
55 base::WeakPtr<MediaPlayerBridge> media_player_; | 57 base::WeakPtr<MediaPlayerBridge> media_player_; |
56 | 58 |
| 59 base::android::ScopedJavaGlobalRef<jobject> j_media_player_listener_; |
| 60 |
57 DISALLOW_COPY_AND_ASSIGN(MediaPlayerListener); | 61 DISALLOW_COPY_AND_ASSIGN(MediaPlayerListener); |
58 }; | 62 }; |
59 | 63 |
60 } // namespace media | 64 } // namespace media |
61 | 65 |
62 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_LISTENER_H_ | 66 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_LISTENER_H_ |
OLD | NEW |