forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexternal_video_surface_container_impl.h
55 lines (40 loc) · 1.87 KB
/
external_video_surface_container_impl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2014 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 ANDROID_WEBVIEW_NATIVE_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_
#define ANDROID_WEBVIEW_NATIVE_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_
#include <jni.h>
#include "base/android/scoped_java_ref.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "content/public/browser/android/external_video_surface_container.h"
namespace android_webview {
class ExternalVideoSurfaceContainerImpl
: public content::ExternalVideoSurfaceContainer {
public:
typedef base::Callback<void(int, jobject)> SurfaceCreatedCB;
typedef base::Callback<void(int)> SurfaceDestroyedCB;
ExternalVideoSurfaceContainerImpl(content::WebContents* contents);
// ExternalVideoSurfaceContainer implementation.
virtual void RequestExternalVideoSurface(
int player_id,
const SurfaceCreatedCB& surface_created_cb,
const SurfaceDestroyedCB& surface_destroyed_cb) OVERRIDE;
virtual void ReleaseExternalVideoSurface(int player_id) OVERRIDE;
virtual void OnFrameInfoUpdated() OVERRIDE;
virtual void OnExternalVideoSurfacePositionChanged(
int player_id, const gfx::RectF& rect) OVERRIDE;
// Methods called from Java.
void SurfaceCreated(
JNIEnv* env, jobject obj, jint player_id, jobject jsurface);
void SurfaceDestroyed(JNIEnv* env, jobject obj, jint player_id);
private:
virtual ~ExternalVideoSurfaceContainerImpl();
base::android::ScopedJavaGlobalRef<jobject> jobject_;
SurfaceCreatedCB surface_created_cb_;
SurfaceDestroyedCB surface_destroyed_cb_;
DISALLOW_COPY_AND_ASSIGN(ExternalVideoSurfaceContainerImpl);
};
bool RegisterExternalVideoSurfaceContainer(JNIEnv* env);
} // namespace android_webview
#endif // ANDROID_WEBVIEW_NATIVE_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_