blob: 2236c1fa9a92a80d7bd06ec3cd14277fb3e6ab3b [file] [log] [blame]
Mathias Agopian3cf61352010-02-09 17:46:37 -08001/*
2 * Copyright (C) 2008 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_ICAMERA_H
18#define ANDROID_HARDWARE_ICAMERA_H
19
20#include <utils/RefBase.h>
21#include <binder/IInterface.h>
22#include <binder/Parcel.h>
Mathias Agopian3cf61352010-02-09 17:46:37 -080023#include <binder/IMemory.h>
24#include <utils/String8.h>
25#include <camera/Camera.h>
26
27namespace android {
28
29class ICameraClient;
Andy McFadden484566c2012-12-18 09:46:54 -080030class IGraphicBufferProducer;
Mathias Agopiandf712ea2012-02-25 18:48:35 -080031class Surface;
Mathias Agopian3cf61352010-02-09 17:46:37 -080032
33class ICamera: public IInterface
34{
35public:
36 DECLARE_META_INTERFACE(Camera);
37
38 virtual void disconnect() = 0;
39
40 // connect new client with existing camera remote
41 virtual status_t connect(const sp<ICameraClient>& client) = 0;
42
43 // prevent other processes from using this ICamera interface
44 virtual status_t lock() = 0;
45
46 // allow other processes to use this ICamera interface
47 virtual status_t unlock() = 0;
48
Andy McFadden484566c2012-12-18 09:46:54 -080049 // pass the buffered IGraphicBufferProducer to the camera service
Jamie Gennisbfa33aa2010-12-20 11:51:31 -080050 virtual status_t setPreviewTexture(
Andy McFadden484566c2012-12-18 09:46:54 -080051 const sp<IGraphicBufferProducer>& bufferProducer) = 0;
Jamie Gennisbfa33aa2010-12-20 11:51:31 -080052
Mathias Agopian3cf61352010-02-09 17:46:37 -080053 // set the preview callback flag to affect how the received frames from
54 // preview are handled.
55 virtual void setPreviewCallbackFlag(int flag) = 0;
56
57 // start preview mode, must call setPreviewDisplay first
58 virtual status_t startPreview() = 0;
59
60 // stop preview mode
61 virtual void stopPreview() = 0;
62
63 // get preview state
64 virtual bool previewEnabled() = 0;
65
66 // start recording mode
67 virtual status_t startRecording() = 0;
68
69 // stop recording mode
James Donge468ac52011-02-17 16:38:06 -080070 virtual void stopRecording() = 0;
Mathias Agopian3cf61352010-02-09 17:46:37 -080071
72 // get recording state
73 virtual bool recordingEnabled() = 0;
74
75 // release a recording frame
76 virtual void releaseRecordingFrame(const sp<IMemory>& mem) = 0;
77
78 // auto focus
79 virtual status_t autoFocus() = 0;
80
81 // cancel auto focus
82 virtual status_t cancelAutoFocus() = 0;
83
James Donge468ac52011-02-17 16:38:06 -080084 /*
85 * take a picture.
86 * @param msgType the message type an application selectively turn on/off
87 * on a photo-by-photo basis. The supported message types are:
88 * CAMERA_MSG_SHUTTER, CAMERA_MSG_RAW_IMAGE, CAMERA_MSG_COMPRESSED_IMAGE,
89 * and CAMERA_MSG_POSTVIEW_FRAME. Any other message types will be ignored.
90 */
91 virtual status_t takePicture(int msgType) = 0;
Mathias Agopian3cf61352010-02-09 17:46:37 -080092
93 // set preview/capture parameters - key/value pairs
94 virtual status_t setParameters(const String8& params) = 0;
95
96 // get preview/capture parameters - key/value pairs
97 virtual String8 getParameters() const = 0;
98
99 // send command to camera driver
100 virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0;
James Donge2ad6732010-10-18 20:42:51 -0700101
James Donge2ad6732010-10-18 20:42:51 -0700102 // tell the camera hal to store meta data or real YUV data in video buffers.
103 virtual status_t storeMetaDataInBuffers(bool enabled) = 0;
Mathias Agopian3cf61352010-02-09 17:46:37 -0800104};
105
106// ----------------------------------------------------------------------------
107
108class BnCamera: public BnInterface<ICamera>
109{
110public:
111 virtual status_t onTransact( uint32_t code,
112 const Parcel& data,
113 Parcel* reply,
114 uint32_t flags = 0);
115};
116
117}; // namespace android
118
119#endif