Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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 | //#define LOG_NDEBUG 0 |
| 18 | #define LOG_TAG "NdkCameraMetadata" |
| 19 | #define ATRACE_TAG ATRACE_TAG_CAMERA |
| 20 | |
| 21 | #include <utils/Log.h> |
| 22 | #include <utils/Trace.h> |
| 23 | |
| 24 | #include "NdkCameraMetadata.h" |
| 25 | #include "impl/ACameraMetadata.h" |
| 26 | |
| 27 | using namespace android; |
| 28 | |
| 29 | EXPORT |
| 30 | camera_status_t ACameraMetadata_getConstEntry( |
| 31 | const ACameraMetadata* acm, uint32_t tag, ACameraMetadata_const_entry* entry) { |
| 32 | ATRACE_CALL(); |
| 33 | if (acm == nullptr || entry == nullptr) { |
Yin-Chia Yeh | ead9146 | 2016-01-06 16:45:08 -0800 | [diff] [blame] | 34 | ALOGE("%s: invalid argument! metadata %p, tag 0x%x, entry %p", |
Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 35 | __FUNCTION__, acm, tag, entry); |
| 36 | return ACAMERA_ERROR_INVALID_PARAMETER; |
| 37 | } |
| 38 | return acm->getConstEntry(tag, entry); |
| 39 | } |
| 40 | |
| 41 | EXPORT |
| 42 | ACameraMetadata* ACameraMetadata_copy(const ACameraMetadata* src) { |
| 43 | ATRACE_CALL(); |
| 44 | if (src == nullptr) { |
| 45 | ALOGE("%s: src is null!", __FUNCTION__); |
| 46 | return nullptr; |
| 47 | } |
| 48 | return new ACameraMetadata(*src); |
| 49 | } |
| 50 | |
| 51 | EXPORT |
| 52 | void ACameraMetadata_free(ACameraMetadata* metadata) { |
| 53 | ATRACE_CALL(); |
| 54 | if (metadata != nullptr) { |
| 55 | delete metadata; |
| 56 | } |
| 57 | } |