1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef CODEC_ADAPTER_IF_H 17 #define CODEC_ADAPTER_IF_H 18 #include <hdf_dlist.h> 19 #include <pthread.h> 20 #include "codec_callback_if.h" 21 #include "codec_component_if.h" 22 #include "codec_component_type.h" 23 #include "codec_type.h" 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 struct CodecComponentNode; 29 30 struct CodecComponentTypeInfo { 31 struct CodecComponentType instance; 32 struct CodecComponentNode *codecNode; 33 }; 34 35 struct ComponentIdElement { 36 uint32_t componentId; 37 struct CodecComponentType **comp; 38 struct CodecComponentTypeInfo *info; 39 struct DListHead node; 40 }; 41 42 struct ComponentManagerList { 43 pthread_mutex_t listMute; 44 struct DListHead head; 45 }; 46 47 int32_t CodecAdapterCodecInit(); 48 int32_t CodecAdapterCodecDeinit(); 49 int32_t CodecAdapterCreateComponent(struct CodecComponentNode **codecNode, const char *compName, int64_t appData, 50 const struct CodecCallbackType *callbacks); 51 int32_t CodecAdapterDestroyComponent(struct CodecComponentNode *codecNode); 52 int32_t CodecAdapterGetComponentVersion(const struct CodecComponentNode *codecNode, struct CompVerInfo *verInfo); 53 int32_t CodecAdapterSendCommand(const struct CodecComponentNode *codecNode, OMX_COMMANDTYPE cmd, uint32_t param, 54 int8_t *cmdData, uint32_t cmdDataLen); 55 int32_t CodecAdapterGetParameter( 56 const struct CodecComponentNode *codecNode, OMX_INDEXTYPE paramIndex, int8_t *param, uint32_t paramLen); 57 int32_t CodecAdapterSetParameter( 58 const struct CodecComponentNode *codecNode, OMX_INDEXTYPE index, const int8_t *param, uint32_t paramLen); 59 int32_t CodecAdapterGetConfig( 60 const struct CodecComponentNode *codecNode, OMX_INDEXTYPE index, int8_t *config, uint32_t configLen); 61 int32_t CodecAdapterSetConfig( 62 const struct CodecComponentNode *codecNode, OMX_INDEXTYPE index, const int8_t *config, uint32_t configLen); 63 int32_t CodecAdapterGetExtensionIndex( 64 const struct CodecComponentNode *codecNode, const char *parameterName, OMX_INDEXTYPE *indexType); 65 int32_t CodecAdapterGetState(const struct CodecComponentNode *codecNode, OMX_STATETYPE *state); 66 int32_t CodecAdapterComponentTunnelRequest(const struct CodecComponentNode *codecNode, uint32_t port, 67 int32_t omxHandleTypeTunneledComp, uint32_t tunneledPort, struct OMX_TUNNELSETUPTYPE *tunnelSetup); 68 int32_t CodecAdapterUseBuffer( 69 const struct CodecComponentNode *codecNode, uint32_t portIndex, struct OmxCodecBuffer *omxBuffer); 70 int32_t CodecAdapterAllocateBuffer( 71 const struct CodecComponentNode *codecNode, uint32_t portIndex, struct OmxCodecBuffer *omxBuffer); 72 int32_t CodecAdapterFreeBuffer( 73 const struct CodecComponentNode *codecNode, uint32_t portIndex, const struct OmxCodecBuffer *omxBuffer); 74 int32_t CodecAdapterEmptyThisBuffer(const struct CodecComponentNode *codecNode, const struct OmxCodecBuffer *omxBuffer); 75 int32_t CodecAdapterFillThisBuffer(const struct CodecComponentNode *codecNode, const struct OmxCodecBuffer *omxBuffer); 76 int32_t CodecAdapterSetCallbacks( 77 const struct CodecComponentNode *codecNode, struct CodecCallbackType *omxCallback, int64_t appData); 78 int32_t CodecAdapterComponentDeInit(const struct CodecComponentNode *codecNode); 79 int32_t CodecAdapterUseEglImage(const struct CodecComponentNode *codecNode, struct OmxCodecBuffer *buffer, 80 uint32_t portIndex, int8_t *eglImage, uint32_t eglImageLen); 81 int32_t CodecAdapterComponentRoleEnum( 82 const struct CodecComponentNode *codecNode, uint8_t *role, uint32_t roleLen, uint32_t index); 83 bool CheckParamStructLen(int32_t paramIndex, uint32_t paramLen); 84 85 #ifdef __cplusplus 86 }; 87 #endif 88 89 #endif // CODEC_ADAPTER_IF_H 90