Home | History | Annotate | Download | only in camera
      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      * 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),
     80           frameNumber(0),
     81           partialResultCount(0),
     82           errorStreamId(-1) {
     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 
     91     virtual status_t                readFromParcel(const Parcel* parcel) override;
     92     virtual status_t                writeToParcel(Parcel* parcel) const override;
     93 };
     94 } // namespace impl
     95 } // namespace camera2
     96 } // namespace hardware
     97 
     98 using hardware::camera2::impl::CaptureResultExtras;
     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 */
    115