blob: b69e075995eb9d64a2fdbbf44f76d36ec0dc2283 [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>
Jamie Gennis4b791682010-08-10 16:37:53 -070023#include <surfaceflinger/Surface.h>
Mathias Agopian3cf61352010-02-09 17:46:37 -080024#include <binder/IMemory.h>
25#include <utils/String8.h>
26#include <camera/Camera.h>
27
28namespace android {
29
30class ICameraClient;
31
32class ICamera: public IInterface
33{
34public:
35 DECLARE_META_INTERFACE(Camera);
36
37 virtual void disconnect() = 0;
38
39 // connect new client with existing camera remote
40 virtual status_t connect(const sp<ICameraClient>& client) = 0;
41
42 // prevent other processes from using this ICamera interface
43 virtual status_t lock() = 0;
44
45 // allow other processes to use this ICamera interface
46 virtual status_t unlock() = 0;
47
Jamie Gennis4b791682010-08-10 16:37:53 -070048 // pass the buffered Surface to the camera service
49 virtual status_t setPreviewDisplay(const sp<Surface>& surface) = 0;
Mathias Agopian3cf61352010-02-09 17:46:37 -080050
51 // set the preview callback flag to affect how the received frames from
52 // preview are handled.
53 virtual void setPreviewCallbackFlag(int flag) = 0;
54
55 // start preview mode, must call setPreviewDisplay first
56 virtual status_t startPreview() = 0;
57
58 // stop preview mode
59 virtual void stopPreview() = 0;
60
61 // get preview state
62 virtual bool previewEnabled() = 0;
63
64 // start recording mode
65 virtual status_t startRecording() = 0;
66
67 // stop recording mode
68 virtual void stopRecording() = 0;
69
70 // get recording state
71 virtual bool recordingEnabled() = 0;
72
73 // release a recording frame
74 virtual void releaseRecordingFrame(const sp<IMemory>& mem) = 0;
75
76 // auto focus
77 virtual status_t autoFocus() = 0;
78
79 // cancel auto focus
80 virtual status_t cancelAutoFocus() = 0;
81
82 // take a picture
83 virtual status_t takePicture() = 0;
84
85 // set preview/capture parameters - key/value pairs
86 virtual status_t setParameters(const String8& params) = 0;
87
88 // get preview/capture parameters - key/value pairs
89 virtual String8 getParameters() const = 0;
90
91 // send command to camera driver
92 virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0;
James Donge2ad6732010-10-18 20:42:51 -070093
94 // return the total number of available video buffers
95 virtual int32_t getNumberOfVideoBuffers() const = 0;
96
97 // return the individual video buffer corresponding to the given index.
98 virtual sp<IMemory> getVideoBuffer(int32_t index) const = 0;
99
100 // tell the camera hal to store meta data or real YUV data in video buffers.
101 virtual status_t storeMetaDataInBuffers(bool enabled) = 0;
Mathias Agopian3cf61352010-02-09 17:46:37 -0800102};
103
104// ----------------------------------------------------------------------------
105
106class BnCamera: public BnInterface<ICamera>
107{
108public:
109 virtual status_t onTransact( uint32_t code,
110 const Parcel& data,
111 Parcel* reply,
112 uint32_t flags = 0);
113};
114
115}; // namespace android
116
117#endif