Index: content/browser/android/external_video_surface_view_holder.h |
diff --git a/content/browser/android/external_video_surface_view_holder.h b/content/browser/android/external_video_surface_view_holder.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3fd5f0aefa9296db31bc57210321f35d6920798d |
--- /dev/null |
+++ b/content/browser/android/external_video_surface_view_holder.h |
@@ -0,0 +1,52 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_VIEW_HOLDER_H_ |
+#define CONTENT_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_VIEW_HOLDER_H_ |
+ |
+#include <jni.h> |
+ |
+#include "base/android/jni_helper.h" |
+#include "base/basictypes.h" |
+ |
+namespace media { |
+class MediaPlayerBridge; |
+} // namespace media |
+ |
+namespace content { |
+ |
+class ExternalVideoSurfaceViewHolder { |
+ public: |
+ // Registers the JNI methods for ExternalVideoSurfaceViewHolder. |
+ static bool RegisterExternalVideoSurfaceViewHolder(JNIEnv* env); |
+ |
+ ExternalVideoSurfaceViewHolder(JNIEnv *env, jobject obj); |
+ ~ExternalVideoSurfaceViewHolder(); |
+ |
+ // Registers/unregisters media player that wants to render to external video |
+ // surface. Note that the client must unregister the player before deleting |
+ // the media player to prevent access to deleted object. |
+ void registerPlayer(media::MediaPlayerBridge* player); |
+ void unregisterPlayer(media::MediaPlayerBridge* player); |
+ |
+ // -------------------------------------------------------------------------- |
+ // Methods called from Java via JNI |
+ // -------------------------------------------------------------------------- |
+ void Destroy(JNIEnv* env, jobject obj); |
+ void AttachExternalVideoSurface(JNIEnv* env, jobject obj, jobject jsurface); |
+ void DetachExternalVideoSurface(JNIEnv* env, jobject obj); |
+ |
+ private: |
+ // A weak reference to the Java ExternalVideoSurfaceViewHolder object. |
+ JavaObjectWeakGlobalRef java_ref_; |
+ |
+ // The MediaPlayerBridge object that should receive video surface updates. |
+ media::MediaPlayerBridge* player_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ExternalVideoSurfaceViewHolder); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_VIEW_HOLDER_H_ |