2 * Copyright (C) 2014 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #define LOG_TAG "Camera-CaptureResult"
18 #include <utils/Log.h>
20 #include <camera/CaptureResult.h>
21 #include <binder/Parcel.h>
25 bool CaptureResultExtras::isValid() {
26 return requestId >= 0;
29 status_t CaptureResultExtras::readFromParcel(const Parcel *parcel) {
31 ALOGE("%s: Null parcel", __FUNCTION__);
35 parcel->readInt32(&requestId);
36 parcel->readInt32(&burstId);
37 parcel->readInt32(&afTriggerId);
38 parcel->readInt32(&precaptureTriggerId);
39 parcel->readInt64(&frameNumber);
40 parcel->readInt32(&partialResultCount);
41 parcel->readInt32(&errorStreamId);
46 status_t CaptureResultExtras::writeToParcel(Parcel *parcel) const {
48 ALOGE("%s: Null parcel", __FUNCTION__);
52 parcel->writeInt32(requestId);
53 parcel->writeInt32(burstId);
54 parcel->writeInt32(afTriggerId);
55 parcel->writeInt32(precaptureTriggerId);
56 parcel->writeInt64(frameNumber);
57 parcel->writeInt32(partialResultCount);
58 parcel->writeInt32(errorStreamId);
63 CaptureResult::CaptureResult() :
64 mMetadata(), mResultExtras() {
67 CaptureResult::CaptureResult(const CaptureResult &otherResult) {
68 mResultExtras = otherResult.mResultExtras;
69 mMetadata = otherResult.mMetadata;
72 status_t CaptureResult::readFromParcel(Parcel *parcel) {
74 ALOGV("%s: parcel = %p", __FUNCTION__, parcel);
77 ALOGE("%s: parcel is null", __FUNCTION__);
84 res = mMetadata.readFromParcel(parcel);
86 ALOGE("%s: Failed to read metadata from parcel.",
90 ALOGV("%s: Read metadata from parcel", __FUNCTION__);
92 res = mResultExtras.readFromParcel(parcel);
94 ALOGE("%s: Failed to read result extras from parcel.",
98 ALOGV("%s: Read result extras from parcel", __FUNCTION__);
103 status_t CaptureResult::writeToParcel(Parcel *parcel) const {
105 ALOGV("%s: parcel = %p", __FUNCTION__, parcel);
107 if (parcel == NULL) {
108 ALOGE("%s: parcel is null", __FUNCTION__);
114 res = mMetadata.writeToParcel(parcel);
116 ALOGE("%s: Failed to write metadata to parcel", __FUNCTION__);
119 ALOGV("%s: Wrote metadata to parcel", __FUNCTION__);
121 res = mResultExtras.writeToParcel(parcel);
123 ALOGE("%s: Failed to write result extras to parcel", __FUNCTION__);
126 ALOGV("%s: Wrote result extras to parcel", __FUNCTION__);