• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  % 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
43<%    gotSections = False %>\
44<%    gotFirstNewSection = False %>\
45% 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 %>\
48/**
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 */
52enum 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)} {
53  % endif
54  % if first_hal_minor_version(hal_major_version()) != hal_minor_version() and not gotFirstNewSection:
55    ${path_name(section) | csym} =
56        android.hardware.camera.metadata@${hal_major_version()}.${hal_minor_version()-1}::CameraMetadataSection:ANDROID_SECTION_COUNT,
57<% gotFirstNewSection = True %>\
58  % else:
59    ${path_name(section) | csym},
60  % endif
61
62% endfor
63% if gotSections:
64    ANDROID_SECTION_COUNT${'' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else '_%d_%d' % (hal_major_version(),hal_minor_version())},
65
66    VENDOR_SECTION${'' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else '_%d_%d' % (hal_major_version(),hal_minor_version())} = 0x8000,
67
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
79  % 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:
82    VENDOR_SECTION_START = CameraMetadataSection:VENDOR_SECTION << 16,
83  % endif
84
85};
86
87% else:
88// No new metadata sections added in this revision
89
90% endif
91/**
92 * 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>
96 */
97enum 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)} {
98    % 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 %>\
102    /** ${entry.name} [${entry.kind}, ${annotated_type(entry)}, ${entry.applied_visibility}]
103        % if entry.description:
104     *
105${entry.description | hidldoc(metadata)}\
106        % endif
107     */
108        % if idx == 0:
109          % if find_first_older_used_hal_version(sec, hal_major_version(), hal_minor_version()) == (0, 0):
110    ${entry.name + " =" | csym} CameraMetadataSectionStart:${path_name(find_parent_section(entry)) | csym}_START,
111          % else:
112<%      prevVersion = find_first_older_used_hal_version(sec, hal_major_version(), hal_minor_version()) %>\
113    ${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},
114          % endif
115        % else:
116    ${entry.name + "," | csym}
117        % endif
118
119      % endfor
120      % if gotEntries:
121    ${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())},
122
123      % endif
124    %endfor
125};
126
127/*
128 * Enumeration definitions for the various entries that need them
129 */
130% for sec in find_all_sections(metadata):
131  % for entry in filter_has_enum_values_added_in_hal_version(remove_synthetic(find_unique_entries(sec)), hal_major_version(), hal_minor_version()):
132    % if entry.enum:
133
134<%    isFirstValue = True %>\
135<%    prevValue = None %>\
136      % for val in entry.enum.values:
137        % 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:
149    ${entry.name | csym}_${val.name},
150          % else:
151    ${'%s_%s'%(csym(entry.name), val.name) | pad(65)} = ${val.id},
152          % endif
153<%        isFirstValue = False %>\
154        % else:
155<%        prevValue = val %>\
156        % endif
157      % endfor
158};
159    % endif
160  % endfor
161% endfor
162