-
Notifications
You must be signed in to change notification settings - Fork 1
/
codec.h
97 lines (75 loc) · 2.81 KB
/
codec.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef __CODEC_H__
#define __CODEC_H__
#include <rockchip/rk_mpi.h>
#include <stdlib.h>
typedef struct MppCodec {
MppCtx ctx;
MppApi *api;
} MppCodec;
static inline MppCodec *mpp_ctx_api_alloc() {
MppCtx ctx = NULL;
MppApi *mpi = NULL;
mpp_create(&ctx, &mpi);
MppCodec *codec;
codec = (MppCodec *)malloc(sizeof(MppCodec));
codec->ctx = ctx;
codec->api = mpi;
return codec;
}
static inline MPP_RET codec_init(MppCodec *codec, MppCtxType type, MppCodingType coding) {
return mpp_init(codec->ctx, type, coding);
}
static inline MPP_RET codec_destroy(MppCodec *codec) {
MPP_RET ret = mpp_destroy(codec->ctx);
free(codec);
return ret;
}
static inline RK_U32 codec_size(MppCodec *codec) {
return codec->api->size;
}
static inline RK_U32 codec_version(MppCodec *codec) {
return codec->api->version;
}
static inline MPP_RET codec_decode(MppCodec *codec, MppPacket packet, MppFrame *frame) {
return codec->api->decode(codec->ctx, packet, frame);
}
static inline MPP_RET codec_decode_put_packet(MppCodec *codec, MppPacket packet) {
return codec->api->decode_put_packet(codec->ctx, packet);
}
static inline MPP_RET codec_decode_get_frame(MppCodec *codec, MppFrame *frame) {
return codec->api->decode_get_frame(codec->ctx, frame);
}
static inline MPP_RET codec_encode(MppCodec *codec, MppFrame frame, MppPacket *packet) {
return codec->api->encode(codec->ctx, frame, packet);
}
static inline MPP_RET codec_encode_put_frame(MppCodec *codec, MppFrame frame) {
return codec->api->encode_put_frame(codec->ctx, frame);
}
static inline MPP_RET codec_encode_get_packet(MppCodec *codec, MppPacket *packet) {
return codec->api->encode_get_packet(codec->ctx, packet);
}
static inline MPP_RET codec_isp(MppCodec *codec, MppFrame dst, MppFrame src) {
return codec->api->isp(codec->ctx, dst, src);
}
static inline MPP_RET codec_isp_put_frame(MppCodec *codec, MppFrame frame) {
return codec->api->isp_put_frame(codec->ctx, frame);
}
static inline MPP_RET codec_isp_get_frame(MppCodec *codec, MppFrame *frame) {
return codec->api->isp_get_frame(codec->ctx, frame);
}
static inline MPP_RET codec_poll(MppCodec *codec, MppPortType type, MppPollType timeout) {
return codec->api->poll(codec->ctx, type, timeout);
}
static inline MPP_RET codec_dequeue(MppCodec *codec, MppPortType type, MppTask *task) {
return codec->api->dequeue(codec->ctx, type, task);
}
static inline MPP_RET codec_enqueue(MppCodec *codec, MppPortType type, MppTask task) {
return codec->api->enqueue(codec->ctx, type, task);
}
static inline MPP_RET codec_reset(MppCodec *codec) {
return codec->api->reset(codec->ctx);
}
static inline MPP_RET codec_control(MppCodec *codec, MpiCmd cmd, void* param) {
return codec->api->control(codec->ctx, cmd, param);
}
#endif /* __CODEC_H__ */