1 /* 2 * Copyright (c) 2021-2023 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 HDI_CODEC_CALLBACK_CODECCALLBACK_H 17 #define HDI_CODEC_CALLBACK_CODECCALLBACK_H 18 #include "codec_type.h" 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif /* __cplusplus */ 23 24 #define CODEC_CALLBACK_DESC "ohos.hdi.codec_callback_service" 25 26 struct HdfRemoteService; 27 28 enum { 29 CMD_CODEC_ON_EVENT, 30 CMD_CODEC_INPUT_BUFFER_AVAILABLE, 31 CMD_CODEC_OUTPUT_BUFFER_AVAILABLE, 32 }; 33 34 struct ICodecCallback { 35 struct HdfRemoteService *remote; 36 CodecCallback callback; 37 }; 38 39 struct ICodecCallbackProxy { 40 struct HdfRemoteService *remote; 41 int32_t (*OnEvent)(struct ICodecCallbackProxy *self, UINTPTR userData, 42 EventType event, uint32_t length, int32_t eventData[]); 43 int32_t (*InputBufferAvailable)(struct ICodecCallbackProxy *self, UINTPTR userData, 44 CodecBuffer *inBuf, int32_t *acquireFd); 45 int32_t (*OutputBufferAvailable)(struct ICodecCallbackProxy *self, UINTPTR userData, 46 CodecBuffer *outBuf, int32_t *acquireFd); 47 }; 48 49 #ifdef __cplusplus 50 } 51 #endif /* __cplusplus */ 52 53 #endif // HDI_CODEC_CALLBACK_CODECCALLBACK_H