xref: /OK3568_Linux_fs/external/mpp/mpp/codec/inc/enc_impl_api.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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 
26 /*
27  * the reset wait for extension
28  */
29 typedef struct EncImplCfg_t {
30     // input
31     MppCodingType   coding;
32     MppClientType   type;
33     MppEncCfgSet    *cfg;
34     MppEncRefs      refs;
35 } EncImplCfg;
36 
37 /*
38  * EncImplApi is the data structure provided from different encoders
39  *
40  * They will be static register to mpp_enc for scaning
41  * name         - encoder name
42  * coding       - encoder coding type
43  * ctx_size     - encoder context size, mpp_dec will use this to malloc memory
44  * flag         - reserve
45  *
46  * init         - encoder initialization function
47  * deinit       - encoder de-initialization function
48  * proc_cfg     - encoder processs control function
49  * gen_hdr      - encoder generate hearder function
50  * proc_dpb     - encoder dpb process function (approach one frame)
51  * proc_hal     - encoder prepare hal info function
52  * add_prefix   - encoder generate user data / sei to packet as prefix
53  */
54 typedef struct EncImplApi_t {
55     char            *name;
56     MppCodingType   coding;
57     RK_U32          ctx_size;
58     RK_U32          flag;
59 
60     MPP_RET (*init)(void *ctx, EncImplCfg *ctrlCfg);
61     MPP_RET (*deinit)(void *ctx);
62 
63     MPP_RET (*proc_cfg)(void *ctx, MpiCmd cmd, void *param);
64     MPP_RET (*gen_hdr)(void *ctx, MppPacket pkt);
65 
66     MPP_RET (*start)(void *ctx, HalEncTask *task);
67     MPP_RET (*proc_dpb)(void *ctx, HalEncTask *task);
68     MPP_RET (*proc_hal)(void *ctx, HalEncTask *task);
69 
70     MPP_RET (*add_prefix)(MppPacket pkt, RK_S32 *length, RK_U8 uuid[16],
71                           const void *data, RK_S32 size);
72 
73     MPP_RET (*sw_enc)(void *ctx, HalEncTask *task);
74 } EncImplApi;
75 
76 #endif /*__ENC_IMPL_API_H__*/
77