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> 21 #include <binder/Parcelable.h> 22 #include <camera/CameraMetadata.h> 23 24 25 namespace android { 26 27 namespace hardware { 28 namespace camera2 { 29 namespace impl { 30 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 */ 35 struct CaptureResultExtras : public android::Parcelable { 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 /** 62 * The partial result count (index) for this capture result. 63 */ 64 int32_t partialResultCount; 65 66 /** 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 /** 73 * For capture result errors, the physical camera ID in case the respective request contains 74 * a reference to physical camera device. 75 * Empty otherwise. 76 */ 77 String16 errorPhysicalCameraId; 78 79 /** 80 * Constructor initializes object as invalid by setting requestId to be -1. 81 */ CaptureResultExtrasCaptureResultExtras82 CaptureResultExtras() 83 : requestId(-1), 84 burstId(0), 85 afTriggerId(0), 86 precaptureTriggerId(0), 87 frameNumber(0), 88 partialResultCount(0), 89 errorStreamId(-1), 90 errorPhysicalCameraId() { 91 } 92 93 /** 94 * This function returns true if it's a valid CaptureResultExtras object. 95 * Otherwise, returns false. It is valid only when requestId is non-negative. 96 */ 97 bool isValid(); 98 99 virtual status_t readFromParcel(const android::Parcel* parcel) override; 100 virtual status_t writeToParcel(android::Parcel* parcel) const override; 101 }; 102 103 struct PhysicalCaptureResultInfo : public android::Parcelable { 104 PhysicalCaptureResultInfoPhysicalCaptureResultInfo105 PhysicalCaptureResultInfo() 106 : mPhysicalCameraId(), 107 mPhysicalCameraMetadata() { 108 } PhysicalCaptureResultInfoPhysicalCaptureResultInfo109 PhysicalCaptureResultInfo(const String16& cameraId, 110 const CameraMetadata& cameraMetadata) 111 : mPhysicalCameraId(cameraId), 112 mPhysicalCameraMetadata(cameraMetadata) { 113 } 114 115 String16 mPhysicalCameraId; 116 CameraMetadata mPhysicalCameraMetadata; 117 118 virtual status_t readFromParcel(const android::Parcel* parcel) override; 119 virtual status_t writeToParcel(android::Parcel* parcel) const override; 120 }; 121 122 } // namespace impl 123 } // namespace camera2 124 } // namespace hardware 125 126 using hardware::camera2::impl::CaptureResultExtras; 127 using hardware::camera2::impl::PhysicalCaptureResultInfo; 128 129 struct CaptureResult : public virtual LightRefBase<CaptureResult> { 130 CameraMetadata mMetadata; 131 std::vector<PhysicalCaptureResultInfo> mPhysicalMetadatas; 132 CaptureResultExtras mResultExtras; 133 134 CaptureResult(); 135 136 CaptureResult(const CaptureResult& otherResult); 137 138 status_t readFromParcel(android::Parcel* parcel); 139 status_t writeToParcel(android::Parcel* parcel) const; 140 }; 141 142 } 143 144 #endif /* ANDROID_HARDWARE_CAPTURERESULT_H */ 145