Igor Murashkin | e7ee763 | 2013-06-11 18:10:18 -0700 | [diff] [blame] | 1 | /* |
| 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_PHOTOGRAPHY_ICAMERADEVICEUSER_H |
| 18 | #define ANDROID_HARDWARE_PHOTOGRAPHY_ICAMERADEVICEUSER_H |
| 19 | |
| 20 | #include <binder/IInterface.h> |
| 21 | #include <binder/Parcel.h> |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 22 | #include <utils/List.h> |
Igor Murashkin | e7ee763 | 2013-06-11 18:10:18 -0700 | [diff] [blame] | 23 | |
| 24 | struct camera_metadata; |
| 25 | |
| 26 | namespace android { |
| 27 | |
| 28 | class ICameraDeviceUserClient; |
| 29 | class IGraphicBufferProducer; |
| 30 | class Surface; |
| 31 | class CaptureRequest; |
| 32 | class CameraMetadata; |
| 33 | |
Jianing Wei | 2d6bb3f | 2014-04-11 10:00:31 -0700 | [diff] [blame] | 34 | enum { |
| 35 | NO_IN_FLIGHT_REPEATING_FRAMES = -1, |
| 36 | }; |
| 37 | |
Igor Murashkin | e7ee763 | 2013-06-11 18:10:18 -0700 | [diff] [blame] | 38 | class ICameraDeviceUser : public IInterface |
| 39 | { |
| 40 | /** |
| 41 | * Keep up-to-date with ICameraDeviceUser.aidl in frameworks/base |
| 42 | */ |
| 43 | public: |
| 44 | DECLARE_META_INTERFACE(CameraDeviceUser); |
| 45 | |
| 46 | virtual void disconnect() = 0; |
| 47 | |
| 48 | /** |
| 49 | * Request Handling |
| 50 | **/ |
| 51 | |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 52 | /** |
| 53 | * For streaming requests, output lastFrameNumber is the last frame number |
| 54 | * of the previous repeating request. |
| 55 | * For non-streaming requests, output lastFrameNumber is the expected last |
| 56 | * frame number of the current request. |
| 57 | */ |
Igor Murashkin | e7ee763 | 2013-06-11 18:10:18 -0700 | [diff] [blame] | 58 | virtual int submitRequest(sp<CaptureRequest> request, |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 59 | bool streaming = false, |
| 60 | /*out*/ |
| 61 | int64_t* lastFrameNumber = NULL) = 0; |
| 62 | |
| 63 | /** |
| 64 | * For streaming requests, output lastFrameNumber is the last frame number |
| 65 | * of the previous repeating request. |
| 66 | * For non-streaming requests, output lastFrameNumber is the expected last |
| 67 | * frame number of the current request. |
| 68 | */ |
| 69 | virtual int submitRequestList(List<sp<CaptureRequest> > requestList, |
| 70 | bool streaming = false, |
| 71 | /*out*/ |
| 72 | int64_t* lastFrameNumber = NULL) = 0; |
| 73 | |
| 74 | /** |
| 75 | * Output lastFrameNumber is the last frame number of the previous repeating request. |
| 76 | */ |
| 77 | virtual status_t cancelRequest(int requestId, |
| 78 | /*out*/ |
| 79 | int64_t* lastFrameNumber = NULL) = 0; |
Igor Murashkin | e7ee763 | 2013-06-11 18:10:18 -0700 | [diff] [blame] | 80 | |
| 81 | virtual status_t deleteStream(int streamId) = 0; |
| 82 | virtual status_t createStream( |
| 83 | int width, int height, int format, |
| 84 | const sp<IGraphicBufferProducer>& bufferProducer) = 0; |
| 85 | |
| 86 | // Create a request object from a template. |
| 87 | virtual status_t createDefaultRequest(int templateId, |
| 88 | /*out*/ |
| 89 | CameraMetadata* request) = 0; |
| 90 | // Get static camera metadata |
Igor Murashkin | 099b457 | 2013-07-12 17:52:16 -0700 | [diff] [blame] | 91 | virtual status_t getCameraInfo(/*out*/ |
| 92 | CameraMetadata* info) = 0; |
Igor Murashkin | e7ee763 | 2013-06-11 18:10:18 -0700 | [diff] [blame] | 93 | |
Zhijun He | 2ab500c | 2013-07-23 08:02:53 -0700 | [diff] [blame] | 94 | // Wait until all the submitted requests have finished processing |
| 95 | virtual status_t waitUntilIdle() = 0; |
Eino-Ville Talvala | abaa51d | 2013-08-14 11:37:00 -0700 | [diff] [blame] | 96 | |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 97 | /** |
| 98 | * Flush all pending and in-progress work as quickly as possible. |
| 99 | * Output lastFrameNumber is the last frame number of the previous repeating request. |
| 100 | */ |
| 101 | virtual status_t flush(/*out*/ |
| 102 | int64_t* lastFrameNumber = NULL) = 0; |
Igor Murashkin | e7ee763 | 2013-06-11 18:10:18 -0700 | [diff] [blame] | 103 | }; |
| 104 | |
| 105 | // ---------------------------------------------------------------------------- |
| 106 | |
| 107 | class BnCameraDeviceUser: public BnInterface<ICameraDeviceUser> |
| 108 | { |
| 109 | public: |
| 110 | virtual status_t onTransact( uint32_t code, |
| 111 | const Parcel& data, |
| 112 | Parcel* reply, |
| 113 | uint32_t flags = 0); |
| 114 | }; |
| 115 | |
| 116 | }; // namespace android |
| 117 | |
| 118 | #endif |