blob: 2266d541f61b0b145eadfba7f45efebdc2b48141 [file] [log] [blame]
Mathias Agopian3131a022018-01-30 18:08:17 -08001/*
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
Elliott Hughes3d70e532019-10-29 08:59:39 -070035#if __ANDROID_API__ >= 28
36
Mathias Agopian3131a022018-01-30 18:08:17 -080037/**
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 *
Elliott Hughes3d70e532019-10-29 08:59:39 -070045 * Available since API level 28.
46 *
Mathias Agopian3131a022018-01-30 18:08:17 -080047 * \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 */
Elliott Hughes3d70e532019-10-29 08:59:39 -070053ASurfaceTexture* ASurfaceTexture_fromSurfaceTexture(JNIEnv* env, jobject surfacetexture) __INTRODUCED_IN(28);
54
55#endif
Mathias Agopian3131a022018-01-30 18:08:17 -080056
57__END_DECLS
58
59#endif /* ANDROID_NATIVE_SURFACE_TEXTURE_JNI_H */