diff --git a/media/1.0/types.hal b/media/1.0/types.hal index 1f9c4dc4f8..bb1a73bd67 100644 --- a/media/1.0/types.hal +++ b/media/1.0/types.hal @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/media/omx/1.0/Android.bp b/media/omx/1.0/Android.bp index c6e03890fc..bfd46c219e 100644 --- a/media/omx/1.0/Android.bp +++ b/media/omx/1.0/Android.bp @@ -9,6 +9,7 @@ filegroup { "IOmxBufferSource.hal", "IOmxNode.hal", "IOmxObserver.hal", + "IOmxStore.hal", ], } @@ -26,6 +27,7 @@ genrule { "android/hardware/media/omx/1.0/OmxBufferSourceAll.cpp", "android/hardware/media/omx/1.0/OmxNodeAll.cpp", "android/hardware/media/omx/1.0/OmxObserverAll.cpp", + "android/hardware/media/omx/1.0/OmxStoreAll.cpp", ], } @@ -64,6 +66,11 @@ genrule { "android/hardware/media/omx/1.0/BnHwOmxObserver.h", "android/hardware/media/omx/1.0/BpHwOmxObserver.h", "android/hardware/media/omx/1.0/BsOmxObserver.h", + "android/hardware/media/omx/1.0/IOmxStore.h", + "android/hardware/media/omx/1.0/IHwOmxStore.h", + "android/hardware/media/omx/1.0/BnHwOmxStore.h", + "android/hardware/media/omx/1.0/BpHwOmxStore.h", + "android/hardware/media/omx/1.0/BsOmxStore.h", ], } diff --git a/media/omx/1.0/IOmx.hal b/media/omx/1.0/IOmx.hal index 78d4b323af..f5fc44987a 100644 --- a/media/omx/1.0/IOmx.hal +++ b/media/omx/1.0/IOmx.hal @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ import IGraphicBufferSource; /** * Ref: frameworks/av/include/media/IOMX.h: IOMX * - * IOmx is the main entry point for communicating with OMX components. + * IOmx has the ability to create OMX nodes. */ interface IOmx { @@ -41,8 +41,8 @@ interface IOmx { /** * List available components. * - * @param[out] status The status of the call. - * @param[out] nodeList The list of ComponentInfo. + * @return status The status of the call. + * @return nodeList The list of ComponentInfo. */ listNodes( ) generates ( @@ -50,14 +50,15 @@ interface IOmx { vec nodeList ); + /** - * Allocate an IOmxNode instance with the specified component name. + * Allocate an IOmxNode instance with the specified node name. * - * @param[in] name The name of the component to create. - * @param[in] observer An observer object that will receive messages from + * @param name The name of the node to create. + * @param observer An observer object that will receive messages from * the created instance. - * @param[out] status The status of the call. - * @param[out] omxNode The allocated instance of IOmxNode. + * @return status The status of the call. + * @return omxNode The allocated instance of `IOmxNode`. */ allocateNode( string name, @@ -70,8 +71,9 @@ interface IOmx { /** * Create an input surface for recording. * - * @param[out] producer The associated producer end of the buffer queue. - * @param[out] source The associated `IGraphicBufferSource`. + * @return status The status of the call. + * @return producer The associated producer end of the buffer queue. + * @return source The associated `IGraphicBufferSource`. */ createInputSurface( ) generates ( diff --git a/media/omx/1.0/IOmxNode.hal b/media/omx/1.0/IOmxNode.hal index 872963756e..71c0da33b1 100644 --- a/media/omx/1.0/IOmxNode.hal +++ b/media/omx/1.0/IOmxNode.hal @@ -35,7 +35,7 @@ interface IOmxNode { /** * Free the node. * - * @param[out] status Status of the call. + * @return status Status of the call. */ freeNode( ) generates ( @@ -45,9 +45,9 @@ interface IOmxNode { /** * Invoke a command on the node. * - * @param[in] cmd Type of the command. - * @param[in] param Parameter for the command. - * @param[out] status Status of the call. + * @param cmd Type of the command. + * @param param Parameter for the command. + * @return status Status of the call. * * @see OMX_SendCommand() in the OpenMax IL standard. */ @@ -61,10 +61,10 @@ interface IOmxNode { /** * Retrieve a parameter setting from the node. * - * @param[in] index Type of the parameter to retrieve. - * @param[in] inParams Information about the retrieval. - * @param[out] status Status of the call. - * @param[out] outParams Current parameter setting. + * @param index Type of the parameter to retrieve. + * @param inParams Information about the retrieval. + * @return status Status of the call. + * @return outParams Current parameter setting. * * @see OMX_GetParameter() in the OpenMax IL standard. */ @@ -79,9 +79,9 @@ interface IOmxNode { /** * Change a parameter setting of the node. * - * @param[in] index Type of the parameter to change. - * @param[in] params New parameter setting. - * @param[out] status Status of the call. + * @param index Type of the parameter to change. + * @param params New parameter setting. + * @return status Status of the call. * * @see OMX_SetParameter() in the OpenMax IL standard. */ @@ -95,10 +95,10 @@ interface IOmxNode { /** * Retrieve a configuration from the node. * - * @param[in] index Type of the configuration to retrieve. - * @param[in] inConfig Information about the retrieval. - * @param[out] status Status of the call. - * @param[out] outConfig Current configuration. + * @param index Type of the configuration to retrieve. + * @param inConfig Information about the retrieval. + * @return status Status of the call. + * @return outConfig Current configuration. * * @see OMX_GetConfig() in the OpenMax IL standard. */ @@ -113,9 +113,9 @@ interface IOmxNode { /** * Change a configuration of the node. * - * @param[in] index Type of the configuration to change. - * @param[in] config New configuration. - * @param[out] status Status of the call. + * @param index Type of the configuration to change. + * @param config New configuration. + * @return status Status of the call. * * @see OMX_SetConfig() in the OpenMax IL standard. */ @@ -129,9 +129,9 @@ interface IOmxNode { /** * Set the mode of a port on the node. * - * @param[in] portIndex Index of the port. - * @param[in] mode Target mode on the specified port. - * @param[out] status Status of the call. + * @param portIndex Index of the port. + * @param mode Target mode on the specified port. + * @return status Status of the call. */ setPortMode( uint32_t portIndex, @@ -144,11 +144,11 @@ interface IOmxNode { * Prepare a port for adaptive playback. This is based on the extension * "OMX.google.android.index.prepareForAdaptivePlayback". * - * @param[in] portIndex Index of the port. - * @param[in] enable Whether the adaptive playback is enabled or not. - * @param[in] maxFrameWidth Maximum frame width. - * @param[in] maxFrameHeight Maximum frame height. - * @param[out] status Status of the call. + * @param portIndex Index of the port. + * @param enable Whether the adaptive playback is enabled or not. + * @param maxFrameWidth Maximum frame width. + * @param maxFrameHeight Maximum frame height. + * @return status Status of the call. */ prepareForAdaptivePlayback( uint32_t portIndex, @@ -163,12 +163,12 @@ interface IOmxNode { * Configure a port for a tunneled playback mode. This is based on the * extension "OMX.google.android.index.configureVideoTunnelMode". * - * @param[in] portIndex Index of the port. - * @param[in] tunneled Whether the tunneled mode is used or not. - * @param[in] audioHwSync HW SYNC ID of the audio HAL output stream to sync + * @param portIndex Index of the port. + * @param tunneled Whether the tunneled mode is used or not. + * @param audioHwSync HW SYNC ID of the audio HAL output stream to sync * the video with. - * @param[out] status Status of the call. - * @param[out] sidebandHandle Codec-allocated sideband window handle. + * @return status Status of the call. + * @return sidebandHandle Codec-allocated sideband window handle. */ configureVideoTunnelMode( uint32_t portIndex, @@ -183,9 +183,9 @@ interface IOmxNode { * Retrieve the buffer usage on a port. This is based on the extension * "OMX.google.android.index.getAndroidNativeBufferUsage". * - * @param[in] portIndex Index of the port. - * @param[out] status Status of the call. - * @param[out] usage Current graphic buffer usage. + * @param portIndex Index of the port. + * @return status Status of the call. + * @return usage Current graphic buffer usage. */ getGraphicBufferUsage( uint32_t portIndex @@ -197,9 +197,9 @@ interface IOmxNode { /** * Set up a listener to events related to the input surface. * - * @param[in] bufferSource Listener object that implements + * @param bufferSource Listener object that implements * IOmxBufferSource. - * @param[out] status Status of the call. + * @return status Status of the call. * * @see IOmxBufferSource. */ @@ -212,12 +212,12 @@ interface IOmxNode { /** * Allocate an opaque buffer on a port as a native handle. * - * @param[in] portIndex Index of the port. - * @param[in] size Desired size of the buffer. - * @param[out] status Status of the call. - * @param[out] buffer Id of the allocated buffer, which will be needed in + * @param portIndex Index of the port. + * @param size Desired size of the buffer. + * @return status Status of the call. + * @return buffer Id of the allocated buffer, which will be needed in * other buffer-related functions. - * @param[out] nativeHandle Native handle of the allocated buffer. + * @return nativeHandle Native handle of the allocated buffer. * * @see OMX_AllocateBuffer() in the OpenMax IL standard. */ @@ -233,10 +233,10 @@ interface IOmxNode { /** * Assign a buffer to a port. * - * @param[in] portIndex Index of the port. - * @param[in] omxBuffer Buffer to be assigned to the port. - * @param[out] status Status of the call. - * @param[out] buffer Id of the assigned buffer, which will be needed in + * @param portIndex Index of the port. + * @param omxBuffer Buffer to be assigned to the port. + * @return status Status of the call. + * @return buffer Id of the assigned buffer, which will be needed in * other buffer-related functions. * * @see OMX_UseBuffer() in the OpenMax IL standard. @@ -253,9 +253,9 @@ interface IOmxNode { * Free a buffer previously assigned to a port by allocateSecureBuffer() or * useBuffer(). * - * @param[in] portIndex Index of the port. - * @param[in] buffer Id of the buffer to be freed. - * @param[out] status Status of the call. + * @param portIndex Index of the port. + * @param buffer Id of the buffer to be freed. + * @return status Status of the call. * * @see OMX_FreeBuffer() in the OpenMax IL standard. */ @@ -275,10 +275,10 @@ interface IOmxNode { * the new buffer passed in via \p omxBuffer before OMX_FillThisBuffer() is * called. Otherwise, \p omxBuffer is not used. * - * @param[in] buffer Id of the buffer to fill. - * @param[in] omxBuffer New buffer information (in metadata mode). - * @param[in] fence Fence to wait for (if not null). - * @param[out] status Status of the call. + * @param buffer Id of the buffer to fill. + * @param omxBuffer New buffer information (in metadata mode). + * @param fence Fence to wait for (if not null). + * @return status Status of the call. * * @see OMX_FillThisBuffer() in the OpenMax IL standard. */ @@ -299,12 +299,12 @@ interface IOmxNode { * the new buffer passed in via \p omxBuffer before OMX_EmptyThisBuffer() is * called. Otherwise, \p omxBuffer is not used. * - * @param[in] buffer Id of the buffer to fill. - * @param[in] omxBuffer New buffer information (in metadata mode). - * @param[in] flags Flags to be passed to OMX_EmptyBuffer(). - * @param[in] timestampUs Timestamp OMX_EmptyBuffer(). - * @param[in] fence Fence to wait for (if not null). - * @param[out] status Status of the call. + * @param buffer Id of the buffer to fill. + * @param omxBuffer New buffer information (in metadata mode). + * @param flags Flags to be passed to OMX_EmptyBuffer(). + * @param timestampUs Timestamp OMX_EmptyBuffer(). + * @param fence Fence to wait for (if not null). + * @return status Status of the call. * * @see OMX_EmptyThisBuffer() in the OpenMax IL standard. */ @@ -321,9 +321,9 @@ interface IOmxNode { /** * Request the node to translate an extension string to an index. * - * @param[in] parameterName Requested extension string. - * @param[out] status Status of the call. - * @param[out] index Translated index. + * @param parameterName Requested extension string. + * @return status Status of the call. + * @return index Translated index. * * @see OMX_GetExtensionIndex() in the OpenMax IL standard. */ @@ -340,8 +340,8 @@ interface IOmxNode { * receive the message in batches by the callback * IOmxObserver::onMessages(). * - * @param[in] msg Message to send. - * @param[out] status Status of the call. + * @param msg Message to send. + * @return status Status of the call. * * @see IOmxObserver::onMessages(). */ @@ -350,16 +350,5 @@ interface IOmxNode { ) generates ( Status status ); - - /** - * Set quirks. - * - * @param[in] quirks Quirks for the component, generally obtained from - * MediaCodecList::getQuirksFor(). - */ - oneway setQuirks( - uint32_t quirks - ); - }; diff --git a/media/omx/1.0/IOmxStore.hal b/media/omx/1.0/IOmxStore.hal new file mode 100644 index 0000000000..a224b0e16f --- /dev/null +++ b/media/omx/1.0/IOmxStore.hal @@ -0,0 +1,215 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.media.omx@1.0; + +import IOmx; + +/** + * Ref: frameworks/av/include/media/IOMX.h: IOMX + * + * There will be two instances of IOmxStore: "platform" and "vendor". + * + * The IOmxStore service provided by the platform must present "platform" as the + * interface name. + * + * The IOmxStore service provided by the vendor must present "vendor" as the + * instance name. + */ +interface IOmxStore { + + /** + * Attribute is a key-value pair of strings. The `value` member is generally + * a stringified value of the following: + * enum: v1 | v2 | ... | vn + * num: 0 | [1-9][0-9]* + * string: arbitrary string + * size: x + * ratio: : + * range: - + * list: | ,> + */ + struct Attribute { + string key; + string value; + }; + + /** + * Service attribute + * + * Optional service attributes: + * key: 'max-video-encoder-input-buffers', value-type: num + * key: 'supports-multiple-secure-codecs', value-type: enum<0,1> + * key: 'supports-secure-with-non-secure-codec', value-type: enum<0,1> + * + * For keys with prefix 'supports-', the value of 0 means "no" (not + * supported) while the value of 1 means "yes" (supported). + */ + typedef Attribute ServiceAttribute; + + /** + * List attributes that are service-specific (not node-specific). + * + * @return attributes The list of `Attribute`s that are specific to this + * service. + */ + listServiceAttributes( + ) generates ( + Status status, + vec attributes + ); + + /** + * Node attribute + * + * Optional node attributes to describe supported values: + * key: 'bitrate-range', value-type: range + * key: 'max-concurrent-instances', value-type: num + * key: 'max-supported-instances', value-type: num + * + * Optional node attributes for audio nodes to describe supported values: + * key: 'max-channel-count', value-type: num + * key: 'sample-rate-ranges', value-type: list> + * + * Optional node attributes for video nodes to describe supported values: + * key: 'alignment', value-type: size + * key: 'block-aspect-ratio-range', value-type: range + * key: 'block-count-range', value-type: range + * key: 'block-size', value-type: size + * key: 'blocks-per-second-range', value-type: range + * key: 'feature-can-swap-width-height', value-type: enum<0,1> + * key: 'frame-rate-range', value-type: range + * key: 'pixel-aspect-ratio-range', value-type: range + * key: 'size-range', value-type: range + * + * Required node attributes for video nodes that are required by Android to + * describe measured values for this device: + * key: 'measured-frame-rate---range', + * value-type: range; where width: num, height: num + * + * Optional node attributes for decoders to describe supported values: + * key: 'feature-adaptive-playback', value: enum<0,1> + * key: 'feature-secure-playback', value: enum<0,1> + * key: 'feature-tunneled-playback', value: enum<0,1> + * + * Optional node attributes for video decoders to describe supported values: + * key: 'feature-partial-frame', value: enum<0,1> + * + * Optional node attributes for encoders to describe supported values: + * key: 'complexity-default', value-type: num + * key: 'complexity-range', value-type: range + * key: 'feature-bitrate-control', value-type: list> + * key: 'feature-intra-refresh', value-type: enum<0,1> + * key: 'quality-default', value-type: num + * key: 'quality-range', value-type: range + * key: 'quality-scale', value-type: string + * + * For keys with prefix 'feature-' and value type enum<0,1>, the value of 0 + * means "optional", while the value of 1 means "required". + */ + typedef Attribute NodeAttribute; + + /** + * Information for an IOmxNode node. + */ + struct NodeInfo { + /** + * Name of this node. + * + * `name` can be supplied to `IOmx::allocateNode` of a + * corresponding `IOmx` instance to create the node. + */ + string name; + /** + * Name of the `IOmx` instance that can create this node. + * + * To obtain the `IOmx` instance, call `getOmx(owner)`. + */ + string owner; + /** + * List of node attributes. + */ + vec attributes; + }; + + /** + * Information about nodes provided for a supported node role + */ + struct RoleInfo { + /** + * Standard OMX node role. + */ + string role; + /** + * Corresponding media type (as defined in MediaFormat.MIMETYPE_* + * constants for types required by Android). + */ + string type; + /** + * Whether this role is for an encoder or a decoder. + */ + bool isEncoder; + /** + * Whether to prefer platform nodes for this role. + */ + bool preferPlatformNodes; + /** + * List of nodes that support this role, ordered by preference. + */ + vec nodes; + }; + + /** + * Return the prefix of names of supported nodes. + * + * @return prefix The prefix of the names of all nodes supported by this + * service. + */ + getNodePrefix( + ) generates ( + string prefix + ); + + /** + * List roles of supported nodes. + * + * The name of each node inside `NodeInfo` must start with the prefix + * returned by `getNodePrefix()`. + * + * @return roleList The list of `RoleInfo`s. + * + * @see RoleInfo + */ + listRoles( + ) generates ( + vec roleList + ); + + /** + * Obtain an `IOmx` instance with a specified name. + * + * @param name The name of the instance. + * @return omx The `IOmx` interface associated with `name`. This must be + * null if the name is not found. + */ + getOmx( + string name + ) generates ( + IOmx omx + ); + +}; + diff --git a/media/omx/1.0/types.hal b/media/omx/1.0/types.hal index 54133446e1..76a60072b6 100644 --- a/media/omx/1.0/types.hal +++ b/media/omx/1.0/types.hal @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,6 +35,7 @@ enum Status : int32_t { NAME_NOT_FOUND = -2, WOULD_BLOCK = -11, NO_MEMORY = -12, + ALREADY_EXISTS = -17, NO_INIT = -19, BAD_VALUE = -22, DEAD_OBJECT = -32,