1 /* 2 * Copyright (C) 2024 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 #ifndef _VNDK_IMAGE_READER_H 18 #define _VNDK_IMAGE_READER_H 19 20 #include <sys/cdefs.h> 21 // vndk is a superset of the NDK 22 #include <media/NdkImageReader.h> 23 24 __BEGIN_DECLS 25 26 /** 27 * Set the usage of this image reader. 28 * 29 * <p>Note that calling this method will replace the previously set usage.</p> 30 * 31 * <p>Note: This will trigger re-allocation, could cause producer failures mid-stream 32 * if the new usage combination isn't supported, and thus should be avoided as much as 33 * possible regardless.</p> 34 * 35 * Available since API level 36. 36 * 37 * @param reader The image reader of interest. 38 * @param usage specifies how the consumer will access the AImage. 39 * See {@link AImageReader_newWithUsage} parameter description for more details. 40 * @return <ul> 41 * <li>{@link AMEDIA_OK} if the method call succeeds.</li> 42 * <li>{@link AMEDIA_ERROR_INVALID_PARAMETER} if reader is NULL.</li> 43 * <li>{@link AMEDIA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul> 44 * 45 * @see AImage_getHardwareBuffer 46 */ 47 media_status_t AImageReader_setUsage( 48 AImageReader* _Nonnull reader, uint64_t usage) __INTRODUCED_IN(36); 49 50 __END_DECLS 51 52 #endif //_VNDK_IMAGE_READER_H 53