/* * Copyright (c) 2025-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include "camera_log.h" #include "camera_metadata.h" namespace OHOS { namespace CameraStandard { std::shared_ptr CopyMetadata( const std::shared_ptr srcMetadata) { CHECK_RETURN_RET_ELOG(srcMetadata == nullptr, nullptr, "CopyMetadata fail,src is null"); auto oldMetadata = srcMetadata->get(); CHECK_RETURN_RET(oldMetadata == nullptr, nullptr); std::shared_ptr result = std::make_shared(oldMetadata->item_capacity, oldMetadata->data_capacity); auto newMetadata = result->get(); int32_t ret = OHOS::Camera::CopyCameraMetadataItems(newMetadata, oldMetadata); CHECK_PRINT_ELOG(ret != CAM_META_SUCCESS, "CopyCameraMetadataItems failed ret:%{public}d", ret); return result; } std::shared_ptr GetMetadataItem(const common_metadata_header_t* src, uint32_t tag) { CHECK_RETURN_RET(src == nullptr, nullptr); auto item = std::make_shared(); int32_t ret = OHOS::Camera::CameraMetadata::FindCameraMetadataItem(src, tag, item.get()); CHECK_RETURN_RET(ret != CAM_META_SUCCESS, nullptr); return item; } } // namespace CameraStandard } // namespace OHOS