1 /* 2 * Copyright (c) 2022-2023 Shenzhen Kaihong DID 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_SERVICE_H 17 #define CODEC_SERVICE_H 18 19 #include "hdf_base.h" 20 #ifndef CODEC_HAL_PASSTHROUGH 21 #include "codec_callback.h" 22 #endif 23 #include "codec_type.h" 24 #include "codec_instance.h" 25 26 #ifdef __cplusplus 27 extern "C" 28 { 29 #endif 30 31 void InitOemIfaceLock(void); 32 void DeinitOemIfaceLock(void); 33 int32_t CodecInit(); 34 int32_t CodecDeinit(); 35 int32_t CodecEnumerateCapability(uint32_t index, CodecCapability *cap); 36 int32_t CodecGetCapability(AvCodecMime mime, CodecType type, uint32_t flags, CodecCapability *cap); 37 int32_t CodecCreate(const char* name, CODEC_HANDLETYPE *handle); 38 int32_t CodecDestroy(CODEC_HANDLETYPE handle); 39 int32_t CodecSetPortMode(CODEC_HANDLETYPE handle, DirectionType direct, AllocateBufferMode mode, BufferType type); 40 int32_t CodecGetPortMode(CODEC_HANDLETYPE handle, DirectionType direct, AllocateBufferMode *mode, BufferType *type); 41 int32_t CodecSetParameter(CODEC_HANDLETYPE handle, const Param *params, int paramCnt); 42 int32_t CodecGetParameter(CODEC_HANDLETYPE handle, Param *params, int paramCnt); 43 int32_t CodecStart(CODEC_HANDLETYPE handle); 44 int32_t CodecStop(CODEC_HANDLETYPE handle); 45 int32_t CodecFlush(CODEC_HANDLETYPE handle, DirectionType directType); 46 int32_t CodecQueueInput(CODEC_HANDLETYPE handle, const CodecBuffer *inputData, uint32_t timeoutMs, int releaseFenceFd); 47 int32_t CodecDequeueInput(CODEC_HANDLETYPE handle, uint32_t timeoutMs, int32_t *acquireFd, CodecBuffer *inputData); 48 int32_t CodecQueueOutput(CODEC_HANDLETYPE handle, CodecBuffer *outInfo, uint32_t timeoutMs, int releaseFenceFd); 49 int32_t CodecDequeueOutput(CODEC_HANDLETYPE handle, uint32_t timeoutMs, int32_t *acquireFd, CodecBuffer *outInfo); 50 #ifndef CODEC_HAL_PASSTHROUGH 51 int32_t CodecSetCallbackProxy(CODEC_HANDLETYPE handle, struct ICodecCallbackProxy *cb, UINTPTR instance); 52 #else 53 int32_t CodecSetCallback(CODEC_HANDLETYPE handle, CodecCallback *cb, UINTPTR instance); 54 #endif 55 #ifdef __cplusplus 56 } 57 #endif 58 #endif // CODEC_SERVICE_H 59