blob: 267702197bf02c0b5c66f5d904938671951c8357 [file] [log] [blame]
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -08001## -*- 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 */
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -080017<%!
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
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -080029/*
30 * Autogenerated from camera metadata definitions in
31 * /system/media/camera/docs/metadata_definitions.xml
32 * *** DO NOT EDIT BY HAND ***
33 */
34
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -080035package android.hardware.camera.metadata@${hal_major_version()}.${hal_minor_version()};
36
37% if first_hal_minor_version(hal_major_version()) != hal_minor_version():
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -080038 % for i in range(first_hal_minor_version(hal_major_version()),hal_minor_version()):
39import android.hardware.camera.metadata@${hal_major_version()}.${i};
40 % endfor
41
42% endif
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -080043<% gotSections = False %>\
Eino-Ville Talvalad4c0fe32018-03-13 19:46:57 -070044<% gotFirstNewSection = False %>\
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -080045% for idx, section in enumerate(find_all_sections_added_in_hal(metadata, hal_major_version(), hal_minor_version())):
46 % if idx == 0:
47<% gotSections = True %>\
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -080048/**
49 * Top level hierarchy definitions for camera metadata. *_INFO sections are for
50 * the static metadata that can be retrived without opening the camera device.
51 */
Shuzhen Wang5fb920e2017-12-28 13:35:32 -080052enum 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)} {
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -080053 % endif
Eino-Ville Talvalad4c0fe32018-03-13 19:46:57 -070054 % if first_hal_minor_version(hal_major_version()) != hal_minor_version() and not gotFirstNewSection:
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -080055 ${path_name(section) | csym} =
Shuzhen Wang5fb920e2017-12-28 13:35:32 -080056 android.hardware.camera.metadata@${hal_major_version()}.${hal_minor_version()-1}::CameraMetadataSection:ANDROID_SECTION_COUNT,
Eino-Ville Talvalad4c0fe32018-03-13 19:46:57 -070057<% gotFirstNewSection = True %>\
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -080058 % else:
59 ${path_name(section) | csym},
60 % endif
61
62% endfor
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -080063% if gotSections:
Shuzhen Wang5fb920e2017-12-28 13:35:32 -080064 ANDROID_SECTION_COUNT${'' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else '_%d_%d' % (hal_major_version(),hal_minor_version())},
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -080065
Shuzhen Wang5fb920e2017-12-28 13:35:32 -080066 VENDOR_SECTION${'' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else '_%d_%d' % (hal_major_version(),hal_minor_version())} = 0x8000,
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -080067
68};
69
70/**
71 * Hierarchy positions in enum space. All vendor extension sections must be
72 * defined with tag >= VENDOR_SECTION_START
73 */
74enum 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)} {
75 % for i in find_all_sections_added_in_hal(metadata, hal_major_version(), hal_minor_version()):
76 ${path_name(i) + '.start' | csym} = CameraMetadataSection:${path_name(i) | csym} << 16,
77
78 % endfor
Shuzhen Wang5fb920e2017-12-28 13:35:32 -080079 % if first_hal_minor_version(hal_major_version()) != hal_minor_version() :
80 VENDOR_SECTION_START${'_%d_%d' % (hal_major_version(),hal_minor_version())} = CameraMetadataSection:VENDOR_SECTION${'_%d_%d' % (hal_major_version(),hal_minor_version())} << 16,
81 % else:
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -080082 VENDOR_SECTION_START = CameraMetadataSection:VENDOR_SECTION << 16,
Shuzhen Wang5fb920e2017-12-28 13:35:32 -080083 % endif
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -080084
85};
86
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -080087% else:
88// No new metadata sections added in this revision
89
90% endif
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -080091/**
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -080092 * Main enumeration for defining camera metadata tags added in this revision
93 *
94 * <p>Partial documentation is included for each tag; for complete documentation, reference
95 * '/system/media/camera/docs/docs.html' in the corresponding Android source tree.</p>
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -080096 */
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -080097enum 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)} {
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -080098 % for sec in find_all_sections(metadata):
99<% gotEntries = False %>\
100 % for idx,entry in enumerate(filter_added_in_hal_version(remove_synthetic(find_unique_entries(sec)), hal_major_version(), hal_minor_version())):
101<% gotEntries = True %>\
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -0800102 /** ${entry.name} [${entry.kind}, ${annotated_type(entry)}, ${entry.applied_visibility}]
103 % if entry.description:
104 *
105${entry.description | hidldoc(metadata)}\
106 % endif
107 */
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -0800108 % if idx == 0:
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -0800109 % if find_first_older_used_hal_version(sec, hal_major_version(), hal_minor_version()) == (0, 0):
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -0800110 ${entry.name + " =" | csym} CameraMetadataSectionStart:${path_name(find_parent_section(entry)) | csym}_START,
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -0800111 % else:
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -0800112<% prevVersion = find_first_older_used_hal_version(sec, hal_major_version(), hal_minor_version()) %>\
Shuzhen Wangd7a23bf2018-11-19 12:15:18 -0800113 ${entry.name + " =" | csym} ${'android.hardware.camera.metadata@%d.%d' % prevVersion}::CameraMetadataTag:${path_name(find_parent_section(entry)) | csym}${'_END' if prevVersion[1] == first_hal_minor_version(hal_major_version()) else '_END_%d_%d' % prevVersion},
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -0800114 % endif
115 % else:
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -0800116 ${entry.name + "," | csym}
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -0800117 % endif
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -0800118
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -0800119 % endfor
120 % if gotEntries:
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -0800121 ${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())},
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -0800122
123 % endif
124 %endfor
125};
126
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -0800127/*
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -0800128 * Enumeration definitions for the various entries that need them
129 */
130% for sec in find_all_sections(metadata):
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -0800131 % for entry in filter_has_enum_values_added_in_hal_version(remove_synthetic(find_unique_entries(sec)), hal_major_version(), hal_minor_version()):
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -0800132 % if entry.enum:
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -0800133
134<% isFirstValue = True %>\
135<% prevValue = None %>\
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -0800136 % for val in entry.enum.values:
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -0800137 % if val.hal_major_version == hal_major_version() and val.hal_minor_version == hal_minor_version():
138 % if isFirstValue:
139 % if prevValue is None:
140/** ${entry.name} enumeration values
141 % else:
142/** ${entry.name} enumeration values added since v${prevValue.hal_major_version}.${prevValue.hal_minor_version}
143 % endif
144 * @see ${entry.name | csym}
145 */
146enum 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))} {
147 % endif
148 % if val.id is None:
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -0800149 ${entry.name | csym}_${val.name},
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -0800150 % else:
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -0800151 ${'%s_%s'%(csym(entry.name), val.name) | pad(65)} = ${val.id},
Eino-Ville Talvala63674ff2017-12-07 13:06:05 -0800152 % endif
153<% isFirstValue = False %>\
154 % else:
155<% prevValue = val %>\
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -0800156 % endif
157 % endfor
158};
Eino-Ville Talvaladafa6532017-11-17 14:48:20 -0800159 % endif
160 % endfor
Shuzhen Wang5fb920e2017-12-28 13:35:32 -0800161% endfor