xref: /rockchip-linux_mpp/mpp/codec/inc/parser_api.h (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
1 /*
2  * Copyright 2015 Rockchip Electronics 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 __PARSER_API_H__
18 #define __PARSER_API_H__
19 
20 #include "rk_mpi_cmd.h"
21 #include "mpp_packet.h"
22 #include "mpp_buf_slot.h"
23 #include "mpp_dec_cfg.h"
24 #include "hal_dec_task.h"
25 #include "mpp_soc.h"
26 
27 /*
28  * slots    - all decoder need a slots interface to sync its internal dpb management
29  *            with buffer group in mpp_dec
30  *
31  * the reset wait for extension
32  */
33 typedef struct DecParserInitCfg_t {
34     MppCodingType       coding;
35     MppBufSlots         frame_slots;
36     MppBufSlots         packet_slots;
37     MppDecCfgSet        *cfg;
38     const MppDecHwCap   *hw_info;
39 } ParserCfg;
40 
41 
42 /*
43  * Parser is the data structure provided from different decoders
44  *
45  * They will be static register to mpp_dec for scaning
46  * name     - decoder name
47  * coding   - decoder coding type
48  * ctx_size - decoder context size, mpp_dec will use this to malloc memory
49  * flag     - reserve
50  *
51  * init     - decoder initialization function
52  * deinit   - decoder de-initialization function
53  * parse    - decoder main working function, mpp_dec will input packet and get output syntax
54  * reset    - decoder reset function
55  * flush    - decoder output all frames
56  * control  - decoder configure function
57  */
58 typedef struct ParserApi_t {
59     char            *name;
60     MppCodingType   coding;
61     RK_U32          ctx_size;
62     RK_U32          flag;
63 
64     MPP_RET (*init)(void *ctx, ParserCfg *cfg);
65     MPP_RET (*deinit)(void *ctx);
66 
67     MPP_RET (*prepare)(void *ctx, MppPacket pkt, HalDecTask *task);
68     MPP_RET (*parse)(void *ctx, HalDecTask *task);
69 
70     MPP_RET (*reset)(void *ctx);
71     MPP_RET (*flush)(void *ctx);
72     MPP_RET (*control)(void *ctx, MpiCmd cmd, void *param);
73     MPP_RET (*callback)(void *ctx, void *err_info);
74 } ParserApi;
75 
76 
77 #endif /*__PARSER_API_H__*/
78