1 ## -*- coding: utf-8 -*-
3 * Copyright (C) 2017 The Android Open Source Project
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 def annotated_type(entry):
23 if entry.container == 'array':
30 * Autogenerated from camera metadata definitions in
31 * /system/media/camera/docs/metadata_definitions.xml
32 * *** DO NOT EDIT BY HAND ***
35 package android.hardware.camera.metadata@${hal_major_version()}.${hal_minor_version()};
37 % if first_hal_minor_version(hal_major_version()) != hal_minor_version():
38 /* Include definitions from all prior minor HAL metadata revisions */
39 % for i in range(first_hal_minor_version(hal_major_version()),hal_minor_version()):
40 import android.hardware.camera.metadata@${hal_major_version()}.${i};
44 <% gotSections = False %>\
45 <% gotFirstNewSection = False %>\
46 % for idx, section in enumerate(find_all_sections_added_in_hal(metadata, hal_major_version(), hal_minor_version())):
48 <% gotSections = True %>\
50 * Top level hierarchy definitions for camera metadata. *_INFO sections are for
51 * the static metadata that can be retrived without opening the camera device.
53 enum CameraMetadataSection : ${'uint32_t' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else '@%d.%d::CameraMetadataSection' % (hal_major_version(), hal_minor_version()-1)} {
55 % if first_hal_minor_version(hal_major_version()) != hal_minor_version() and not gotFirstNewSection:
56 ${path_name(section) | csym} =
57 android.hardware.camera.metadata@${hal_major_version()}.${hal_minor_version()-1}::CameraMetadataSection:ANDROID_SECTION_COUNT,
58 <% gotFirstNewSection = True %>\
60 ${path_name(section) | csym},
65 ANDROID_SECTION_COUNT${'' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else '_%d_%d' % (hal_major_version(),hal_minor_version())},
67 VENDOR_SECTION${'' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else '_%d_%d' % (hal_major_version(),hal_minor_version())} = 0x8000,
72 * Hierarchy positions in enum space. All vendor extension sections must be
73 * defined with tag >= VENDOR_SECTION_START
75 enum CameraMetadataSectionStart : ${'uint32_t' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else 'android.hardware.camera.metadata@%d.%d::CameraMetadataSectionStart' % (hal_major_version(), hal_minor_version()-1)} {
76 % for i in find_all_sections_added_in_hal(metadata, hal_major_version(), hal_minor_version()):
77 ${path_name(i) + '.start' | csym} = CameraMetadataSection:${path_name(i) | csym} << 16,
80 % if first_hal_minor_version(hal_major_version()) != hal_minor_version() :
81 VENDOR_SECTION_START${'_%d_%d' % (hal_major_version(),hal_minor_version())} = CameraMetadataSection:VENDOR_SECTION${'_%d_%d' % (hal_major_version(),hal_minor_version())} << 16,
83 VENDOR_SECTION_START = CameraMetadataSection:VENDOR_SECTION << 16,
89 // No new metadata sections added in this revision
93 * Main enumeration for defining camera metadata tags added in this revision
95 * <p>Partial documentation is included for each tag; for complete documentation, reference
96 * '/system/media/camera/docs/docs.html' in the corresponding Android source tree.</p>
98 enum CameraMetadataTag : ${'uint32_t' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else '@%d.%d::CameraMetadataTag' % (hal_major_version(), hal_minor_version()-1)} {
99 % for sec in find_all_sections(metadata):
100 <% gotEntries = False %>\
101 % for idx,entry in enumerate(filter_added_in_hal_version(remove_synthetic(find_unique_entries(sec)), hal_major_version(), hal_minor_version())):
102 <% gotEntries = True %>\
103 /** ${entry.name} [${entry.kind}, ${annotated_type(entry)}, ${entry.applied_visibility}]
104 % if entry.description:
106 ${entry.description | hidldoc(metadata)}\
110 % if find_first_older_used_hal_version(sec, hal_major_version(), hal_minor_version()) == (0, 0):
111 ${entry.name + " =" | csym} CameraMetadataSectionStart:${path_name(find_parent_section(entry)) | csym}_START,
113 <% prevVersion = find_first_older_used_hal_version(sec, hal_major_version(), hal_minor_version()) %>\
114 ${entry.name + " =" | csym} ${'android.hardware.camera.metadata@%d.%d' % prevVersion}::CameraMetadataTag:${path_name(find_parent_section(entry)) | csym}${'_END' if find_first_older_used_hal_version(sec, prevVersion[0], prevVersion[1]) == (0,0) else '_END_%d_%d' % prevVersion},
117 ${entry.name + "," | csym}
122 ${path_name(sec) | csym}${'_END' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else '_END_%d_%d' % (hal_major_version(),hal_minor_version())},
129 * Enumeration definitions for the various entries that need them
131 % for sec in find_all_sections(metadata):
132 % for entry in filter_has_enum_values_added_in_hal_version(remove_synthetic(find_unique_entries(sec)), hal_major_version(), hal_minor_version()):
135 <% isFirstValue = True %>\
136 <% prevValue = None %>\
137 % for val in entry.enum.values:
138 % if val.hal_major_version == hal_major_version() and val.hal_minor_version == hal_minor_version():
140 % if prevValue is None:
141 /** ${entry.name} enumeration values
143 /** ${entry.name} enumeration values added since v${prevValue.hal_major_version}.${prevValue.hal_minor_version}
145 * @see ${entry.name | csym}
147 enum CameraMetadataEnum${entry.name | pascal_case} :${' uint32_t' if prevValue is None else '\n @%d.%d::CameraMetadataEnum%s' % (prevValue.hal_major_version, prevValue.hal_minor_version, pascal_case(entry.name))} {
150 ${entry.name | csym}_${val.name},
152 ${'%s_%s'%(csym(entry.name), val.name) | pad(65)} = ${val.id},
154 <% isFirstValue = False %>\
156 <% prevValue = val %>\