xref: /aosp_15_r20/hardware/interfaces/camera/device/1.0/ICameraDevicePreviewCallback.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2016 The Android Open Source Project
3*4d7e907cSAndroid Build Coastguard Worker *
4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*4d7e907cSAndroid Build Coastguard Worker *
8*4d7e907cSAndroid Build Coastguard Worker *      http://www.apache.org/licenses/LICENSE-2.0
9*4d7e907cSAndroid Build Coastguard Worker *
10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License.
15*4d7e907cSAndroid Build Coastguard Worker */
16*4d7e907cSAndroid Build Coastguard Worker
17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected];
18*4d7e907cSAndroid Build Coastguard Worker
19*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::types;
20*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::types;
21*4d7e907cSAndroid Build Coastguard Worker
22*4d7e907cSAndroid Build Coastguard Worker/**
23*4d7e907cSAndroid Build Coastguard Worker * Camera device [email protected] preview stream operation interface.
24*4d7e907cSAndroid Build Coastguard Worker */
25*4d7e907cSAndroid Build Coastguard Workerinterface ICameraDevicePreviewCallback {
26*4d7e907cSAndroid Build Coastguard Worker
27*4d7e907cSAndroid Build Coastguard Worker    /**
28*4d7e907cSAndroid Build Coastguard Worker     * Acquire a buffer to write a preview buffer into.
29*4d7e907cSAndroid Build Coastguard Worker     *
30*4d7e907cSAndroid Build Coastguard Worker     * @return status The status code for this operation. If not OK, then
31*4d7e907cSAndroid Build Coastguard Worker     *     buffer and stride must not be used.
32*4d7e907cSAndroid Build Coastguard Worker     * @return bufferId A unique ID for the returned buffer.
33*4d7e907cSAndroid Build Coastguard Worker     * @return buffer A handle to the buffer to write into. Must be non-null if the bufferId has not
34*4d7e907cSAndroid Build Coastguard Worker     *     been seen by HAL before. Must be null if the bufferId is seen before. HAL must keep track
35*4d7e907cSAndroid Build Coastguard Worker     *     of the bufferId to actual buffer handle mapping.
36*4d7e907cSAndroid Build Coastguard Worker     * @return stride The stride between two rows of pixels in this buffer.
37*4d7e907cSAndroid Build Coastguard Worker     */
38*4d7e907cSAndroid Build Coastguard Worker    dequeueBuffer() generates (Status status, uint64_t bufferId, handle buffer, uint32_t stride);
39*4d7e907cSAndroid Build Coastguard Worker
40*4d7e907cSAndroid Build Coastguard Worker    /**
41*4d7e907cSAndroid Build Coastguard Worker     * Send a filled preview buffer to its consumer.
42*4d7e907cSAndroid Build Coastguard Worker     *
43*4d7e907cSAndroid Build Coastguard Worker     * @param bufferId The bufferId of the preview buffer
44*4d7e907cSAndroid Build Coastguard Worker     * @return status The status code for this operation.
45*4d7e907cSAndroid Build Coastguard Worker     */
46*4d7e907cSAndroid Build Coastguard Worker    enqueueBuffer(uint64_t bufferId) generates (Status status);
47*4d7e907cSAndroid Build Coastguard Worker
48*4d7e907cSAndroid Build Coastguard Worker    /**
49*4d7e907cSAndroid Build Coastguard Worker     * Return a preview buffer unfilled. This buffer must not be sent on to the
50*4d7e907cSAndroid Build Coastguard Worker     * preview consumer as a valid buffer, but may be reused as if it were
51*4d7e907cSAndroid Build Coastguard Worker     * empty.
52*4d7e907cSAndroid Build Coastguard Worker     *
53*4d7e907cSAndroid Build Coastguard Worker     * @param bufferId The bufferId of the preview buffer
54*4d7e907cSAndroid Build Coastguard Worker     * @return status The status code for this operation.
55*4d7e907cSAndroid Build Coastguard Worker     */
56*4d7e907cSAndroid Build Coastguard Worker    cancelBuffer(uint64_t bufferId) generates (Status status);
57*4d7e907cSAndroid Build Coastguard Worker
58*4d7e907cSAndroid Build Coastguard Worker    /**
59*4d7e907cSAndroid Build Coastguard Worker     * Set the number of preview buffers needed by the HAL.
60*4d7e907cSAndroid Build Coastguard Worker     *
61*4d7e907cSAndroid Build Coastguard Worker     * @param count The maximum number of preview buffers to allocate.
62*4d7e907cSAndroid Build Coastguard Worker     * @return status The status code for this operation.
63*4d7e907cSAndroid Build Coastguard Worker     */
64*4d7e907cSAndroid Build Coastguard Worker    setBufferCount(uint32_t count) generates (Status status);
65*4d7e907cSAndroid Build Coastguard Worker
66*4d7e907cSAndroid Build Coastguard Worker    /**
67*4d7e907cSAndroid Build Coastguard Worker     * Set the dimensions and format of future preview buffers.
68*4d7e907cSAndroid Build Coastguard Worker     *
69*4d7e907cSAndroid Build Coastguard Worker     * The next buffer that is dequeued must match the requested size and
70*4d7e907cSAndroid Build Coastguard Worker     * format.
71*4d7e907cSAndroid Build Coastguard Worker     *
72*4d7e907cSAndroid Build Coastguard Worker     * @return Status The status code for this operation.
73*4d7e907cSAndroid Build Coastguard Worker     */
74*4d7e907cSAndroid Build Coastguard Worker    setBuffersGeometry(uint32_t w, uint32_t h,
75*4d7e907cSAndroid Build Coastguard Worker            [email protected]::PixelFormat format)
76*4d7e907cSAndroid Build Coastguard Worker            generates (Status status);
77*4d7e907cSAndroid Build Coastguard Worker
78*4d7e907cSAndroid Build Coastguard Worker    /**
79*4d7e907cSAndroid Build Coastguard Worker     * Set the valid region of image data for the next buffer(s) to be enqueued.
80*4d7e907cSAndroid Build Coastguard Worker     *
81*4d7e907cSAndroid Build Coastguard Worker     * @return Status The status code for this operation.
82*4d7e907cSAndroid Build Coastguard Worker     */
83*4d7e907cSAndroid Build Coastguard Worker    setCrop(int32_t left, int32_t top, int32_t right, int32_t bottom)
84*4d7e907cSAndroid Build Coastguard Worker            generates (Status status);
85*4d7e907cSAndroid Build Coastguard Worker
86*4d7e907cSAndroid Build Coastguard Worker    /**
87*4d7e907cSAndroid Build Coastguard Worker     * Set the producer usage flags for the next buffer(s) to be enqueued.
88*4d7e907cSAndroid Build Coastguard Worker     *
89*4d7e907cSAndroid Build Coastguard Worker     * @return Status The status code for this operation.
90*4d7e907cSAndroid Build Coastguard Worker     */
91*4d7e907cSAndroid Build Coastguard Worker    setUsage(BufferUsage usage) generates (Status status);
92*4d7e907cSAndroid Build Coastguard Worker
93*4d7e907cSAndroid Build Coastguard Worker    /**
94*4d7e907cSAndroid Build Coastguard Worker     * Set the expected buffering mode for the preview output.
95*4d7e907cSAndroid Build Coastguard Worker     */
96*4d7e907cSAndroid Build Coastguard Worker    setSwapInterval(int32_t interval) generates (Status status);
97*4d7e907cSAndroid Build Coastguard Worker
98*4d7e907cSAndroid Build Coastguard Worker    /**
99*4d7e907cSAndroid Build Coastguard Worker     * Get the minimum number of buffers the preview consumer endpoint needs
100*4d7e907cSAndroid Build Coastguard Worker     * to hold for correct operation.
101*4d7e907cSAndroid Build Coastguard Worker     *
102*4d7e907cSAndroid Build Coastguard Worker     * @return Status The status code for this operation.
103*4d7e907cSAndroid Build Coastguard Worker     * @return count The number of buffers the consumer has requested.
104*4d7e907cSAndroid Build Coastguard Worker     */
105*4d7e907cSAndroid Build Coastguard Worker    getMinUndequeuedBufferCount() generates (Status status, uint32_t count);
106*4d7e907cSAndroid Build Coastguard Worker
107*4d7e907cSAndroid Build Coastguard Worker    /**
108*4d7e907cSAndroid Build Coastguard Worker     * Set the timestamp for the next buffer to enqueue
109*4d7e907cSAndroid Build Coastguard Worker     *
110*4d7e907cSAndroid Build Coastguard Worker     * Timestamps are measured in nanoseconds, and must be comparable
111*4d7e907cSAndroid Build Coastguard Worker     * and monotonically increasing between two frames in the same
112*4d7e907cSAndroid Build Coastguard Worker     * preview stream. They do not need to be comparable between
113*4d7e907cSAndroid Build Coastguard Worker     * consecutive or parallel preview streams, cameras, or app runs.
114*4d7e907cSAndroid Build Coastguard Worker     *
115*4d7e907cSAndroid Build Coastguard Worker     * @param timestamp The timestamp to set for future buffers.
116*4d7e907cSAndroid Build Coastguard Worker     * @return Status The status code for this operation.
117*4d7e907cSAndroid Build Coastguard Worker     */
118*4d7e907cSAndroid Build Coastguard Worker    setTimestamp(int64_t timestamp) generates (Status status);
119*4d7e907cSAndroid Build Coastguard Worker
120*4d7e907cSAndroid Build Coastguard Worker};
121