OSDN Git Service

Snap for 4683893 from c8e8062cbeec8f08050867db132fd8d1479ccfef to pi-release
[android-x86/system-media.git] / camera / docs / metadata_template.mako
1 ## -*- coding: utf-8 -*-
2 <?xml version="1.0" encoding="UTF-8"?>
3 <!-- Copyright (C) 2012 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 <metadata
18     xmlns="http://schemas.android.com/service/camera/metadata/"
19     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20     xsi:schemaLocation="http://schemas.android.com/service/camera/metadata/ metadata_properties.xsd">
21
22 <tags>
23 % for tag in metadata.tags:
24   % if tag.description and tag.description.strip():
25   <tag id="${tag.id}">${tag.description | x}</tag>
26   % else:
27   <tag id="${tag.id}"><!-- TODO: fill the tag description --></tag>
28   % endif
29 % endfor
30 </tags>
31
32 <types>
33 % for typedef in metadata.types:
34   <typedef name="${typedef.name}">
35     % for (language, klass) in typedef.languages.iteritems():
36       <language name="${language}">${klass | h}</language>
37     % endfor
38   </typedef>
39 % endfor
40 </types>
41
42 % for root in metadata.outer_namespaces:
43 <namespace name="${root.name}">
44   % for section in root.sections:
45   <section name="${section.name}">
46
47     % if section.description is not None:
48       <description>${section.description}</description>
49     % endif
50
51     % for kind in section.kinds: # dynamic,static,controls
52       <${kind.name}>
53
54         <%def name="insert_body(node)">
55             % for nested in node.namespaces:
56                 ${insert_namespace(nested)}
57             % endfor
58
59             % for entry in node.entries:
60                 ${insert_entry(entry)}
61             % endfor
62         </%def>
63
64         <%def name="insert_namespace(namespace)">
65         <namespace name="${namespace.name}">
66             ${insert_body(namespace)}
67         </namespace>
68         </%def>
69
70         <%def name="insert_entry(prop)">
71         % if prop.is_clone():
72             <clone entry="${prop.name}" kind="${prop.target_kind}"
73           % if ('hal_version' in prop._property_keys):
74                 hal_version="${prop.hal_major_version}.${prop.hal_minor_version}"
75           % endif
76             >
77
78               % if prop.details is not None:
79                 <details>${prop.details}</details>
80               % endif
81
82               % if prop.ndk_details is not None:
83                 <ndk_details>${prop.ndk_details}</ndk_details>
84               % endif
85
86               % if prop.hal_details is not None:
87                 <hal_details>${prop.hal_details}</hal_details>
88               % endif
89
90               % for tag in prop.tags:
91                 <tag id="${tag.id}" />
92               % endfor
93
94             </clone>
95         % else:
96             <entry name="${prop.name_short}" type="${prop.type}"
97           % if prop.visibility:
98                 visibility="${prop.visibility}"
99           % endif
100           % if prop.synthetic:
101                 synthetic="true"
102           % endif
103           % if prop.deprecated:
104                 deprecated="true"
105           % endif
106           % if prop.optional:
107                 optional="${str(prop.optional).lower()}"
108           % endif
109           % if prop.enum:
110                 enum="true"
111           % endif
112           % if prop.type_notes is not None:
113                 type_notes="${prop.type_notes}"
114           % endif
115           % if prop.container is not None:
116                 container="${prop.container}"
117           % endif
118
119           % if prop.typedef is not None:
120                 typedef="${prop.typedef.name}"
121           % endif
122
123           % if prop.hwlevel:
124                 hwlevel="${prop.hwlevel}"
125           % endif
126
127           % if (prop.hal_major_version, prop.hal_minor_version) != (3,2):
128                 hal_version="${prop.hal_major_version}.${prop.hal_minor_version}"
129           % endif
130             >
131
132               % if prop.container == 'array':
133                 <array>
134                   % for size in prop.container_sizes:
135                     <size>${size}</size>
136                   % endfor
137                 </array>
138               % elif prop.container == 'tuple':
139                 <tuple>
140                   % for size in prop.container_sizes:
141                     <value /> <!-- intentionally generated empty. manually fix -->
142                   % endfor
143                 </tuple>
144               % endif
145               % if prop.enum:
146                 <enum>
147                   % for value in prop.enum.values:
148                       <value
149                     % if value.deprecated:
150                              deprecated="true"
151                     % endif:
152                     % if value.optional:
153                              optional="true"
154                     % endif:
155                     % if value.hidden:
156                              hidden="true"
157                     % endif:
158                     % if value.ndk_hidden:
159                              ndk_hidden="true"
160                     % endif:
161                     % if value.id is not None:
162                              id="${value.id}"
163                     % endif
164                     % if not (value.hal_major_version == prop.hal_major_version and value.hal_minor_version == prop.hal_minor_version):
165                              hal_version=${"%d.%d" % (value.hal_major_version, value.hal_minor_version)}
166                     % endif
167                       >${value.name}
168                     % if value.notes is not None:
169                              <notes>${value.notes}</notes>
170                     % endif
171                     % if value.sdk_notes is not None:
172                              <sdk_notes>${value.sdk_notes}</sdk_notes>
173                     % endif
174                     % if value.ndk_notes is not None:
175                              <ndk_notes>${value.ndk_notes}</ndk_notes>
176                     % endif
177
178                       </value>
179                   % endfor
180                 </enum>
181               % endif
182
183               % if prop.description is not None:
184                 <description>${prop.description | x}</description>
185               % endif
186
187               % if prop.deprecation_description is not None:
188                 <deprecation_description>${prop.deprecation_description | x}</deprecation_description>
189               % endif
190
191               % if prop.units is not None:
192                 <units>${prop.units | x}</units>
193               % endif
194
195               % if prop.range is not None:
196                 <range>${prop.range | x}</range>
197               % endif
198
199               % if prop.details is not None:
200                 <details>${prop.details | x}</details>
201               % endif
202
203               % if prop.ndk_details is not None:
204                 <ndk_details>${prop.ndk_details}</ndk_details>
205               % endif
206
207               % if prop.hal_details is not None:
208                 <hal_details>${prop.hal_details | x}</hal_details>
209               % endif
210
211               % for tag in prop.tags:
212                 <tag id="${tag.id}" />
213               % endfor
214
215             </entry>
216         % endif
217         </%def>
218
219         ${insert_body(kind)}
220
221       </${kind.name}>
222     % endfor # for each kind
223
224   </section>
225   % endfor
226 </namespace>
227 % endfor
228
229 </metadata>