xref: /rockchip-linux_mpp/mpp/codec/inc/enc_impl_api.h (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
1 /*
2  * Copyright 2010 Rockchip Electronics S.LSI Co. LTD
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __ENC_IMPL_API_H__
18 #define __ENC_IMPL_API_H__
19 
20 #include "rk_mpi_cmd.h"
21 
22 #include "hal_enc_task.h"
23 #include "mpp_enc_cfg.h"
24 #include "mpp_enc_refs.h"
25 #include "mpp_dev_defs.h"
26 
27 /*
28  * the reset wait for extension
29  */
30 typedef struct EncImplCfg_t {
31     // input
32     MppCodingType   coding;
33     MppClientType   type;
34     MppEncCfgSet    *cfg;
35     MppEncRefs      refs;
36 } EncImplCfg;
37 
38 /*
39  * EncImplApi is the data structure provided from different encoders
40  *
41  * They will be static register to mpp_enc for scaning
42  * name         - encoder name
43  * coding       - encoder coding type
44  * ctx_size     - encoder context size, mpp_dec will use this to malloc memory
45  * flag         - reserve
46  *
47  * init         - encoder initialization function
48  * deinit       - encoder de-initialization function
49  * proc_cfg     - encoder processs control function
50  * gen_hdr      - encoder generate hearder function
51  * proc_dpb     - encoder dpb process function (approach one frame)
52  * proc_hal     - encoder prepare hal info function
53  * add_prefix   - encoder generate user data / sei to packet as prefix
54  */
55 typedef struct EncImplApi_t {
56     char            *name;
57     MppCodingType   coding;
58     RK_U32          ctx_size;
59     RK_U32          flag;
60 
61     MPP_RET (*init)(void *ctx, EncImplCfg *ctrlCfg);
62     MPP_RET (*deinit)(void *ctx);
63 
64     MPP_RET (*proc_cfg)(void *ctx, MpiCmd cmd, void *param);
65     MPP_RET (*gen_hdr)(void *ctx, MppPacket pkt);
66 
67     MPP_RET (*start)(void *ctx, HalEncTask *task);
68     MPP_RET (*proc_dpb)(void *ctx, HalEncTask *task);
69     MPP_RET (*proc_hal)(void *ctx, HalEncTask *task);
70 
71     MPP_RET (*add_prefix)(MppPacket pkt, RK_S32 *length, RK_U8 uuid[16],
72                           const void *data, RK_S32 size);
73 
74     MPP_RET (*sw_enc)(void *ctx, HalEncTask *task);
75 } EncImplApi;
76 
77 #endif /*__ENC_IMPL_API_H__*/
78