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 /** 36 * Get a reference to the native ASurfaceTexture from the corresponding java object. 37 * 38 * The caller must keep a reference to the Java SurfaceTexture during the lifetime of the returned 39 * ASurfaceTexture. Failing to do so could result in the ASurfaceTexture to stop functioning 40 * properly once the Java object gets finalized. 41 * However, this will not result in program termination. 42 * 43 * Available since API level 28. 44 * 45 * \param env JNI environment 46 * \param surfacetexture Instance of Java SurfaceTexture object 47 * \return native ASurfaceTexture reference or nullptr if the java object is not a SurfaceTexture. 48 * The returned reference MUST BE released when it's no longer needed using 49 * ASurfaceTexture_release(). 50 */ 51 ASurfaceTexture* ASurfaceTexture_fromSurfaceTexture(JNIEnv* env, jobject surfacetexture) __INTRODUCED_IN(28); 52 53 __END_DECLS 54 55 #endif /* ANDROID_NATIVE_SURFACE_TEXTURE_JNI_H */ 56 57 /** @} */ 58