summaryrefslogtreecommitdiffstats
path: root/include/camera/camera2/ICameraDeviceUser.h
blob: 913696f4f1ce4278ac598ef0c2bd321d277aa631 (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) 2013 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.
 */

#ifndef ANDROID_HARDWARE_PHOTOGRAPHY_ICAMERADEVICEUSER_H
#define ANDROID_HARDWARE_PHOTOGRAPHY_ICAMERADEVICEUSER_H

#include <binder/IInterface.h>
#include <binder/Parcel.h>
#include <utils/List.h>

struct camera_metadata;

namespace android {

class ICameraDeviceUserClient;
class IGraphicBufferProducer;
class Surface;
class CaptureRequest;
class CameraMetadata;

enum {
    NO_IN_FLIGHT_REPEATING_FRAMES = -1,
};

class ICameraDeviceUser : public IInterface
{
    /**
     * Keep up-to-date with ICameraDeviceUser.aidl in frameworks/base
     */
public:
    DECLARE_META_INTERFACE(CameraDeviceUser);

    virtual void            disconnect() = 0;

    /**
     * Request Handling
     **/

    /**
     * For streaming requests, output lastFrameNumber is the last frame number
     * of the previous repeating request.
     * For non-streaming requests, output lastFrameNumber is the expected last
     * frame number of the current request.
     */
    virtual int             submitRequest(sp<CaptureRequest> request,
                                          bool streaming = false,
                                          /*out*/
                                          int64_t* lastFrameNumber = NULL) = 0;

    /**
     * For streaming requests, output lastFrameNumber is the last frame number
     * of the previous repeating request.
     * For non-streaming requests, output lastFrameNumber is the expected last
     * frame number of the current request.
     */
    virtual int             submitRequestList(List<sp<CaptureRequest> > requestList,
                                              bool streaming = false,
                                              /*out*/
                                              int64_t* lastFrameNumber = NULL) = 0;

    /**
     * Output lastFrameNumber is the last frame number of the previous repeating request.
     */
    virtual status_t        cancelRequest(int requestId,
                                          /*out*/
                                          int64_t* lastFrameNumber = NULL) = 0;

    virtual status_t        deleteStream(int streamId) = 0;
    virtual status_t        createStream(
            int width, int height, int format,
            const sp<IGraphicBufferProducer>& bufferProducer) = 0;

    // Create a request object from a template.
    virtual status_t        createDefaultRequest(int templateId,
                                                 /*out*/
                                                 CameraMetadata* request) = 0;
    // Get static camera metadata
    virtual status_t        getCameraInfo(/*out*/
                                          CameraMetadata* info) = 0;

    // Wait until all the submitted requests have finished processing
    virtual status_t        waitUntilIdle() =  0;

    /**
     * Flush all pending and in-progress work as quickly as possible.
     * Output lastFrameNumber is the last frame number of the previous repeating request.
     */
    virtual status_t        flush(/*out*/
                                  int64_t* lastFrameNumber = NULL) = 0;
};

// ----------------------------------------------------------------------------

class BnCameraDeviceUser: public BnInterface<ICameraDeviceUser>
{
public:
    virtual status_t    onTransact( uint32_t code,
                                    const Parcel& data,
                                    Parcel* reply,
                                    uint32_t flags = 0);
};

}; // namespace android

#endif