blob: a1417691343e8f0ca0bdb2c1d42cec9ad4c3f9c9 [file] [log] [blame]
Igor Murashkin634a5152013-02-20 17:15:11 -08001/*
2 * Copyright (C) 2013 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 ANDROID_HARDWARE_IPROCAMERAUSER_H
18#define ANDROID_HARDWARE_IPROCAMERAUSER_H
19
20#include <utils/RefBase.h>
21#include <binder/IInterface.h>
22#include <binder/Parcel.h>
23#include <binder/IMemory.h>
24#include <utils/String8.h>
25#include <camera/IProCameraCallbacks.h>
26
27struct camera_metadata;
28
29namespace android {
30
31class IProCameraUserClient;
32class IGraphicBufferProducer;
33class Surface;
34
35class IProCameraUser: public IInterface
36{
37public:
38 DECLARE_META_INTERFACE(ProCameraUser);
39
40 virtual void disconnect() = 0;
41
42 // connect to the service, given a callbacks listener
43 virtual status_t connect(const sp<IProCameraCallbacks>& callbacks)
44 = 0;
45
46 /**
47 * Locking
48 **/
49 virtual status_t exclusiveTryLock() = 0;
50 virtual status_t exclusiveLock() = 0;
51 virtual status_t exclusiveUnlock() = 0;
52
53 virtual bool hasExclusiveLock() = 0;
54
55 /**
56 * Request Handling
57 **/
58
59 // Note that the callee gets a copy of the metadata.
60 virtual int submitRequest(struct camera_metadata* metadata,
61 bool streaming = false) = 0;
62 virtual status_t cancelRequest(int requestId) = 0;
63
64 virtual status_t requestStream(int streamId) = 0;
65 virtual status_t cancelStream(int streamId) = 0;
Igor Murashkin76f8b432013-02-20 19:15:15 -080066 virtual status_t createStream(
67 int width, int height, int format,
68 const sp<IGraphicBufferProducer>& bufferProducer,
69 /*out*/
70 int* streamId) = 0;
Igor Murashkin985fd302013-02-20 18:24:43 -080071
72 // Create a request object from a template.
73 virtual status_t createDefaultRequest(int templateId,
74 /*out*/
75 camera_metadata** request)
76 = 0;
Igor Murashkin634a5152013-02-20 17:15:11 -080077
78};
79
80// ----------------------------------------------------------------------------
81
82class BnProCameraUser: public BnInterface<IProCameraUser>
83{
84public:
85 virtual status_t onTransact( uint32_t code,
86 const Parcel& data,
87 Parcel* reply,
88 uint32_t flags = 0);
89};
90
91}; // namespace android
92
93#endif