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 
26 /**
27  * Vendor tags:
28  *
29  * This structure contains basic functions for enumerating an immutable set of
30  * vendor-defined camera metadata tags, and querying static information about
31  * their structure/type.  The intended use of this information is to validate
32  * the structure of metadata returned by the camera HAL, and to allow vendor-
33  * defined metadata tags to be visible in application facing camera API.
34  */
35 typedef struct vendor_tag_ops vendor_tag_ops_t;
36 struct vendor_tag_ops {
37     /**
38      * Get the number of vendor tags supported on this platform. Used to
39      * calculate the size of buffer needed for holding the array of all tags
40      * returned by get_all_tags().  This must return -1 on error.
41      */
42     int (*get_tag_count)(const vendor_tag_ops_t *v);
43 
44     /**
45      * Fill an array with all of the supported vendor tags on this platform.
46      * get_tag_count() must return the number of tags supported, and
47      * tag_array will be allocated with enough space to hold the number of tags
48      * returned by get_tag_count().
49      */
50     void (*get_all_tags)(const vendor_tag_ops_t *v, uint32_t *tag_array);
51 
52     /**
53      * Get the vendor section name for a vendor-specified entry tag. This will
54      * only be called for vendor-defined tags.
55      *
56      * The naming convention for the vendor-specific section names should
57      * follow a style similar to the Java package style.  For example,
58      * CameraZoom Inc. must prefix their sections with "com.camerazoom."
59      * This must return NULL if the tag is outside the bounds of
60      * vendor-defined sections.
61      *
62      * There may be different vendor-defined tag sections, for example the
63      * phone maker, the chipset maker, and the camera module maker may each
64      * have their own "com.vendor."-prefixed section.
65      *
66      * The memory pointed to by the return value must remain valid for the
67      * lifetime of the module, and is owned by the module.
68      */
69     const char *(*get_section_name)(const vendor_tag_ops_t *v, uint32_t tag);
70 
71     /**
72      * Get the tag name for a vendor-specified entry tag. This is only called
73      * for vendor-defined tags, and must return NULL if it is not a
74      * vendor-defined tag.
75      *
76      * The memory pointed to by the return value must remain valid for the
77      * lifetime of the module, and is owned by the module.
78      */
79     const char *(*get_tag_name)(const vendor_tag_ops_t *v, uint32_t tag);
80 
81     /**
82      * Get tag type for a vendor-specified entry tag. The type returned must be
83      * a valid type defined in camera_metadata.h.  This method is only called
84      * for tags >= CAMERA_METADATA_VENDOR_TAG_BOUNDARY, and must return
85      * -1 if the tag is outside the bounds of the vendor-defined sections.
86      */
87     int (*get_tag_type)(const vendor_tag_ops_t *v, uint32_t tag);
88 
89     /* Reserved for future use.  These must be initialized to NULL. */
90     void* reserved[8];
91 };
92 
93 #ifdef __cplusplus
94 } /* extern "C" */
95 #endif
96 
97 #endif /* SYSTEM_MEDIA_INCLUDE_ANDROID_CAMERA_VENDOR_TAGS_H */
98 
99