-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathmpp.h
82 lines (68 loc) · 1.76 KB
/
mpp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef _MPP_H
#define _MPP_H
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <string.h>
#include <errno.h>
#include <rockchip/rk_mpi.h>
#ifdef __cplusplus
extern "C"
{
#endif
#define MPP_ALIGN(x, a) (((x)+(a)-1)&~((a)-1))
typedef struct {
uint8_t *data;
uint32_t size;
} SpsHeader;
typedef struct {
// global flow control flag
RK_U32 frm_eos;
RK_U32 pkt_eos;
RK_U32 frame_count;
RK_U64 stream_size;
// base flow context
MppCtx ctx;
MppApi *mpi;
MppEncPrepCfg prep_cfg;
MppEncRcCfg rc_cfg;
MppEncCodecCfg codec_cfg;
// input / output
MppBuffer frm_buf;
MppEncSeiMode sei_mode;
// paramter for resource malloc
RK_U32 width;
RK_U32 height;
RK_U32 hor_stride;
RK_U32 ver_stride;
MppFrameFormat fmt;
MppCodingType type;
RK_U32 num_frames;
// resources
size_t frame_size;
/* NOTE: packet buffer may overflow */
size_t packet_size;
// rate control runtime parameter
RK_S32 gop;
RK_S32 fps;
RK_S32 bps;
FILE *fp_output;
FILE *fp_outputx;
//call back function
int (*write_frame)(uint8_t*data,int size);
//function pointer
void (*init_mpp)(void *mpp_enc_data);
_Bool (*process_image)(uint8_t *p, int size,void *mpp_enc_data);
_Bool (*write_header)(void *mpp_enc_data,SpsHeader *sps_header);
void (*close)(void* ctx);
} MppContext;
MppContext* alloc_mpp_context();
#ifdef __cplusplus
}
#endif
#endif /* !_MPP_H */