1cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei/* 2cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * Copyright (C) 2014 The Android Open Source Project 3cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * 4cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * Licensed under the Apache License, Version 2.0 (the "License"); 5cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * you may not use this file except in compliance with the License. 6cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * You may obtain a copy of the License at 7cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * 8cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * http://www.apache.org/licenses/LICENSE-2.0 9cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * 10cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * Unless required by applicable law or agreed to in writing, software 11cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * distributed under the License is distributed on an "AS IS" BASIS, 12cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * See the License for the specific language governing permissions and 14cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * limitations under the License. 15cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei */ 16cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 17cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei#ifndef ANDROID_HARDWARE_CAPTURERESULT_H 18cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei#define ANDROID_HARDWARE_CAPTURERESULT_H 19cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 20cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei#include <utils/RefBase.h> 21d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala#include <binder/Parcelable.h> 22cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei#include <camera/CameraMetadata.h> 23cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 24d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala 25cb0652e5a850b2fcd919e977247e87239efaf70eJianing Weinamespace android { 26cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 27d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvalanamespace hardware { 28d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvalanamespace camera2 { 29d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvalanamespace impl { 30d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala 31cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei/** 32cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * CaptureResultExtras is a structure to encapsulate various indices for a capture result. 33cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * These indices are framework-internal and not sent to the HAL. 34cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei */ 35d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvalastruct CaptureResultExtras : public android::Parcelable { 36cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei /** 37cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * An integer to index the request sequence that this result belongs to. 38cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei */ 39cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei int32_t requestId; 40cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 41cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei /** 42cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * An integer to index this result inside a request sequence, starting from 0. 43cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei */ 44cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei int32_t burstId; 45cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 46cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei /** 47cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * TODO: Add documentation for this field. 48cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei */ 49cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei int32_t afTriggerId; 50cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 51cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei /** 52cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * TODO: Add documentation for this field. 53cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei */ 54cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei int32_t precaptureTriggerId; 55cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 56cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei /** 57cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * A 64bit integer to index the frame number associated with this result. 58cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei */ 59cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei int64_t frameNumber; 60cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 61cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei /** 62204e3295e2814052aef7e45ee9edd60128efbbd0Zhijun He * The partial result count (index) for this capture result. 63204e3295e2814052aef7e45ee9edd60128efbbd0Zhijun He */ 64204e3295e2814052aef7e45ee9edd60128efbbd0Zhijun He int32_t partialResultCount; 65204e3295e2814052aef7e45ee9edd60128efbbd0Zhijun He 66204e3295e2814052aef7e45ee9edd60128efbbd0Zhijun He /** 67e95bb6312b972117a0ee70eabf78fcd118018f61Eino-Ville Talvala * For buffer drop errors, the stream ID for the stream that lost a buffer. 68e95bb6312b972117a0ee70eabf78fcd118018f61Eino-Ville Talvala * Otherwise -1. 69e95bb6312b972117a0ee70eabf78fcd118018f61Eino-Ville Talvala */ 70e95bb6312b972117a0ee70eabf78fcd118018f61Eino-Ville Talvala int32_t errorStreamId; 71e95bb6312b972117a0ee70eabf78fcd118018f61Eino-Ville Talvala 72e95bb6312b972117a0ee70eabf78fcd118018f61Eino-Ville Talvala /** 73cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * Constructor initializes object as invalid by setting requestId to be -1. 74cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei */ 75cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei CaptureResultExtras() 76cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei : requestId(-1), 77cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei burstId(0), 78cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei afTriggerId(0), 79cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei precaptureTriggerId(0), 80204e3295e2814052aef7e45ee9edd60128efbbd0Zhijun He frameNumber(0), 81e95bb6312b972117a0ee70eabf78fcd118018f61Eino-Ville Talvala partialResultCount(0), 82e95bb6312b972117a0ee70eabf78fcd118018f61Eino-Ville Talvala errorStreamId(-1) { 83cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei } 84cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 85cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei /** 86cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * This function returns true if it's a valid CaptureResultExtras object. 87cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei * Otherwise, returns false. It is valid only when requestId is non-negative. 88cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei */ 89cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei bool isValid(); 90cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 91d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala virtual status_t readFromParcel(const Parcel* parcel) override; 92d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala virtual status_t writeToParcel(Parcel* parcel) const override; 93cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei}; 94d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala} // namespace impl 95d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala} // namespace camera2 96d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala} // namespace hardware 97d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala 98d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvalausing hardware::camera2::impl::CaptureResultExtras; 99cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 100cb0652e5a850b2fcd919e977247e87239efaf70eJianing Weistruct CaptureResult : public virtual LightRefBase<CaptureResult> { 101cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei CameraMetadata mMetadata; 102cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei CaptureResultExtras mResultExtras; 103cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 104cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei CaptureResult(); 105cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 106cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei CaptureResult(const CaptureResult& otherResult); 107cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 108cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei status_t readFromParcel(Parcel* parcel); 109cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei status_t writeToParcel(Parcel* parcel) const; 110cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei}; 111cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 112cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei} 113cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei 114cb0652e5a850b2fcd919e977247e87239efaf70eJianing Wei#endif /* ANDROID_HARDWARE_CAPTURERESULT_H */ 115