1e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian/*
2e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian * Copyright (C) 2017 The Android Open Source Project
3e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian *
4e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian * Licensed under the Apache License, Version 2.0 (the "License");
5e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian * you may not use this file except in compliance with the License.
6e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian * You may obtain a copy of the License at
7e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian *
8e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian *      http://www.apache.org/licenses/LICENSE-2.0
9e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian *
10e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian * Unless required by applicable law or agreed to in writing, software
11e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian * distributed under the License is distributed on an "AS IS" BASIS,
12e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian * See the License for the specific language governing permissions and
14e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian * limitations under the License.
15e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian */
16e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian
17e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian#define LOG_TAG "AHardwareBuffer"
18e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian
19e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian#include <android/hardware_buffer_jni.h>
20e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian
21e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian#include <android_runtime/android_hardware_HardwareBuffer.h>
22e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian
23e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopianusing namespace android;
24e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian
25e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias AgopianAHardwareBuffer* AHardwareBuffer_fromHardwareBuffer(JNIEnv* env, jobject hardwareBufferObj) {
26e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian    return android_hardware_HardwareBuffer_getNativeHardwareBuffer(env, hardwareBufferObj);
27e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian}
28e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian
29e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopianjobject AHardwareBuffer_toHardwareBuffer(JNIEnv* env, AHardwareBuffer* hardwareBuffer) {
30e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian    return android_hardware_HardwareBuffer_createFromAHardwareBuffer(env, hardwareBuffer);
31e68b4f73a92b4683a668608e1a64548eb7dbd27aMathias Agopian}
32