1*e01b6f76SAndroid Build Coastguard Worker /* 2*e01b6f76SAndroid Build Coastguard Worker * Copyright (C) 2013 The Android Open Source Project 3*e01b6f76SAndroid Build Coastguard Worker * 4*e01b6f76SAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*e01b6f76SAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*e01b6f76SAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*e01b6f76SAndroid Build Coastguard Worker * 8*e01b6f76SAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*e01b6f76SAndroid Build Coastguard Worker * 10*e01b6f76SAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*e01b6f76SAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*e01b6f76SAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*e01b6f76SAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*e01b6f76SAndroid Build Coastguard Worker * limitations under the License. 15*e01b6f76SAndroid Build Coastguard Worker */ 16*e01b6f76SAndroid Build Coastguard Worker 17*e01b6f76SAndroid Build Coastguard Worker #ifndef METADATA_H_ 18*e01b6f76SAndroid Build Coastguard Worker #define METADATA_H_ 19*e01b6f76SAndroid Build Coastguard Worker 20*e01b6f76SAndroid Build Coastguard Worker #include <stdint.h> 21*e01b6f76SAndroid Build Coastguard Worker #include <hardware/camera3.h> 22*e01b6f76SAndroid Build Coastguard Worker #include <system/camera_metadata.h> 23*e01b6f76SAndroid Build Coastguard Worker 24*e01b6f76SAndroid Build Coastguard Worker namespace default_camera_hal { 25*e01b6f76SAndroid Build Coastguard Worker // Metadata is a convenience class for dealing with libcamera_metadata 26*e01b6f76SAndroid Build Coastguard Worker class Metadata { 27*e01b6f76SAndroid Build Coastguard Worker public: 28*e01b6f76SAndroid Build Coastguard Worker Metadata(); 29*e01b6f76SAndroid Build Coastguard Worker ~Metadata(); 30*e01b6f76SAndroid Build Coastguard Worker // Initialize with framework metadata 31*e01b6f76SAndroid Build Coastguard Worker int init(const camera_metadata_t *metadata); 32*e01b6f76SAndroid Build Coastguard Worker 33*e01b6f76SAndroid Build Coastguard Worker // Parse and add an entry. Allocates and copies new storage for *data. 34*e01b6f76SAndroid Build Coastguard Worker int addUInt8(uint32_t tag, int count, const uint8_t *data); 35*e01b6f76SAndroid Build Coastguard Worker int add1UInt8(uint32_t tag, const uint8_t data); 36*e01b6f76SAndroid Build Coastguard Worker int addInt32(uint32_t tag, int count, const int32_t *data); 37*e01b6f76SAndroid Build Coastguard Worker int addFloat(uint32_t tag, int count, const float *data); 38*e01b6f76SAndroid Build Coastguard Worker int addInt64(uint32_t tag, int count, const int64_t *data); 39*e01b6f76SAndroid Build Coastguard Worker int addDouble(uint32_t tag, int count, const double *data); 40*e01b6f76SAndroid Build Coastguard Worker int addRational(uint32_t tag, int count, 41*e01b6f76SAndroid Build Coastguard Worker const camera_metadata_rational_t *data); 42*e01b6f76SAndroid Build Coastguard Worker 43*e01b6f76SAndroid Build Coastguard Worker // Get a handle to the current metadata 44*e01b6f76SAndroid Build Coastguard Worker // This is not a durable handle, and may be destroyed by add*/init 45*e01b6f76SAndroid Build Coastguard Worker camera_metadata_t* get(); 46*e01b6f76SAndroid Build Coastguard Worker 47*e01b6f76SAndroid Build Coastguard Worker private: 48*e01b6f76SAndroid Build Coastguard Worker // Actual internal storage 49*e01b6f76SAndroid Build Coastguard Worker camera_metadata_t* mData; 50*e01b6f76SAndroid Build Coastguard Worker // Destroy old metadata and replace with new 51*e01b6f76SAndroid Build Coastguard Worker void replace(camera_metadata_t *m); 52*e01b6f76SAndroid Build Coastguard Worker // Validate the tag, type and count for a metadata entry 53*e01b6f76SAndroid Build Coastguard Worker bool validate(uint32_t tag, int tag_type, int count); 54*e01b6f76SAndroid Build Coastguard Worker // Add a verified tag with data 55*e01b6f76SAndroid Build Coastguard Worker int add(uint32_t tag, int count, const void *tag_data); 56*e01b6f76SAndroid Build Coastguard Worker }; 57*e01b6f76SAndroid Build Coastguard Worker } // namespace default_camera_hal 58*e01b6f76SAndroid Build Coastguard Worker 59*e01b6f76SAndroid Build Coastguard Worker #endif // METADATA_H_ 60