| /* |
| * Copyright (C) 2018 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.c2@1.0; |
| |
| /** |
| * Generic configuration interface presented by all configurable Codec2 objects. |
| * |
| * This interface must be supported in all states of the owning object, and must |
| * not change the state of the owning object. |
| */ |
| interface IConfigurable { |
| /** |
| * Returns the id of the object. This must be unique among all objects of |
| * the same type hosted by the same store. |
| * |
| * @return id Id of the object. |
| */ |
| getId() generates (uint32_t id); |
| |
| /** |
| * Returns the name of the object. |
| * |
| * This must match the name that was supplied during the creation of the |
| * object. |
| * |
| * @return name Name of the object. |
| */ |
| getName() generates (string name); |
| |
| /** |
| * Queries a set of parameters from the object. |
| * |
| * Querying is performed at best effort: the object must query all supported |
| * parameters and skip unsupported ones (which may include parameters that |
| * could not be allocated). Any errors are communicated in the return value. |
| * |
| * If @p mayBlock is false, this method must not block. All parameter |
| * queries that require blocking must be skipped. |
| * |
| * If @p mayBlock is true, a query may block, but the whole method call |
| * has to complete in a timely manner, or `status = TIMED_OUT` is returned. |
| * |
| * If @p mayBlock is false, this method must not block. Otherwise, this |
| * method is allowed to block for a certain period of time before completing |
| * the operation. If the operation is not completed in a timely manner, |
| * `status = TIMED_OUT` is returned. |
| * |
| * @note The order of C2Param objects in @p param does not depend on the |
| * order of C2Param structure indices in @p indices. |
| * |
| * \par For IComponent |
| * |
| * When the object type is @ref IComponent, this method must be supported in |
| * any state except released. This call must not change the state nor the |
| * internal configuration of the component. |
| * |
| * The blocking behavior of this method differs among states: |
| * - In the stopped state, this must be non-blocking. @p mayBlock is |
| * ignored. (The method operates as if @p mayBlock was false.) |
| * - In any of the running states, this method may block momentarily if |
| * @p mayBlock is true. However, if the call cannot be completed in a |
| * timely manner, `status = TIMED_OUT` is returned. |
| * |
| * @param indices List of C2Param structure indices to query. |
| * @param mayBlock Whether this call may block or not. |
| * @return status Status of the call, which may be |
| * - `OK` - All parameters could be queried. |
| * - `BAD_INDEX` - All supported parameters could be queried, but some |
| * parameters were not supported. |
| * - `NO_MEMORY` - Could not allocate memory for a supported parameter. |
| * - `BLOCKING` - Querying some parameters requires blocking, but |
| * @p mayBlock is false. |
| * - `TIMED_OUT` - The operation cannot be finished in a timely manner. |
| * - `CORRUPTED` - Some unknown error occurred. |
| * @return params Flattened representation of C2Param objects. |
| * |
| * @sa Params. |
| */ |
| query( |
| vec<ParamIndex> indices, |
| bool mayBlock |
| ) generates ( |
| Status status, |
| Params params |
| ); |
| |
| /** |
| * Sets a set of parameters for the object. |
| * |
| * Tuning is performed at best effort: the object must update all supported |
| * configurations at best effort and skip unsupported parameters. Any errors |
| * are communicated in the return value and in @p failures. |
| * |
| * A non-strict parameter update with an unsupported value shall cause an |
| * update to the closest supported value. A strict parameter update with an |
| * unsupported value shall be skipped and a failure shall be returned. |
| * |
| * If @p mayBlock is false, this method must not block. An update that |
| * requires blocking shall be skipped and a failure shall be returned. |
| * |
| * If @p mayBlock is true, an update may block, but the whole method call |
| * has to complete in a timely manner, or `status = TIMED_OUT` is returned. |
| * |
| * The final values for all parameters set are propagated back to the caller |
| * in @p params. |
| * |
| * \par For IComponent |
| * |
| * When the object type is @ref IComponent, this method must be supported in |
| * any state except released. |
| * |
| * The blocking behavior of this method differs among states: |
| * - In the stopped state, this must be non-blocking. @p mayBlock is |
| * ignored. (The method operates as if @p mayBlock was false.) |
| * - In any of the running states, this method may block momentarily if |
| * @p mayBlock is true. However, if the call cannot be completed in a |
| * timely manner, `status = TIMED_OUT` is returned. |
| * |
| * @note Parameter tuning @e does depend on the order of the tuning |
| * parameters, e.g., some parameter update may enable some subsequent |
| * parameter update. |
| * |
| * @param inParams Requested parameter updates. |
| * @param mayBlock Whether this call may block or not. |
| * @return status Status of the call, which may be |
| * - `OK` - All parameters could be updated successfully. |
| * - `BAD_INDEX` - All supported parameters could be updated successfully, |
| * but some parameters were not supported. |
| * - `NO_MEMORY` - Some supported parameters could not be updated |
| * successfully because they contained unsupported values. |
| * These are returned in @p failures. |
| * - `BLOCKING` - Setting some parameters requires blocking, but |
| * @p mayBlock is false. |
| * - `TIMED_OUT` - The operation cannot be finished in a timely manner. |
| * - `CORRUPTED` - Some unknown error occurred. |
| * @return failures List of update failures. |
| * @return outParams Flattened representation of configured parameters. The |
| * order of parameters in @p outParams is based on the order of |
| * requested updates in @p inParams. |
| * |
| * @sa SettingResult. |
| */ |
| config( |
| Params inParams, |
| bool mayBlock |
| ) generates ( |
| Status status, |
| vec<SettingResult> failures, |
| Params outParams |
| ); |
| |
| // REFLECTION MECHANISM |
| // ========================================================================= |
| |
| /** |
| * Returns a list of supported parameters within a selected range of C2Param |
| * structure indices. |
| * |
| * @param start The first index of the selected range. |
| * @param count The length of the selected range. |
| * @return status Status of the call, which may be |
| * - `OK` - The operation completed successfully. |
| * - `NO_MEMORY` - Not enough memory to complete this method. |
| * @return params List of supported parameters in the selected range. This |
| * list may have fewer than @p count elements if some indices in the |
| * range are not supported. |
| * |
| * @sa ParamDescriptor. |
| */ |
| querySupportedParams( |
| uint32_t start, |
| uint32_t count |
| ) generates ( |
| Status status, |
| vec<ParamDescriptor> params |
| ); |
| |
| /** |
| * Retrieves the supported values for the queried fields. |
| * |
| * The object must process all fields queried even if some queries fail. |
| * |
| * If @p mayBlock is false, this method must not block. Otherwise, this |
| * method is allowed to block for a certain period of time before completing |
| * the operation. If the operation cannot be completed in a timely manner, |
| * `status = TIMED_OUT` is returned. |
| * |
| * \par For IComponent |
| * |
| * When the object type is @ref IComponent, this method must be supported in |
| * any state except released. |
| * |
| * The blocking behavior of this method differs among states: |
| * - In the stopped state, this must be non-blocking. @p mayBlock is |
| * ignored. (The method operates as if @p mayBlock was false.) |
| * - In any of the running states, this method may block momentarily if |
| * @p mayBlock is true. However, if the call cannot be completed in a |
| * timely manner, `status = TIMED_OUT` is returned. |
| * |
| * @param inFields List of field queries. |
| * @param mayBlock Whether this call may block or not. |
| * @return status Status of the call, which may be |
| * - `OK` - The operation completed successfully. |
| * - `BLOCKING` - Querying some parameters requires blocking, but |
| * @p mayBlock is false. |
| * - `NO_MEMORY` - Not enough memory to complete this method. |
| * - `BAD_INDEX` - At least one field was not recognized as a component |
| * field. |
| * - `BLOCKING` - Querying some fields requires blocking, but @p mayblock |
| * is false. |
| * - `TIMED_OUT` - The operation cannot be finished in a timely manner. |
| * - `CORRUPTED` - Some unknown error occurred. |
| * @return outFields List of supported values and results for the |
| * supplied queries. |
| * |
| * @sa FieldSupportedValuesQuery, FieldSupportedValuesQueryResult. |
| */ |
| querySupportedValues( |
| vec<FieldSupportedValuesQuery> inFields, |
| bool mayBlock |
| ) generates ( |
| Status status, |
| vec<FieldSupportedValuesQueryResult> outFields |
| ); |
| |
| }; |
| |