2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
11 #ifndef WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_ANDROID_VIDEO_RENDER_ANDROID_NATIVE_OPENGL2_H_
12 #define WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_ANDROID_VIDEO_RENDER_ANDROID_NATIVE_OPENGL2_H_
16 #include "webrtc/modules/video_render/android/video_render_android_impl.h"
17 #include "webrtc/modules/video_render/android/video_render_opengles20.h"
18 #include "webrtc/modules/video_render/include/video_render_defines.h"
22 class CriticalSectionWrapper;
24 class AndroidNativeOpenGl2Channel: public AndroidStream {
26 AndroidNativeOpenGl2Channel(
29 VideoRenderAndroid& renderer,jobject javaRenderObj);
30 ~AndroidNativeOpenGl2Channel();
32 int32_t Init(int32_t zOrder, const float left, const float top,
33 const float right, const float bottom);
35 //Implement VideoRenderCallback
36 virtual int32_t RenderFrame(
37 const uint32_t streamId,
38 I420VideoFrame& videoFrame);
40 //Implements AndroidStream
41 virtual void DeliverFrame(JNIEnv* jniEnv);
44 static jint JNICALL CreateOpenGLNativeStatic(
50 jint CreateOpenGLNative(int width, int height);
52 static void JNICALL DrawNativeStatic(JNIEnv * env,jobject, jlong context);
55 CriticalSectionWrapper& _renderCritSect;
57 I420VideoFrame _bufferToRender;
58 VideoRenderAndroid& _renderer;
60 jobject _javaRenderObj;
63 jmethodID _registerNativeCID;
64 jmethodID _deRegisterNativeCID;
65 VideoRenderOpenGles20 _openGLRenderer;
69 class AndroidNativeOpenGl2Renderer: private VideoRenderAndroid {
71 AndroidNativeOpenGl2Renderer(const int32_t id,
72 const VideoRenderType videoRenderType,
74 const bool fullscreen);
76 ~AndroidNativeOpenGl2Renderer();
77 static bool UseOpenGL2(void* window);
80 virtual AndroidStream* CreateAndroidRenderChannel(
87 VideoRenderAndroid& renderer);
90 jobject _javaRenderObj;
91 jclass _javaRenderClass;
96 #endif // WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_ANDROID_VIDEO_RENDER_ANDROID_NATIVE_OPENGL2_H_