ICamera.h revision 3ee3550a2f529cbf56d87d8503f59a8f45dccf32
1/* 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> 23#include <binder/IMemory.h> 24#include <utils/String8.h> 25#include <camera/Camera.h> 26 27namespace android { 28 29class ICameraClient; 30class IGraphicBufferProducer; 31class Surface; 32 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 49 // pass the buffered IGraphicBufferProducer to the camera service 50 virtual status_t setPreviewTexture( 51 const sp<IGraphicBufferProducer>& bufferProducer) = 0; 52 53 // set the preview callback flag to affect how the received frames from 54 // preview are handled. Enabling preview callback flags disables any active 55 // preview callback surface set by setPreviewCallbackTarget(). 56 virtual void setPreviewCallbackFlag(int flag) = 0; 57 // set a buffer interface to use for client-received preview frames instead 58 // of preview callback buffers. Passing a valid interface here disables any 59 // active preview callbacks set by setPreviewCallbackFlag(). Passing NULL 60 // disables the use of the callback target. 61 virtual status_t setPreviewCallbackTarget( 62 const sp<IGraphicBufferProducer>& callbackProducer) = 0; 63 64 // start preview mode, must call setPreviewDisplay first 65 virtual status_t startPreview() = 0; 66 67 // stop preview mode 68 virtual void stopPreview() = 0; 69 70 // get preview state 71 virtual bool previewEnabled() = 0; 72 73 // start recording mode 74 virtual status_t startRecording() = 0; 75 76 // stop recording mode 77 virtual void stopRecording() = 0; 78 79 // get recording state 80 virtual bool recordingEnabled() = 0; 81 82 // release a recording frame 83 virtual void releaseRecordingFrame(const sp<IMemory>& mem) = 0; 84 85 // auto focus 86 virtual status_t autoFocus() = 0; 87 88 // cancel auto focus 89 virtual status_t cancelAutoFocus() = 0; 90 91 /* 92 * take a picture. 93 * @param msgType the message type an application selectively turn on/off 94 * on a photo-by-photo basis. The supported message types are: 95 * CAMERA_MSG_SHUTTER, CAMERA_MSG_RAW_IMAGE, CAMERA_MSG_COMPRESSED_IMAGE, 96 * and CAMERA_MSG_POSTVIEW_FRAME. Any other message types will be ignored. 97 */ 98 virtual status_t takePicture(int msgType) = 0; 99 100 // set preview/capture parameters - key/value pairs 101 virtual status_t setParameters(const String8& params) = 0; 102 103 // get preview/capture parameters - key/value pairs 104 virtual String8 getParameters() const = 0; 105 106 // send command to camera driver 107 virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0; 108 109 // tell the camera hal to store meta data or real YUV data in video buffers. 110 virtual status_t storeMetaDataInBuffers(bool enabled) = 0; 111}; 112 113// ---------------------------------------------------------------------------- 114 115class BnCamera: public BnInterface<ICamera> 116{ 117public: 118 virtual status_t onTransact( uint32_t code, 119 const Parcel& data, 120 Parcel* reply, 121 uint32_t flags = 0); 122}; 123 124}; // namespace android 125 126#endif 127