1## -*- coding: utf-8 -*- 2/* 3 * Copyright (C) 2017 The Android Open Source Project 4 * 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 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 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. 16 */ 17<%! 18 def annotated_type(entry): 19 if entry.enum: 20 type = 'enum' 21 else: 22 type = entry.type 23 if entry.container == 'array': 24 type += '[]' 25 26 return type 27%>\ 28 29/* 30 * Autogenerated from camera metadata definitions in 31 * /system/media/camera/docs/metadata_definitions.xml 32 * *** DO NOT EDIT BY HAND *** 33 */ 34 35package android.hardware.camera.metadata@${hal_major_version()}.${hal_minor_version()}; 36 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()): 40import android.hardware.camera.metadata@${hal_major_version()}.${i}; 41 % endfor 42 43% endif 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())): 47 % if idx == 0: 48<% gotSections = True %>\ 49/** 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. 52 */ 53enum 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)} { 54 % endif 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 %>\ 59 % else: 60 ${path_name(section) | csym}, 61 % endif 62 63% endfor 64% if gotSections: 65 ANDROID_SECTION_COUNT${'' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else '_%d_%d' % (hal_major_version(),hal_minor_version())}, 66 67 VENDOR_SECTION${'' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else '_%d_%d' % (hal_major_version(),hal_minor_version())} = 0x8000, 68 69}; 70 71/** 72 * Hierarchy positions in enum space. All vendor extension sections must be 73 * defined with tag >= VENDOR_SECTION_START 74 */ 75enum 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, 78 79 % endfor 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, 82 % else: 83 VENDOR_SECTION_START = CameraMetadataSection:VENDOR_SECTION << 16, 84 % endif 85 86}; 87 88% else: 89// No new metadata sections added in this revision 90 91% endif 92/** 93 * Main enumeration for defining camera metadata tags added in this revision 94 * 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> 97 */ 98enum 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: 105 * 106${entry.description | hidldoc(metadata)}\ 107 % endif 108 */ 109 % if idx == 0: 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, 112 % else: 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}, 115 % endif 116 % else: 117 ${entry.name + "," | csym} 118 % endif 119 120 % endfor 121 % if gotEntries: 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())}, 123 124 % endif 125 %endfor 126}; 127 128/* 129 * Enumeration definitions for the various entries that need them 130 */ 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()): 133 % if entry.enum: 134 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(): 139 % if isFirstValue: 140 % if prevValue is None: 141/** ${entry.name} enumeration values 142 % else: 143/** ${entry.name} enumeration values added since v${prevValue.hal_major_version}.${prevValue.hal_minor_version} 144 % endif 145 * @see ${entry.name | csym} 146 */ 147enum 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))} { 148 % endif 149 % if val.id is None: 150 ${entry.name | csym}_${val.name}, 151 % else: 152 ${'%s_%s'%(csym(entry.name), val.name) | pad(65)} = ${val.id}, 153 % endif 154<% isFirstValue = False %>\ 155 % else: 156<% prevValue = val %>\ 157 % endif 158 % endfor 159}; 160 % endif 161 % endfor 162% endfor 163