summaryrefslogtreecommitdiffstats
path: root/camera/device/1.0/ICameraDevicePreviewCallback.hal
blob: ebc74604b6ac8cf68b2408aecd2f08805b0d4780 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.camera.device@1.0;

import android.hardware.camera.common@1.0::types;
import android.hardware.graphics.allocator@2.0::types;
import android.hardware.graphics.common@1.0::types;

/**
 * Camera device HAL@1.0 preview stream operation interface.
 */
interface ICameraDevicePreviewCallback {

    /**
     * Acquire a buffer to write a preview buffer into.
     *
     * @return status The status code for this operation. If not OK, then
     *     buffer and stride must not be used.
     * @return buffer A handle to the buffer to write into.
     * @return stride The stride between two rows of pixels in this buffer.
     */
    dequeueBuffer() generates (Status status, handle buffer, uint32_t stride);

    /**
     * Send a filled preview buffer to its consumer.
     *
     * @param buffer The handle to the preview buffer that's been filled.
     * @return status The status code for this operation.
     */
    enqueueBuffer(handle buffer) generates (Status status);

    /**
     * Return a preview buffer unfilled. This buffer must not be sent on to the
     * preview consumer as a valid buffer, but may be reused as if it were
     * empty.
     *
     * @param buffer The handle to the preview buffer to return.
     * @return status The status code for this operation.
     */
    cancelBuffer(handle buffer) generates (Status status);

    /**
     * Set the number of preview buffers needed by the HAL.
     *
     * @param count The maximum number of preview buffers to allocate.
     * @return status The status code for this operation.
     */
    setBufferCount(uint32_t count) generates (Status status);

    /**
     * Set the dimensions and format of future preview buffers.
     *
     * The next buffer that is dequeued must match the requested size and
     * format.
     *
     * @return Status The status code for this operation.
     */
    setBuffersGeometry(uint32_t w, uint32_t h,
            android.hardware.graphics.common@1.0::PixelFormat format)
            generates (Status status);

    /**
     * Set the valid region of image data for the next buffer(s) to be enqueued.
     *
     * @return Status The status code for this operation.
     */
    setCrop(int32_t left, int32_t top, int32_t right, int32_t bottom)
            generates (Status status);

    /**
     * Set the producer usage flags for the next buffer(s) to be enqueued.
     *
     * @return Status The status code for this operation.
     */
    setUsage(ProducerUsage usage) generates (Status status);

    /**
     * Set the expected buffering mode for the preview output.
     */
    setSwapInterval(int32_t interval) generates (Status status);

    /**
     * Get the minimum number of buffers the preview consumer endpoint needs
     * to hold for correct operation.
     *
     * @return Status The status code for this operation.
     * @return count The number of buffers the consumer has requested.
     */
    getMinUndequeuedBufferCount() generates (Status status, uint32_t count);

    /**
     * Set the timestamp for the next buffer to enqueue
     *
     * Timestamps are measured in nanoseconds, and must be comparable
     * and monotonically increasing between two frames in the same
     * preview stream. They do not need to be comparable between
     * consecutive or parallel preview streams, cameras, or app runs.
     *
     * @param timestamp The timestamp to set for future buffers.
     * @return Status The status code for this operation.
     */
    setTimestamp(int64_t timestamp) generates (Status status);

};