blob: 45e4518bcbaf24570d5d651db775de45240caa50 [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 /**
Eino-Ville Talvalae95bb632016-03-06 19:55:44 -080067 * 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 Weicb0652e2014-03-12 18:29:36 -070073 * 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 He204e3292014-07-14 17:09:23 -070080 frameNumber(0),
Eino-Ville Talvalae95bb632016-03-06 19:55:44 -080081 partialResultCount(0),
82 errorStreamId(-1) {
Jianing Weicb0652e2014-03-12 18:29:36 -070083 }
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 Talvalad56db1d2015-12-17 16:50:35 -080091 virtual status_t readFromParcel(const Parcel* parcel) override;
92 virtual status_t writeToParcel(Parcel* parcel) const override;
Jianing Weicb0652e2014-03-12 18:29:36 -070093};
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080094} // namespace impl
95} // namespace camera2
96} // namespace hardware
97
98using hardware::camera2::impl::CaptureResultExtras;
Jianing Weicb0652e2014-03-12 18:29:36 -070099
100struct 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 */