OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_VIEW_HOLDER_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_VIEW_HOLDER_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 |
| 10 #include "base/android/jni_helper.h" |
| 11 #include "base/basictypes.h" |
| 12 |
| 13 namespace media { |
| 14 class MediaPlayerBridge; |
| 15 } // namespace media |
| 16 |
| 17 namespace content { |
| 18 |
| 19 class ExternalVideoSurfaceViewHolder { |
| 20 public: |
| 21 // Registers the JNI methods for ExternalVideoSurfaceViewHolder. |
| 22 static bool RegisterExternalVideoSurfaceViewHolder(JNIEnv* env); |
| 23 |
| 24 ExternalVideoSurfaceViewHolder(JNIEnv *env, jobject obj); |
| 25 ~ExternalVideoSurfaceViewHolder(); |
| 26 |
| 27 // Registers/unregisters media player that wants to render to external video |
| 28 // surface. Note that the client must unregister the player before deleting |
| 29 // the media player to prevent access to deleted object. |
| 30 void registerPlayer(media::MediaPlayerBridge* player); |
| 31 void unregisterPlayer(media::MediaPlayerBridge* player); |
| 32 |
| 33 // -------------------------------------------------------------------------- |
| 34 // Methods called from Java via JNI |
| 35 // -------------------------------------------------------------------------- |
| 36 void Destroy(JNIEnv* env, jobject obj); |
| 37 void AttachExternalVideoSurface(JNIEnv* env, jobject obj, jobject jsurface); |
| 38 void DetachExternalVideoSurface(JNIEnv* env, jobject obj); |
| 39 |
| 40 private: |
| 41 // A weak reference to the Java ExternalVideoSurfaceViewHolder object. |
| 42 JavaObjectWeakGlobalRef java_ref_; |
| 43 |
| 44 // The MediaPlayerBridge object that should receive video surface updates. |
| 45 media::MediaPlayerBridge* player_; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(ExternalVideoSurfaceViewHolder); |
| 48 }; |
| 49 |
| 50 } // namespace content |
| 51 |
| 52 #endif // CONTENT_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_VIEW_HOLDER_H_ |
OLD | NEW |