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