1f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk/* 2f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * Copyright 2014 The Android Open Source Project 3f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * 4f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * Licensed under the Apache License, Version 2.0 (the "License"); 5f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * you may not use this file except in compliance with the License. 6f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * You may obtain a copy of the License at 7f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * 8f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * http://www.apache.org/licenses/LICENSE-2.0 9f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * 10f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * Unless required by applicable law or agreed to in writing, software 11f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * distributed under the License is distributed on an "AS IS" BASIS, 12f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * See the License for the specific language governing permissions and 14f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * limitations under the License. 15f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk */ 16f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk 17f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk#ifndef SYSTEM_MEDIA_INCLUDE_ANDROID_CAMERA_VENDOR_TAGS_H 18f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk#define SYSTEM_MEDIA_INCLUDE_ANDROID_CAMERA_VENDOR_TAGS_H 19f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk 20f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk#ifdef __cplusplus 21f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunkextern "C" { 22f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk#endif 23f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk 24f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk#define CAMERA_METADATA_VENDOR_TAG_BOUNDARY 0x80000000u 25a26996379965c552df9001618afce4d02b659abbEmilian Peev#define CAMERA_METADATA_INVALID_VENDOR_ID UINT64_MAX 26a26996379965c552df9001618afce4d02b659abbEmilian Peev 27a26996379965c552df9001618afce4d02b659abbEmilian Peevtypedef uint64_t metadata_vendor_id_t; 28f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk 29f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk/** 30f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * Vendor tags: 31f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * 32f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * This structure contains basic functions for enumerating an immutable set of 33f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * vendor-defined camera metadata tags, and querying static information about 34f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * their structure/type. The intended use of this information is to validate 35f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * the structure of metadata returned by the camera HAL, and to allow vendor- 36f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * defined metadata tags to be visible in application facing camera API. 37f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk */ 38f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunktypedef struct vendor_tag_ops vendor_tag_ops_t; 39f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunkstruct vendor_tag_ops { 40f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk /** 41f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * Get the number of vendor tags supported on this platform. Used to 42f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * calculate the size of buffer needed for holding the array of all tags 439c13e191ea2d9622d00621d6acb009a9a759dc92Ruben Brunk * returned by get_all_tags(). This must return -1 on error. 44f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk */ 45f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk int (*get_tag_count)(const vendor_tag_ops_t *v); 46f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk 47f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk /** 48f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * Fill an array with all of the supported vendor tags on this platform. 49f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * get_tag_count() must return the number of tags supported, and 50f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * tag_array will be allocated with enough space to hold the number of tags 51f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * returned by get_tag_count(). 52f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk */ 53f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk void (*get_all_tags)(const vendor_tag_ops_t *v, uint32_t *tag_array); 54f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk 55f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk /** 56f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * Get the vendor section name for a vendor-specified entry tag. This will 57f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * only be called for vendor-defined tags. 58f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * 59f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * The naming convention for the vendor-specific section names should 60f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * follow a style similar to the Java package style. For example, 61f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * CameraZoom Inc. must prefix their sections with "com.camerazoom." 629c13e191ea2d9622d00621d6acb009a9a759dc92Ruben Brunk * This must return NULL if the tag is outside the bounds of 639c13e191ea2d9622d00621d6acb009a9a759dc92Ruben Brunk * vendor-defined sections. 64f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * 65f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * There may be different vendor-defined tag sections, for example the 66f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * phone maker, the chipset maker, and the camera module maker may each 67f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * have their own "com.vendor."-prefixed section. 68f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * 69f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * The memory pointed to by the return value must remain valid for the 70f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * lifetime of the module, and is owned by the module. 71f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk */ 72f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk const char *(*get_section_name)(const vendor_tag_ops_t *v, uint32_t tag); 73f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk 74f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk /** 75f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * Get the tag name for a vendor-specified entry tag. This is only called 76f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * for vendor-defined tags, and must return NULL if it is not a 77f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * vendor-defined tag. 78f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * 79f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * The memory pointed to by the return value must remain valid for the 80f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * lifetime of the module, and is owned by the module. 81f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk */ 82f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk const char *(*get_tag_name)(const vendor_tag_ops_t *v, uint32_t tag); 83f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk 84f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk /** 85f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * Get tag type for a vendor-specified entry tag. The type returned must be 86f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk * a valid type defined in camera_metadata.h. This method is only called 879c13e191ea2d9622d00621d6acb009a9a759dc92Ruben Brunk * for tags >= CAMERA_METADATA_VENDOR_TAG_BOUNDARY, and must return 889c13e191ea2d9622d00621d6acb009a9a759dc92Ruben Brunk * -1 if the tag is outside the bounds of the vendor-defined sections. 89f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk */ 90f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk int (*get_tag_type)(const vendor_tag_ops_t *v, uint32_t tag); 91f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk 92f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk /* Reserved for future use. These must be initialized to NULL. */ 93f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk void* reserved[8]; 94f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk}; 95f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk 96a26996379965c552df9001618afce4d02b659abbEmilian Peevstruct vendor_tag_cache_ops { 97a26996379965c552df9001618afce4d02b659abbEmilian Peev /** 98a26996379965c552df9001618afce4d02b659abbEmilian Peev * Get the number of vendor tags supported on this platform. Used to 99a26996379965c552df9001618afce4d02b659abbEmilian Peev * calculate the size of buffer needed for holding the array of all tags 100a26996379965c552df9001618afce4d02b659abbEmilian Peev * returned by get_all_tags(). This must return -1 on error. 101a26996379965c552df9001618afce4d02b659abbEmilian Peev */ 102a26996379965c552df9001618afce4d02b659abbEmilian Peev int (*get_tag_count)(metadata_vendor_id_t id); 103a26996379965c552df9001618afce4d02b659abbEmilian Peev 104a26996379965c552df9001618afce4d02b659abbEmilian Peev /** 105a26996379965c552df9001618afce4d02b659abbEmilian Peev * Fill an array with all of the supported vendor tags on this platform. 106a26996379965c552df9001618afce4d02b659abbEmilian Peev * get_tag_count() must return the number of tags supported, and 107a26996379965c552df9001618afce4d02b659abbEmilian Peev * tag_array will be allocated with enough space to hold the number of tags 108a26996379965c552df9001618afce4d02b659abbEmilian Peev * returned by get_tag_count(). 109a26996379965c552df9001618afce4d02b659abbEmilian Peev */ 110a26996379965c552df9001618afce4d02b659abbEmilian Peev void (*get_all_tags)(uint32_t *tag_array, metadata_vendor_id_t id); 111a26996379965c552df9001618afce4d02b659abbEmilian Peev 112a26996379965c552df9001618afce4d02b659abbEmilian Peev /** 113a26996379965c552df9001618afce4d02b659abbEmilian Peev * Get the vendor section name for a vendor-specified entry tag. This will 114a26996379965c552df9001618afce4d02b659abbEmilian Peev * only be called for vendor-defined tags. 115a26996379965c552df9001618afce4d02b659abbEmilian Peev * 116a26996379965c552df9001618afce4d02b659abbEmilian Peev * The naming convention for the vendor-specific section names should 117a26996379965c552df9001618afce4d02b659abbEmilian Peev * follow a style similar to the Java package style. For example, 118a26996379965c552df9001618afce4d02b659abbEmilian Peev * CameraZoom Inc. must prefix their sections with "com.camerazoom." 119a26996379965c552df9001618afce4d02b659abbEmilian Peev * This must return NULL if the tag is outside the bounds of 120a26996379965c552df9001618afce4d02b659abbEmilian Peev * vendor-defined sections. 121a26996379965c552df9001618afce4d02b659abbEmilian Peev * 122a26996379965c552df9001618afce4d02b659abbEmilian Peev * There may be different vendor-defined tag sections, for example the 123a26996379965c552df9001618afce4d02b659abbEmilian Peev * phone maker, the chipset maker, and the camera module maker may each 124a26996379965c552df9001618afce4d02b659abbEmilian Peev * have their own "com.vendor."-prefixed section. 125a26996379965c552df9001618afce4d02b659abbEmilian Peev * 126a26996379965c552df9001618afce4d02b659abbEmilian Peev * The memory pointed to by the return value must remain valid for the 127a26996379965c552df9001618afce4d02b659abbEmilian Peev * lifetime of the module, and is owned by the module. 128a26996379965c552df9001618afce4d02b659abbEmilian Peev */ 129a26996379965c552df9001618afce4d02b659abbEmilian Peev const char *(*get_section_name)(uint32_t tag, metadata_vendor_id_t id); 130a26996379965c552df9001618afce4d02b659abbEmilian Peev 131a26996379965c552df9001618afce4d02b659abbEmilian Peev /** 132a26996379965c552df9001618afce4d02b659abbEmilian Peev * Get the tag name for a vendor-specified entry tag. This is only called 133a26996379965c552df9001618afce4d02b659abbEmilian Peev * for vendor-defined tags, and must return NULL if it is not a 134a26996379965c552df9001618afce4d02b659abbEmilian Peev * vendor-defined tag. 135a26996379965c552df9001618afce4d02b659abbEmilian Peev * 136a26996379965c552df9001618afce4d02b659abbEmilian Peev * The memory pointed to by the return value must remain valid for the 137a26996379965c552df9001618afce4d02b659abbEmilian Peev * lifetime of the module, and is owned by the module. 138a26996379965c552df9001618afce4d02b659abbEmilian Peev */ 139a26996379965c552df9001618afce4d02b659abbEmilian Peev const char *(*get_tag_name)(uint32_t tag, metadata_vendor_id_t id); 140a26996379965c552df9001618afce4d02b659abbEmilian Peev 141a26996379965c552df9001618afce4d02b659abbEmilian Peev /** 142a26996379965c552df9001618afce4d02b659abbEmilian Peev * Get tag type for a vendor-specified entry tag. The type returned must be 143a26996379965c552df9001618afce4d02b659abbEmilian Peev * a valid type defined in camera_metadata.h. This method is only called 144a26996379965c552df9001618afce4d02b659abbEmilian Peev * for tags >= CAMERA_METADATA_VENDOR_TAG_BOUNDARY, and must return 145a26996379965c552df9001618afce4d02b659abbEmilian Peev * -1 if the tag is outside the bounds of the vendor-defined sections. 146a26996379965c552df9001618afce4d02b659abbEmilian Peev */ 147a26996379965c552df9001618afce4d02b659abbEmilian Peev int (*get_tag_type)(uint32_t tag, metadata_vendor_id_t id); 148a26996379965c552df9001618afce4d02b659abbEmilian Peev 149a26996379965c552df9001618afce4d02b659abbEmilian Peev /* Reserved for future use. These must be initialized to NULL. */ 150a26996379965c552df9001618afce4d02b659abbEmilian Peev void* reserved[8]; 151a26996379965c552df9001618afce4d02b659abbEmilian Peev}; 152a26996379965c552df9001618afce4d02b659abbEmilian Peev 153f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk#ifdef __cplusplus 154f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk} /* extern "C" */ 155f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk#endif 156f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk 157f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk#endif /* SYSTEM_MEDIA_INCLUDE_ANDROID_CAMERA_VENDOR_TAGS_H */ 158f260382cd29623ff49c6a230d07a7657919f0f89Ruben Brunk 159