xref: /rockchip-linux_mpp/mpp/codec/inc/mpp_dec.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 __MPP_DEC_H__
18 #define __MPP_DEC_H__
19 
20 #include "rk_type.h"
21 #include "mpp_err.h"
22 #include "rk_mpi_cmd.h"
23 #include "mpp_dec_cfg.h"
24 
25 typedef enum MppDecEvent_e {
26     MPP_DEC_EVENT_ON_PKT_RELEASE,
27     MPP_DEC_EVENT_ON_FRM_READY,
28 
29     MPP_DEC_EVENT_BUTT,
30 } MppDecEvent;
31 
32 typedef void* MppDec;
33 
34 typedef struct {
35     MppCodingType       coding;
36     void                *mpp;
37 
38     MppDecCfg           cfg;
39 } MppDecInitCfg;
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 MPP_RET mpp_dec_init(MppDec *ctx, MppDecInitCfg *cfg);
46 MPP_RET mpp_dec_deinit(MppDec ctx);
47 
48 MPP_RET mpp_dec_start(MppDec ctx);
49 MPP_RET mpp_dec_stop(MppDec ctx);
50 
51 MPP_RET mpp_dec_reset(MppDec ctx);
52 MPP_RET mpp_dec_flush(MppDec ctx);
53 MPP_RET mpp_dec_control(MppDec ctx, MpiCmd cmd, void *param);
54 MPP_RET mpp_dec_notify(MppDec ctx, RK_U32 flag);
55 MPP_RET mpp_dec_callback(MppDec ctx, MppDecEvent event, void *arg);
56 
57 /* update init cfg before init */
58 MPP_RET mpp_dec_set_cfg_by_cmd(MppDecCfg cfg, MpiCmd cmd, void *param);
59 
60 /*
61  * return positive value for the number of decoded frame
62  * return zero           for decoding success but no frame decoded
63  * return negtive value  for decoding flow failed
64  */
65 MPP_RET mpp_dec_decode(MppDec ctx, MppPacket packet);
66 
67 #ifdef __cplusplus
68 }
69 #endif
70 
71 #endif /*__MPP_DEC_H__*/
72