1 /* SPDX-License-Identifier: Apache-2.0 OR MIT */ 2 /* 3 * Copyright (c) 2024 Rockchip Electronics Co., Ltd. 4 */ 5 6 #ifndef __KMPP_H__ 7 #define __KMPP_H__ 8 9 #include <unistd.h> 10 11 #include "mpp_impl.h" 12 #include "mpp_dec_cfg.h" 13 #include "mpp_enc_cfg.h" 14 #include "mpp_mem_pool.h" 15 #include "kmpp_obj.h" 16 17 typedef struct Kmpp_t Kmpp; 18 typedef struct KmppOps_t { 19 MPP_RET (*open_client)(Kmpp *ctx); 20 MPP_RET (*init)(Kmpp *ctx, MppCtxType type, MppCodingType coding); 21 22 MPP_RET (*start)(Kmpp *ctx); 23 MPP_RET (*stop)(Kmpp *ctx); 24 25 MPP_RET (*pause)(Kmpp *ctx); 26 MPP_RET (*resume)(Kmpp *ctx); 27 28 MPP_RET (*put_packet)(Kmpp *ctx, MppPacket packet); 29 MPP_RET (*get_frame)(Kmpp *ctx, MppFrame *frame); 30 31 MPP_RET (*put_frame)(Kmpp *ctx, MppFrame frame); 32 MPP_RET (*get_packet)(Kmpp *ctx, MppPacket *packet); 33 MPP_RET (*release_packet)(Kmpp *ctx, MppPacket *packet); 34 35 MPP_RET (*poll)(Kmpp *ctx, MppPortType type, MppPollType timeout); 36 MPP_RET (*dequeue)(Kmpp *ctx, MppPortType type, MppTask *task); 37 MPP_RET (*enqueue)(Kmpp *ctx, MppPortType type, MppTask task); 38 39 MPP_RET (*reset)(Kmpp *ctx); 40 MPP_RET (*control)(Kmpp *ctx, MpiCmd cmd, MppParam param); 41 42 MPP_RET (*notify_flag)(Kmpp *ctx, RK_U32 flag); 43 MPP_RET (*notify)(Kmpp *ctx, MppBufferGroup group); 44 45 MPP_RET (*get_fd)(Kmpp *ctx, RK_S32 *fd); 46 MPP_RET (*close_fd)(Kmpp *ctx, RK_S32 fd); 47 void (*clear)(Kmpp *ctx); 48 } KmppOps; 49 50 struct Kmpp_t { 51 MppPollType mInputTimeout; 52 MppPollType mOutputTimeout; 53 54 MppCtx mCtx; 55 RK_S32 mChanId; 56 RK_U32 mEncVersion; 57 58 MppCtxType mType; 59 MppCodingType mCoding; 60 RK_U32 mChanDup; 61 62 RK_U32 mInitDone; 63 64 RK_S32 mClientFd; 65 struct timeval mTimeout; 66 67 MppBufferGroup mPacketGroup; 68 MppPacket mPacket; 69 KmppFrame mKframe; 70 71 KmppOps *mApi; 72 KmppObj mVencInitKcfg; 73 }; 74 75 #ifdef __cplusplus 76 extern "C" { 77 #endif 78 79 void mpp_get_api(Kmpp *ctx); 80 81 #ifdef __cplusplus 82 } 83 #endif 84 #endif /*__MPP_H__*/ 85