Home | History | Annotate | Download | only in system
      1 /*
      2  * Copyright 2014 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 #ifndef SYSTEM_MEDIA_INCLUDE_ANDROID_CAMERA_VENDOR_TAGS_H
     18 #define SYSTEM_MEDIA_INCLUDE_ANDROID_CAMERA_VENDOR_TAGS_H
     19 
     20 #ifdef __cplusplus
     21 extern "C" {
     22 #endif
     23 
     24 #define CAMERA_METADATA_VENDOR_TAG_BOUNDARY 0x80000000u
     25 #define CAMERA_METADATA_INVALID_VENDOR_ID UINT64_MAX
     26 
     27 typedef uint64_t metadata_vendor_id_t;
     28 
     29 /**
     30  * Vendor tags:
     31  *
     32  * This structure contains basic functions for enumerating an immutable set of
     33  * vendor-defined camera metadata tags, and querying static information about
     34  * their structure/type.  The intended use of this information is to validate
     35  * the structure of metadata returned by the camera HAL, and to allow vendor-
     36  * defined metadata tags to be visible in application facing camera API.
     37  */
     38 typedef struct vendor_tag_ops vendor_tag_ops_t;
     39 struct vendor_tag_ops {
     40     /**
     41      * Get the number of vendor tags supported on this platform. Used to
     42      * calculate the size of buffer needed for holding the array of all tags
     43      * returned by get_all_tags().  This must return -1 on error.
     44      */
     45     int (*get_tag_count)(const vendor_tag_ops_t *v);
     46 
     47     /**
     48      * Fill an array with all of the supported vendor tags on this platform.
     49      * get_tag_count() must return the number of tags supported, and
     50      * tag_array will be allocated with enough space to hold the number of tags
     51      * returned by get_tag_count().
     52      */
     53     void (*get_all_tags)(const vendor_tag_ops_t *v, uint32_t *tag_array);
     54 
     55     /**
     56      * Get the vendor section name for a vendor-specified entry tag. This will
     57      * only be called for vendor-defined tags.
     58      *
     59      * The naming convention for the vendor-specific section names should
     60      * follow a style similar to the Java package style.  For example,
     61      * CameraZoom Inc. must prefix their sections with "com.camerazoom."
     62      * This must return NULL if the tag is outside the bounds of
     63      * vendor-defined sections.
     64      *
     65      * There may be different vendor-defined tag sections, for example the
     66      * phone maker, the chipset maker, and the camera module maker may each
     67      * have their own "com.vendor."-prefixed section.
     68      *
     69      * The memory pointed to by the return value must remain valid for the
     70      * lifetime of the module, and is owned by the module.
     71      */
     72     const char *(*get_section_name)(const vendor_tag_ops_t *v, uint32_t tag);
     73 
     74     /**
     75      * Get the tag name for a vendor-specified entry tag. This is only called
     76      * for vendor-defined tags, and must return NULL if it is not a
     77      * vendor-defined tag.
     78      *
     79      * The memory pointed to by the return value must remain valid for the
     80      * lifetime of the module, and is owned by the module.
     81      */
     82     const char *(*get_tag_name)(const vendor_tag_ops_t *v, uint32_t tag);
     83 
     84     /**
     85      * Get tag type for a vendor-specified entry tag. The type returned must be
     86      * a valid type defined in camera_metadata.h.  This method is only called
     87      * for tags >= CAMERA_METADATA_VENDOR_TAG_BOUNDARY, and must return
     88      * -1 if the tag is outside the bounds of the vendor-defined sections.
     89      */
     90     int (*get_tag_type)(const vendor_tag_ops_t *v, uint32_t tag);
     91 
     92     /* Reserved for future use.  These must be initialized to NULL. */
     93     void* reserved[8];
     94 };
     95 
     96 struct vendor_tag_cache_ops {
     97     /**
     98      * Get the number of vendor tags supported on this platform. Used to
     99      * calculate the size of buffer needed for holding the array of all tags
    100      * returned by get_all_tags().  This must return -1 on error.
    101      */
    102     int (*get_tag_count)(metadata_vendor_id_t id);
    103 
    104     /**
    105      * Fill an array with all of the supported vendor tags on this platform.
    106      * get_tag_count() must return the number of tags supported, and
    107      * tag_array will be allocated with enough space to hold the number of tags
    108      * returned by get_tag_count().
    109      */
    110     void (*get_all_tags)(uint32_t *tag_array, metadata_vendor_id_t id);
    111 
    112     /**
    113      * Get the vendor section name for a vendor-specified entry tag. This will
    114      * only be called for vendor-defined tags.
    115      *
    116      * The naming convention for the vendor-specific section names should
    117      * follow a style similar to the Java package style.  For example,
    118      * CameraZoom Inc. must prefix their sections with "com.camerazoom."
    119      * This must return NULL if the tag is outside the bounds of
    120      * vendor-defined sections.
    121      *
    122      * There may be different vendor-defined tag sections, for example the
    123      * phone maker, the chipset maker, and the camera module maker may each
    124      * have their own "com.vendor."-prefixed section.
    125      *
    126      * The memory pointed to by the return value must remain valid for the
    127      * lifetime of the module, and is owned by the module.
    128      */
    129     const char *(*get_section_name)(uint32_t tag, metadata_vendor_id_t id);
    130 
    131     /**
    132      * Get the tag name for a vendor-specified entry tag. This is only called
    133      * for vendor-defined tags, and must return NULL if it is not a
    134      * vendor-defined tag.
    135      *
    136      * The memory pointed to by the return value must remain valid for the
    137      * lifetime of the module, and is owned by the module.
    138      */
    139     const char *(*get_tag_name)(uint32_t tag, metadata_vendor_id_t id);
    140 
    141     /**
    142      * Get tag type for a vendor-specified entry tag. The type returned must be
    143      * a valid type defined in camera_metadata.h.  This method is only called
    144      * for tags >= CAMERA_METADATA_VENDOR_TAG_BOUNDARY, and must return
    145      * -1 if the tag is outside the bounds of the vendor-defined sections.
    146      */
    147     int (*get_tag_type)(uint32_t tag, metadata_vendor_id_t id);
    148 
    149     /* Reserved for future use.  These must be initialized to NULL. */
    150     void* reserved[8];
    151 };
    152 
    153 #ifdef __cplusplus
    154 } /* extern "C" */
    155 #endif
    156 
    157 #endif /* SYSTEM_MEDIA_INCLUDE_ANDROID_CAMERA_VENDOR_TAGS_H */
    158 
    159