Home | History | Annotate | Download | only in docs
      1 ## -*- coding: utf-8 -*-
      2 /*
      3  * Copyright (C) 2015 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 /**
     19  * @addtogroup Camera
     20  * @{
     21  */
     22 
     23 /**
     24  * @file NdkCameraMetadataTags.h
     25  */
     26 
     27 /*
     28  * This file defines an NDK API.
     29  * Do not remove methods.
     30  * Do not change method signatures.
     31  * Do not change the value of constants.
     32  * Do not change the size of any of the classes defined in here.
     33  * Do not reference types that are not part of the NDK.
     34  * Do not #include files that aren't part of the NDK.
     35  */
     36 
     37 #ifndef _NDK_CAMERA_METADATA_TAGS_H
     38 #define _NDK_CAMERA_METADATA_TAGS_H
     39 <%!
     40   def annotated_type(entry):
     41     type = entry.type
     42     if entry.container == 'array':
     43        type += '[' + '*'.join(entry.container_sizes) + ']'
     44     if entry.enum:
     45        type += ' (enum)'
     46 
     47     return type
     48 %>\
     49 \
     50 
     51 typedef enum acamera_metadata_section {
     52   % for i in find_all_sections(metadata):
     53     ${ndk(path_name(i)) | csym},
     54   % endfor
     55     ACAMERA_SECTION_COUNT,
     56 
     57     ACAMERA_VENDOR = 0x8000
     58 } acamera_metadata_section_t;
     59 
     60 /**
     61  * Hierarchy positions in enum space.
     62  */
     63 typedef enum acamera_metadata_section_start {
     64   % for i in find_all_sections(metadata):
     65     ${ndk(path_name(i)) + '.start' | csym,ljust(30)} = ${ndk(path_name(i)) | csym,pad(64)} << 16,
     66   % endfor
     67     ACAMERA_VENDOR_START           = ACAMERA_VENDOR            << 16
     68 } acamera_metadata_section_start_t;
     69 
     70 /**
     71  * Main enum for camera metadata tags.
     72  */
     73 typedef enum acamera_metadata_tag {
     74     % for sec in find_all_sections(metadata):
     75 <%
     76       entries = remove_synthetic(find_unique_entries(sec))
     77       skip_sec = all(e.applied_ndk_visible == "false" for e in entries)
     78       if skip_sec:
     79         continue
     80 %>\
     81       % for idx,entry in enumerate(remove_synthetic(find_unique_entries(sec))):
     82         % if entry.applied_ndk_visible == "true":
     83           % if entry.deprecated:
     84     ${ndk(entry.name) + " = " | csym,ljust(60)}// Deprecated! DO NOT USE
     85           % else:
     86             % if entry.description or entry.details:
     87     /**
     88 ${entry.description | ndkdoc(metadata)}\
     89      *
     90      * <p>This tag may appear in:</p>
     91      * <ul>
     92               % if metadata.is_entry_this_kind(entry, 'static'):
     93      *   <li>ACameraMetadata from ACameraManager_getCameraCharacteristics</li>
     94               % endif
     95               % if metadata.is_entry_this_kind(entry, 'dynamic'):
     96      *   <li>ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks</li>
     97               % endif
     98               % if metadata.is_entry_this_kind(entry, 'controls'):
     99      *   <li>ACaptureRequest</li>
    100               % endif
    101      * </ul>
    102      *
    103 ${entry.details | ndkdoc(metadata)}\
    104      */
    105             % endif
    106     ${ndk(entry.name) + " = " | csym,ljust(60)}// ${annotated_type(entry)}
    107           % endif
    108           % if idx == 0:
    109             ${ndk(path_name(find_parent_section(entry))) | csym}_START,
    110           % else:
    111             ${ndk(path_name(find_parent_section(entry))) | csym}_START + ${idx},
    112           % endif
    113         % endif
    114       % endfor
    115     ${ndk(path_name(sec)) | csym}_END,
    116 
    117     %endfor
    118 } acamera_metadata_tag_t;
    119 
    120 /**
    121  * Enumeration definitions for the various entries that need them
    122  */
    123 
    124 % for sec in find_all_sections(metadata):
    125   % for entry in filter_ndk_visible(remove_synthetic(find_unique_entries(sec))):
    126     % if entry.enum:
    127 // ${ndk(entry.name) | csym}
    128 typedef enum acamera_metadata_enum_${csym(ndk(entry.name)).lower()} {
    129 <%
    130       i = 0
    131 %>\
    132       % for val in entry.enum.values:
    133         % if val.ndk_hidden:
    134 <%
    135           print "  WARNING: {}_{} is marked as hidden".format(csym(ndk(entry.name)), val.name) + \
    136                 " enum in NDK. Please double check this value is properly hidden" +  \
    137                 " in NDK API implementation"
    138 %>\
    139         % endif
    140         % if val.hidden or val.ndk_hidden:
    141           % if val.id:
    142 <%
    143             i = int(val.id, 0) + 1
    144             continue
    145 %>\
    146           % else:
    147 <%
    148             i += 1
    149             continue
    150 %>\
    151           % endif
    152         % endif
    153         % if (val.notes or val.deprecated):
    154     /**
    155           % if val.notes:
    156 ${val.notes | ndkdoc(metadata)}\
    157           % endif
    158           % if val.deprecated:
    159      *
    160      * <b>Deprecated</b>: please refer to this API documentation to find the alternatives
    161           % endif
    162      */
    163         % endif
    164         % if val.id:
    165     ${'%s_%s'%(csym(ndk(entry.name)), val.name) | pad(70)} = ${val.id},
    166 <%
    167           i = int(val.id, 0)
    168 %>\
    169         % else:
    170     ${'%s_%s'%(csym(ndk(entry.name)), val.name) | pad(70)} = ${i},
    171         % endif
    172 <%
    173         i += 1
    174 %>
    175       % endfor
    176 } acamera_metadata_enum_${csym(entry.name).lower()}_t;
    177 
    178     % endif
    179   % endfor
    180 
    181 % endfor
    182 
    183 #endif //_NDK_CAMERA_METADATA_TAGS_H
    184 
    185 /** @} */
    186