1 /* 2 * Copyright (C) 2018 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 /** 18 * @addtogroup SurfaceTexture 19 * @{ 20 */ 21 22 /** 23 * @file surface_texture_jni.h 24 */ 25 26 #ifndef ANDROID_NATIVE_SURFACE_TEXTURE_JNI_H 27 #define ANDROID_NATIVE_SURFACE_TEXTURE_JNI_H 28 29 #include <android/surface_texture.h> 30 31 #include <jni.h> 32 33 __BEGIN_DECLS 34 35 #if __ANDROID_API__ >= 28 36 37 /** 38 * Get a reference to the native ASurfaceTexture from the corresponding java object. 39 * 40 * The caller must keep a reference to the Java SurfaceTexture during the lifetime of the returned 41 * ASurfaceTexture. Failing to do so could result in the ASurfaceTexture to stop functioning 42 * properly once the Java object gets finalized. 43 * However, this will not result in program termination. 44 * 45 * Available since API level 28. 46 * 47 * \param env JNI environment 48 * \param surfacetexture Instance of Java SurfaceTexture object 49 * \return native ASurfaceTexture reference or nullptr if the java object is not a SurfaceTexture. 50 * The returned reference MUST BE released when it's no longer needed using 51 * ASurfaceTexture_release(). 52 */ 53 ASurfaceTexture* ASurfaceTexture_fromSurfaceTexture(JNIEnv* env, jobject surfacetexture) __INTRODUCED_IN(28); 54 55 #endif 56 57 __END_DECLS 58 59 #endif /* ANDROID_NATIVE_SURFACE_TEXTURE_JNI_H */ 60