• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## -*- coding: utf-8 -*-
2/*
3 * Copyright (C) ${copyright_year()} 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  def annotated_enum_type(entry):
29    if entry.type == 'int64' and entry.container == 'array':
30       type = ' int64_t'
31    else:
32       type = ' uint32_t'
33
34    return type
35%>\
36
37/*
38 * Autogenerated from camera metadata definitions in
39 * /system/media/camera/docs/metadata_definitions.xml
40 * *** DO NOT EDIT BY HAND ***
41 */
42
43package android.hardware.camera.metadata@${hal_major_version()}.${hal_minor_version()};
44
45% if first_hal_minor_version(hal_major_version()) != hal_minor_version():
46  % for i in range(first_hal_minor_version(hal_major_version()),hal_minor_version()):
47import android.hardware.camera.metadata@${hal_major_version()}.${i};
48  % endfor
49
50% endif
51<%    gotSections = False %>\
52<%    gotFirstNewSection = False %>\
53% for idx, section in enumerate(find_all_sections_added_in_hal(metadata, hal_major_version(), hal_minor_version())):
54  % if idx == 0:
55<%    gotSections = True %>\
56/**
57 * Top level hierarchy definitions for camera metadata. *_INFO sections are for
58 * the static metadata that can be retrived without opening the camera device.
59 */
60enum 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)} {
61  % endif
62  % if first_hal_minor_version(hal_major_version()) != hal_minor_version() and not gotFirstNewSection:
63    ${path_name(section) | csym} =
64        android.hardware.camera.metadata@${hal_major_version()}.${hal_minor_version()-1}::CameraMetadataSection:ANDROID_SECTION_COUNT,
65<% gotFirstNewSection = True %>\
66  % else:
67    ${path_name(section) | csym},
68  % endif
69
70% endfor
71% if gotSections:
72    ANDROID_SECTION_COUNT${'' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else '_%d_%d' % (hal_major_version(),hal_minor_version())},
73
74    VENDOR_SECTION${'' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else '_%d_%d' % (hal_major_version(),hal_minor_version())} = 0x8000,
75
76};
77
78/**
79 * Hierarchy positions in enum space. All vendor extension sections must be
80 * defined with tag >= VENDOR_SECTION_START
81 */
82enum 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)} {
83  % for i in find_all_sections_added_in_hal(metadata, hal_major_version(), hal_minor_version()):
84    ${path_name(i) + '.start' | csym} = CameraMetadataSection:${path_name(i) | csym} << 16,
85
86  % endfor
87  % if first_hal_minor_version(hal_major_version()) != hal_minor_version() :
88    VENDOR_SECTION_START${'_%d_%d' % (hal_major_version(),hal_minor_version())} = CameraMetadataSection:VENDOR_SECTION${'_%d_%d' % (hal_major_version(),hal_minor_version())} << 16,
89  % else:
90    VENDOR_SECTION_START = CameraMetadataSection:VENDOR_SECTION << 16,
91  % endif
92
93};
94
95% else:
96// No new metadata sections added in this revision
97
98% endif
99/**
100 * Main enumeration for defining camera metadata tags added in this revision
101 *
102 * <p>Partial documentation is included for each tag; for complete documentation, reference
103 * '/system/media/camera/docs/docs.html' in the corresponding Android source tree.</p>
104 */
105enum 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)} {
106    % for sec in find_all_sections(metadata):
107<%    gotEntries = False %>\
108      % for idx,entry in enumerate(filter_added_in_hal_version(remove_hal_non_visible(find_unique_entries(sec)), hal_major_version(), hal_minor_version())):
109<%      gotEntries = True %>\
110    /** ${entry.name} [${entry.kind}, ${annotated_type(entry)}, ${entry.applied_visibility}]
111        % if entry.description:
112     *
113${entry.description | hidldoc(metadata)}\
114        % endif
115     */
116        % if idx == 0:
117          % if find_first_older_used_hal_version(sec, hal_major_version(), hal_minor_version()) == (0, 0):
118    ${entry.name + " =" | csym} CameraMetadataSectionStart:${path_name(find_parent_section(entry)) | csym}_START,
119          % else:
120<%      prevVersion = find_first_older_used_hal_version(sec, hal_major_version(), hal_minor_version()) %>\
121    ${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},
122          % endif
123        % else:
124    ${entry.name + "," | csym}
125        % endif
126
127      % endfor
128      % if gotEntries:
129    ${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())},
130
131      % endif
132    %endfor
133};
134
135/*
136 * Enumeration definitions for the various entries that need them
137 */
138% for sec in find_all_sections(metadata):
139  % for entry in filter_has_enum_values_added_in_hal_version(remove_hal_non_visible(find_unique_entries(sec)), hal_major_version(), hal_minor_version()):
140    % if entry.enum:
141
142<%    isFirstValue = True %>\
143<%    prevValue = None %>\
144      % for val in entry.enum.values:
145        % if val.hal_major_version == hal_major_version() and val.hal_minor_version == hal_minor_version():
146          % if isFirstValue:
147              % if prevValue is None:
148/** ${entry.name} enumeration values
149              % else:
150/** ${entry.name} enumeration values added since v${prevValue.hal_major_version}.${prevValue.hal_minor_version}
151              % endif
152 * @see ${entry.name | csym}
153 */
154enum CameraMetadataEnum${entry.name | pascal_case} :${annotated_enum_type(entry) if prevValue is None else '\n        @%d.%d::CameraMetadataEnum%s' % (prevValue.hal_major_version, prevValue.hal_minor_version, pascal_case(entry.name))} {
155          % endif
156          % if val.id is None:
157    ${entry.name | csym}_${val.name},
158          % else:
159    ${'%s_%s'%(csym(entry.name), val.name) | pad(65)} = ${val.id},
160          % endif
161<%        isFirstValue = False %>\
162        % else:
163<%        prevValue = val %>\
164        % endif
165      % endfor
166};
167    % endif
168  % endfor
169% endfor
170