1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.hardware.media.omx@1.0; 18 19 import IOmx; 20 21 /** 22 * Ref: frameworks/av/include/media/IOMX.h: IOMX 23 * 24 * There will be two instances of IOmxStore: "platform" and "vendor". 25 * 26 * The IOmxStore service provided by the platform must present "platform" as the 27 * interface name. 28 * 29 * The IOmxStore service provided by the vendor must present "vendor" as the 30 * instance name. 31 */ 32 interface IOmxStore { 33 34 /** 35 * Attribute is a key-value pair of strings. The `value` member is generally 36 * a stringified value of the following: 37 * enum<v1,v2,...,vn>: v1 | v2 | ... | vn 38 * num: 0 | [1-9][0-9]* 39 * string: arbitrary string 40 * size: <num>x<num> 41 * ratio: <num>:<num> 42 * range<type>: <type> | <type>-<type> 43 * list<type>: <type> | <type>,<list<type>> 44 */ 45 struct Attribute { 46 string key; 47 string value; 48 }; 49 50 /** 51 * Service attribute 52 * 53 * Optional service attributes: 54 * key: 'max-video-encoder-input-buffers', value-type: num 55 * key: 'supports-multiple-secure-codecs', value-type: enum<0,1> 56 * key: 'supports-secure-with-non-secure-codec', value-type: enum<0,1> 57 * 58 * For keys with prefix 'supports-', the value of 0 means "no" (not 59 * supported) while the value of 1 means "yes" (supported). 60 */ 61 typedef Attribute ServiceAttribute; 62 63 /** 64 * List attributes that are service-specific (not node-specific). 65 * 66 * @return attributes The list of `Attribute`s that are specific to this 67 * service. 68 */ 69 listServiceAttributes( 70 ) generates ( 71 Status status, 72 vec<ServiceAttribute> attributes 73 ); 74 75 /** 76 * Node attribute 77 * 78 * Optional node attributes to describe supported values: 79 * key: 'bitrate-range', value-type: range<num> 80 * key: 'max-concurrent-instances', value-type: num 81 * key: 'max-supported-instances', value-type: num 82 * 83 * Optional node attributes for audio nodes to describe supported values: 84 * key: 'max-channel-count', value-type: num 85 * key: 'sample-rate-ranges', value-type: list<range<num>> 86 * 87 * Optional node attributes for video nodes to describe supported values: 88 * key: 'alignment', value-type: size 89 * key: 'block-aspect-ratio-range', value-type: range<ratio> 90 * key: 'block-count-range', value-type: range<num> 91 * key: 'block-size', value-type: size 92 * key: 'blocks-per-second-range', value-type: range<num> 93 * key: 'feature-can-swap-width-height', value-type: enum<0,1> 94 * key: 'frame-rate-range', value-type: range<num> 95 * key: 'pixel-aspect-ratio-range', value-type: range<ratio> 96 * key: 'size-range', value-type: range<size> 97 * 98 * Required node attributes for video nodes that are required by Android to 99 * describe measured values for this device: 100 * key: 'measured-frame-rate-<width>x<height>-range', 101 * value-type: range<num>; where width: num, height: num 102 * 103 * Optional node attributes for decoders to describe supported values: 104 * key: 'feature-adaptive-playback', value: enum<0,1> 105 * key: 'feature-secure-playback', value: enum<0,1> 106 * key: 'feature-tunneled-playback', value: enum<0,1> 107 * 108 * Optional node attributes for video decoders to describe supported values: 109 * key: 'feature-partial-frame', value: enum<0,1> 110 * 111 * Optional node attributes for encoders to describe supported values: 112 * key: 'complexity-default', value-type: num 113 * key: 'complexity-range', value-type: range<num> 114 * key: 'feature-bitrate-modes', value-type: list<enum<VBR,CBR,CQ>> 115 * key: 'feature-intra-refresh', value-type: enum<0,1> 116 * key: 'quality-default', value-type: num 117 * key: 'quality-range', value-type: range<num> 118 * key: 'quality-scale', value-type: string 119 * 120 * For keys with prefix 'feature-' and value type enum<0,1>, the value of 0 121 * means "optional", while the value of 1 means "required". 122 */ 123 typedef Attribute NodeAttribute; 124 125 /** 126 * Information for an IOmxNode node. 127 */ 128 struct NodeInfo { 129 /** 130 * Name of this node. 131 * 132 * `name` can be supplied to `IOmx::allocateNode` of a 133 * corresponding `IOmx` instance to create the node. 134 */ 135 string name; 136 /** 137 * Name of the `IOmx` instance that can create this node. 138 * 139 * To obtain the `IOmx` instance, call `getOmx(owner)`. 140 */ 141 string owner; 142 /** 143 * List of node attributes. 144 */ 145 vec<NodeAttribute> attributes; 146 }; 147 148 /** 149 * Information about nodes provided for a supported node role 150 */ 151 struct RoleInfo { 152 /** 153 * Standard OMX node role. 154 */ 155 string role; 156 /** 157 * Corresponding media type (as defined in MediaFormat.MIMETYPE_* 158 * constants for types required by Android). 159 */ 160 string type; 161 /** 162 * Whether this role is for an encoder or a decoder. 163 */ 164 bool isEncoder; 165 /** 166 * Whether to prefer platform nodes for this role. 167 */ 168 bool preferPlatformNodes; 169 /** 170 * List of nodes that support this role, ordered by preference. 171 */ 172 vec<NodeInfo> nodes; 173 }; 174 175 /** 176 * Return the prefix of names of supported nodes. 177 * 178 * @return prefix The prefix of the names of all nodes supported by this 179 * service. 180 */ 181 getNodePrefix( 182 ) generates ( 183 string prefix 184 ); 185 186 /** 187 * List roles of supported nodes. 188 * 189 * The name of each node inside `NodeInfo` must start with the prefix 190 * returned by `getNodePrefix()`. 191 * 192 * @return roleList The list of `RoleInfo`s. 193 * 194 * @see RoleInfo 195 */ 196 listRoles( 197 ) generates ( 198 vec<RoleInfo> roleList 199 ); 200 201 /** 202 * Obtain an `IOmx` instance with a specified name. 203 * 204 * @param name The name of the instance. 205 * @return omx The `IOmx` interface associated with `name`. This must be 206 * null if the name is not found. 207 */ 208 getOmx( 209 string name 210 ) generates ( 211 IOmx omx 212 ); 213 214 }; 215 216