jni_init.cpp revision 65953da4636fbf5f0a24b8f5f2b5fa7d76ff13d9
1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "jni/jni_util.h"
18
19#include "native/core/native_frame.h"
20#include "native/core/native_program.h"
21#include "native/core/gl_env.h"
22#include "native/core/gl_frame.h"
23#include "native/core/shader_program.h"
24#include "native/core/vertex_frame.h"
25
26using namespace android::filterfw;
27
28JavaVM* g_current_java_vm_ = NULL;
29
30jint JNI_OnLoad(JavaVM* vm, void* reserved) {
31  // Set the current vm pointer
32  g_current_java_vm_ = vm;
33
34  // Initialize object pools
35  ObjectPool<NativeFrame>::Setup("android/filterfw/core/NativeFrame", "nativeFrameId");
36  ObjectPool<NativeProgram>::Setup("android/filterfw/core/NativeProgram", "nativeProgramId");
37  ObjectPool<GLFrame>::Setup("android/filterfw/core/GLFrame", "glFrameId");
38  ObjectPool<ShaderProgram>::Setup("android/filterfw/core/ShaderProgram", "shaderProgramId");
39  ObjectPool<GLEnv>::Setup("android/filterfw/core/GLEnvironment", "glEnvId");
40  ObjectPool<VertexFrame>::Setup("android/filterfw/core/VertexFrame", "vertexFrameId");
41
42  return JNI_VERSION_1_4;
43}
44