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