blob: ff0e3d34c043e73d5652a38765500c0252a00946 [file] [log] [blame]
Jianing Weicb0652e2014-03-12 18:29:36 -07001/*
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 Talvalad56db1d2015-12-17 16:50:35 -080021#include <binder/Parcelable.h>
Jianing Weicb0652e2014-03-12 18:29:36 -070022#include <camera/CameraMetadata.h>
23
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080024
Jianing Weicb0652e2014-03-12 18:29:36 -070025namespace android {
26
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080027namespace hardware {
28namespace camera2 {
29namespace impl {
30
Jianing Weicb0652e2014-03-12 18:29:36 -070031/**
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 Talvalad56db1d2015-12-17 16:50:35 -080035struct CaptureResultExtras : public android::Parcelable {
Jianing Weicb0652e2014-03-12 18:29:36 -070036 /**
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 He204e3292014-07-14 17:09:23 -070062 * The partial result count (index) for this capture result.
63 */
64 int32_t partialResultCount;
65
66 /**
Jianing Weicb0652e2014-03-12 18:29:36 -070067 * Constructor initializes object as invalid by setting requestId to be -1.
68 */
69 CaptureResultExtras()
70 : requestId(-1),
71 burstId(0),
72 afTriggerId(0),
73 precaptureTriggerId(0),
Zhijun He204e3292014-07-14 17:09:23 -070074 frameNumber(0),
75 partialResultCount(0) {
Jianing Weicb0652e2014-03-12 18:29:36 -070076 }
77
78 /**
79 * This function returns true if it's a valid CaptureResultExtras object.
80 * Otherwise, returns false. It is valid only when requestId is non-negative.
81 */
82 bool isValid();
83
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080084 virtual status_t readFromParcel(const Parcel* parcel) override;
85 virtual status_t writeToParcel(Parcel* parcel) const override;
Jianing Weicb0652e2014-03-12 18:29:36 -070086};
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080087} // namespace impl
88} // namespace camera2
89} // namespace hardware
90
91using hardware::camera2::impl::CaptureResultExtras;
Jianing Weicb0652e2014-03-12 18:29:36 -070092
93struct CaptureResult : public virtual LightRefBase<CaptureResult> {
94 CameraMetadata mMetadata;
95 CaptureResultExtras mResultExtras;
96
97 CaptureResult();
98
99 CaptureResult(const CaptureResult& otherResult);
100
101 status_t readFromParcel(Parcel* parcel);
102 status_t writeToParcel(Parcel* parcel) const;
103};
104
105}
106
107#endif /* ANDROID_HARDWARE_CAPTURERESULT_H */