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 % for idx, section in enumerate(find_all_sections_added_in_hal(metadata, hal_major_version(), hal_minor_version())):
47 <% gotSections = True %>\
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.
52 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)} {
54 % if first_hal_minor_version(hal_major_version()) != hal_minor_version():
55 ${path_name(section) | csym} =
56 android.hardware.camera.metadata@${hal_major_version()}.${hal_minor_version()-1}::CameraMetadataSection:ANDROID_SECTION_COUNT,
58 ${path_name(section) | csym},
63 ANDROID_SECTION_COUNT${'' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else '_%d_%d' % (hal_major_version(),hal_minor_version())},
65 VENDOR_SECTION${'' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else '_%d_%d' % (hal_major_version(),hal_minor_version())} = 0x8000,
70 * Hierarchy positions in enum space. All vendor extension sections must be
71 * defined with tag >= VENDOR_SECTION_START
73 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)} {
74 % for i in find_all_sections_added_in_hal(metadata, hal_major_version(), hal_minor_version()):
75 ${path_name(i) + '.start' | csym} = CameraMetadataSection:${path_name(i) | csym} << 16,
78 % if first_hal_minor_version(hal_major_version()) != hal_minor_version() :
79 VENDOR_SECTION_START${'_%d_%d' % (hal_major_version(),hal_minor_version())} = CameraMetadataSection:VENDOR_SECTION${'_%d_%d' % (hal_major_version(),hal_minor_version())} << 16,
81 VENDOR_SECTION_START = CameraMetadataSection:VENDOR_SECTION << 16,
87 // No new metadata sections added in this revision
91 * Main enumeration for defining camera metadata tags added in this revision
93 * <p>Partial documentation is included for each tag; for complete documentation, reference
94 * '/system/media/camera/docs/docs.html' in the corresponding Android source tree.</p>
96 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)} {
97 % for sec in find_all_sections(metadata):
98 <% gotEntries = False %>\
99 % for idx,entry in enumerate(filter_added_in_hal_version(remove_synthetic(find_unique_entries(sec)), hal_major_version(), hal_minor_version())):
100 <% gotEntries = True %>\
101 /** ${entry.name} [${entry.kind}, ${annotated_type(entry)}, ${entry.applied_visibility}]
102 % if entry.description:
104 ${entry.description | hidldoc(metadata)}\
108 % if find_first_older_used_hal_version(sec, hal_major_version(), hal_minor_version()) == (0, 0):
109 ${entry.name + " =" | csym} CameraMetadataSectionStart:${path_name(find_parent_section(entry)) | csym}_START,
111 <% prevVersion = find_first_older_used_hal_version(sec, hal_major_version(), hal_minor_version()) %>\
112 ${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 ${entry.name + "," | csym}
120 ${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())},
127 * Enumeration definitions for the various entries that need them
129 % for sec in find_all_sections(metadata):
130 % for entry in filter_has_enum_values_added_in_hal_version(remove_synthetic(find_unique_entries(sec)), hal_major_version(), hal_minor_version()):
133 <% isFirstValue = True %>\
134 <% prevValue = None %>\
135 % for val in entry.enum.values:
136 % if val.hal_major_version == hal_major_version() and val.hal_minor_version == hal_minor_version():
138 % if prevValue is None:
139 /** ${entry.name} enumeration values
141 /** ${entry.name} enumeration values added since v${prevValue.hal_major_version}.${prevValue.hal_minor_version}
143 * @see ${entry.name | csym}
145 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))} {
148 ${entry.name | csym}_${val.name},
150 ${'%s_%s'%(csym(entry.name), val.name) | pad(65)} = ${val.id},
152 <% isFirstValue = False %>\
154 <% prevValue = val %>\