Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 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_CAPTURERESULT_H |
| 18 | #define ANDROID_HARDWARE_CAPTURERESULT_H |
| 19 | |
| 20 | #include <utils/RefBase.h> |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 21 | #include <binder/Parcelable.h> |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 22 | #include <camera/CameraMetadata.h> |
| 23 | |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 24 | |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 25 | namespace android { |
| 26 | |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 27 | namespace hardware { |
| 28 | namespace camera2 { |
| 29 | namespace impl { |
| 30 | |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 31 | /** |
| 32 | * CaptureResultExtras is a structure to encapsulate various indices for a capture result. |
| 33 | * These indices are framework-internal and not sent to the HAL. |
| 34 | */ |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 35 | struct CaptureResultExtras : public android::Parcelable { |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 36 | /** |
| 37 | * An integer to index the request sequence that this result belongs to. |
| 38 | */ |
| 39 | int32_t requestId; |
| 40 | |
| 41 | /** |
| 42 | * An integer to index this result inside a request sequence, starting from 0. |
| 43 | */ |
| 44 | int32_t burstId; |
| 45 | |
| 46 | /** |
| 47 | * TODO: Add documentation for this field. |
| 48 | */ |
| 49 | int32_t afTriggerId; |
| 50 | |
| 51 | /** |
| 52 | * TODO: Add documentation for this field. |
| 53 | */ |
| 54 | int32_t precaptureTriggerId; |
| 55 | |
| 56 | /** |
| 57 | * A 64bit integer to index the frame number associated with this result. |
| 58 | */ |
| 59 | int64_t frameNumber; |
| 60 | |
| 61 | /** |
Zhijun He | 204e329 | 2014-07-14 17:09:23 -0700 | [diff] [blame] | 62 | * The partial result count (index) for this capture result. |
| 63 | */ |
| 64 | int32_t partialResultCount; |
| 65 | |
| 66 | /** |
Eino-Ville Talvala | e95bb63 | 2016-03-06 19:55:44 -0800 | [diff] [blame] | 67 | * For buffer drop errors, the stream ID for the stream that lost a buffer. |
| 68 | * Otherwise -1. |
| 69 | */ |
| 70 | int32_t errorStreamId; |
| 71 | |
| 72 | /** |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 73 | * Constructor initializes object as invalid by setting requestId to be -1. |
| 74 | */ |
| 75 | CaptureResultExtras() |
| 76 | : requestId(-1), |
| 77 | burstId(0), |
| 78 | afTriggerId(0), |
| 79 | precaptureTriggerId(0), |
Zhijun He | 204e329 | 2014-07-14 17:09:23 -0700 | [diff] [blame] | 80 | frameNumber(0), |
Eino-Ville Talvala | e95bb63 | 2016-03-06 19:55:44 -0800 | [diff] [blame] | 81 | partialResultCount(0), |
| 82 | errorStreamId(-1) { |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | /** |
| 86 | * This function returns true if it's a valid CaptureResultExtras object. |
| 87 | * Otherwise, returns false. It is valid only when requestId is non-negative. |
| 88 | */ |
| 89 | bool isValid(); |
| 90 | |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 91 | virtual status_t readFromParcel(const Parcel* parcel) override; |
| 92 | virtual status_t writeToParcel(Parcel* parcel) const override; |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 93 | }; |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 94 | } // namespace impl |
| 95 | } // namespace camera2 |
| 96 | } // namespace hardware |
| 97 | |
| 98 | using hardware::camera2::impl::CaptureResultExtras; |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 99 | |
| 100 | struct CaptureResult : public virtual LightRefBase<CaptureResult> { |
| 101 | CameraMetadata mMetadata; |
| 102 | CaptureResultExtras mResultExtras; |
| 103 | |
| 104 | CaptureResult(); |
| 105 | |
| 106 | CaptureResult(const CaptureResult& otherResult); |
| 107 | |
| 108 | status_t readFromParcel(Parcel* parcel); |
| 109 | status_t writeToParcel(Parcel* parcel) const; |
| 110 | }; |
| 111 | |
| 112 | } |
| 113 | |
| 114 | #endif /* ANDROID_HARDWARE_CAPTURERESULT_H */ |