Loading media/codec2/hal/client/ApexCodecsLazy.cpp +12 −12 Original line number Diff line number Diff line Loading @@ -47,13 +47,13 @@ enum MethodIndex { k_ApexCodec_Configurable_querySupportedParams, k_ApexCodec_Configurable_querySupportedValues, k_ApexCodec_GetComponentStore, k_ApexCodec_ParamDescriptors_destroy, k_ApexCodec_ParamDescriptors_getDescriptor, k_ApexCodec_ParamDescriptors_getIndices, k_ApexCodec_ParamDescriptors_release, k_ApexCodec_SettingResults_destroy, k_ApexCodec_SettingResults_getResultAtIndex, k_ApexCodec_SettingResults_release, k_ApexCodec_SupportedValues_destroy, k_ApexCodec_SupportedValues_getTypeAndValues, k_ApexCodec_SupportedValues_release, k_ApexCodec_Traits_get, // Marker for count of methods Loading Loading @@ -124,13 +124,13 @@ private: BIND_SYMBOL(ApexCodec_Configurable_querySupportedParams); BIND_SYMBOL(ApexCodec_Configurable_querySupportedValues); BIND_SYMBOL(ApexCodec_GetComponentStore); BIND_SYMBOL(ApexCodec_ParamDescriptors_destroy); BIND_SYMBOL(ApexCodec_ParamDescriptors_getDescriptor); BIND_SYMBOL(ApexCodec_ParamDescriptors_getIndices); BIND_SYMBOL(ApexCodec_ParamDescriptors_release); BIND_SYMBOL(ApexCodec_SettingResults_destroy); BIND_SYMBOL(ApexCodec_SettingResults_getResultAtIndex); BIND_SYMBOL(ApexCodec_SettingResults_release); BIND_SYMBOL(ApexCodec_SupportedValues_destroy); BIND_SYMBOL(ApexCodec_SupportedValues_getTypeAndValues); BIND_SYMBOL(ApexCodec_SupportedValues_release); BIND_SYMBOL(ApexCodec_Traits_get); #undef BIND_SYMBOL Loading Loading @@ -209,8 +209,8 @@ ApexCodec_Status ApexCodec_SupportedValues_getTypeAndValues( supportedValues, type, numberType, values, numValues); } void ApexCodec_SupportedValues_release(ApexCodec_SupportedValues *values) { INVOKE_METHOD(ApexCodec_SupportedValues_release, void(), values); void ApexCodec_SupportedValues_destroy(ApexCodec_SupportedValues *values) { INVOKE_METHOD(ApexCodec_SupportedValues_destroy, void(), values); } ApexCodec_Status ApexCodec_SettingResults_getResultAtIndex( Loading @@ -224,8 +224,8 @@ ApexCodec_Status ApexCodec_SettingResults_getResultAtIndex( results, index, failure, field, conflicts, numConflicts); } void ApexCodec_SettingResults_release(ApexCodec_SettingResults *results) { INVOKE_METHOD(ApexCodec_SettingResults_release, void(), results); void ApexCodec_SettingResults_destroy(ApexCodec_SettingResults *results) { INVOKE_METHOD(ApexCodec_SettingResults_destroy, void(), results); } ApexCodec_Status ApexCodec_Component_process( Loading Loading @@ -274,9 +274,9 @@ ApexCodec_Status ApexCodec_ParamDescriptors_getDescriptor( descriptors, index, attr, name, dependencies, numDependencies); } ApexCodec_Status ApexCodec_ParamDescriptors_release( ApexCodec_Status ApexCodec_ParamDescriptors_destroy( ApexCodec_ParamDescriptors *descriptors) { INVOKE_METHOD(ApexCodec_ParamDescriptors_release, APEXCODEC_STATUS_OMITTED, descriptors); INVOKE_METHOD(ApexCodec_ParamDescriptors_destroy, APEXCODEC_STATUS_OMITTED, descriptors); } ApexCodec_Status ApexCodec_Configurable_querySupportedParams( Loading media/codec2/hal/client/client.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -1066,7 +1066,7 @@ c2_status_t Codec2ConfigurableClient::ApexImpl::config( mBase, &config, &result); base::ScopeGuard guard([result] { if (result) { ApexCodec_SettingResults_release(result); ApexCodec_SettingResults_destroy(result); } }); size_t index = 0; Loading Loading @@ -1115,7 +1115,7 @@ c2_status_t Codec2ConfigurableClient::ApexImpl::querySupportedParams( ApexCodec_Configurable_querySupportedParams(mBase, ¶mDescs); base::ScopeGuard guard([paramDescs] { if (paramDescs) { ApexCodec_ParamDescriptors_release(paramDescs); ApexCodec_ParamDescriptors_destroy(paramDescs); } }); uint32_t *indices = nullptr; Loading Loading @@ -1173,7 +1173,7 @@ c2_status_t Codec2ConfigurableClient::ApexImpl::querySupportedValues( fields[i].status = (c2_status_t)queries[i].status; FromApex(queries[i].values, &fields[i].values); if (queries[i].values) { ApexCodec_SupportedValues_release(queries[i].values); ApexCodec_SupportedValues_destroy(queries[i].values); queries[i].values = nullptr; } } Loading media/module/libapexcodecs/ApexCodecs.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <android-base/no_destructor.h> #include <apex/ApexCodecs.h> #include <apex/ApexCodecsParam.h> // TODO: remove when we have real implementations #pragma clang diagnostic push Loading Loading @@ -71,7 +72,7 @@ ApexCodec_Status ApexCodec_SupportedValues_getTypeAndValues( return APEXCODEC_STATUS_OMITTED; } void ApexCodec_SupportedValues_release(ApexCodec_SupportedValues *values) {} void ApexCodec_SupportedValues_destroy(ApexCodec_SupportedValues *values) {} ApexCodec_Status ApexCodec_SettingResults_getResultAtIndex( ApexCodec_SettingResults *results, Loading @@ -83,7 +84,7 @@ ApexCodec_Status ApexCodec_SettingResults_getResultAtIndex( return APEXCODEC_STATUS_OMITTED; } void ApexCodec_SettingResults_release(ApexCodec_SettingResults *results) {} void ApexCodec_SettingResults_destroy(ApexCodec_SettingResults *results) {} ApexCodec_Status ApexCodec_Component_process( ApexCodec_Component *comp, Loading Loading @@ -127,7 +128,7 @@ ApexCodec_Status ApexCodec_ParamDescriptors_getDescriptor( return APEXCODEC_STATUS_OMITTED; } ApexCodec_Status ApexCodec_ParamDescriptors_release( ApexCodec_Status ApexCodec_ParamDescriptors_destroy( ApexCodec_ParamDescriptors *descriptors) { return APEXCODEC_STATUS_OMITTED; } Loading media/module/libapexcodecs/include/apex/ApexCodecs.h +10 −158 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <android/api-level.h> #include <android/hardware_buffer.h> #include <android/versioning.h> #include <apex/ApexCodecsParam.h> __BEGIN_DECLS Loading Loading @@ -334,74 +335,6 @@ typedef struct ApexCodec_Buffer { ApexCodec_LinearBuffer configUpdates; } ApexCodec_Buffer; /** * Enum that represents the query type for the supported values. * * Introduced in API 36. */ typedef enum ApexCodec_SupportedValuesQueryType : uint32_t { /** Query all possible supported values regardless of current configuration */ APEXCODEC_SUPPORTED_VALUES_QUERY_POSSIBLE, /** Query supported values at current configuration */ APEXCODEC_SUPPORTED_VALUES_QUERY_CURRENT, } ApexCodec_SupportedValuesQueryType; /** * Enum that represents the type of the supported values. * * Introduced in API 36. */ typedef enum ApexCodec_SupportedValuesType : uint32_t { /** The supported values are empty. */ APEXCODEC_SUPPORTED_VALUES_EMPTY, /** * The supported values are represented by a range defined with {min, max, step, num, den}. * * If step is 0 and num and denom are both 1, the supported values are any value, for which * min <= value <= max. * * Otherwise, the range represents a geometric/arithmetic/multiply-accumulate series, where * successive supported values can be derived from previous values (starting at min), using the * following formula: * v[0] = min * v[i] = v[i-1] * num / denom + step for i >= 1, while min < v[i] <= max. */ APEXCODEC_SUPPORTED_VALUES_RANGE, /** The supported values are represented by a list of values. */ APEXCODEC_SUPPORTED_VALUES_VALUES, /** The supported values are represented by a list of flags. */ APEXCODEC_SUPPORTED_VALUES_FLAGS, } ApexCodec_SupportedValuesType; /** * Enum that represents numeric types of the supported values. * * Introduced in API 36. */ typedef enum ApexCodec_SupportedValuesNumberType : uint32_t { APEXCODEC_SUPPORTED_VALUES_TYPE_NONE = 0, APEXCODEC_SUPPORTED_VALUES_TYPE_INT32 = 1, APEXCODEC_SUPPORTED_VALUES_TYPE_UINT32 = 2, // RESERVED = 3, APEXCODEC_SUPPORTED_VALUES_TYPE_INT64 = 4, APEXCODEC_SUPPORTED_VALUES_TYPE_UINT64 = 5, // RESERVED = 6, APEXCODEC_SUPPORTED_VALUES_TYPE_FLOAT = 7, } ApexCodec_SupportedValuesNumberType; /** * Union of primitive types. * * Introduced in API 36. */ typedef union { int32_t i32; uint32_t u32; int64_t i64; uint64_t u64; float f; } ApexCodec_Value; /** * An opaque struct that represents the supported values of a parameter. * Loading Loading @@ -435,11 +368,11 @@ ApexCodec_Status ApexCodec_SupportedValues_getTypeAndValues( uint32_t *_Nonnull outNumValues) __INTRODUCED_IN(36); /** * Release the supported values object. No-op if |values| is nullptr. * Destroy the supported values object. No-op if |values| is nullptr. * * \param values the supported values object */ void ApexCodec_SupportedValues_release( void ApexCodec_SupportedValues_destroy( ApexCodec_SupportedValues *_Nullable values) __INTRODUCED_IN(36); /** Loading @@ -449,65 +382,6 @@ void ApexCodec_SupportedValues_release( */ typedef struct ApexCodec_SettingResults ApexCodec_SettingResults; /** * Enum that represents the failure code of ApexCodec_SettingResults. * * Introduced in API 36. */ typedef enum ApexCodec_SettingResultFailure : uint32_t { /** parameter type is not supported */ APEXCODEC_SETTING_RESULT_BAD_TYPE, /** parameter is not supported on the specific port */ APEXCODEC_SETTING_RESULT_BAD_PORT, /** parameter is not supported on the specific stream */ APEXCODEC_SETTING_RESULT_BAD_INDEX, /** parameter is read-only */ APEXCODEC_SETTING_RESULT_READ_ONLY, /** parameter mismatches input data */ APEXCODEC_SETTING_RESULT_MISMATCH, /** strict parameter does not accept value for the field at all */ APEXCODEC_SETTING_RESULT_BAD_VALUE, /** strict parameter field value conflicts with another settings */ APEXCODEC_SETTING_RESULT_CONFLICT, /** strict parameter field is out of range due to other settings */ APEXCODEC_SETTING_RESULT_UNSUPPORTED, /** * field does not accept the requested parameter value at all. It has been corrected to * the closest supported value. This failure mode is provided to give guidance as to what * are the currently supported values for this field (which may be a subset of the at-all- * potential values) */ APEXCODEC_SETTING_RESULT_INFO_BAD_VALUE, /** * requested parameter value is in conflict with an/other setting(s) * and has been corrected to the closest supported value. This failure * mode is given to provide guidance as to what are the currently supported values as well * as to optionally provide suggestion to the client as to how to enable the requested * parameter value. */ APEXCODEC_SETTING_RESULT_INFO_CONFLICT, } ApexCodec_SettingResultFailure; /** * Struct that represents a field and its supported values of a parameter. * * The offset and size of the field are where the field is located in the blob representation of * the parameter, as used in the ApexCodec_Configurable_query() and ApexCodec_Configurable_config(), * for example. * * Introduced in API 36. */ typedef struct ApexCodec_ParamFieldValues { /** index of the param */ uint32_t index; /** offset of the param field */ uint32_t offset; /** size of the param field */ uint32_t size; /** currently supported values of the param field */ ApexCodec_SupportedValues *_Nullable values; } ApexCodec_ParamFieldValues; /** * Extract the result of ApexCodec_Configurable_config. * The client can iterate through the results with index starting from 0 until this function returns Loading Loading @@ -537,11 +411,11 @@ ApexCodec_Status ApexCodec_SettingResults_getResultAtIndex( size_t *_Nonnull outNumConflicts) __INTRODUCED_IN(36); /** * Release the setting result object. No-op if |results| is nullptr. * Destroy the setting result object. No-op if |results| is nullptr. * * \param result the setting result object */ void ApexCodec_SettingResults_release( void ApexCodec_SettingResults_destroy( ApexCodec_SettingResults *_Nullable results) __INTRODUCED_IN(36); /** Loading Loading @@ -599,7 +473,7 @@ ApexCodec_Status ApexCodec_Component_process( * \param outResult the result of the configuration. * the client should call ApexCodec_SettingResult_getResultAtIndex() * to extract the result. The result object is owned by the client and should * be released with ApexCodec_SettingResult_release(). * be released with ApexCodec_SettingResult_destroy(). * |result| may be nullptr if empty. * \return APEXCODEC_STATUS_OK if successful * \return APEXCODEC_STATUS_BAD_VALUE if the config is invalid Loading Loading @@ -645,28 +519,6 @@ ApexCodec_Status ApexCodec_Configurable_query( */ typedef struct ApexCodec_ParamDescriptors ApexCodec_ParamDescriptors; /** * Enum that represents the attributes of a parameter. * * Introduced in API 36. */ typedef enum ApexCodec_ParamAttribute : uint32_t { /** parameter is required to be specified */ APEXCODEC_PARAM_IS_REQUIRED = 1u << 0, /** parameter retains its value */ APEXCODEC_PARAM_IS_PERSISTENT = 1u << 1, /** parameter is strict */ APEXCODEC_PARAM_IS_STRICT = 1u << 2, /** parameter is read-only */ APEXCODEC_PARAM_IS_READ_ONLY = 1u << 3, /** parameter shall not be visible to clients */ APEXCODEC_PARAM_IS_HIDDEN = 1u << 4, /** parameter shall not be used by framework (other than testing) */ APEXCODEC_PARAM_IS_INTERNAL = 1u << 5, /** parameter is publicly const (hence read-only) */ APEXCODEC_PARAM_IS_CONST = 1u << 6 | APEXCODEC_PARAM_IS_READ_ONLY, } ApexCodec_ParamAttribute; /** * Get the parameter indices of the param descriptors. * Loading Loading @@ -710,11 +562,11 @@ ApexCodec_Status ApexCodec_ParamDescriptors_getDescriptor( size_t *_Nonnull outNumDependencies) __INTRODUCED_IN(36); /** * Release the param descriptors object. * Destroy the param descriptors object. * * \param descriptors the param descriptors object */ ApexCodec_Status ApexCodec_ParamDescriptors_release( ApexCodec_Status ApexCodec_ParamDescriptors_destroy( ApexCodec_ParamDescriptors *_Nullable descriptors) __INTRODUCED_IN(36); /** Loading @@ -722,7 +574,7 @@ ApexCodec_Status ApexCodec_ParamDescriptors_release( * * \param comp the handle for the component * \param outDescriptors the pointer to be filled with the param descriptors object * the object should be released with ApexCodec_ParamDescriptors_release(). * the object should be released with ApexCodec_ParamDescriptors_destroy(). * \return APEXCODEC_STATUS_OK if successful * \return APEXCODEC_STATUS_BAD_VALUE if parameters are bad. e.g. |descriptors| is nullptr. */ Loading Loading @@ -752,7 +604,7 @@ typedef struct ApexCodec_SupportedValuesQuery { /** status of the query */ ApexCodec_Status status; /** supported values. must be released with ApexCodec_SupportedValues_release(). */ /** supported values. must be released with ApexCodec_SupportedValues_destroy(). */ ApexCodec_SupportedValues *_Nullable values; } ApexCodec_SupportedValuesQuery; Loading media/module/libapexcodecs/include/apex/ApexCodecsParam.h 0 → 100644 +185 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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. */ #pragma once #include <sys/cdefs.h> #include <stdint.h> #include <android/api-level.h> #include <android/versioning.h> __BEGIN_DECLS /** * Enums and types that represent parameters in ApexCodecs. * * NOTE: Many of the constants and types mirror the ones in the Codec 2.0 API. */ /** * Enum that represents the query type for the supported values. * * Introduced in API 36. */ typedef enum ApexCodec_SupportedValuesQueryType : uint32_t { /** Query all possible supported values regardless of current configuration */ APEXCODEC_SUPPORTED_VALUES_QUERY_POSSIBLE, /** Query supported values at current configuration */ APEXCODEC_SUPPORTED_VALUES_QUERY_CURRENT, } ApexCodec_SupportedValuesQueryType; /** * Enum that represents the type of the supported values. * * Introduced in API 36. */ typedef enum ApexCodec_SupportedValuesType : uint32_t { /** The supported values are empty. */ APEXCODEC_SUPPORTED_VALUES_EMPTY, /** * The supported values are represented by a range defined with {min, max, step, num, den}. * * If step is 0 and num and denom are both 1, the supported values are any value, for which * min <= value <= max. * * Otherwise, the range represents a geometric/arithmetic/multiply-accumulate series, where * successive supported values can be derived from previous values (starting at min), using the * following formula: * v[0] = min * v[i] = v[i-1] * num / denom + step for i >= 1, while min < v[i] <= max. */ APEXCODEC_SUPPORTED_VALUES_RANGE, /** The supported values are represented by a list of values. */ APEXCODEC_SUPPORTED_VALUES_VALUES, /** The supported values are represented by a list of flags. */ APEXCODEC_SUPPORTED_VALUES_FLAGS, } ApexCodec_SupportedValuesType; /** * Enum that represents numeric types of the supported values. * * Introduced in API 36. */ typedef enum ApexCodec_SupportedValuesNumberType : uint32_t { APEXCODEC_SUPPORTED_VALUES_TYPE_NONE = 0, APEXCODEC_SUPPORTED_VALUES_TYPE_INT32 = 1, APEXCODEC_SUPPORTED_VALUES_TYPE_UINT32 = 2, // RESERVED = 3, APEXCODEC_SUPPORTED_VALUES_TYPE_INT64 = 4, APEXCODEC_SUPPORTED_VALUES_TYPE_UINT64 = 5, // RESERVED = 6, APEXCODEC_SUPPORTED_VALUES_TYPE_FLOAT = 7, } ApexCodec_SupportedValuesNumberType; /** * Union of primitive types. * * Introduced in API 36. */ typedef union { int32_t i32; uint32_t u32; int64_t i64; uint64_t u64; float f; } ApexCodec_Value; /** * Enum that represents the failure code of ApexCodec_SettingResults. * * Introduced in API 36. */ typedef enum ApexCodec_SettingResultFailure : uint32_t { /** parameter type is not supported */ APEXCODEC_SETTING_RESULT_BAD_TYPE, /** parameter is not supported on the specific port */ APEXCODEC_SETTING_RESULT_BAD_PORT, /** parameter is not supported on the specific stream */ APEXCODEC_SETTING_RESULT_BAD_INDEX, /** parameter is read-only */ APEXCODEC_SETTING_RESULT_READ_ONLY, /** parameter mismatches input data */ APEXCODEC_SETTING_RESULT_MISMATCH, /** strict parameter does not accept value for the field at all */ APEXCODEC_SETTING_RESULT_BAD_VALUE, /** strict parameter field value conflicts with another settings */ APEXCODEC_SETTING_RESULT_CONFLICT, /** strict parameter field is out of range due to other settings */ APEXCODEC_SETTING_RESULT_UNSUPPORTED, /** * field does not accept the requested parameter value at all. It has been corrected to * the closest supported value. This failure mode is provided to give guidance as to what * are the currently supported values for this field (which may be a subset of the at-all- * potential values) */ APEXCODEC_SETTING_RESULT_INFO_BAD_VALUE, /** * requested parameter value is in conflict with an/other setting(s) * and has been corrected to the closest supported value. This failure * mode is given to provide guidance as to what are the currently supported values as well * as to optionally provide suggestion to the client as to how to enable the requested * parameter value. */ APEXCODEC_SETTING_RESULT_INFO_CONFLICT, } ApexCodec_SettingResultFailure; /* forward-declaration for an opaque struct */ struct ApexCodec_SupportedValues; /** * Struct that represents a field and its supported values of a parameter. * * The offset and size of the field are where the field is located in the blob representation of * the parameter, as used in the ApexCodec_Configurable_query() and ApexCodec_Configurable_config(), * for example. * * Introduced in API 36. */ typedef struct ApexCodec_ParamFieldValues { /** index of the param */ uint32_t index; /** offset of the param field */ uint32_t offset; /** size of the param field */ uint32_t size; /** currently supported values of the param field */ struct ApexCodec_SupportedValues *_Nullable values; } ApexCodec_ParamFieldValues; /** * Enum that represents the attributes of a parameter. * * Introduced in API 36. */ typedef enum ApexCodec_ParamAttribute : uint32_t { /** parameter is required to be specified */ APEXCODEC_PARAM_IS_REQUIRED = 1u << 0, /** parameter retains its value */ APEXCODEC_PARAM_IS_PERSISTENT = 1u << 1, /** parameter is strict */ APEXCODEC_PARAM_IS_STRICT = 1u << 2, /** parameter is read-only */ APEXCODEC_PARAM_IS_READ_ONLY = 1u << 3, /** parameter shall not be visible to clients */ APEXCODEC_PARAM_IS_HIDDEN = 1u << 4, /** parameter shall not be used by framework (other than testing) */ APEXCODEC_PARAM_IS_INTERNAL = 1u << 5, /** parameter is publicly const (hence read-only) */ APEXCODEC_PARAM_IS_CONST = 1u << 6 | APEXCODEC_PARAM_IS_READ_ONLY, } ApexCodec_ParamAttribute; __END_DECLS No newline at end of file Loading
media/codec2/hal/client/ApexCodecsLazy.cpp +12 −12 Original line number Diff line number Diff line Loading @@ -47,13 +47,13 @@ enum MethodIndex { k_ApexCodec_Configurable_querySupportedParams, k_ApexCodec_Configurable_querySupportedValues, k_ApexCodec_GetComponentStore, k_ApexCodec_ParamDescriptors_destroy, k_ApexCodec_ParamDescriptors_getDescriptor, k_ApexCodec_ParamDescriptors_getIndices, k_ApexCodec_ParamDescriptors_release, k_ApexCodec_SettingResults_destroy, k_ApexCodec_SettingResults_getResultAtIndex, k_ApexCodec_SettingResults_release, k_ApexCodec_SupportedValues_destroy, k_ApexCodec_SupportedValues_getTypeAndValues, k_ApexCodec_SupportedValues_release, k_ApexCodec_Traits_get, // Marker for count of methods Loading Loading @@ -124,13 +124,13 @@ private: BIND_SYMBOL(ApexCodec_Configurable_querySupportedParams); BIND_SYMBOL(ApexCodec_Configurable_querySupportedValues); BIND_SYMBOL(ApexCodec_GetComponentStore); BIND_SYMBOL(ApexCodec_ParamDescriptors_destroy); BIND_SYMBOL(ApexCodec_ParamDescriptors_getDescriptor); BIND_SYMBOL(ApexCodec_ParamDescriptors_getIndices); BIND_SYMBOL(ApexCodec_ParamDescriptors_release); BIND_SYMBOL(ApexCodec_SettingResults_destroy); BIND_SYMBOL(ApexCodec_SettingResults_getResultAtIndex); BIND_SYMBOL(ApexCodec_SettingResults_release); BIND_SYMBOL(ApexCodec_SupportedValues_destroy); BIND_SYMBOL(ApexCodec_SupportedValues_getTypeAndValues); BIND_SYMBOL(ApexCodec_SupportedValues_release); BIND_SYMBOL(ApexCodec_Traits_get); #undef BIND_SYMBOL Loading Loading @@ -209,8 +209,8 @@ ApexCodec_Status ApexCodec_SupportedValues_getTypeAndValues( supportedValues, type, numberType, values, numValues); } void ApexCodec_SupportedValues_release(ApexCodec_SupportedValues *values) { INVOKE_METHOD(ApexCodec_SupportedValues_release, void(), values); void ApexCodec_SupportedValues_destroy(ApexCodec_SupportedValues *values) { INVOKE_METHOD(ApexCodec_SupportedValues_destroy, void(), values); } ApexCodec_Status ApexCodec_SettingResults_getResultAtIndex( Loading @@ -224,8 +224,8 @@ ApexCodec_Status ApexCodec_SettingResults_getResultAtIndex( results, index, failure, field, conflicts, numConflicts); } void ApexCodec_SettingResults_release(ApexCodec_SettingResults *results) { INVOKE_METHOD(ApexCodec_SettingResults_release, void(), results); void ApexCodec_SettingResults_destroy(ApexCodec_SettingResults *results) { INVOKE_METHOD(ApexCodec_SettingResults_destroy, void(), results); } ApexCodec_Status ApexCodec_Component_process( Loading Loading @@ -274,9 +274,9 @@ ApexCodec_Status ApexCodec_ParamDescriptors_getDescriptor( descriptors, index, attr, name, dependencies, numDependencies); } ApexCodec_Status ApexCodec_ParamDescriptors_release( ApexCodec_Status ApexCodec_ParamDescriptors_destroy( ApexCodec_ParamDescriptors *descriptors) { INVOKE_METHOD(ApexCodec_ParamDescriptors_release, APEXCODEC_STATUS_OMITTED, descriptors); INVOKE_METHOD(ApexCodec_ParamDescriptors_destroy, APEXCODEC_STATUS_OMITTED, descriptors); } ApexCodec_Status ApexCodec_Configurable_querySupportedParams( Loading
media/codec2/hal/client/client.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -1066,7 +1066,7 @@ c2_status_t Codec2ConfigurableClient::ApexImpl::config( mBase, &config, &result); base::ScopeGuard guard([result] { if (result) { ApexCodec_SettingResults_release(result); ApexCodec_SettingResults_destroy(result); } }); size_t index = 0; Loading Loading @@ -1115,7 +1115,7 @@ c2_status_t Codec2ConfigurableClient::ApexImpl::querySupportedParams( ApexCodec_Configurable_querySupportedParams(mBase, ¶mDescs); base::ScopeGuard guard([paramDescs] { if (paramDescs) { ApexCodec_ParamDescriptors_release(paramDescs); ApexCodec_ParamDescriptors_destroy(paramDescs); } }); uint32_t *indices = nullptr; Loading Loading @@ -1173,7 +1173,7 @@ c2_status_t Codec2ConfigurableClient::ApexImpl::querySupportedValues( fields[i].status = (c2_status_t)queries[i].status; FromApex(queries[i].values, &fields[i].values); if (queries[i].values) { ApexCodec_SupportedValues_release(queries[i].values); ApexCodec_SupportedValues_destroy(queries[i].values); queries[i].values = nullptr; } } Loading
media/module/libapexcodecs/ApexCodecs.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <android-base/no_destructor.h> #include <apex/ApexCodecs.h> #include <apex/ApexCodecsParam.h> // TODO: remove when we have real implementations #pragma clang diagnostic push Loading Loading @@ -71,7 +72,7 @@ ApexCodec_Status ApexCodec_SupportedValues_getTypeAndValues( return APEXCODEC_STATUS_OMITTED; } void ApexCodec_SupportedValues_release(ApexCodec_SupportedValues *values) {} void ApexCodec_SupportedValues_destroy(ApexCodec_SupportedValues *values) {} ApexCodec_Status ApexCodec_SettingResults_getResultAtIndex( ApexCodec_SettingResults *results, Loading @@ -83,7 +84,7 @@ ApexCodec_Status ApexCodec_SettingResults_getResultAtIndex( return APEXCODEC_STATUS_OMITTED; } void ApexCodec_SettingResults_release(ApexCodec_SettingResults *results) {} void ApexCodec_SettingResults_destroy(ApexCodec_SettingResults *results) {} ApexCodec_Status ApexCodec_Component_process( ApexCodec_Component *comp, Loading Loading @@ -127,7 +128,7 @@ ApexCodec_Status ApexCodec_ParamDescriptors_getDescriptor( return APEXCODEC_STATUS_OMITTED; } ApexCodec_Status ApexCodec_ParamDescriptors_release( ApexCodec_Status ApexCodec_ParamDescriptors_destroy( ApexCodec_ParamDescriptors *descriptors) { return APEXCODEC_STATUS_OMITTED; } Loading
media/module/libapexcodecs/include/apex/ApexCodecs.h +10 −158 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <android/api-level.h> #include <android/hardware_buffer.h> #include <android/versioning.h> #include <apex/ApexCodecsParam.h> __BEGIN_DECLS Loading Loading @@ -334,74 +335,6 @@ typedef struct ApexCodec_Buffer { ApexCodec_LinearBuffer configUpdates; } ApexCodec_Buffer; /** * Enum that represents the query type for the supported values. * * Introduced in API 36. */ typedef enum ApexCodec_SupportedValuesQueryType : uint32_t { /** Query all possible supported values regardless of current configuration */ APEXCODEC_SUPPORTED_VALUES_QUERY_POSSIBLE, /** Query supported values at current configuration */ APEXCODEC_SUPPORTED_VALUES_QUERY_CURRENT, } ApexCodec_SupportedValuesQueryType; /** * Enum that represents the type of the supported values. * * Introduced in API 36. */ typedef enum ApexCodec_SupportedValuesType : uint32_t { /** The supported values are empty. */ APEXCODEC_SUPPORTED_VALUES_EMPTY, /** * The supported values are represented by a range defined with {min, max, step, num, den}. * * If step is 0 and num and denom are both 1, the supported values are any value, for which * min <= value <= max. * * Otherwise, the range represents a geometric/arithmetic/multiply-accumulate series, where * successive supported values can be derived from previous values (starting at min), using the * following formula: * v[0] = min * v[i] = v[i-1] * num / denom + step for i >= 1, while min < v[i] <= max. */ APEXCODEC_SUPPORTED_VALUES_RANGE, /** The supported values are represented by a list of values. */ APEXCODEC_SUPPORTED_VALUES_VALUES, /** The supported values are represented by a list of flags. */ APEXCODEC_SUPPORTED_VALUES_FLAGS, } ApexCodec_SupportedValuesType; /** * Enum that represents numeric types of the supported values. * * Introduced in API 36. */ typedef enum ApexCodec_SupportedValuesNumberType : uint32_t { APEXCODEC_SUPPORTED_VALUES_TYPE_NONE = 0, APEXCODEC_SUPPORTED_VALUES_TYPE_INT32 = 1, APEXCODEC_SUPPORTED_VALUES_TYPE_UINT32 = 2, // RESERVED = 3, APEXCODEC_SUPPORTED_VALUES_TYPE_INT64 = 4, APEXCODEC_SUPPORTED_VALUES_TYPE_UINT64 = 5, // RESERVED = 6, APEXCODEC_SUPPORTED_VALUES_TYPE_FLOAT = 7, } ApexCodec_SupportedValuesNumberType; /** * Union of primitive types. * * Introduced in API 36. */ typedef union { int32_t i32; uint32_t u32; int64_t i64; uint64_t u64; float f; } ApexCodec_Value; /** * An opaque struct that represents the supported values of a parameter. * Loading Loading @@ -435,11 +368,11 @@ ApexCodec_Status ApexCodec_SupportedValues_getTypeAndValues( uint32_t *_Nonnull outNumValues) __INTRODUCED_IN(36); /** * Release the supported values object. No-op if |values| is nullptr. * Destroy the supported values object. No-op if |values| is nullptr. * * \param values the supported values object */ void ApexCodec_SupportedValues_release( void ApexCodec_SupportedValues_destroy( ApexCodec_SupportedValues *_Nullable values) __INTRODUCED_IN(36); /** Loading @@ -449,65 +382,6 @@ void ApexCodec_SupportedValues_release( */ typedef struct ApexCodec_SettingResults ApexCodec_SettingResults; /** * Enum that represents the failure code of ApexCodec_SettingResults. * * Introduced in API 36. */ typedef enum ApexCodec_SettingResultFailure : uint32_t { /** parameter type is not supported */ APEXCODEC_SETTING_RESULT_BAD_TYPE, /** parameter is not supported on the specific port */ APEXCODEC_SETTING_RESULT_BAD_PORT, /** parameter is not supported on the specific stream */ APEXCODEC_SETTING_RESULT_BAD_INDEX, /** parameter is read-only */ APEXCODEC_SETTING_RESULT_READ_ONLY, /** parameter mismatches input data */ APEXCODEC_SETTING_RESULT_MISMATCH, /** strict parameter does not accept value for the field at all */ APEXCODEC_SETTING_RESULT_BAD_VALUE, /** strict parameter field value conflicts with another settings */ APEXCODEC_SETTING_RESULT_CONFLICT, /** strict parameter field is out of range due to other settings */ APEXCODEC_SETTING_RESULT_UNSUPPORTED, /** * field does not accept the requested parameter value at all. It has been corrected to * the closest supported value. This failure mode is provided to give guidance as to what * are the currently supported values for this field (which may be a subset of the at-all- * potential values) */ APEXCODEC_SETTING_RESULT_INFO_BAD_VALUE, /** * requested parameter value is in conflict with an/other setting(s) * and has been corrected to the closest supported value. This failure * mode is given to provide guidance as to what are the currently supported values as well * as to optionally provide suggestion to the client as to how to enable the requested * parameter value. */ APEXCODEC_SETTING_RESULT_INFO_CONFLICT, } ApexCodec_SettingResultFailure; /** * Struct that represents a field and its supported values of a parameter. * * The offset and size of the field are where the field is located in the blob representation of * the parameter, as used in the ApexCodec_Configurable_query() and ApexCodec_Configurable_config(), * for example. * * Introduced in API 36. */ typedef struct ApexCodec_ParamFieldValues { /** index of the param */ uint32_t index; /** offset of the param field */ uint32_t offset; /** size of the param field */ uint32_t size; /** currently supported values of the param field */ ApexCodec_SupportedValues *_Nullable values; } ApexCodec_ParamFieldValues; /** * Extract the result of ApexCodec_Configurable_config. * The client can iterate through the results with index starting from 0 until this function returns Loading Loading @@ -537,11 +411,11 @@ ApexCodec_Status ApexCodec_SettingResults_getResultAtIndex( size_t *_Nonnull outNumConflicts) __INTRODUCED_IN(36); /** * Release the setting result object. No-op if |results| is nullptr. * Destroy the setting result object. No-op if |results| is nullptr. * * \param result the setting result object */ void ApexCodec_SettingResults_release( void ApexCodec_SettingResults_destroy( ApexCodec_SettingResults *_Nullable results) __INTRODUCED_IN(36); /** Loading Loading @@ -599,7 +473,7 @@ ApexCodec_Status ApexCodec_Component_process( * \param outResult the result of the configuration. * the client should call ApexCodec_SettingResult_getResultAtIndex() * to extract the result. The result object is owned by the client and should * be released with ApexCodec_SettingResult_release(). * be released with ApexCodec_SettingResult_destroy(). * |result| may be nullptr if empty. * \return APEXCODEC_STATUS_OK if successful * \return APEXCODEC_STATUS_BAD_VALUE if the config is invalid Loading Loading @@ -645,28 +519,6 @@ ApexCodec_Status ApexCodec_Configurable_query( */ typedef struct ApexCodec_ParamDescriptors ApexCodec_ParamDescriptors; /** * Enum that represents the attributes of a parameter. * * Introduced in API 36. */ typedef enum ApexCodec_ParamAttribute : uint32_t { /** parameter is required to be specified */ APEXCODEC_PARAM_IS_REQUIRED = 1u << 0, /** parameter retains its value */ APEXCODEC_PARAM_IS_PERSISTENT = 1u << 1, /** parameter is strict */ APEXCODEC_PARAM_IS_STRICT = 1u << 2, /** parameter is read-only */ APEXCODEC_PARAM_IS_READ_ONLY = 1u << 3, /** parameter shall not be visible to clients */ APEXCODEC_PARAM_IS_HIDDEN = 1u << 4, /** parameter shall not be used by framework (other than testing) */ APEXCODEC_PARAM_IS_INTERNAL = 1u << 5, /** parameter is publicly const (hence read-only) */ APEXCODEC_PARAM_IS_CONST = 1u << 6 | APEXCODEC_PARAM_IS_READ_ONLY, } ApexCodec_ParamAttribute; /** * Get the parameter indices of the param descriptors. * Loading Loading @@ -710,11 +562,11 @@ ApexCodec_Status ApexCodec_ParamDescriptors_getDescriptor( size_t *_Nonnull outNumDependencies) __INTRODUCED_IN(36); /** * Release the param descriptors object. * Destroy the param descriptors object. * * \param descriptors the param descriptors object */ ApexCodec_Status ApexCodec_ParamDescriptors_release( ApexCodec_Status ApexCodec_ParamDescriptors_destroy( ApexCodec_ParamDescriptors *_Nullable descriptors) __INTRODUCED_IN(36); /** Loading @@ -722,7 +574,7 @@ ApexCodec_Status ApexCodec_ParamDescriptors_release( * * \param comp the handle for the component * \param outDescriptors the pointer to be filled with the param descriptors object * the object should be released with ApexCodec_ParamDescriptors_release(). * the object should be released with ApexCodec_ParamDescriptors_destroy(). * \return APEXCODEC_STATUS_OK if successful * \return APEXCODEC_STATUS_BAD_VALUE if parameters are bad. e.g. |descriptors| is nullptr. */ Loading Loading @@ -752,7 +604,7 @@ typedef struct ApexCodec_SupportedValuesQuery { /** status of the query */ ApexCodec_Status status; /** supported values. must be released with ApexCodec_SupportedValues_release(). */ /** supported values. must be released with ApexCodec_SupportedValues_destroy(). */ ApexCodec_SupportedValues *_Nullable values; } ApexCodec_SupportedValuesQuery; Loading
media/module/libapexcodecs/include/apex/ApexCodecsParam.h 0 → 100644 +185 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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. */ #pragma once #include <sys/cdefs.h> #include <stdint.h> #include <android/api-level.h> #include <android/versioning.h> __BEGIN_DECLS /** * Enums and types that represent parameters in ApexCodecs. * * NOTE: Many of the constants and types mirror the ones in the Codec 2.0 API. */ /** * Enum that represents the query type for the supported values. * * Introduced in API 36. */ typedef enum ApexCodec_SupportedValuesQueryType : uint32_t { /** Query all possible supported values regardless of current configuration */ APEXCODEC_SUPPORTED_VALUES_QUERY_POSSIBLE, /** Query supported values at current configuration */ APEXCODEC_SUPPORTED_VALUES_QUERY_CURRENT, } ApexCodec_SupportedValuesQueryType; /** * Enum that represents the type of the supported values. * * Introduced in API 36. */ typedef enum ApexCodec_SupportedValuesType : uint32_t { /** The supported values are empty. */ APEXCODEC_SUPPORTED_VALUES_EMPTY, /** * The supported values are represented by a range defined with {min, max, step, num, den}. * * If step is 0 and num and denom are both 1, the supported values are any value, for which * min <= value <= max. * * Otherwise, the range represents a geometric/arithmetic/multiply-accumulate series, where * successive supported values can be derived from previous values (starting at min), using the * following formula: * v[0] = min * v[i] = v[i-1] * num / denom + step for i >= 1, while min < v[i] <= max. */ APEXCODEC_SUPPORTED_VALUES_RANGE, /** The supported values are represented by a list of values. */ APEXCODEC_SUPPORTED_VALUES_VALUES, /** The supported values are represented by a list of flags. */ APEXCODEC_SUPPORTED_VALUES_FLAGS, } ApexCodec_SupportedValuesType; /** * Enum that represents numeric types of the supported values. * * Introduced in API 36. */ typedef enum ApexCodec_SupportedValuesNumberType : uint32_t { APEXCODEC_SUPPORTED_VALUES_TYPE_NONE = 0, APEXCODEC_SUPPORTED_VALUES_TYPE_INT32 = 1, APEXCODEC_SUPPORTED_VALUES_TYPE_UINT32 = 2, // RESERVED = 3, APEXCODEC_SUPPORTED_VALUES_TYPE_INT64 = 4, APEXCODEC_SUPPORTED_VALUES_TYPE_UINT64 = 5, // RESERVED = 6, APEXCODEC_SUPPORTED_VALUES_TYPE_FLOAT = 7, } ApexCodec_SupportedValuesNumberType; /** * Union of primitive types. * * Introduced in API 36. */ typedef union { int32_t i32; uint32_t u32; int64_t i64; uint64_t u64; float f; } ApexCodec_Value; /** * Enum that represents the failure code of ApexCodec_SettingResults. * * Introduced in API 36. */ typedef enum ApexCodec_SettingResultFailure : uint32_t { /** parameter type is not supported */ APEXCODEC_SETTING_RESULT_BAD_TYPE, /** parameter is not supported on the specific port */ APEXCODEC_SETTING_RESULT_BAD_PORT, /** parameter is not supported on the specific stream */ APEXCODEC_SETTING_RESULT_BAD_INDEX, /** parameter is read-only */ APEXCODEC_SETTING_RESULT_READ_ONLY, /** parameter mismatches input data */ APEXCODEC_SETTING_RESULT_MISMATCH, /** strict parameter does not accept value for the field at all */ APEXCODEC_SETTING_RESULT_BAD_VALUE, /** strict parameter field value conflicts with another settings */ APEXCODEC_SETTING_RESULT_CONFLICT, /** strict parameter field is out of range due to other settings */ APEXCODEC_SETTING_RESULT_UNSUPPORTED, /** * field does not accept the requested parameter value at all. It has been corrected to * the closest supported value. This failure mode is provided to give guidance as to what * are the currently supported values for this field (which may be a subset of the at-all- * potential values) */ APEXCODEC_SETTING_RESULT_INFO_BAD_VALUE, /** * requested parameter value is in conflict with an/other setting(s) * and has been corrected to the closest supported value. This failure * mode is given to provide guidance as to what are the currently supported values as well * as to optionally provide suggestion to the client as to how to enable the requested * parameter value. */ APEXCODEC_SETTING_RESULT_INFO_CONFLICT, } ApexCodec_SettingResultFailure; /* forward-declaration for an opaque struct */ struct ApexCodec_SupportedValues; /** * Struct that represents a field and its supported values of a parameter. * * The offset and size of the field are where the field is located in the blob representation of * the parameter, as used in the ApexCodec_Configurable_query() and ApexCodec_Configurable_config(), * for example. * * Introduced in API 36. */ typedef struct ApexCodec_ParamFieldValues { /** index of the param */ uint32_t index; /** offset of the param field */ uint32_t offset; /** size of the param field */ uint32_t size; /** currently supported values of the param field */ struct ApexCodec_SupportedValues *_Nullable values; } ApexCodec_ParamFieldValues; /** * Enum that represents the attributes of a parameter. * * Introduced in API 36. */ typedef enum ApexCodec_ParamAttribute : uint32_t { /** parameter is required to be specified */ APEXCODEC_PARAM_IS_REQUIRED = 1u << 0, /** parameter retains its value */ APEXCODEC_PARAM_IS_PERSISTENT = 1u << 1, /** parameter is strict */ APEXCODEC_PARAM_IS_STRICT = 1u << 2, /** parameter is read-only */ APEXCODEC_PARAM_IS_READ_ONLY = 1u << 3, /** parameter shall not be visible to clients */ APEXCODEC_PARAM_IS_HIDDEN = 1u << 4, /** parameter shall not be used by framework (other than testing) */ APEXCODEC_PARAM_IS_INTERNAL = 1u << 5, /** parameter is publicly const (hence read-only) */ APEXCODEC_PARAM_IS_CONST = 1u << 6 | APEXCODEC_PARAM_IS_READ_ONLY, } ApexCodec_ParamAttribute; __END_DECLS No newline at end of file